tera-system-ui 0.1.76 → 0.2.2

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 (1085) hide show
  1. package/dist/components/accordion/Accordion.recipe.d.ts +125 -0
  2. package/dist/components/accordion/Accordion.recipe.js +28 -0
  3. package/dist/components/accordion/components/Accordion.svelte +4 -1
  4. package/dist/components/accordion/components/AccordionContent.svelte +4 -6
  5. package/dist/components/accordion/components/AccordionItem.svelte +3 -2
  6. package/dist/components/accordion/components/AccordionTrigger.svelte +11 -9
  7. package/dist/components/accordion/components/AccordionTrigger.svelte.d.ts +3 -0
  8. package/dist/components/accordion/index.d.ts +2 -1
  9. package/dist/components/accordion/index.js +1 -0
  10. package/dist/components/alert/Alert.recipe.d.ts +113 -0
  11. package/dist/components/alert/Alert.recipe.js +53 -0
  12. package/dist/components/alert/Alert.svelte +28 -18
  13. package/dist/components/alert/Alert.svelte.d.ts +2 -13
  14. package/dist/components/alert/index.d.ts +2 -0
  15. package/dist/components/alert/index.js +1 -0
  16. package/dist/components/avatar/Avatar.recipe.d.ts +113 -0
  17. package/dist/components/avatar/Avatar.recipe.js +37 -0
  18. package/dist/components/avatar/Avatar.svelte +19 -24
  19. package/dist/components/avatar/Avatar.svelte.d.ts +1 -1
  20. package/dist/components/avatar/index.d.ts +2 -1
  21. package/dist/components/avatar/index.js +1 -0
  22. package/dist/components/badge/Badge.recipe.d.ts +68 -0
  23. package/dist/components/badge/Badge.recipe.js +35 -0
  24. package/dist/components/badge/Badge.svelte +15 -7
  25. package/dist/components/badge/Badge.svelte.d.ts +1 -1
  26. package/dist/components/badge/index.d.ts +2 -1
  27. package/dist/components/badge/index.js +1 -0
  28. package/dist/components/bottom-sheet/BottomSheet.recipe.d.ts +130 -0
  29. package/dist/components/bottom-sheet/BottomSheet.recipe.js +47 -0
  30. package/dist/components/bottom-sheet/BottomSheet.svelte +1123 -0
  31. package/dist/components/bottom-sheet/BottomSheet.svelte.d.ts +4 -0
  32. package/dist/components/bottom-sheet/bottomSheetStore.svelte.d.ts +39 -0
  33. package/dist/components/bottom-sheet/bottomSheetStore.svelte.js +158 -0
  34. package/dist/components/bottom-sheet/index.d.ts +5 -0
  35. package/dist/components/bottom-sheet/index.js +3 -0
  36. package/dist/components/button/Button.recipe.d.ts +131 -0
  37. package/dist/components/button/Button.recipe.js +120 -0
  38. package/dist/components/button/Button.svelte +37 -23
  39. package/dist/components/button/Button.svelte.d.ts +1 -1
  40. package/dist/components/button/index.d.ts +2 -1
  41. package/dist/components/button/index.js +1 -0
  42. package/dist/components/card/{Card.d.ts → Card.recipe.d.ts} +18 -6
  43. package/dist/components/card/Card.recipe.js +41 -0
  44. package/dist/components/card/Card.svelte +5 -5
  45. package/dist/components/card/Card.svelte.d.ts +1 -1
  46. package/dist/components/card/index.d.ts +2 -1
  47. package/dist/components/card/index.js +1 -0
  48. package/dist/components/checkbox/Checkbox.recipe.d.ts +80 -0
  49. package/dist/components/checkbox/Checkbox.recipe.js +39 -0
  50. package/dist/components/checkbox/Checkbox.svelte +29 -35
  51. package/dist/components/checkbox/Checkbox.svelte.d.ts +1 -1
  52. package/dist/components/checkbox/index.d.ts +2 -1
  53. package/dist/components/checkbox/index.js +1 -0
  54. package/dist/components/combobox/Combobox.recipe.d.ts +138 -0
  55. package/dist/components/combobox/Combobox.recipe.js +50 -0
  56. package/dist/components/combobox/Combobox.svelte +57 -37
  57. package/dist/components/combobox/Combobox.svelte.d.ts +1 -1
  58. package/dist/components/combobox/index.d.ts +2 -1
  59. package/dist/components/combobox/index.js +1 -0
  60. package/dist/components/command/Command.recipe.d.ts +92 -0
  61. package/dist/components/command/Command.recipe.js +31 -0
  62. package/dist/components/command/components/command-empty.svelte +2 -2
  63. package/dist/components/command/components/command-group.svelte +4 -3
  64. package/dist/components/command/components/command-input.svelte +3 -7
  65. package/dist/components/command/components/command-item.svelte +2 -5
  66. package/dist/components/command/components/command-link-item.svelte +2 -5
  67. package/dist/components/command/components/command-list.svelte +2 -2
  68. package/dist/components/command/components/command-separator.svelte +2 -2
  69. package/dist/components/command/components/command-shortcut.svelte +2 -2
  70. package/dist/components/command/components/command-shortcut.svelte.d.ts +1 -1
  71. package/dist/components/command/components/command.svelte +2 -5
  72. package/dist/components/command/index.d.ts +2 -0
  73. package/dist/components/command/index.js +1 -0
  74. package/dist/components/date-range-picker/DateRangePicker.recipe.d.ts +220 -0
  75. package/dist/components/date-range-picker/DateRangePicker.recipe.js +113 -0
  76. package/dist/components/date-range-picker/DateRangePicker.svelte +53 -72
  77. package/dist/components/date-range-picker/DateRangePicker.svelte.d.ts +1 -1
  78. package/dist/components/date-range-picker/index.d.ts +2 -1
  79. package/dist/components/date-range-picker/index.js +1 -0
  80. package/dist/components/dialog/Dialog.recipe.d.ts +229 -0
  81. package/dist/components/dialog/Dialog.recipe.js +68 -0
  82. package/dist/components/dialog/Dialog.svelte +21 -39
  83. package/dist/components/dialog/Dialog.svelte.d.ts +1 -1
  84. package/dist/components/dialog/index.d.ts +2 -1
  85. package/dist/components/dialog/index.js +1 -0
  86. package/dist/components/drawer/Drawer.recipe.d.ts +140 -0
  87. package/dist/components/drawer/Drawer.recipe.js +50 -0
  88. package/dist/components/drawer/Drawer.svelte +16 -24
  89. package/dist/components/drawer/Drawer.svelte.d.ts +2 -14
  90. package/dist/components/drawer/index.d.ts +1 -0
  91. package/dist/components/drawer/index.js +1 -0
  92. package/dist/components/dropdown-menu/{DropdownMenu.d.ts → DropdownMenu.recipe.d.ts} +63 -4
  93. package/dist/components/dropdown-menu/DropdownMenu.recipe.js +41 -0
  94. package/dist/components/dropdown-menu/components/DropdownMenu.svelte +3 -8
  95. package/dist/components/dropdown-menu/components/DropdownMenu.svelte.d.ts +1 -1
  96. package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte +3 -2
  97. package/dist/components/dropdown-menu/components/DropdownMenuGroup.svelte.d.ts +1 -1
  98. package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte +3 -2
  99. package/dist/components/dropdown-menu/components/DropdownMenuHeader.svelte.d.ts +1 -1
  100. package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte +3 -9
  101. package/dist/components/dropdown-menu/components/DropdownMenuItem.svelte.d.ts +1 -1
  102. package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte +3 -2
  103. package/dist/components/dropdown-menu/components/DropdownMenuSeparator.svelte.d.ts +1 -1
  104. package/dist/components/dropdown-menu/index.d.ts +2 -1
  105. package/dist/components/dropdown-menu/index.js +1 -0
  106. package/dist/components/fonts/TeraFontMono.svelte +1 -1
  107. package/dist/components/fonts/TeraFontMono.svelte.d.ts +1 -1
  108. package/dist/components/input/Input.recipe.d.ts +166 -0
  109. package/dist/components/input/Input.recipe.js +86 -0
  110. package/dist/components/input/Input.svelte +43 -38
  111. package/dist/components/input/Input.svelte.d.ts +1 -1
  112. package/dist/components/input/index.d.ts +2 -1
  113. package/dist/components/input/index.js +1 -0
  114. package/dist/components/label/Label.recipe.d.ts +46 -0
  115. package/dist/components/label/Label.recipe.js +27 -0
  116. package/dist/components/label/Label.svelte +2 -2
  117. package/dist/components/label/Label.svelte.d.ts +1 -1
  118. package/dist/components/label/index.d.ts +2 -1
  119. package/dist/components/label/index.js +1 -0
  120. package/dist/components/popover/Popover.recipe.d.ts +80 -0
  121. package/dist/components/popover/Popover.recipe.js +23 -0
  122. package/dist/components/popover/Popover.svelte +4 -8
  123. package/dist/components/popover/Popover.svelte.d.ts +1 -1
  124. package/dist/components/popover/index.d.ts +2 -1
  125. package/dist/components/popover/index.js +1 -0
  126. package/dist/components/popover-responsive/PopoverResponsive.recipe.d.ts +85 -0
  127. package/dist/components/popover-responsive/PopoverResponsive.recipe.js +27 -0
  128. package/dist/components/popover-responsive/PopoverResponsive.svelte +38 -5
  129. package/dist/components/popover-responsive/PopoverResponsive.svelte.d.ts +1 -1
  130. package/dist/components/popover-responsive/index.d.ts +2 -1
  131. package/dist/components/popover-responsive/index.js +1 -0
  132. package/dist/components/select/Select.recipe.d.ts +190 -0
  133. package/dist/components/select/Select.recipe.js +51 -0
  134. package/dist/components/select/Select.svelte +18 -24
  135. package/dist/components/select/Select.svelte.d.ts +1 -1
  136. package/dist/components/select/index.d.ts +2 -1
  137. package/dist/components/select/index.js +1 -0
  138. package/dist/components/skeleton/Skeleton.recipe.d.ts +89 -0
  139. package/dist/components/skeleton/Skeleton.recipe.js +41 -0
  140. package/dist/components/skeleton/Skeleton.svelte +7 -6
  141. package/dist/components/skeleton/Skeleton.svelte.d.ts +2 -10
  142. package/dist/components/skeleton/index.d.ts +2 -0
  143. package/dist/components/skeleton/index.js +1 -0
  144. package/dist/components/slider/Slider.recipe.d.ts +115 -0
  145. package/dist/components/slider/Slider.recipe.js +50 -0
  146. package/dist/components/slider/Slider.svelte +6 -12
  147. package/dist/components/slider/Slider.svelte.d.ts +1 -1
  148. package/dist/components/slider/index.d.ts +3 -1
  149. package/dist/components/slider/index.js +1 -0
  150. package/dist/components/spinner/Spinner.recipe.d.ts +60 -0
  151. package/dist/components/spinner/Spinner.recipe.js +38 -0
  152. package/dist/components/spinner/Spinner.svelte +2 -2
  153. package/dist/components/spinner/Spinner.svelte.d.ts +2 -8
  154. package/dist/components/spinner/index.d.ts +2 -0
  155. package/dist/components/spinner/index.js +1 -0
  156. package/dist/components/star-rating/StarRating.recipe.d.ts +49 -0
  157. package/dist/components/star-rating/StarRating.recipe.js +29 -0
  158. package/dist/components/star-rating/StarRating.svelte +39 -35
  159. package/dist/components/star-rating/StarRating.svelte.d.ts +1 -1
  160. package/dist/components/star-rating/index.d.ts +2 -1
  161. package/dist/components/star-rating/index.js +1 -0
  162. package/dist/components/switch/Switch.recipe.d.ts +81 -0
  163. package/dist/components/switch/Switch.recipe.js +38 -0
  164. package/dist/components/switch/Switch.svelte +27 -36
  165. package/dist/components/switch/Switch.svelte.d.ts +1 -1
  166. package/dist/components/switch/index.d.ts +2 -1
  167. package/dist/components/switch/index.js +1 -0
  168. package/dist/components/table/Table.recipe.d.ts +134 -0
  169. package/dist/components/table/Table.recipe.js +44 -0
  170. package/dist/components/table/Table.svelte +10 -10
  171. package/dist/components/table/Table.svelte.d.ts +2 -17
  172. package/dist/components/table/index.d.ts +2 -0
  173. package/dist/components/table/index.js +1 -0
  174. package/dist/components/tabs/Tabs.recipe.d.ts +161 -0
  175. package/dist/components/tabs/Tabs.recipe.js +76 -0
  176. package/dist/components/tabs/Tabs.svelte.d.ts +2 -58
  177. package/dist/components/tabs/Tabs.svelte.js +3 -0
  178. package/dist/components/tabs/components/Tabs.svelte +8 -8
  179. package/dist/components/tabs/components/Tabs.svelte.d.ts +1 -1
  180. package/dist/components/tabs/components/TabsContent.svelte +3 -2
  181. package/dist/components/tabs/components/TabsContent.svelte.d.ts +1 -1
  182. package/dist/components/tabs/components/TabsItem.svelte +11 -36
  183. package/dist/components/tabs/components/TabsItem.svelte.d.ts +1 -1
  184. package/dist/components/tabs/components/TabsList.svelte +13 -42
  185. package/dist/components/tabs/components/TabsList.svelte.d.ts +1 -1
  186. package/dist/components/tabs/index.d.ts +2 -1
  187. package/dist/components/tabs/index.js +1 -0
  188. package/dist/components/text-area/TextArea.recipe.d.ts +181 -0
  189. package/dist/components/text-area/TextArea.recipe.js +81 -0
  190. package/dist/components/text-area/TextArea.svelte +68 -63
  191. package/dist/components/text-area/TextArea.svelte.d.ts +1 -1
  192. package/dist/components/text-area/index.d.ts +2 -1
  193. package/dist/components/text-area/index.js +1 -0
  194. package/dist/components/toast/ToastContainer.svelte +15 -16
  195. package/dist/components/tooltip/Tooltip.recipe.d.ts +79 -0
  196. package/dist/components/tooltip/Tooltip.recipe.js +26 -0
  197. package/dist/components/tooltip/Tooltip.svelte +10 -7
  198. package/dist/components/tooltip/Tooltip.svelte.d.ts +1 -1
  199. package/dist/components/tooltip/index.d.ts +2 -1
  200. package/dist/components/tooltip/index.js +1 -0
  201. package/dist/index.d.ts +55 -65
  202. package/dist/index.js +28 -37
  203. package/dist/{components → internal}/icons/IconCheck.svelte +3 -4
  204. package/dist/{components → internal}/icons/IconChevronDown.svelte +3 -4
  205. package/dist/{components → internal}/icons/IconSearch.svelte +3 -4
  206. package/dist/{components → internal}/icons/IconX.svelte +3 -4
  207. package/dist/internal/icons/index.d.ts +4 -0
  208. package/dist/internal/icons/index.js +4 -0
  209. package/dist/llms/accordion.md +2 -1
  210. package/dist/llms/alert.md +7 -2
  211. package/dist/llms/avatar.md +2 -2
  212. package/dist/llms/badge.md +4 -0
  213. package/dist/llms/bottom-sheet.md +44 -0
  214. package/dist/llms/button.md +7 -1
  215. package/dist/llms/card.md +2 -0
  216. package/dist/llms/checkbox.md +2 -1
  217. package/dist/llms/colors.md +20 -20
  218. package/dist/llms/combobox.md +8 -2
  219. package/dist/llms/command.md +2 -0
  220. package/dist/llms/date-range-picker.md +12 -2
  221. package/dist/llms/dialog.md +9 -4
  222. package/dist/llms/drawer.md +13 -8
  223. package/dist/llms/dropdown-menu.md +11 -2
  224. package/dist/llms/index.md +1 -13
  225. package/dist/llms/input.md +3 -0
  226. package/dist/llms/label.md +2 -0
  227. package/dist/llms/popover-responsive.md +10 -2
  228. package/dist/llms/popover.md +1 -1
  229. package/dist/llms/select.md +2 -1
  230. package/dist/llms/skeleton.md +8 -5
  231. package/dist/llms/slider.md +5 -3
  232. package/dist/llms/spinner.md +6 -2
  233. package/dist/llms/star-rating.md +3 -0
  234. package/dist/llms/switch.md +2 -1
  235. package/dist/llms/table.md +14 -7
  236. package/dist/llms/tabs.md +18 -3
  237. package/dist/llms/text-area.md +3 -0
  238. package/dist/llms/tooltip.md +2 -1
  239. package/dist/recipes/index.d.ts +79 -0
  240. package/dist/recipes/index.js +52 -0
  241. package/dist/stories/ComponentOverview.stories.svelte +346 -350
  242. package/dist/themes/tera-ui-base.css +149 -62
  243. package/dist/themes/theme-cv-builder.css +146 -0
  244. package/dist/themes/theme-professional.css +8 -33
  245. package/dist/tokens/index.d.ts +168 -0
  246. package/dist/tokens/index.js +122 -0
  247. package/dist/types/index.d.ts +19 -24
  248. package/package.json +30 -50
  249. package/registry/accordion.json +65 -0
  250. package/registry/alert.json +43 -0
  251. package/registry/avatar.json +43 -0
  252. package/registry/badge.json +43 -0
  253. package/registry/bottom-sheet.json +50 -0
  254. package/registry/button.json +43 -0
  255. package/registry/card.json +43 -0
  256. package/registry/checkbox.json +45 -0
  257. package/registry/combobox.json +45 -0
  258. package/registry/command.json +109 -0
  259. package/registry/date-range-picker.json +48 -0
  260. package/registry/dialog.json +50 -0
  261. package/registry/drawer.json +45 -0
  262. package/registry/dropdown-menu.json +72 -0
  263. package/registry/fonts.json +41 -0
  264. package/registry/index.json +193 -0
  265. package/registry/input.json +43 -0
  266. package/registry/label.json +44 -0
  267. package/registry/popover-responsive.json +46 -0
  268. package/registry/popover.json +44 -0
  269. package/registry/select.json +51 -0
  270. package/registry/skeleton.json +43 -0
  271. package/registry/slider.json +44 -0
  272. package/registry/spinner.json +43 -0
  273. package/registry/star-rating.json +43 -0
  274. package/registry/switch.json +44 -0
  275. package/registry/table.json +45 -0
  276. package/registry/tabs.json +71 -0
  277. package/registry/text-area.json +43 -0
  278. package/registry/toast.json +41 -0
  279. package/registry/tooltip.json +44 -0
  280. package/scripts/generate-ts-index.js +1 -18
  281. package/scripts/tera-ui.mjs +171 -0
  282. package/dist/components/accordion/Accordion.d.ts +0 -52
  283. package/dist/components/accordion/Accordion.js +0 -11
  284. package/dist/components/ai/ChatBubble.svelte +0 -35
  285. package/dist/components/ai/ChatBubble.svelte.d.ts +0 -12
  286. package/dist/components/ai/PromptInput.svelte +0 -58
  287. package/dist/components/ai/PromptInput.svelte.d.ts +0 -13
  288. package/dist/components/ai/StreamText.svelte +0 -41
  289. package/dist/components/ai/StreamText.svelte.d.ts +0 -11
  290. package/dist/components/ai/SuggestionChips.svelte +0 -34
  291. package/dist/components/ai/SuggestionChips.svelte.d.ts +0 -10
  292. package/dist/components/ai/ThinkingLoader.svelte +0 -34
  293. package/dist/components/ai/ThinkingLoader.svelte.d.ts +0 -11
  294. package/dist/components/ai/index.d.ts +0 -5
  295. package/dist/components/ai/index.js +0 -5
  296. package/dist/components/avatar/Avatar.d.ts +0 -45
  297. package/dist/components/avatar/Avatar.js +0 -35
  298. package/dist/components/badge/Badge.d.ts +0 -52
  299. package/dist/components/badge/Badge.js +0 -22
  300. package/dist/components/brand-logo/BrandLogo.d.ts +0 -38
  301. package/dist/components/brand-logo/BrandLogo.js +0 -18
  302. package/dist/components/brand-logo/BrandLogo.svelte +0 -36
  303. package/dist/components/brand-logo/BrandLogo.svelte.d.ts +0 -4
  304. package/dist/components/brand-logo/index.d.ts +0 -2
  305. package/dist/components/brand-logo/index.js +0 -1
  306. package/dist/components/button/Button.d.ts +0 -113
  307. package/dist/components/button/Button.js +0 -135
  308. package/dist/components/card/Card.js +0 -28
  309. package/dist/components/checkbox/Checkbox.d.ts +0 -32
  310. package/dist/components/checkbox/Checkbox.js +0 -11
  311. package/dist/components/combobox/Combobox.d.ts +0 -47
  312. package/dist/components/combobox/Combobox.js +0 -5
  313. package/dist/components/date-range-picker/DateRangePicker.types.d.ts +0 -38
  314. package/dist/components/date-range-picker/DateRangePicker.types.js +0 -1
  315. package/dist/components/dialog/Dialog.d.ts +0 -55
  316. package/dist/components/dialog/Dialog.js +0 -1
  317. package/dist/components/dropdown-menu/DropdownMenu.js +0 -1
  318. package/dist/components/header/Header.d.ts +0 -11
  319. package/dist/components/header/Header.js +0 -7
  320. package/dist/components/header/Header.svelte +0 -33
  321. package/dist/components/header/Header.svelte.d.ts +0 -5
  322. package/dist/components/header/header.scss +0 -20
  323. package/dist/components/header/index.d.ts +0 -2
  324. package/dist/components/header/index.js +0 -1
  325. package/dist/components/header/package.json +0 -14
  326. package/dist/components/icons/IconArrowBigRightFilled.svelte +0 -7
  327. package/dist/components/icons/IconArrowBigRightFilled.svelte.d.ts +0 -5
  328. package/dist/components/icons/IconBook.svelte +0 -7
  329. package/dist/components/icons/IconBook.svelte.d.ts +0 -5
  330. package/dist/components/icons/IconBookmarkPlus.svelte +0 -7
  331. package/dist/components/icons/IconBookmarkPlus.svelte.d.ts +0 -5
  332. package/dist/components/icons/IconCalculator.svelte +0 -7
  333. package/dist/components/icons/IconCalculator.svelte.d.ts +0 -5
  334. package/dist/components/icons/IconCoin.svelte +0 -7
  335. package/dist/components/icons/IconCoin.svelte.d.ts +0 -5
  336. package/dist/components/icons/IconCoinConvert.svelte +0 -17
  337. package/dist/components/icons/IconCoinConvert.svelte.d.ts +0 -4
  338. package/dist/components/icons/IconCopy.svelte +0 -7
  339. package/dist/components/icons/IconCopy.svelte.d.ts +0 -5
  340. package/dist/components/icons/IconCopyCheckFilled.svelte +0 -7
  341. package/dist/components/icons/IconCopyCheckFilled.svelte.d.ts +0 -5
  342. package/dist/components/icons/IconHamburger.svelte +0 -7
  343. package/dist/components/icons/IconHamburger.svelte.d.ts +0 -4
  344. package/dist/components/icons/IconLanguage.svelte +0 -7
  345. package/dist/components/icons/IconLanguage.svelte.d.ts +0 -5
  346. package/dist/components/icons/IconLoader2.svelte +0 -7
  347. package/dist/components/icons/IconLoader2.svelte.d.ts +0 -5
  348. package/dist/components/icons/IconLogout.svelte +0 -7
  349. package/dist/components/icons/IconLogout.svelte.d.ts +0 -5
  350. package/dist/components/icons/IconMoon.svelte +0 -7
  351. package/dist/components/icons/IconMoon.svelte.d.ts +0 -4
  352. package/dist/components/icons/IconPointFilled.svelte +0 -7
  353. package/dist/components/icons/IconPointFilled.svelte.d.ts +0 -5
  354. package/dist/components/icons/IconSettings.svelte +0 -7
  355. package/dist/components/icons/IconSettings.svelte.d.ts +0 -5
  356. package/dist/components/icons/IconSun.svelte +0 -7
  357. package/dist/components/icons/IconSun.svelte.d.ts +0 -4
  358. package/dist/components/icons/IconSwitchHorizontal.svelte +0 -7
  359. package/dist/components/icons/IconSwitchHorizontal.svelte.d.ts +0 -5
  360. package/dist/components/icons/IconSwitchVertical.svelte +0 -7
  361. package/dist/components/icons/IconSwitchVertical.svelte.d.ts +0 -5
  362. package/dist/components/icons/IconTransform.svelte +0 -7
  363. package/dist/components/icons/IconTransform.svelte.d.ts +0 -5
  364. package/dist/components/icons/index.d.ts +0 -23
  365. package/dist/components/icons/index.js +0 -23
  366. package/dist/components/input/Input.d.ts +0 -72
  367. package/dist/components/input/Input.js +0 -45
  368. package/dist/components/label/Label.d.ts +0 -38
  369. package/dist/components/label/Label.js +0 -18
  370. package/dist/components/language-picker-button/LanguagePickerButton.d.ts +0 -15
  371. package/dist/components/language-picker-button/LanguagePickerButton.js +0 -7
  372. package/dist/components/language-picker-button/LanguagePickerButton.svelte +0 -78
  373. package/dist/components/language-picker-button/LanguagePickerButton.svelte.d.ts +0 -7
  374. package/dist/components/language-picker-button/index.d.ts +0 -2
  375. package/dist/components/language-picker-button/index.js +0 -1
  376. package/dist/components/light-dark-toggle/LightDarkToggle.d.ts +0 -11
  377. package/dist/components/light-dark-toggle/LightDarkToggle.js +0 -7
  378. package/dist/components/light-dark-toggle/LightDarkToggle.svelte +0 -33
  379. package/dist/components/light-dark-toggle/LightDarkToggle.svelte.d.ts +0 -4
  380. package/dist/components/light-dark-toggle/index.d.ts +0 -2
  381. package/dist/components/light-dark-toggle/index.js +0 -1
  382. package/dist/components/marketing/FeatureCard.svelte +0 -37
  383. package/dist/components/marketing/FeatureCard.svelte.d.ts +0 -13
  384. package/dist/components/marketing/PricingCard.svelte +0 -48
  385. package/dist/components/marketing/PricingCard.svelte.d.ts +0 -15
  386. package/dist/components/marketing/StatBlock.svelte +0 -14
  387. package/dist/components/marketing/StatBlock.svelte.d.ts +0 -10
  388. package/dist/components/marketing/TestimonialCard.svelte +0 -24
  389. package/dist/components/marketing/TestimonialCard.svelte.d.ts +0 -12
  390. package/dist/components/marketing/index.d.ts +0 -4
  391. package/dist/components/marketing/index.js +0 -4
  392. package/dist/components/popover/Popover.d.ts +0 -37
  393. package/dist/components/popover/Popover.js +0 -1
  394. package/dist/components/popover-responsive/PopoverResponsive.d.ts +0 -22
  395. package/dist/components/popover-responsive/PopoverResponsive.js +0 -1
  396. package/dist/components/select/Select.d.ts +0 -106
  397. package/dist/components/select/Select.js +0 -24
  398. package/dist/components/side-navigation/SideNavigation.d.ts +0 -72
  399. package/dist/components/side-navigation/SideNavigation.js +0 -91
  400. package/dist/components/side-navigation/SideNavigation.svelte +0 -143
  401. package/dist/components/side-navigation/SideNavigation.svelte.d.ts +0 -4
  402. package/dist/components/side-navigation/SideNavigationGroup.svelte +0 -40
  403. package/dist/components/side-navigation/SideNavigationGroup.svelte.d.ts +0 -10
  404. package/dist/components/side-navigation/SideNavigationItem.svelte +0 -18
  405. package/dist/components/side-navigation/SideNavigationItem.svelte.d.ts +0 -8
  406. package/dist/components/side-navigation/SideNavigationLayout.svelte +0 -19
  407. package/dist/components/side-navigation/SideNavigationLayout.svelte.d.ts +0 -9
  408. package/dist/components/side-navigation/index.d.ts +0 -5
  409. package/dist/components/side-navigation/index.js +0 -4
  410. package/dist/components/side-navigation/sidenav.scss +0 -226
  411. package/dist/components/slider/Slider.d.ts +0 -28
  412. package/dist/components/slider/Slider.js +0 -1
  413. package/dist/components/star-rating/StarRating.d.ts +0 -31
  414. package/dist/components/star-rating/StarRating.js +0 -15
  415. package/dist/components/switch/Switch.d.ts +0 -27
  416. package/dist/components/switch/Switch.js +0 -11
  417. package/dist/components/tera-ui-context/TeraUiContext.d.ts +0 -11
  418. package/dist/components/tera-ui-context/TeraUiContext.js +0 -1
  419. package/dist/components/tera-ui-context/TeraUiContext.svelte +0 -13
  420. package/dist/components/tera-ui-context/TeraUiContext.svelte.d.ts +0 -4
  421. package/dist/components/tera-ui-context/global-context-store.d.ts +0 -3
  422. package/dist/components/tera-ui-context/global-context-store.js +0 -2
  423. package/dist/components/tera-ui-context/global-context.d.ts +0 -3
  424. package/dist/components/tera-ui-context/global-context.js +0 -24
  425. package/dist/components/tera-ui-context/index.d.ts +0 -2
  426. package/dist/components/tera-ui-context/index.js +0 -1
  427. package/dist/components/text-area/TextArea.d.ts +0 -87
  428. package/dist/components/text-area/TextArea.js +0 -48
  429. package/dist/components/tooltip/Tooltip.d.ts +0 -23
  430. package/dist/components/tooltip/Tooltip.js +0 -1
  431. package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.d.ts +0 -14
  432. package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.js +0 -7
  433. package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.svelte +0 -48
  434. package/dist/components/user-avatar-with-menu/UserAvatarWithMenu.svelte.d.ts +0 -4
  435. package/dist/components/user-avatar-with-menu/index.d.ts +0 -2
  436. package/dist/components/user-avatar-with-menu/index.js +0 -1
  437. package/dist/i18n/index.d.ts +0 -1
  438. package/dist/i18n/index.js +0 -1
  439. package/dist/i18n/language.d.ts +0 -2
  440. package/dist/i18n/language.js +0 -45
  441. package/dist/internal/service/user.service.d.ts +0 -2
  442. package/dist/internal/service/user.service.js +0 -20
  443. package/dist/llms/ai.md +0 -110
  444. package/dist/llms/brand-logo.md +0 -30
  445. package/dist/llms/header.md +0 -26
  446. package/dist/llms/icons.md +0 -43
  447. package/dist/llms/language-picker-button.md +0 -30
  448. package/dist/llms/light-dark-toggle.md +0 -26
  449. package/dist/llms/marketing.md +0 -95
  450. package/dist/llms/side-navigation.md +0 -51
  451. package/dist/llms/tera-ui-context.md +0 -30
  452. package/dist/llms/user-avatar-with-menu.md +0 -28
  453. package/dist/paraglide/.prettierignore +0 -3
  454. package/dist/paraglide/README.md +0 -162
  455. package/dist/paraglide/messages/_index.d.ts +0 -106
  456. package/dist/paraglide/messages/_index.js +0 -439
  457. package/dist/paraglide/messages/ar.d.ts +0 -23
  458. package/dist/paraglide/messages/ar.js +0 -38
  459. package/dist/paraglide/messages/bg.d.ts +0 -23
  460. package/dist/paraglide/messages/bg.js +0 -38
  461. package/dist/paraglide/messages/bn.d.ts +0 -23
  462. package/dist/paraglide/messages/bn.js +0 -38
  463. package/dist/paraglide/messages/ca.d.ts +0 -23
  464. package/dist/paraglide/messages/ca.js +0 -38
  465. package/dist/paraglide/messages/cs.d.ts +0 -23
  466. package/dist/paraglide/messages/cs.js +0 -38
  467. package/dist/paraglide/messages/da.d.ts +0 -23
  468. package/dist/paraglide/messages/da.js +0 -38
  469. package/dist/paraglide/messages/de.d.ts +0 -23
  470. package/dist/paraglide/messages/de.js +0 -38
  471. package/dist/paraglide/messages/el.d.ts +0 -23
  472. package/dist/paraglide/messages/el.js +0 -38
  473. package/dist/paraglide/messages/en.d.ts +0 -23
  474. package/dist/paraglide/messages/en.js +0 -38
  475. package/dist/paraglide/messages/es.d.ts +0 -23
  476. package/dist/paraglide/messages/es.js +0 -38
  477. package/dist/paraglide/messages/fi.d.ts +0 -23
  478. package/dist/paraglide/messages/fi.js +0 -38
  479. package/dist/paraglide/messages/fr.d.ts +0 -23
  480. package/dist/paraglide/messages/fr.js +0 -38
  481. package/dist/paraglide/messages/he.d.ts +0 -23
  482. package/dist/paraglide/messages/he.js +0 -38
  483. package/dist/paraglide/messages/hi.d.ts +0 -23
  484. package/dist/paraglide/messages/hi.js +0 -38
  485. package/dist/paraglide/messages/hu.d.ts +0 -23
  486. package/dist/paraglide/messages/hu.js +0 -38
  487. package/dist/paraglide/messages/id.d.ts +0 -23
  488. package/dist/paraglide/messages/id.js +0 -38
  489. package/dist/paraglide/messages/it.d.ts +0 -23
  490. package/dist/paraglide/messages/it.js +0 -38
  491. package/dist/paraglide/messages/ja.d.ts +0 -23
  492. package/dist/paraglide/messages/ja.js +0 -38
  493. package/dist/paraglide/messages/ko.d.ts +0 -23
  494. package/dist/paraglide/messages/ko.js +0 -38
  495. package/dist/paraglide/messages/lt.d.ts +0 -23
  496. package/dist/paraglide/messages/lt.js +0 -38
  497. package/dist/paraglide/messages/lv.d.ts +0 -23
  498. package/dist/paraglide/messages/lv.js +0 -38
  499. package/dist/paraglide/messages/ms.d.ts +0 -23
  500. package/dist/paraglide/messages/ms.js +0 -38
  501. package/dist/paraglide/messages/nl.d.ts +0 -23
  502. package/dist/paraglide/messages/nl.js +0 -38
  503. package/dist/paraglide/messages/no.d.ts +0 -23
  504. package/dist/paraglide/messages/no.js +0 -38
  505. package/dist/paraglide/messages/pl.d.ts +0 -23
  506. package/dist/paraglide/messages/pl.js +0 -38
  507. package/dist/paraglide/messages/pt.d.ts +0 -23
  508. package/dist/paraglide/messages/pt.js +0 -38
  509. package/dist/paraglide/messages/ro.d.ts +0 -23
  510. package/dist/paraglide/messages/ro.js +0 -38
  511. package/dist/paraglide/messages/ru.d.ts +0 -23
  512. package/dist/paraglide/messages/ru.js +0 -38
  513. package/dist/paraglide/messages/sk.d.ts +0 -23
  514. package/dist/paraglide/messages/sk.js +0 -38
  515. package/dist/paraglide/messages/sl.d.ts +0 -23
  516. package/dist/paraglide/messages/sl.js +0 -38
  517. package/dist/paraglide/messages/sq.d.ts +0 -23
  518. package/dist/paraglide/messages/sq.js +0 -38
  519. package/dist/paraglide/messages/sr.d.ts +0 -23
  520. package/dist/paraglide/messages/sr.js +0 -38
  521. package/dist/paraglide/messages/sv.d.ts +0 -23
  522. package/dist/paraglide/messages/sv.js +0 -38
  523. package/dist/paraglide/messages/sw.d.ts +0 -23
  524. package/dist/paraglide/messages/sw.js +0 -38
  525. package/dist/paraglide/messages/ta.d.ts +0 -23
  526. package/dist/paraglide/messages/ta.js +0 -38
  527. package/dist/paraglide/messages/te.d.ts +0 -23
  528. package/dist/paraglide/messages/te.js +0 -38
  529. package/dist/paraglide/messages/th.d.ts +0 -23
  530. package/dist/paraglide/messages/th.js +0 -38
  531. package/dist/paraglide/messages/tl.d.ts +0 -23
  532. package/dist/paraglide/messages/tl.js +0 -38
  533. package/dist/paraglide/messages/tr.d.ts +0 -23
  534. package/dist/paraglide/messages/tr.js +0 -38
  535. package/dist/paraglide/messages/uk.d.ts +0 -23
  536. package/dist/paraglide/messages/uk.js +0 -38
  537. package/dist/paraglide/messages/vi.d.ts +0 -23
  538. package/dist/paraglide/messages/vi.js +0 -38
  539. package/dist/paraglide/messages/zh-CN.d.ts +0 -23
  540. package/dist/paraglide/messages/zh-CN.js +0 -38
  541. package/dist/paraglide/messages/zh-TW.d.ts +0 -23
  542. package/dist/paraglide/messages/zh-TW.js +0 -38
  543. package/dist/paraglide/messages.d.ts +0 -2
  544. package/dist/paraglide/messages.js +0 -4
  545. package/dist/paraglide/registry.d.ts +0 -34
  546. package/dist/paraglide/registry.js +0 -46
  547. package/dist/paraglide/runtime.d.ts +0 -758
  548. package/dist/paraglide/runtime.js +0 -1990
  549. package/dist/paraglide/server.d.ts +0 -96
  550. package/dist/paraglide/server.js +0 -277
  551. package/dist/tera-i18n/README.md +0 -105
  552. package/dist/tera-i18n/assets/world-flags/Algeria.svg +0 -13
  553. package/dist/tera-i18n/assets/world-flags/East Timor.svg +0 -13
  554. package/dist/tera-i18n/assets/world-flags/Rapa Nui.svg +0 -11
  555. package/dist/tera-i18n/assets/world-flags/abkhazia.svg +0 -23
  556. package/dist/tera-i18n/assets/world-flags/afghanistan.svg +0 -14
  557. package/dist/tera-i18n/assets/world-flags/aland islands.svg +0 -15
  558. package/dist/tera-i18n/assets/world-flags/albania.svg +0 -11
  559. package/dist/tera-i18n/assets/world-flags/american samoa.svg +0 -15
  560. package/dist/tera-i18n/assets/world-flags/andorra.svg +0 -15
  561. package/dist/tera-i18n/assets/world-flags/angola.svg +0 -14
  562. package/dist/tera-i18n/assets/world-flags/anguilla.svg +0 -19
  563. package/dist/tera-i18n/assets/world-flags/antigua and barbuda.svg +0 -15
  564. package/dist/tera-i18n/assets/world-flags/argentina.svg +0 -13
  565. package/dist/tera-i18n/assets/world-flags/armenia.svg +0 -12
  566. package/dist/tera-i18n/assets/world-flags/aruba.svg +0 -15
  567. package/dist/tera-i18n/assets/world-flags/australia.svg +0 -21
  568. package/dist/tera-i18n/assets/world-flags/austria.svg +0 -12
  569. package/dist/tera-i18n/assets/world-flags/azerbaijan.svg +0 -14
  570. package/dist/tera-i18n/assets/world-flags/azores islands.svg +0 -21
  571. package/dist/tera-i18n/assets/world-flags/bahamas.svg +0 -13
  572. package/dist/tera-i18n/assets/world-flags/bahrain.svg +0 -11
  573. package/dist/tera-i18n/assets/world-flags/balearic islands.svg +0 -16
  574. package/dist/tera-i18n/assets/world-flags/bangladesh.svg +0 -11
  575. package/dist/tera-i18n/assets/world-flags/barbados.svg +0 -13
  576. package/dist/tera-i18n/assets/world-flags/basque country.svg +0 -20
  577. package/dist/tera-i18n/assets/world-flags/belarus.svg +0 -18
  578. package/dist/tera-i18n/assets/world-flags/belgium.svg +0 -12
  579. package/dist/tera-i18n/assets/world-flags/belize.svg +0 -17
  580. package/dist/tera-i18n/assets/world-flags/benin.svg +0 -12
  581. package/dist/tera-i18n/assets/world-flags/bermuda.svg +0 -20
  582. package/dist/tera-i18n/assets/world-flags/bhutan.svg +0 -13
  583. package/dist/tera-i18n/assets/world-flags/bolivia.svg +0 -12
  584. package/dist/tera-i18n/assets/world-flags/bonaire.svg +0 -14
  585. package/dist/tera-i18n/assets/world-flags/bosnia and herzegovina.svg +0 -13
  586. package/dist/tera-i18n/assets/world-flags/botswana.svg +0 -13
  587. package/dist/tera-i18n/assets/world-flags/brazil.svg +0 -14
  588. package/dist/tera-i18n/assets/world-flags/british columbia.svg +0 -31
  589. package/dist/tera-i18n/assets/world-flags/british indian ocean territory.svg +0 -29
  590. package/dist/tera-i18n/assets/world-flags/british virgin islands.svg +0 -24
  591. package/dist/tera-i18n/assets/world-flags/brunei.svg +0 -19
  592. package/dist/tera-i18n/assets/world-flags/bulgaria.svg +0 -12
  593. package/dist/tera-i18n/assets/world-flags/burkina faso.svg +0 -12
  594. package/dist/tera-i18n/assets/world-flags/burundi.svg +0 -18
  595. package/dist/tera-i18n/assets/world-flags/cambodia.svg +0 -13
  596. package/dist/tera-i18n/assets/world-flags/cameroon.svg +0 -13
  597. package/dist/tera-i18n/assets/world-flags/canada.svg +0 -13
  598. package/dist/tera-i18n/assets/world-flags/canary islands.svg +0 -12
  599. package/dist/tera-i18n/assets/world-flags/cape verde.svg +0 -23
  600. package/dist/tera-i18n/assets/world-flags/catalonia.svg +0 -7
  601. package/dist/tera-i18n/assets/world-flags/cayman islands.svg +0 -20
  602. package/dist/tera-i18n/assets/world-flags/central african republic.svg +0 -20
  603. package/dist/tera-i18n/assets/world-flags/ceuta.svg +0 -29
  604. package/dist/tera-i18n/assets/world-flags/chad.svg +0 -12
  605. package/dist/tera-i18n/assets/world-flags/chile.svg +0 -13
  606. package/dist/tera-i18n/assets/world-flags/china.svg +0 -15
  607. package/dist/tera-i18n/assets/world-flags/cocos island.svg +0 -19
  608. package/dist/tera-i18n/assets/world-flags/colombia.svg +0 -12
  609. package/dist/tera-i18n/assets/world-flags/comoros.svg +0 -19
  610. package/dist/tera-i18n/assets/world-flags/cook islands.svg +0 -22
  611. package/dist/tera-i18n/assets/world-flags/corsica.svg +0 -12
  612. package/dist/tera-i18n/assets/world-flags/costa rica.svg +0 -13
  613. package/dist/tera-i18n/assets/world-flags/croatia.svg +0 -31
  614. package/dist/tera-i18n/assets/world-flags/cuba.svg +0 -16
  615. package/dist/tera-i18n/assets/world-flags/curacao.svg +0 -14
  616. package/dist/tera-i18n/assets/world-flags/cyprus.svg +0 -12
  617. package/dist/tera-i18n/assets/world-flags/czech republic.svg +0 -12
  618. package/dist/tera-i18n/assets/world-flags/democratic republic of congo.svg +0 -14
  619. package/dist/tera-i18n/assets/world-flags/denmark.svg +0 -14
  620. package/dist/tera-i18n/assets/world-flags/djibouti.svg +0 -13
  621. package/dist/tera-i18n/assets/world-flags/dominica.svg +0 -34
  622. package/dist/tera-i18n/assets/world-flags/dominican republic.svg +0 -17
  623. package/dist/tera-i18n/assets/world-flags/ecuador.svg +0 -15
  624. package/dist/tera-i18n/assets/world-flags/egypt.svg +0 -13
  625. package/dist/tera-i18n/assets/world-flags/el salvador.svg +0 -15
  626. package/dist/tera-i18n/assets/world-flags/england.svg +0 -11
  627. package/dist/tera-i18n/assets/world-flags/equatorial guinea.svg +0 -16
  628. package/dist/tera-i18n/assets/world-flags/eritrea.svg +0 -13
  629. package/dist/tera-i18n/assets/world-flags/estonia.svg +0 -12
  630. package/dist/tera-i18n/assets/world-flags/ethiopia.svg +0 -15
  631. package/dist/tera-i18n/assets/world-flags/european union.svg +0 -18
  632. package/dist/tera-i18n/assets/world-flags/falkland islands.svg +0 -18
  633. package/dist/tera-i18n/assets/world-flags/faroe islands.svg +0 -12
  634. package/dist/tera-i18n/assets/world-flags/fiji.svg +0 -18
  635. package/dist/tera-i18n/assets/world-flags/finland.svg +0 -11
  636. package/dist/tera-i18n/assets/world-flags/france.svg +0 -12
  637. package/dist/tera-i18n/assets/world-flags/french polynesia.svg +0 -17
  638. package/dist/tera-i18n/assets/world-flags/gabon.svg +0 -12
  639. package/dist/tera-i18n/assets/world-flags/galapagos islands.svg +0 -12
  640. package/dist/tera-i18n/assets/world-flags/gambia.svg +0 -13
  641. package/dist/tera-i18n/assets/world-flags/georgia.svg +0 -15
  642. package/dist/tera-i18n/assets/world-flags/germany.svg +0 -12
  643. package/dist/tera-i18n/assets/world-flags/ghana.svg +0 -13
  644. package/dist/tera-i18n/assets/world-flags/gibraltar.svg +0 -13
  645. package/dist/tera-i18n/assets/world-flags/greece.svg +0 -15
  646. package/dist/tera-i18n/assets/world-flags/greenland.svg +0 -13
  647. package/dist/tera-i18n/assets/world-flags/grenada.svg +0 -27
  648. package/dist/tera-i18n/assets/world-flags/guam.svg +0 -18
  649. package/dist/tera-i18n/assets/world-flags/guatemala.svg +0 -14
  650. package/dist/tera-i18n/assets/world-flags/guernsey.svg +0 -12
  651. package/dist/tera-i18n/assets/world-flags/guinea bissau.svg +0 -14
  652. package/dist/tera-i18n/assets/world-flags/guinea.svg +0 -12
  653. package/dist/tera-i18n/assets/world-flags/guyana.svg +0 -15
  654. package/dist/tera-i18n/assets/world-flags/haiti.svg +0 -17
  655. package/dist/tera-i18n/assets/world-flags/hawaii.svg +0 -15
  656. package/dist/tera-i18n/assets/world-flags/honduras.svg +0 -17
  657. package/dist/tera-i18n/assets/world-flags/hong kong.svg +0 -15
  658. package/dist/tera-i18n/assets/world-flags/hungary.svg +0 -12
  659. package/dist/tera-i18n/assets/world-flags/iceland.svg +0 -15
  660. package/dist/tera-i18n/assets/world-flags/india.svg +0 -15
  661. package/dist/tera-i18n/assets/world-flags/indonesia.svg +0 -11
  662. package/dist/tera-i18n/assets/world-flags/iran.svg +0 -13
  663. package/dist/tera-i18n/assets/world-flags/iraq.svg +0 -15
  664. package/dist/tera-i18n/assets/world-flags/ireland.svg +0 -12
  665. package/dist/tera-i18n/assets/world-flags/isle of man.svg +0 -11
  666. package/dist/tera-i18n/assets/world-flags/israel.svg +0 -13
  667. package/dist/tera-i18n/assets/world-flags/italy.svg +0 -12
  668. package/dist/tera-i18n/assets/world-flags/ivory coast.svg +0 -12
  669. package/dist/tera-i18n/assets/world-flags/jamaica.svg +0 -14
  670. package/dist/tera-i18n/assets/world-flags/japan.svg +0 -11
  671. package/dist/tera-i18n/assets/world-flags/jersey.svg +0 -13
  672. package/dist/tera-i18n/assets/world-flags/jordan.svg +0 -14
  673. package/dist/tera-i18n/assets/world-flags/kazakhstan.svg +0 -13
  674. package/dist/tera-i18n/assets/world-flags/kenya.svg +0 -19
  675. package/dist/tera-i18n/assets/world-flags/kiribati.svg +0 -17
  676. package/dist/tera-i18n/assets/world-flags/kosovo.svg +0 -17
  677. package/dist/tera-i18n/assets/world-flags/kuwait.svg +0 -13
  678. package/dist/tera-i18n/assets/world-flags/kyrgyzstan.svg +0 -16
  679. package/dist/tera-i18n/assets/world-flags/laos.svg +0 -13
  680. package/dist/tera-i18n/assets/world-flags/latvia.svg +0 -12
  681. package/dist/tera-i18n/assets/world-flags/lebanon.svg +0 -13
  682. package/dist/tera-i18n/assets/world-flags/lesotho.svg +0 -13
  683. package/dist/tera-i18n/assets/world-flags/liberia.svg +0 -23
  684. package/dist/tera-i18n/assets/world-flags/libya.svg +0 -14
  685. package/dist/tera-i18n/assets/world-flags/liechtenstein.svg +0 -12
  686. package/dist/tera-i18n/assets/world-flags/lithuania.svg +0 -12
  687. package/dist/tera-i18n/assets/world-flags/luxembourg.svg +0 -12
  688. package/dist/tera-i18n/assets/world-flags/macao.svg +0 -18
  689. package/dist/tera-i18n/assets/world-flags/madagascar.svg +0 -12
  690. package/dist/tera-i18n/assets/world-flags/madeira.svg +0 -14
  691. package/dist/tera-i18n/assets/world-flags/malawi.svg +0 -13
  692. package/dist/tera-i18n/assets/world-flags/malaysia.svg +0 -17
  693. package/dist/tera-i18n/assets/world-flags/maldives.svg +0 -12
  694. package/dist/tera-i18n/assets/world-flags/mali.svg +0 -12
  695. package/dist/tera-i18n/assets/world-flags/malta.svg +0 -12
  696. package/dist/tera-i18n/assets/world-flags/marshall island.svg +0 -13
  697. package/dist/tera-i18n/assets/world-flags/martinique.svg +0 -18
  698. package/dist/tera-i18n/assets/world-flags/mauritania.svg +0 -12
  699. package/dist/tera-i18n/assets/world-flags/mauritius.svg +0 -13
  700. package/dist/tera-i18n/assets/world-flags/melilla.svg +0 -25
  701. package/dist/tera-i18n/assets/world-flags/mexico.svg +0 -14
  702. package/dist/tera-i18n/assets/world-flags/micronesia.svg +0 -14
  703. package/dist/tera-i18n/assets/world-flags/moldova.svg +0 -15
  704. package/dist/tera-i18n/assets/world-flags/monaco.svg +0 -11
  705. package/dist/tera-i18n/assets/world-flags/mongolia.svg +0 -19
  706. package/dist/tera-i18n/assets/world-flags/montenegro.svg +0 -15
  707. package/dist/tera-i18n/assets/world-flags/montserrat.svg +0 -17
  708. package/dist/tera-i18n/assets/world-flags/morocco.svg +0 -11
  709. package/dist/tera-i18n/assets/world-flags/mozambique.svg +0 -17
  710. package/dist/tera-i18n/assets/world-flags/myanmar.svg +0 -13
  711. package/dist/tera-i18n/assets/world-flags/namibia.svg +0 -14
  712. package/dist/tera-i18n/assets/world-flags/nato.svg +0 -19
  713. package/dist/tera-i18n/assets/world-flags/nauru.svg +0 -14
  714. package/dist/tera-i18n/assets/world-flags/nepal.svg +0 -16
  715. package/dist/tera-i18n/assets/world-flags/netherlands.svg +0 -12
  716. package/dist/tera-i18n/assets/world-flags/new zealand.svg +0 -18
  717. package/dist/tera-i18n/assets/world-flags/nicaragua.svg +0 -16
  718. package/dist/tera-i18n/assets/world-flags/niger.svg +0 -13
  719. package/dist/tera-i18n/assets/world-flags/nigeria.svg +0 -12
  720. package/dist/tera-i18n/assets/world-flags/niue.svg +0 -20
  721. package/dist/tera-i18n/assets/world-flags/norfolk island.svg +0 -13
  722. package/dist/tera-i18n/assets/world-flags/north korea.svg +0 -15
  723. package/dist/tera-i18n/assets/world-flags/northern cyprus.svg +0 -14
  724. package/dist/tera-i18n/assets/world-flags/northern marianas islands.svg +0 -14
  725. package/dist/tera-i18n/assets/world-flags/norway.svg +0 -15
  726. package/dist/tera-i18n/assets/world-flags/oman.svg +0 -15
  727. package/dist/tera-i18n/assets/world-flags/orkney islands.svg +0 -15
  728. package/dist/tera-i18n/assets/world-flags/ossetia.svg +0 -12
  729. package/dist/tera-i18n/assets/world-flags/pakistan.svg +0 -14
  730. package/dist/tera-i18n/assets/world-flags/palau.svg +0 -11
  731. package/dist/tera-i18n/assets/world-flags/palestine.svg +0 -13
  732. package/dist/tera-i18n/assets/world-flags/panama.svg +0 -14
  733. package/dist/tera-i18n/assets/world-flags/papua new guinea.svg +0 -17
  734. package/dist/tera-i18n/assets/world-flags/paraguay.svg +0 -14
  735. package/dist/tera-i18n/assets/world-flags/peru.svg +0 -12
  736. package/dist/tera-i18n/assets/world-flags/philippines.svg +0 -16
  737. package/dist/tera-i18n/assets/world-flags/pitcairn islands.svg +0 -18
  738. package/dist/tera-i18n/assets/world-flags/poland.svg +0 -11
  739. package/dist/tera-i18n/assets/world-flags/portugal.svg +0 -14
  740. package/dist/tera-i18n/assets/world-flags/puerto rico.svg +0 -15
  741. package/dist/tera-i18n/assets/world-flags/qatar.svg +0 -11
  742. package/dist/tera-i18n/assets/world-flags/republic of macedonia.svg +0 -20
  743. package/dist/tera-i18n/assets/world-flags/republic of the congo.svg +0 -12
  744. package/dist/tera-i18n/assets/world-flags/romania.svg +0 -12
  745. package/dist/tera-i18n/assets/world-flags/russia.svg +0 -12
  746. package/dist/tera-i18n/assets/world-flags/rwanda.svg +0 -13
  747. package/dist/tera-i18n/assets/world-flags/saba island.svg +0 -15
  748. package/dist/tera-i18n/assets/world-flags/sahrawi arab democratic republic.svg +0 -15
  749. package/dist/tera-i18n/assets/world-flags/samoa.svg +0 -16
  750. package/dist/tera-i18n/assets/world-flags/san marino.svg +0 -16
  751. package/dist/tera-i18n/assets/world-flags/sao tome and prince.svg +0 -15
  752. package/dist/tera-i18n/assets/world-flags/sardinia.svg +0 -23
  753. package/dist/tera-i18n/assets/world-flags/saudi arabia.svg +0 -16
  754. package/dist/tera-i18n/assets/world-flags/scotland.svg +0 -14
  755. package/dist/tera-i18n/assets/world-flags/senegal.svg +0 -13
  756. package/dist/tera-i18n/assets/world-flags/serbia.svg +0 -16
  757. package/dist/tera-i18n/assets/world-flags/seychelles.svg +0 -14
  758. package/dist/tera-i18n/assets/world-flags/sierra leone.svg +0 -12
  759. package/dist/tera-i18n/assets/world-flags/singapore.svg +0 -17
  760. package/dist/tera-i18n/assets/world-flags/sint eustatius.svg +0 -20
  761. package/dist/tera-i18n/assets/world-flags/sint maarten.svg +0 -17
  762. package/dist/tera-i18n/assets/world-flags/slovakia.svg +0 -16
  763. package/dist/tera-i18n/assets/world-flags/slovenia.svg +0 -13
  764. package/dist/tera-i18n/assets/world-flags/solomon islands.svg +0 -17
  765. package/dist/tera-i18n/assets/world-flags/somalia.svg +0 -11
  766. package/dist/tera-i18n/assets/world-flags/somaliland.svg +0 -18
  767. package/dist/tera-i18n/assets/world-flags/south africa.svg +0 -15
  768. package/dist/tera-i18n/assets/world-flags/south korea.svg +0 -30
  769. package/dist/tera-i18n/assets/world-flags/south sudan.svg +0 -15
  770. package/dist/tera-i18n/assets/world-flags/spain.png +0 -0
  771. package/dist/tera-i18n/assets/world-flags/spain.svg +0 -676
  772. package/dist/tera-i18n/assets/world-flags/sri lanka.svg +0 -15
  773. package/dist/tera-i18n/assets/world-flags/st barts.svg +0 -16
  774. package/dist/tera-i18n/assets/world-flags/st lucia.svg +0 -13
  775. package/dist/tera-i18n/assets/world-flags/st vincent and the grenadines.svg +0 -15
  776. package/dist/tera-i18n/assets/world-flags/sudan.svg +0 -13
  777. package/dist/tera-i18n/assets/world-flags/suriname.svg +0 -14
  778. package/dist/tera-i18n/assets/world-flags/swaziland.svg +0 -21
  779. package/dist/tera-i18n/assets/world-flags/sweden.svg +0 -14
  780. package/dist/tera-i18n/assets/world-flags/switzerland.svg +0 -11
  781. package/dist/tera-i18n/assets/world-flags/syria.svg +0 -14
  782. package/dist/tera-i18n/assets/world-flags/taiwan.svg +0 -14
  783. package/dist/tera-i18n/assets/world-flags/tajikistan.svg +0 -20
  784. package/dist/tera-i18n/assets/world-flags/tanzania.svg +0 -13
  785. package/dist/tera-i18n/assets/world-flags/thailand.svg +0 -13
  786. package/dist/tera-i18n/assets/world-flags/tibet.svg +0 -22
  787. package/dist/tera-i18n/assets/world-flags/togo.svg +0 -15
  788. package/dist/tera-i18n/assets/world-flags/tokelau.svg +0 -15
  789. package/dist/tera-i18n/assets/world-flags/tonga.svg +0 -12
  790. package/dist/tera-i18n/assets/world-flags/transnistria.svg +0 -12
  791. package/dist/tera-i18n/assets/world-flags/trinidad and tobago.svg +0 -13
  792. package/dist/tera-i18n/assets/world-flags/tunisia.svg +0 -13
  793. package/dist/tera-i18n/assets/world-flags/turkey.svg +0 -12
  794. package/dist/tera-i18n/assets/world-flags/turkmenistan.svg +0 -30
  795. package/dist/tera-i18n/assets/world-flags/turks and caicos.svg +0 -19
  796. package/dist/tera-i18n/assets/world-flags/tuvalu.svg +0 -25
  797. package/dist/tera-i18n/assets/world-flags/uganda.svg +0 -16
  798. package/dist/tera-i18n/assets/world-flags/ukraine.svg +0 -11
  799. package/dist/tera-i18n/assets/world-flags/united arab emirates.svg +0 -13
  800. package/dist/tera-i18n/assets/world-flags/united kingdom.svg +0 -23
  801. package/dist/tera-i18n/assets/world-flags/united nations.svg +0 -12
  802. package/dist/tera-i18n/assets/world-flags/united states.svg +0 -15
  803. package/dist/tera-i18n/assets/world-flags/uruguay.svg +0 -16
  804. package/dist/tera-i18n/assets/world-flags/uzbekista/314/201n.svg +0 -27
  805. package/dist/tera-i18n/assets/world-flags/uzbekist/303/241n.svg +0 -27
  806. package/dist/tera-i18n/assets/world-flags/vanuatu.svg +0 -32
  807. package/dist/tera-i18n/assets/world-flags/vatican city.svg +0 -13
  808. package/dist/tera-i18n/assets/world-flags/venezuela.svg +0 -20
  809. package/dist/tera-i18n/assets/world-flags/vietnam.svg +0 -11
  810. package/dist/tera-i18n/assets/world-flags/virgin islands.svg +0 -18
  811. package/dist/tera-i18n/assets/world-flags/wales.svg +0 -12
  812. package/dist/tera-i18n/assets/world-flags/yemen.svg +0 -12
  813. package/dist/tera-i18n/assets/world-flags/zambia.svg +0 -14
  814. package/dist/tera-i18n/assets/world-flags/zimbabwe.svg +0 -20
  815. package/dist/tera-i18n/dev-tools/translator/.env +0 -2
  816. package/dist/tera-i18n/dev-tools/translator/gpt-translator-calculator-seo.js +0 -79
  817. package/dist/tera-i18n/dev-tools/translator/gpt-translator-i18n-message.js +0 -274
  818. package/dist/tera-i18n/dev-tools/translator/gpt-translator.js +0 -128
  819. package/dist/tera-i18n/dev-tools/translator/index.js +0 -2
  820. package/dist/tera-i18n/dev-tools/translator/package-lock.json +0 -780
  821. package/dist/tera-i18n/dev-tools/translator/package.json +0 -20
  822. package/dist/tera-i18n/dev-tools/translator/prompt/i18n-message-translate-prompt-calculator.md +0 -34
  823. package/dist/tera-i18n/dev-tools/translator/prompt/i18n-message-translate-prompt-cv-maker.md +0 -149
  824. package/dist/tera-i18n/dev-tools/translator/prompt/i18n-message-translate-prompt-system.txt +0 -1
  825. package/dist/tera-i18n/dev-tools/translator/prompt/i18n-message-translate-prompt.txt +0 -14
  826. package/dist/tera-i18n/dev-tools/translator/tsconfig.json +0 -17
  827. package/dist/tera-i18n/dev-tools/translator/types/supported-languages.js +0 -90
  828. package/dist/tera-i18n/projects/common/all-language-data.d.ts +0 -3
  829. package/dist/tera-i18n/projects/common/all-language-data.js +0 -141
  830. package/dist/tera-i18n/projects/common/messages/en.json +0 -0
  831. package/dist/tera-i18n/projects/common/types/language.d.ts +0 -6
  832. package/dist/tera-i18n/projects/common/types/language.js +0 -1
  833. package/dist/tera-i18n/projects/cv-maker/messages/ar-AE.json +0 -94
  834. package/dist/tera-i18n/projects/cv-maker/messages/ar-EG.json +0 -94
  835. package/dist/tera-i18n/projects/cv-maker/messages/ar-IQ.json +0 -94
  836. package/dist/tera-i18n/projects/cv-maker/messages/ar-SA.json +0 -94
  837. package/dist/tera-i18n/projects/cv-maker/messages/ar-SD.json +0 -94
  838. package/dist/tera-i18n/projects/cv-maker/messages/ar-YE.json +0 -94
  839. package/dist/tera-i18n/projects/cv-maker/messages/ar.json +0 -95
  840. package/dist/tera-i18n/projects/cv-maker/messages/bg.json +0 -95
  841. package/dist/tera-i18n/projects/cv-maker/messages/bn.json +0 -95
  842. package/dist/tera-i18n/projects/cv-maker/messages/ca.json +0 -95
  843. package/dist/tera-i18n/projects/cv-maker/messages/cs.json +0 -95
  844. package/dist/tera-i18n/projects/cv-maker/messages/da.json +0 -95
  845. package/dist/tera-i18n/projects/cv-maker/messages/de.json +0 -95
  846. package/dist/tera-i18n/projects/cv-maker/messages/el.json +0 -95
  847. package/dist/tera-i18n/projects/cv-maker/messages/en-AE.json +0 -94
  848. package/dist/tera-i18n/projects/cv-maker/messages/en-AU.json +0 -94
  849. package/dist/tera-i18n/projects/cv-maker/messages/en-CA.json +0 -94
  850. package/dist/tera-i18n/projects/cv-maker/messages/en-GB.json +0 -94
  851. package/dist/tera-i18n/projects/cv-maker/messages/en-ID.json +0 -94
  852. package/dist/tera-i18n/projects/cv-maker/messages/en-IN.json +0 -94
  853. package/dist/tera-i18n/projects/cv-maker/messages/en-NZ.json +0 -94
  854. package/dist/tera-i18n/projects/cv-maker/messages/en-PH.json +0 -94
  855. package/dist/tera-i18n/projects/cv-maker/messages/en-PK.json +0 -94
  856. package/dist/tera-i18n/projects/cv-maker/messages/en-SA.json +0 -94
  857. package/dist/tera-i18n/projects/cv-maker/messages/en-US.json +0 -94
  858. package/dist/tera-i18n/projects/cv-maker/messages/en-ZA.json +0 -94
  859. package/dist/tera-i18n/projects/cv-maker/messages/en.json +0 -92
  860. package/dist/tera-i18n/projects/cv-maker/messages/es-419.json +0 -94
  861. package/dist/tera-i18n/projects/cv-maker/messages/es-AR.json +0 -94
  862. package/dist/tera-i18n/projects/cv-maker/messages/es-ES.json +0 -94
  863. package/dist/tera-i18n/projects/cv-maker/messages/es-MX.json +0 -94
  864. package/dist/tera-i18n/projects/cv-maker/messages/es.json +0 -95
  865. package/dist/tera-i18n/projects/cv-maker/messages/fi.json +0 -95
  866. package/dist/tera-i18n/projects/cv-maker/messages/fr-MA.json +0 -94
  867. package/dist/tera-i18n/projects/cv-maker/messages/fr.json +0 -95
  868. package/dist/tera-i18n/projects/cv-maker/messages/he.json +0 -95
  869. package/dist/tera-i18n/projects/cv-maker/messages/hi.json +0 -95
  870. package/dist/tera-i18n/projects/cv-maker/messages/hr.json +0 -94
  871. package/dist/tera-i18n/projects/cv-maker/messages/hu.json +0 -95
  872. package/dist/tera-i18n/projects/cv-maker/messages/id.json +0 -95
  873. package/dist/tera-i18n/projects/cv-maker/messages/it.json +0 -95
  874. package/dist/tera-i18n/projects/cv-maker/messages/ja.json +0 -95
  875. package/dist/tera-i18n/projects/cv-maker/messages/ko.json +0 -95
  876. package/dist/tera-i18n/projects/cv-maker/messages/lt.json +0 -95
  877. package/dist/tera-i18n/projects/cv-maker/messages/lv.json +0 -95
  878. package/dist/tera-i18n/projects/cv-maker/messages/ms-MY.json +0 -94
  879. package/dist/tera-i18n/projects/cv-maker/messages/ms.json +0 -95
  880. package/dist/tera-i18n/projects/cv-maker/messages/nl.json +0 -95
  881. package/dist/tera-i18n/projects/cv-maker/messages/no.json +0 -95
  882. package/dist/tera-i18n/projects/cv-maker/messages/pl.json +0 -95
  883. package/dist/tera-i18n/projects/cv-maker/messages/pt-BR.json +0 -94
  884. package/dist/tera-i18n/projects/cv-maker/messages/pt-PT.json +0 -94
  885. package/dist/tera-i18n/projects/cv-maker/messages/pt.json +0 -95
  886. package/dist/tera-i18n/projects/cv-maker/messages/ro.json +0 -95
  887. package/dist/tera-i18n/projects/cv-maker/messages/ru.json +0 -95
  888. package/dist/tera-i18n/projects/cv-maker/messages/sk.json +0 -95
  889. package/dist/tera-i18n/projects/cv-maker/messages/sl.json +0 -95
  890. package/dist/tera-i18n/projects/cv-maker/messages/sq.json +0 -95
  891. package/dist/tera-i18n/projects/cv-maker/messages/sr.json +0 -95
  892. package/dist/tera-i18n/projects/cv-maker/messages/sv.json +0 -95
  893. package/dist/tera-i18n/projects/cv-maker/messages/sw.json +0 -95
  894. package/dist/tera-i18n/projects/cv-maker/messages/ta.json +0 -95
  895. package/dist/tera-i18n/projects/cv-maker/messages/te.json +0 -95
  896. package/dist/tera-i18n/projects/cv-maker/messages/th.json +0 -95
  897. package/dist/tera-i18n/projects/cv-maker/messages/tl.json +0 -95
  898. package/dist/tera-i18n/projects/cv-maker/messages/tr.json +0 -95
  899. package/dist/tera-i18n/projects/cv-maker/messages/uk.json +0 -95
  900. package/dist/tera-i18n/projects/cv-maker/messages/vi.json +0 -95
  901. package/dist/tera-i18n/projects/cv-maker/messages/zh-CN.json +0 -95
  902. package/dist/tera-i18n/projects/cv-maker/messages/zh-TW.json +0 -95
  903. package/dist/tera-i18n/projects/cv-maker/messages/zh.json +0 -94
  904. package/dist/tera-i18n/projects/cv-maker/project.inlang/settings.json +0 -84
  905. package/dist/tera-i18n/projects/cv-maker/supported-language.d.ts +0 -1
  906. package/dist/tera-i18n/projects/cv-maker/supported-language.js +0 -81
  907. package/dist/tera-i18n/projects/mathda/messages/en.json +0 -4
  908. package/dist/tera-i18n/projects/mathda/messages/vi.json +0 -4
  909. package/dist/tera-i18n/projects/mathda/project.inlang/settings.json +0 -15
  910. package/dist/tera-i18n/projects/mathda/supported-language.d.ts +0 -1
  911. package/dist/tera-i18n/projects/mathda/supported-language.js +0 -4
  912. package/dist/tera-i18n/projects/tera-calculator/messages/bg.json +0 -183
  913. package/dist/tera-i18n/projects/tera-calculator/messages/bn.json +0 -183
  914. package/dist/tera-i18n/projects/tera-calculator/messages/ca.json +0 -183
  915. package/dist/tera-i18n/projects/tera-calculator/messages/cs.json +0 -183
  916. package/dist/tera-i18n/projects/tera-calculator/messages/da.json +0 -183
  917. package/dist/tera-i18n/projects/tera-calculator/messages/de.json +0 -183
  918. package/dist/tera-i18n/projects/tera-calculator/messages/el.json +0 -183
  919. package/dist/tera-i18n/projects/tera-calculator/messages/en-IN.json +0 -183
  920. package/dist/tera-i18n/projects/tera-calculator/messages/en-PH.json +0 -183
  921. package/dist/tera-i18n/projects/tera-calculator/messages/en-US.json +0 -183
  922. package/dist/tera-i18n/projects/tera-calculator/messages/en.json +0 -189
  923. package/dist/tera-i18n/projects/tera-calculator/messages/es.json +0 -183
  924. package/dist/tera-i18n/projects/tera-calculator/messages/fi.json +0 -183
  925. package/dist/tera-i18n/projects/tera-calculator/messages/fr.json +0 -183
  926. package/dist/tera-i18n/projects/tera-calculator/messages/hi.json +0 -183
  927. package/dist/tera-i18n/projects/tera-calculator/messages/hu.json +0 -183
  928. package/dist/tera-i18n/projects/tera-calculator/messages/id.json +0 -183
  929. package/dist/tera-i18n/projects/tera-calculator/messages/it.json +0 -183
  930. package/dist/tera-i18n/projects/tera-calculator/messages/ja.json +0 -183
  931. package/dist/tera-i18n/projects/tera-calculator/messages/ko.json +0 -183
  932. package/dist/tera-i18n/projects/tera-calculator/messages/lt.json +0 -183
  933. package/dist/tera-i18n/projects/tera-calculator/messages/lv.json +0 -183
  934. package/dist/tera-i18n/projects/tera-calculator/messages/ms.json +0 -183
  935. package/dist/tera-i18n/projects/tera-calculator/messages/nl.json +0 -183
  936. package/dist/tera-i18n/projects/tera-calculator/messages/no.json +0 -183
  937. package/dist/tera-i18n/projects/tera-calculator/messages/pl.json +0 -183
  938. package/dist/tera-i18n/projects/tera-calculator/messages/pt.json +0 -183
  939. package/dist/tera-i18n/projects/tera-calculator/messages/ro.json +0 -183
  940. package/dist/tera-i18n/projects/tera-calculator/messages/ru.json +0 -183
  941. package/dist/tera-i18n/projects/tera-calculator/messages/sk.json +0 -183
  942. package/dist/tera-i18n/projects/tera-calculator/messages/sl.json +0 -183
  943. package/dist/tera-i18n/projects/tera-calculator/messages/sq.json +0 -183
  944. package/dist/tera-i18n/projects/tera-calculator/messages/sr.json +0 -183
  945. package/dist/tera-i18n/projects/tera-calculator/messages/sv.json +0 -183
  946. package/dist/tera-i18n/projects/tera-calculator/messages/sw.json +0 -183
  947. package/dist/tera-i18n/projects/tera-calculator/messages/ta.json +0 -183
  948. package/dist/tera-i18n/projects/tera-calculator/messages/te.json +0 -183
  949. package/dist/tera-i18n/projects/tera-calculator/messages/th.json +0 -183
  950. package/dist/tera-i18n/projects/tera-calculator/messages/tl.json +0 -183
  951. package/dist/tera-i18n/projects/tera-calculator/messages/tr.json +0 -183
  952. package/dist/tera-i18n/projects/tera-calculator/messages/uk.json +0 -183
  953. package/dist/tera-i18n/projects/tera-calculator/messages/vi.json +0 -183
  954. package/dist/tera-i18n/projects/tera-calculator/messages/zh-CN.json +0 -183
  955. package/dist/tera-i18n/projects/tera-calculator/messages/zh-TW.json +0 -183
  956. package/dist/tera-i18n/projects/tera-calculator/project.inlang/settings.json +0 -57
  957. package/dist/tera-i18n/projects/tera-calculator/supported-language.d.ts +0 -1
  958. package/dist/tera-i18n/projects/tera-calculator/supported-language.js +0 -48
  959. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/de.json +0 -1876
  960. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/en.json +0 -1876
  961. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/es.json +0 -1876
  962. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/fr.json +0 -1876
  963. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/it.json +0 -1876
  964. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/ja.json +0 -1876
  965. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/ko.json +0 -1876
  966. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/pt.json +0 -1876
  967. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/ru.json +0 -1876
  968. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/vi.json +0 -1876
  969. package/dist/tera-i18n/projects/tera-converter/messages/auto-generated/zh-CN.json +0 -1876
  970. package/dist/tera-i18n/projects/tera-converter/messages/de.json +0 -41
  971. package/dist/tera-i18n/projects/tera-converter/messages/en.json +0 -42
  972. package/dist/tera-i18n/projects/tera-converter/messages/es.json +0 -41
  973. package/dist/tera-i18n/projects/tera-converter/messages/fr.json +0 -41
  974. package/dist/tera-i18n/projects/tera-converter/messages/it.json +0 -41
  975. package/dist/tera-i18n/projects/tera-converter/messages/ja.json +0 -41
  976. package/dist/tera-i18n/projects/tera-converter/messages/ko.json +0 -41
  977. package/dist/tera-i18n/projects/tera-converter/messages/pt.json +0 -41
  978. package/dist/tera-i18n/projects/tera-converter/messages/ru.json +0 -41
  979. package/dist/tera-i18n/projects/tera-converter/messages/vi.json +0 -41
  980. package/dist/tera-i18n/projects/tera-converter/messages/zh-CN.json +0 -41
  981. package/dist/tera-i18n/projects/tera-converter/project.inlang/project_id +0 -1
  982. package/dist/tera-i18n/projects/tera-converter/project.inlang/settings.json +0 -27
  983. package/dist/tera-i18n/projects/tera-converter/supported-language.d.ts +0 -1
  984. package/dist/tera-i18n/projects/tera-converter/supported-language.js +0 -13
  985. package/dist/tera-i18n/projects/tera-system-ui/messages/ar.json +0 -10
  986. package/dist/tera-i18n/projects/tera-system-ui/messages/bg.json +0 -10
  987. package/dist/tera-i18n/projects/tera-system-ui/messages/bn.json +0 -10
  988. package/dist/tera-i18n/projects/tera-system-ui/messages/ca.json +0 -10
  989. package/dist/tera-i18n/projects/tera-system-ui/messages/cs.json +0 -10
  990. package/dist/tera-i18n/projects/tera-system-ui/messages/da.json +0 -10
  991. package/dist/tera-i18n/projects/tera-system-ui/messages/de.json +0 -10
  992. package/dist/tera-i18n/projects/tera-system-ui/messages/el.json +0 -10
  993. package/dist/tera-i18n/projects/tera-system-ui/messages/en.json +0 -10
  994. package/dist/tera-i18n/projects/tera-system-ui/messages/es.json +0 -10
  995. package/dist/tera-i18n/projects/tera-system-ui/messages/fi.json +0 -10
  996. package/dist/tera-i18n/projects/tera-system-ui/messages/fr.json +0 -10
  997. package/dist/tera-i18n/projects/tera-system-ui/messages/he.json +0 -10
  998. package/dist/tera-i18n/projects/tera-system-ui/messages/hi.json +0 -10
  999. package/dist/tera-i18n/projects/tera-system-ui/messages/hu.json +0 -10
  1000. package/dist/tera-i18n/projects/tera-system-ui/messages/id.json +0 -10
  1001. package/dist/tera-i18n/projects/tera-system-ui/messages/it.json +0 -10
  1002. package/dist/tera-i18n/projects/tera-system-ui/messages/ja.json +0 -10
  1003. package/dist/tera-i18n/projects/tera-system-ui/messages/ko.json +0 -10
  1004. package/dist/tera-i18n/projects/tera-system-ui/messages/lt.json +0 -10
  1005. package/dist/tera-i18n/projects/tera-system-ui/messages/lv.json +0 -10
  1006. package/dist/tera-i18n/projects/tera-system-ui/messages/ms.json +0 -10
  1007. package/dist/tera-i18n/projects/tera-system-ui/messages/nl.json +0 -10
  1008. package/dist/tera-i18n/projects/tera-system-ui/messages/no.json +0 -10
  1009. package/dist/tera-i18n/projects/tera-system-ui/messages/pl.json +0 -10
  1010. package/dist/tera-i18n/projects/tera-system-ui/messages/pt.json +0 -10
  1011. package/dist/tera-i18n/projects/tera-system-ui/messages/ro.json +0 -10
  1012. package/dist/tera-i18n/projects/tera-system-ui/messages/ru.json +0 -10
  1013. package/dist/tera-i18n/projects/tera-system-ui/messages/sk.json +0 -10
  1014. package/dist/tera-i18n/projects/tera-system-ui/messages/sl.json +0 -10
  1015. package/dist/tera-i18n/projects/tera-system-ui/messages/sq.json +0 -10
  1016. package/dist/tera-i18n/projects/tera-system-ui/messages/sr.json +0 -10
  1017. package/dist/tera-i18n/projects/tera-system-ui/messages/sv.json +0 -10
  1018. package/dist/tera-i18n/projects/tera-system-ui/messages/sw.json +0 -10
  1019. package/dist/tera-i18n/projects/tera-system-ui/messages/ta.json +0 -10
  1020. package/dist/tera-i18n/projects/tera-system-ui/messages/te.json +0 -10
  1021. package/dist/tera-i18n/projects/tera-system-ui/messages/th.json +0 -10
  1022. package/dist/tera-i18n/projects/tera-system-ui/messages/tl.json +0 -10
  1023. package/dist/tera-i18n/projects/tera-system-ui/messages/tr.json +0 -10
  1024. package/dist/tera-i18n/projects/tera-system-ui/messages/uk.json +0 -10
  1025. package/dist/tera-i18n/projects/tera-system-ui/messages/vi.json +0 -10
  1026. package/dist/tera-i18n/projects/tera-system-ui/messages/zh-CN.json +0 -10
  1027. package/dist/tera-i18n/projects/tera-system-ui/messages/zh-TW.json +0 -10
  1028. package/dist/tera-i18n/projects/tera-system-ui/project.inlang/settings.json +0 -59
  1029. package/dist/tera-i18n/projects/tera-system-ui/supported-language.d.ts +0 -1
  1030. package/dist/tera-i18n/projects/tera-system-ui/supported-language.js +0 -45
  1031. package/dist/tera-i18n/projects/tera-tools/messages/ar.json +0 -70
  1032. package/dist/tera-i18n/projects/tera-tools/messages/bg.json +0 -70
  1033. package/dist/tera-i18n/projects/tera-tools/messages/bn.json +0 -70
  1034. package/dist/tera-i18n/projects/tera-tools/messages/ca.json +0 -70
  1035. package/dist/tera-i18n/projects/tera-tools/messages/cs.json +0 -70
  1036. package/dist/tera-i18n/projects/tera-tools/messages/da.json +0 -70
  1037. package/dist/tera-i18n/projects/tera-tools/messages/de.json +0 -70
  1038. package/dist/tera-i18n/projects/tera-tools/messages/el.json +0 -70
  1039. package/dist/tera-i18n/projects/tera-tools/messages/en.json +0 -96
  1040. package/dist/tera-i18n/projects/tera-tools/messages/es.json +0 -70
  1041. package/dist/tera-i18n/projects/tera-tools/messages/fi.json +0 -70
  1042. package/dist/tera-i18n/projects/tera-tools/messages/fr.json +0 -70
  1043. package/dist/tera-i18n/projects/tera-tools/messages/he.json +0 -70
  1044. package/dist/tera-i18n/projects/tera-tools/messages/hi.json +0 -70
  1045. package/dist/tera-i18n/projects/tera-tools/messages/hu.json +0 -70
  1046. package/dist/tera-i18n/projects/tera-tools/messages/id.json +0 -70
  1047. package/dist/tera-i18n/projects/tera-tools/messages/it.json +0 -70
  1048. package/dist/tera-i18n/projects/tera-tools/messages/ja.json +0 -70
  1049. package/dist/tera-i18n/projects/tera-tools/messages/ko.json +0 -70
  1050. package/dist/tera-i18n/projects/tera-tools/messages/lt.json +0 -70
  1051. package/dist/tera-i18n/projects/tera-tools/messages/lv.json +0 -70
  1052. package/dist/tera-i18n/projects/tera-tools/messages/ms.json +0 -70
  1053. package/dist/tera-i18n/projects/tera-tools/messages/nl.json +0 -70
  1054. package/dist/tera-i18n/projects/tera-tools/messages/no.json +0 -70
  1055. package/dist/tera-i18n/projects/tera-tools/messages/pl.json +0 -70
  1056. package/dist/tera-i18n/projects/tera-tools/messages/pt.json +0 -70
  1057. package/dist/tera-i18n/projects/tera-tools/messages/ro.json +0 -70
  1058. package/dist/tera-i18n/projects/tera-tools/messages/ru.json +0 -70
  1059. package/dist/tera-i18n/projects/tera-tools/messages/sk.json +0 -70
  1060. package/dist/tera-i18n/projects/tera-tools/messages/sl.json +0 -70
  1061. package/dist/tera-i18n/projects/tera-tools/messages/sq.json +0 -70
  1062. package/dist/tera-i18n/projects/tera-tools/messages/sr.json +0 -70
  1063. package/dist/tera-i18n/projects/tera-tools/messages/sv.json +0 -70
  1064. package/dist/tera-i18n/projects/tera-tools/messages/sw.json +0 -70
  1065. package/dist/tera-i18n/projects/tera-tools/messages/ta.json +0 -70
  1066. package/dist/tera-i18n/projects/tera-tools/messages/te.json +0 -70
  1067. package/dist/tera-i18n/projects/tera-tools/messages/th.json +0 -70
  1068. package/dist/tera-i18n/projects/tera-tools/messages/tl.json +0 -70
  1069. package/dist/tera-i18n/projects/tera-tools/messages/tr.json +0 -70
  1070. package/dist/tera-i18n/projects/tera-tools/messages/uk.json +0 -70
  1071. package/dist/tera-i18n/projects/tera-tools/messages/vi.json +0 -70
  1072. package/dist/tera-i18n/projects/tera-tools/messages/zh-CN.json +0 -70
  1073. package/dist/tera-i18n/projects/tera-tools/messages/zh-TW.json +0 -70
  1074. package/dist/tera-i18n/projects/tera-tools/project.inlang/project_id +0 -1
  1075. package/dist/tera-i18n/projects/tera-tools/project.inlang/settings.json +0 -61
  1076. package/dist/tera-i18n/projects/tera-tools/supported-language.d.ts +0 -1
  1077. package/dist/tera-i18n/projects/tera-tools/supported-language.js +0 -45
  1078. package/dist/themes/theme-ai.css +0 -100
  1079. package/dist/themes/theme-marketing.css +0 -91
  1080. /package/dist/{components → internal}/icons/IconCheck.svelte.d.ts +0 -0
  1081. /package/dist/{components → internal}/icons/IconChevronDown.svelte.d.ts +0 -0
  1082. /package/dist/{components → internal}/icons/IconSearch.svelte.d.ts +0 -0
  1083. /package/dist/{components → internal}/icons/IconX.svelte.d.ts +0 -0
  1084. /package/dist/{components → internal}/icons/Icons.d.ts +0 -0
  1085. /package/dist/{components → internal}/icons/Icons.js +0 -0
@@ -1,1990 +0,0 @@
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} */ (["ar","bg","bn","ca","cs","da","de","el","en","es","fi","fr","he","hi","hu","id","it","ja","ko","lt","lv","ms","nl","no","pl","pt","ro","ru","sk","sl","sq","sr","sv","sw","ta","te","th","tl","tr","uk","vi","zh-CN","zh-TW"]);
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
- "url",
37
- "cookie",
38
- "preferredLanguage",
39
- "baseLocale"
40
- ];
41
- /**
42
- * Route-level strategy overrides.
43
- *
44
- * `match` uses URLPattern syntax.
45
- *
46
- * @type {Array<{
47
- * match: string;
48
- * strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>;
49
- * exclude?: boolean;
50
- * }>}
51
- */
52
- export const routeStrategies = [];
53
- /**
54
- * The used URL patterns.
55
- *
56
- * @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
57
- */
58
- export const urlPatterns = [
59
- {
60
- "pattern": ":protocol://:domain(.*)::port?/:path(.*)?",
61
- "localized": [
62
- [
63
- "ar",
64
- ":protocol://:domain(.*)::port?/ar/:path(.*)?"
65
- ],
66
- [
67
- "bg",
68
- ":protocol://:domain(.*)::port?/bg/:path(.*)?"
69
- ],
70
- [
71
- "bn",
72
- ":protocol://:domain(.*)::port?/bn/:path(.*)?"
73
- ],
74
- [
75
- "ca",
76
- ":protocol://:domain(.*)::port?/ca/:path(.*)?"
77
- ],
78
- [
79
- "cs",
80
- ":protocol://:domain(.*)::port?/cs/:path(.*)?"
81
- ],
82
- [
83
- "da",
84
- ":protocol://:domain(.*)::port?/da/:path(.*)?"
85
- ],
86
- [
87
- "de",
88
- ":protocol://:domain(.*)::port?/de/:path(.*)?"
89
- ],
90
- [
91
- "el",
92
- ":protocol://:domain(.*)::port?/el/:path(.*)?"
93
- ],
94
- [
95
- "es",
96
- ":protocol://:domain(.*)::port?/es/:path(.*)?"
97
- ],
98
- [
99
- "fi",
100
- ":protocol://:domain(.*)::port?/fi/:path(.*)?"
101
- ],
102
- [
103
- "fr",
104
- ":protocol://:domain(.*)::port?/fr/:path(.*)?"
105
- ],
106
- [
107
- "he",
108
- ":protocol://:domain(.*)::port?/he/:path(.*)?"
109
- ],
110
- [
111
- "hi",
112
- ":protocol://:domain(.*)::port?/hi/:path(.*)?"
113
- ],
114
- [
115
- "hu",
116
- ":protocol://:domain(.*)::port?/hu/:path(.*)?"
117
- ],
118
- [
119
- "id",
120
- ":protocol://:domain(.*)::port?/id/:path(.*)?"
121
- ],
122
- [
123
- "it",
124
- ":protocol://:domain(.*)::port?/it/:path(.*)?"
125
- ],
126
- [
127
- "ja",
128
- ":protocol://:domain(.*)::port?/ja/:path(.*)?"
129
- ],
130
- [
131
- "ko",
132
- ":protocol://:domain(.*)::port?/ko/:path(.*)?"
133
- ],
134
- [
135
- "lt",
136
- ":protocol://:domain(.*)::port?/lt/:path(.*)?"
137
- ],
138
- [
139
- "lv",
140
- ":protocol://:domain(.*)::port?/lv/:path(.*)?"
141
- ],
142
- [
143
- "ms",
144
- ":protocol://:domain(.*)::port?/ms/:path(.*)?"
145
- ],
146
- [
147
- "nl",
148
- ":protocol://:domain(.*)::port?/nl/:path(.*)?"
149
- ],
150
- [
151
- "no",
152
- ":protocol://:domain(.*)::port?/no/:path(.*)?"
153
- ],
154
- [
155
- "pl",
156
- ":protocol://:domain(.*)::port?/pl/:path(.*)?"
157
- ],
158
- [
159
- "pt",
160
- ":protocol://:domain(.*)::port?/pt/:path(.*)?"
161
- ],
162
- [
163
- "ro",
164
- ":protocol://:domain(.*)::port?/ro/:path(.*)?"
165
- ],
166
- [
167
- "ru",
168
- ":protocol://:domain(.*)::port?/ru/:path(.*)?"
169
- ],
170
- [
171
- "sk",
172
- ":protocol://:domain(.*)::port?/sk/:path(.*)?"
173
- ],
174
- [
175
- "sl",
176
- ":protocol://:domain(.*)::port?/sl/:path(.*)?"
177
- ],
178
- [
179
- "sq",
180
- ":protocol://:domain(.*)::port?/sq/:path(.*)?"
181
- ],
182
- [
183
- "sr",
184
- ":protocol://:domain(.*)::port?/sr/:path(.*)?"
185
- ],
186
- [
187
- "sv",
188
- ":protocol://:domain(.*)::port?/sv/:path(.*)?"
189
- ],
190
- [
191
- "sw",
192
- ":protocol://:domain(.*)::port?/sw/:path(.*)?"
193
- ],
194
- [
195
- "ta",
196
- ":protocol://:domain(.*)::port?/ta/:path(.*)?"
197
- ],
198
- [
199
- "te",
200
- ":protocol://:domain(.*)::port?/te/:path(.*)?"
201
- ],
202
- [
203
- "th",
204
- ":protocol://:domain(.*)::port?/th/:path(.*)?"
205
- ],
206
- [
207
- "tl",
208
- ":protocol://:domain(.*)::port?/tl/:path(.*)?"
209
- ],
210
- [
211
- "tr",
212
- ":protocol://:domain(.*)::port?/tr/:path(.*)?"
213
- ],
214
- [
215
- "uk",
216
- ":protocol://:domain(.*)::port?/uk/:path(.*)?"
217
- ],
218
- [
219
- "vi",
220
- ":protocol://:domain(.*)::port?/vi/:path(.*)?"
221
- ],
222
- [
223
- "zh-CN",
224
- ":protocol://:domain(.*)::port?/zh-CN/:path(.*)?"
225
- ],
226
- [
227
- "zh-TW",
228
- ":protocol://:domain(.*)::port?/zh-TW/:path(.*)?"
229
- ],
230
- [
231
- "en",
232
- ":protocol://:domain(.*)::port?/:path(.*)?"
233
- ]
234
- ]
235
- }
236
- ];
237
- /** @type {string | undefined} */
238
- let cachedRouteStrategyUrl;
239
- /** @type {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined} */
240
- let cachedRouteStrategy;
241
- /**
242
- * @param {string | URL} url
243
- * @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}
244
- */
245
- function findMatchingRouteStrategy(url) {
246
- if (routeStrategies.length === 0) {
247
- return undefined;
248
- }
249
- const urlString = typeof url === "string" ? url : url.href;
250
- if (cachedRouteStrategyUrl === urlString) {
251
- return cachedRouteStrategy;
252
- }
253
- const urlObject = new URL(urlString, "http://dummy.com");
254
- let match;
255
- for (const routeStrategy of routeStrategies) {
256
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
257
- if (pattern.exec(urlObject.href)) {
258
- match = routeStrategy;
259
- break;
260
- }
261
- }
262
- cachedRouteStrategyUrl = urlString;
263
- cachedRouteStrategy = match;
264
- return match;
265
- }
266
- /**
267
- * Returns the strategy to use for a specific URL.
268
- *
269
- * If no route strategy matches (or the matching rule is `exclude: true`),
270
- * the global strategy is returned.
271
- *
272
- * @param {string | URL} url
273
- * @returns {typeof strategy}
274
- */
275
- export function getStrategyForUrl(url) {
276
- const routeStrategy = findMatchingRouteStrategy(url);
277
- if (routeStrategy &&
278
- routeStrategy.exclude !== true &&
279
- Array.isArray(routeStrategy.strategy)) {
280
- return routeStrategy.strategy;
281
- }
282
- return strategy;
283
- }
284
- /**
285
- * Returns whether the given URL is excluded from middleware i18n processing.
286
- *
287
- * @param {string | URL} url
288
- * @returns {boolean}
289
- */
290
- export function isExcludedByRouteStrategy(url) {
291
- return findMatchingRouteStrategy(url)?.exclude === true;
292
- }
293
- /**
294
- * @typedef {{
295
- * getStore(): {
296
- * locale?: Locale,
297
- * origin?: string,
298
- * messageCalls?: Set<string>
299
- * } | undefined,
300
- * run: (store: { locale?: Locale, origin?: string, messageCalls?: Set<string>},
301
- * cb: any) => any
302
- * }} ParaglideAsyncLocalStorage
303
- */
304
- /**
305
- * Server side async local storage that is set by `serverMiddleware()`.
306
- *
307
- * The variable is used to retrieve the locale and origin in a server-side
308
- * rendering context without effecting other requests.
309
- *
310
- * @type {ParaglideAsyncLocalStorage | undefined}
311
- */
312
- export let serverAsyncLocalStorage = undefined;
313
- export const disableAsyncLocalStorage = false;
314
- export const experimentalMiddlewareLocaleSplitting = false;
315
- export const isServer = import.meta.env?.SSR ?? typeof window === 'undefined';
316
- /** @type {Locale | undefined} */
317
- export const experimentalStaticLocale = undefined;
318
- /**
319
- * Sets the server side async local storage.
320
- *
321
- * The function is needed because the `runtime.js` file
322
- * must define the `serverAsyncLocalStorage` variable to
323
- * avoid a circular import between `runtime.js` and
324
- * `server.js` files.
325
- *
326
- * @param {ParaglideAsyncLocalStorage | undefined} value
327
- */
328
- export function overwriteServerAsyncLocalStorage(value) {
329
- serverAsyncLocalStorage = value;
330
- }
331
- const TREE_SHAKE_COOKIE_STRATEGY_USED = true;
332
- const TREE_SHAKE_URL_STRATEGY_USED = true;
333
- const TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
334
- const TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
335
- const TREE_SHAKE_DEFAULT_URL_PATTERN_USED = true;
336
- const TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
337
-
338
- /** @type {any} */ (globalThis).__paraglide =
339
- /** @type {any} */ (globalThis).__paraglide ?? {};
340
- /** @type {any} */ (globalThis).__paraglide.ssr =
341
- /** @type {any} */ (globalThis).__paraglide.ssr ?? {};
342
-
343
- /**
344
- * This is a fallback to get started with a custom
345
- * strategy and avoid type errors.
346
- *
347
- * The implementation is overwritten
348
- * by `overwriteGetLocale()` and `defineSetLocale()`.
349
- *
350
- * @type {Locale | undefined}
351
- */
352
- let _locale;
353
- let localeInitiallySet = false;
354
- /**
355
- * Get the current locale.
356
- *
357
- * The locale is resolved using your configured strategies (URL, cookie, localStorage, etc.)
358
- * in the order they are defined. In SSR contexts, the locale is retrieved from AsyncLocalStorage
359
- * which is set by the `paraglideMiddleware()`.
360
- *
361
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy - Configure locale detection strategies
362
- *
363
- * @example
364
- * if (getLocale() === 'de') {
365
- * console.log('Germany 🇩🇪');
366
- * } else if (getLocale() === 'nl') {
367
- * console.log('Netherlands 🇳🇱');
368
- * }
369
- *
370
- * @returns {Locale} The current locale.
371
- */
372
- export let getLocale = () => {
373
- if (experimentalStaticLocale !== undefined) {
374
- return experimentalStaticLocale;
375
- }
376
- // if running in a server-side rendering context
377
- // retrieve the locale from the async local storage
378
- if (serverAsyncLocalStorage) {
379
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
380
- if (locale) {
381
- return locale;
382
- }
383
- }
384
- let strategyToUse = strategy;
385
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
386
- strategyToUse = getStrategyForUrl(window.location.href);
387
- }
388
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
389
- if (resolved) {
390
- if (!localeInitiallySet) {
391
- _locale = resolved;
392
- // https://github.com/opral/inlang-paraglide-js/issues/455
393
- localeInitiallySet = true;
394
- setLocale(resolved, { reload: false });
395
- }
396
- return resolved;
397
- }
398
- throw new Error("No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found");
399
- };
400
- /**
401
- * Resolve locale for a given URL using route-aware strategies.
402
- *
403
- * @param {string | URL} url
404
- * @returns {Locale}
405
- */
406
- export function getLocaleForUrl(url) {
407
- if (experimentalStaticLocale !== undefined) {
408
- return experimentalStaticLocale;
409
- }
410
- const strategyToUse = getStrategyForUrl(url);
411
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof url === "string" ? url : url.href);
412
- if (resolved) {
413
- return resolved;
414
- }
415
- throw new Error("No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found");
416
- }
417
- /**
418
- * @param {typeof strategy} strategyToUse
419
- * @param {string | undefined} urlForUrlStrategy
420
- * @returns {Locale | undefined}
421
- */
422
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
423
- /** @type {string | undefined} */
424
- let locale;
425
- for (const strat of strategyToUse) {
426
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
427
- locale = extractLocaleFromCookie();
428
- }
429
- else if (strat === "baseLocale") {
430
- locale = baseLocale;
431
- }
432
- else if (TREE_SHAKE_URL_STRATEGY_USED &&
433
- strat === "url" &&
434
- !isServer &&
435
- typeof urlForUrlStrategy === "string") {
436
- locale = extractLocaleFromUrl(urlForUrlStrategy);
437
- }
438
- else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&
439
- strat === "globalVariable" &&
440
- _locale !== undefined) {
441
- locale = _locale;
442
- }
443
- else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&
444
- strat === "preferredLanguage" &&
445
- !isServer) {
446
- locale = extractLocaleFromNavigator();
447
- }
448
- else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&
449
- strat === "localStorage" &&
450
- !isServer) {
451
- locale = localStorage.getItem(localStorageKey) ?? undefined;
452
- }
453
- else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
454
- const handler = customClientStrategies.get(strat);
455
- if (handler) {
456
- const result = handler.getLocale();
457
- // Handle both sync and async results - skip async in sync getLocale
458
- if (result instanceof Promise) {
459
- // Can't await in sync function, skip async strategies
460
- continue;
461
- }
462
- if (result !== undefined) {
463
- return assertIsLocale(result);
464
- }
465
- }
466
- }
467
- const matchedLocale = toLocale(locale);
468
- if (matchedLocale) {
469
- return matchedLocale;
470
- }
471
- }
472
- return undefined;
473
- }
474
- /**
475
- * Overwrite the `getLocale()` function.
476
- *
477
- * Use this function to overwrite how the locale is resolved. This is useful
478
- * for custom locale resolution or advanced use cases like SSG with concurrent rendering.
479
- *
480
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy
481
- *
482
- * @example
483
- * overwriteGetLocale(() => {
484
- * return Cookies.get('locale') ?? baseLocale
485
- * });
486
- *
487
- * @param {() => Locale} fn - The new implementation for `getLocale()`.
488
- */
489
- export const overwriteGetLocale = (fn) => {
490
- getLocale = fn;
491
- };
492
-
493
- const rtlLanguages = new Set([
494
- "ar",
495
- "dv",
496
- "fa",
497
- "he",
498
- "ks",
499
- "ku",
500
- "ps",
501
- "sd",
502
- "ug",
503
- "ur",
504
- "yi",
505
- ]);
506
- /**
507
- * Get writing direction for a locale.
508
- *
509
- * Uses `Intl.Locale` text info when available and falls back to a
510
- * language-based RTL check for runtimes without `getTextInfo()`.
511
- *
512
- * @example
513
- * getTextDirection(); // "ltr" or "rtl" for current locale
514
- * getTextDirection("ar"); // "rtl"
515
- * getTextDirection("en"); // "ltr"
516
- *
517
- * @param {string} [locale] - Target locale. If not provided, uses `getLocale()`
518
- * @returns {"ltr" | "rtl"}
519
- */
520
- export function getTextDirection(locale = getLocale()) {
521
- try {
522
- const intlLocale = /** @type {Intl.Locale & {
523
- getTextInfo?: () => { direction?: string };
524
- textInfo?: { direction?: string };
525
- }} */ (new Intl.Locale(locale));
526
- const direction = intlLocale.getTextInfo?.().direction ?? intlLocale.textInfo?.direction;
527
- if (direction === "ltr" || direction === "rtl") {
528
- return direction;
529
- }
530
- }
531
- catch {
532
- // Ignore Intl.Locale parsing/runtime errors and use fallback below.
533
- }
534
- const language = locale.split("-")[0]?.toLowerCase();
535
- return rtlLanguages.has(language ?? "") ? "rtl" : "ltr";
536
- }
537
-
538
- /**
539
- * Navigates to the localized URL, or reloads the current page
540
- *
541
- * @param {string} [newLocation] The new location
542
- */
543
- const navigateOrReload = (newLocation) => {
544
- if (newLocation) {
545
- // reload the page by navigating to the new url
546
- window.location.href = newLocation;
547
- }
548
- else {
549
- // reload the page to reflect the new locale
550
- window.location.reload();
551
- }
552
- };
553
- /**
554
- * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
555
- */
556
- /**
557
- * Set the locale.
558
- *
559
- * Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).
560
- * By default, this reloads the page on the client to reflect the new locale. Reloading
561
- * can be disabled by passing `reload: false` as an option, but you'll need to ensure
562
- * the UI updates to reflect the new locale.
563
- *
564
- * If any custom strategy's `setLocale` function is async, then this function
565
- * will become async as well.
566
- *
567
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy
568
- *
569
- * @example
570
- * setLocale('en');
571
- *
572
- * @example
573
- * setLocale('en', { reload: false });
574
- *
575
- * @type {SetLocaleFn}
576
- */
577
- export let setLocale = (newLocale, options) => {
578
- const optionsWithDefaults = {
579
- reload: true,
580
- ...options,
581
- };
582
- // locale is already set
583
- // https://github.com/opral/inlang-paraglide-js/issues/430
584
- /** @type {Locale | undefined} */
585
- let currentLocale;
586
- try {
587
- currentLocale = getLocale();
588
- }
589
- catch {
590
- // do nothing, no locale has been set yet.
591
- }
592
- /** @type {Array<Promise<void>>} */
593
- const customSetLocalePromises = [];
594
- /** @type {string | undefined} */
595
- let newLocation = undefined;
596
- let strategyToUse = strategy;
597
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
598
- strategyToUse = getStrategyForUrl(window.location.href);
599
- }
600
- for (const strat of strategyToUse) {
601
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&
602
- strat === "globalVariable") {
603
- // a default for a custom strategy to get started quickly
604
- // is likely overwritten by `defineSetLocale()`
605
- _locale = newLocale;
606
- }
607
- else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
608
- if (isServer ||
609
- typeof document === "undefined" ||
610
- typeof window === "undefined") {
611
- continue;
612
- }
613
- // set the cookie
614
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
615
- document.cookie = cookieDomain
616
- ? `${cookieString}; domain=${cookieDomain}`
617
- : cookieString;
618
- }
619
- else if (strat === "baseLocale") {
620
- // nothing to be set here. baseLocale is only a fallback
621
- continue;
622
- }
623
- else if (TREE_SHAKE_URL_STRATEGY_USED &&
624
- strat === "url" &&
625
- typeof window !== "undefined") {
626
- // route to the new url
627
- //
628
- // this triggers a page reload but a user rarely
629
- // switches locales, so this should be fine.
630
- //
631
- // if the behavior is not desired, the implementation
632
- // can be overwritten by `defineSetLocale()` to avoid
633
- // a full page reload.
634
- newLocation = localizeUrl(window.location.href, {
635
- locale: newLocale,
636
- }).href;
637
- }
638
- else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&
639
- strat === "localStorage" &&
640
- typeof window !== "undefined") {
641
- // set the localStorage
642
- localStorage.setItem(localStorageKey, newLocale);
643
- }
644
- else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
645
- const handler = customClientStrategies.get(strat);
646
- if (handler) {
647
- let result = handler.setLocale(newLocale);
648
- // Handle async setLocale
649
- if (result instanceof Promise) {
650
- result = result.catch((error) => {
651
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
652
- cause: error,
653
- });
654
- });
655
- customSetLocalePromises.push(result);
656
- }
657
- }
658
- }
659
- }
660
- const runReload = () => {
661
- if (!isServer &&
662
- optionsWithDefaults.reload &&
663
- window.location &&
664
- newLocale !== currentLocale) {
665
- navigateOrReload(newLocation);
666
- }
667
- };
668
- if (customSetLocalePromises.length) {
669
- return Promise.all(customSetLocalePromises).then(() => {
670
- runReload();
671
- });
672
- }
673
- runReload();
674
- return;
675
- };
676
- /**
677
- * Overwrite the `setLocale()` function.
678
- *
679
- * Use this function to overwrite how the locale is set. For example,
680
- * modify a cookie, env variable, or a user's preference.
681
- *
682
- * @example
683
- * overwriteSetLocale((newLocale) => {
684
- * // set the locale in a cookie
685
- * return Cookies.set('locale', newLocale)
686
- * });
687
- *
688
- * @param {SetLocaleFn} fn
689
- */
690
- export const overwriteSetLocale = (fn) => {
691
- setLocale = fn;
692
- };
693
-
694
- /**
695
- * The origin of the current URL.
696
- *
697
- * Defaults to "http://y.com" in non-browser environments. If this
698
- * behavior is not desired, the implementation can be overwritten
699
- * by `overwriteGetUrlOrigin()`.
700
- *
701
- * @type {() => string}
702
- */
703
- export let getUrlOrigin = () => {
704
- if (serverAsyncLocalStorage) {
705
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
706
- }
707
- else if (typeof window !== "undefined") {
708
- return window.location.origin;
709
- }
710
- return "http://fallback.com";
711
- };
712
- /**
713
- * Overwrite the getUrlOrigin function.
714
- *
715
- * Use this function in server environments to
716
- * define how the URL origin is resolved.
717
- *
718
- * @param {() => string} fn - The new implementation for `getUrlOrigin()`.
719
- */
720
- export let overwriteGetUrlOrigin = (fn) => {
721
- getUrlOrigin = fn;
722
- };
723
-
724
- /**
725
- * Coerces a locale-like string to the canonical locale value used by the runtime.
726
- *
727
- * @param {unknown} value
728
- * @returns {Locale | undefined}
729
- */
730
- export function toLocale(value) {
731
- if (typeof value !== "string") {
732
- return undefined;
733
- }
734
- const lowerValue = value.toLowerCase();
735
- for (const locale of locales) {
736
- if (locale.toLowerCase() === lowerValue) {
737
- return locale;
738
- }
739
- }
740
- return undefined;
741
- }
742
- /**
743
- * Check if something is an available locale with the canonical project casing.
744
- *
745
- * @example
746
- * if (isLocale(params.locale)) {
747
- * setLocale(params.locale);
748
- * } else {
749
- * setLocale('en');
750
- * }
751
- *
752
- * Use `toLocale()` when you want case-insensitive matching and canonicalization.
753
- *
754
- * @param {unknown} locale
755
- * @returns {locale is Locale}
756
- */
757
- export function isLocale(locale) {
758
- return !!locale && locales.some((item) => item === locale);
759
- }
760
- /**
761
- * Asserts that the input can be normalized to a locale.
762
- *
763
- * @param {unknown} input - The input to check.
764
- * @returns {Locale} The input normalized to a Locale.
765
- * @throws {Error} If the input is not a locale.
766
- */
767
- export function assertIsLocale(input) {
768
- const locale = toLocale(input);
769
- if (locale)
770
- return locale;
771
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
772
- }
773
-
774
- /**
775
- * @typedef {object} ExtractLocaleFromRequestOptions
776
- * @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching and locale detection with the URL strategy.
777
- */
778
- /**
779
- * Extracts a locale from a request.
780
- *
781
- * Use the function on the server to extract the locale
782
- * from a request.
783
- *
784
- * The function goes through the strategies in the order
785
- * they are defined. If a strategy returns an invalid locale,
786
- * it will fall back to the next strategy.
787
- *
788
- * Note: Custom server strategies are not supported in this synchronous version.
789
- * Use `extractLocaleFromRequestAsync` if you need custom server strategies with async getLocale methods.
790
- *
791
- * @example
792
- * const locale = extractLocaleFromRequest(request);
793
- *
794
- * @param {Request} request
795
- * @param {ExtractLocaleFromRequestOptions} [options]
796
- * @returns {Locale}
797
- */
798
- export const extractLocaleFromRequest = (request, options = {}) => {
799
- const effectiveRequestUrl = resolveEffectiveRequestUrl(request, options.effectiveRequestUrl);
800
- return extractLocaleFromRequestWithStrategies(request, getStrategyForUrl(effectiveRequestUrl), effectiveRequestUrl);
801
- };
802
- /**
803
- * Extracts a locale from a request using the provided strategy order.
804
- *
805
- * @param {Request} request
806
- * @param {typeof strategy} strategies
807
- * @param {string | URL} [url]
808
- * @returns {Locale}
809
- */
810
- export const extractLocaleFromRequestWithStrategies = (request, strategies, url = request.url) => {
811
- const effectiveRequestUrl = resolveEffectiveRequestUrl(request, url);
812
- /** @type {string|undefined} */
813
- let locale;
814
- for (const strat of strategies) {
815
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
816
- locale = request.headers
817
- .get("cookie")
818
- ?.split("; ")
819
- .find((c) => c.startsWith(cookieName + "="))
820
- ?.split("=")[1];
821
- }
822
- else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url") {
823
- locale = extractLocaleFromUrl(effectiveRequestUrl);
824
- }
825
- else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&
826
- strat === "preferredLanguage") {
827
- locale = extractLocaleFromHeader(request);
828
- }
829
- else if (strat === "globalVariable") {
830
- locale = _locale;
831
- }
832
- else if (strat === "baseLocale") {
833
- return baseLocale;
834
- }
835
- else if (strat === "localStorage") {
836
- continue;
837
- }
838
- else if (isCustomStrategy(strat)) {
839
- // Custom strategies are not supported in sync version
840
- // Use extractLocaleFromRequestAsync for custom server strategies
841
- continue;
842
- }
843
- const matchedLocale = toLocale(locale);
844
- if (matchedLocale) {
845
- return matchedLocale;
846
- }
847
- }
848
- 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://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found");
849
- };
850
- /**
851
- * @param {Request} request
852
- * @param {string | URL | undefined} effectiveRequestUrl
853
- * @returns {URL}
854
- */
855
- function resolveEffectiveRequestUrl(request, effectiveRequestUrl = request.url) {
856
- if (effectiveRequestUrl instanceof URL) {
857
- return new URL(effectiveRequestUrl.href);
858
- }
859
- return new URL(effectiveRequestUrl, request.url);
860
- }
861
-
862
- /**
863
- * Asynchronously extracts a locale from a request.
864
- *
865
- * This function supports async custom server strategies, unlike the synchronous
866
- * `extractLocaleFromRequest`. Use this function when you have custom server strategies
867
- * that need to perform asynchronous operations (like database calls) in their getLocale method.
868
- *
869
- * The function first processes any custom server strategies asynchronously, then falls back
870
- * to the synchronous `extractLocaleFromRequest` for all other strategies.
871
- *
872
- * @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}
873
- *
874
- * @example
875
- * // Basic usage
876
- * const locale = await extractLocaleFromRequestAsync(request);
877
- *
878
- * @example
879
- * // With custom async server strategy
880
- * defineCustomServerStrategy("custom-database", {
881
- * getLocale: async (request) => {
882
- * const userId = extractUserIdFromRequest(request);
883
- * return await getUserLocaleFromDatabase(userId);
884
- * }
885
- * });
886
- *
887
- * const locale = await extractLocaleFromRequestAsync(request);
888
- *
889
- * @param {Request} request - The request object to extract the locale from.
890
- * @param {{ effectiveRequestUrl?: string | URL }} [options] - Effective request URL to use for route matching and locale detection with the URL strategy.
891
- * @returns {Promise<Locale>} The extracted locale.
892
- */
893
- export const extractLocaleFromRequestAsync = async (request, options = {}) => {
894
- /** @type {string|undefined} */
895
- let locale;
896
- const effectiveRequestUrl = resolveEffectiveRequestUrlFromRequestAsync(request, options.effectiveRequestUrl);
897
- const strategy = getStrategyForUrl(effectiveRequestUrl);
898
- // Process custom strategies first, in order
899
- for (const strat of strategy) {
900
- if (isCustomStrategy(strat) && customServerStrategies.has(strat)) {
901
- const handler = customServerStrategies.get(strat);
902
- if (handler) {
903
- /** @type {string|undefined} */
904
- locale = await handler.getLocale(request);
905
- }
906
- // If we got a valid locale from this custom strategy, use it
907
- const matchedLocale = toLocale(locale);
908
- if (matchedLocale) {
909
- return matchedLocale;
910
- }
911
- }
912
- }
913
- // If no custom strategy provided a valid locale, fall back to sync version
914
- return extractLocaleFromRequestWithStrategies(request, strategy, effectiveRequestUrl);
915
- };
916
- /**
917
- * @param {Request} request
918
- * @param {string | URL | undefined} effectiveRequestUrl
919
- * @returns {URL}
920
- */
921
- function resolveEffectiveRequestUrlFromRequestAsync(request, effectiveRequestUrl = request.url) {
922
- if (effectiveRequestUrl instanceof URL) {
923
- return new URL(effectiveRequestUrl.href);
924
- }
925
- return new URL(effectiveRequestUrl, request.url);
926
- }
927
-
928
- /**
929
- * Extracts a cookie from the document.
930
- *
931
- * Will return undefined if the document is not available or if the cookie is not set.
932
- * The `document` object is not available in server-side rendering, so this function should not be called in that context.
933
- *
934
- * @returns {Locale | undefined}
935
- */
936
- export function extractLocaleFromCookie() {
937
- if (typeof document === "undefined" || !document.cookie) {
938
- return;
939
- }
940
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
941
- const locale = match?.[2];
942
- return toLocale(locale);
943
- }
944
-
945
- /**
946
- * Extracts a locale from the accept-language header.
947
- *
948
- * Use the function on the server to extract the locale
949
- * from the accept-language header that is sent by the client.
950
- *
951
- * @example
952
- * const locale = extractLocaleFromHeader(request);
953
- *
954
- * @param {Request} request - The request object to extract the locale from.
955
- * @returns {Locale | undefined} The negotiated preferred language.
956
- */
957
- export function extractLocaleFromHeader(request) {
958
- const acceptLanguageHeader = request.headers.get("accept-language");
959
- if (acceptLanguageHeader) {
960
- // Parse language preferences with their q-values and base language codes
961
- const languages = acceptLanguageHeader
962
- .split(",")
963
- .map((lang) => {
964
- const [tag, q = "1"] = lang.trim().split(";q=");
965
- // Get both the full tag and base language code
966
- const baseTag = tag?.split("-")[0];
967
- return {
968
- fullTag: tag,
969
- baseTag,
970
- q: Number(q),
971
- };
972
- })
973
- .sort((a, b) => b.q - a.q);
974
- for (const lang of languages) {
975
- const fullLocale = toLocale(lang.fullTag);
976
- if (fullLocale) {
977
- return fullLocale;
978
- }
979
- const baseLocale = toLocale(lang.baseTag);
980
- if (baseLocale) {
981
- return baseLocale;
982
- }
983
- }
984
- return undefined;
985
- }
986
- return undefined;
987
- }
988
-
989
- /**
990
- * Negotiates a preferred language from navigator.languages.
991
- *
992
- * Use the function on the client to extract the locale
993
- * from the navigator.languages array.
994
- *
995
- * @example
996
- * const locale = extractLocaleFromNavigator();
997
- *
998
- * @returns {Locale | undefined}
999
- */
1000
- export function extractLocaleFromNavigator() {
1001
- if (!navigator?.languages?.length) {
1002
- return undefined;
1003
- }
1004
- const languages = navigator.languages.map((lang) => ({
1005
- fullTag: lang,
1006
- baseTag: lang.split("-")[0],
1007
- }));
1008
- for (const lang of languages) {
1009
- const fullLocale = toLocale(lang.fullTag);
1010
- if (fullLocale) {
1011
- return fullLocale;
1012
- }
1013
- const baseLocale = toLocale(lang.baseTag);
1014
- if (baseLocale) {
1015
- return baseLocale;
1016
- }
1017
- }
1018
- return undefined;
1019
- }
1020
-
1021
- /**
1022
- * If extractLocaleFromUrl is called many times on the same page and the URL
1023
- * hasn't changed, we don't need to recompute it every time which can get expensive.
1024
- * We might use a LRU cache if needed, but for now storing only the last result is enough.
1025
- * https://github.com/opral/monorepo/pull/3575#discussion_r2066731243
1026
- */
1027
- /** @type {string|undefined} */
1028
- let cachedUrl;
1029
- /** @type {Locale|undefined} */
1030
- let cachedLocale;
1031
- /**
1032
- * Extracts the locale from a given URL using native URLPattern.
1033
- *
1034
- * The built-in default `/:locale/...` routing is case-insensitive because it
1035
- * canonicalizes the first path segment with `toLocale()`. Custom `urlPatterns`
1036
- * keep URLPattern's normal exact matching semantics for path segments.
1037
- *
1038
- * @param {URL|string} url - The full URL from which to extract the locale.
1039
- * @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.
1040
- */
1041
- export function extractLocaleFromUrl(url) {
1042
- const urlString = typeof url === "string" ? url : url.href;
1043
- if (cachedUrl === urlString) {
1044
- return cachedLocale;
1045
- }
1046
- /** @type {Locale | undefined} */
1047
- let result;
1048
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1049
- result = defaultUrlPatternExtractLocale(url);
1050
- }
1051
- else {
1052
- const urlObj = typeof url === "string" ? new URL(url) : url;
1053
- // Iterate over URL patterns
1054
- for (const element of urlPatterns) {
1055
- for (const [locale, localizedPattern] of element.localized) {
1056
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
1057
- if (match) {
1058
- result = locale;
1059
- break;
1060
- }
1061
- }
1062
- if (result)
1063
- break;
1064
- }
1065
- }
1066
- cachedUrl = urlString;
1067
- cachedLocale = result;
1068
- return result;
1069
- }
1070
- /**
1071
- * https://github.com/opral/inlang-paraglide-js/issues/381
1072
- *
1073
- * @param {URL | string} url - The full URL from which to extract the locale.
1074
- * @returns {Locale | undefined} The extracted locale, or undefined if no locale is found.
1075
- */
1076
- function defaultUrlPatternExtractLocale(url) {
1077
- const urlObj = new URL(url, "http://dummy.com");
1078
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
1079
- return toLocale(pathSegments[0]) || baseLocale;
1080
- }
1081
-
1082
- /**
1083
- * Lower-level URL localization function, primarily used in server contexts.
1084
- *
1085
- * This function is designed for server-side usage where you need precise control
1086
- * over URL localization, such as in middleware or request handlers. It works with
1087
- * URL objects and always returns absolute URLs.
1088
- *
1089
- * For client-side UI components, use `localizeHref()` instead, which provides
1090
- * a more convenient API with relative paths and automatic locale detection.
1091
- *
1092
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
1093
- *
1094
- * @example
1095
- * ```typescript
1096
- * // Server middleware example
1097
- * app.use((req, res, next) => {
1098
- * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);
1099
- * const localized = localizeUrl(url, { locale: "de" });
1100
- *
1101
- * if (localized.href !== url.href) {
1102
- * return res.redirect(localized.href);
1103
- * }
1104
- * next();
1105
- * });
1106
- * ```
1107
- *
1108
- * @example
1109
- * ```typescript
1110
- * // Using with URL patterns
1111
- * const url = new URL("https://example.com/about");
1112
- * localizeUrl(url, { locale: "de" });
1113
- * // => URL("https://example.com/de/about")
1114
- *
1115
- * // Using with domain-based localization
1116
- * const url = new URL("https://example.com/store");
1117
- * localizeUrl(url, { locale: "de" });
1118
- * // => URL("https://de.example.com/store")
1119
- * ```
1120
- *
1121
- * @param {string | URL} url - The URL to localize. If string, must be absolute.
1122
- * @param {object} [options] - Options for localization
1123
- * @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()
1124
- * @returns {URL} The localized URL, always absolute
1125
- */
1126
- export function localizeUrl(url, options) {
1127
- const targetLocale = options?.locale
1128
- ? assertIsLocale(options?.locale)
1129
- : getLocale();
1130
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1131
- return localizeUrlDefaultPattern(url, targetLocale);
1132
- }
1133
- const urlObj = typeof url === "string" ? new URL(url) : url;
1134
- // Iterate over URL patterns
1135
- for (const element of urlPatterns) {
1136
- // match localized patterns
1137
- for (const [, localizedPattern] of element.localized) {
1138
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
1139
- if (!match) {
1140
- continue;
1141
- }
1142
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
1143
- if (!targetPattern) {
1144
- continue;
1145
- }
1146
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
1147
- return fillMissingUrlParts(localizedUrl, match);
1148
- }
1149
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
1150
- if (unlocalizedMatch) {
1151
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
1152
- if (targetPattern) {
1153
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
1154
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
1155
- }
1156
- }
1157
- }
1158
- // If no match found, return the original URL
1159
- return urlObj;
1160
- }
1161
- /**
1162
- * https://github.com/opral/inlang-paraglide-js/issues/381
1163
- *
1164
- * @param {string | URL} url
1165
- * @param {Locale} locale
1166
- * @returns {URL}
1167
- */
1168
- function localizeUrlDefaultPattern(url, locale) {
1169
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
1170
- const currentLocale = extractLocaleFromUrl(urlObj);
1171
- // If current locale matches target locale, no change needed
1172
- if (currentLocale === locale) {
1173
- return urlObj;
1174
- }
1175
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
1176
- // If current path starts with a locale, remove it
1177
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
1178
- pathSegments.shift();
1179
- }
1180
- // For base locale, don't add prefix
1181
- if (locale === baseLocale) {
1182
- urlObj.pathname = "/" + pathSegments.join("/");
1183
- }
1184
- else {
1185
- // For other locales, add prefix
1186
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
1187
- }
1188
- return urlObj;
1189
- }
1190
- /**
1191
- * Low-level URL de-localization function, primarily used in server contexts.
1192
- *
1193
- * This function is designed for server-side usage where you need precise control
1194
- * over URL de-localization, such as in middleware or request handlers. It works with
1195
- * URL objects and always returns absolute URLs.
1196
- *
1197
- * For client-side UI components, use `deLocalizeHref()` instead, which provides
1198
- * a more convenient API with relative paths.
1199
- *
1200
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
1201
- *
1202
- * @example
1203
- * ```typescript
1204
- * // Server middleware example
1205
- * app.use((req, res, next) => {
1206
- * const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);
1207
- * const baseUrl = deLocalizeUrl(url);
1208
- *
1209
- * // Store the base URL for later use
1210
- * req.baseUrl = baseUrl;
1211
- * next();
1212
- * });
1213
- * ```
1214
- *
1215
- * @example
1216
- * ```typescript
1217
- * // Using with URL patterns
1218
- * const url = new URL("https://example.com/de/about");
1219
- * deLocalizeUrl(url); // => URL("https://example.com/about")
1220
- *
1221
- * // Using with domain-based localization
1222
- * const url = new URL("https://de.example.com/store");
1223
- * deLocalizeUrl(url); // => URL("https://example.com/store")
1224
- * ```
1225
- *
1226
- * @param {string | URL} url - The URL to de-localize. If string, must be absolute.
1227
- * @returns {URL} The de-localized URL, always absolute
1228
- */
1229
- export function deLocalizeUrl(url) {
1230
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1231
- return deLocalizeUrlDefaultPattern(url);
1232
- }
1233
- const urlObj = typeof url === "string" ? new URL(url) : url;
1234
- // Iterate over URL patterns
1235
- for (const element of urlPatterns) {
1236
- // Iterate over localized versions
1237
- for (const [, localizedPattern] of element.localized) {
1238
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
1239
- if (match) {
1240
- // Convert localized URL back to the base pattern
1241
- const groups = aggregateGroups(match);
1242
- const baseUrl = fillPattern(element.pattern, groups, urlObj.origin);
1243
- return fillMissingUrlParts(baseUrl, match);
1244
- }
1245
- }
1246
- // match unlocalized pattern
1247
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
1248
- if (unlocalizedMatch) {
1249
- const baseUrl = fillPattern(element.pattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
1250
- return fillMissingUrlParts(baseUrl, unlocalizedMatch);
1251
- }
1252
- }
1253
- // no match found return the original url
1254
- return urlObj;
1255
- }
1256
- /**
1257
- * De-localizes a URL using the default pattern (/:locale/*)
1258
- * @param {string|URL} url
1259
- * @returns {URL}
1260
- */
1261
- function deLocalizeUrlDefaultPattern(url) {
1262
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
1263
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
1264
- // If first segment is a locale, remove it
1265
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
1266
- urlObj.pathname = "/" + pathSegments.slice(1).join("/");
1267
- }
1268
- return urlObj;
1269
- }
1270
- /**
1271
- * Takes matches of implicit wildcards in the UrlPattern (when a part is missing
1272
- * it is equal to '*') and adds them back to the result of fillPattern.
1273
- *
1274
- * At least protocol and hostname are required to create a valid URL inside fillPattern.
1275
- *
1276
- * @param {URL} url
1277
- * @param {any} match
1278
- * @returns {URL}
1279
- */
1280
- function fillMissingUrlParts(url, match) {
1281
- if (match.protocol.groups["0"]) {
1282
- url.protocol = match.protocol.groups["0"] ?? "";
1283
- }
1284
- if (match.hostname.groups["0"]) {
1285
- url.hostname = match.hostname.groups["0"] ?? "";
1286
- }
1287
- if (match.username.groups["0"]) {
1288
- url.username = match.username.groups["0"] ?? "";
1289
- }
1290
- if (match.password.groups["0"]) {
1291
- url.password = match.password.groups["0"] ?? "";
1292
- }
1293
- if (match.port.groups["0"]) {
1294
- url.port = match.port.groups["0"] ?? "";
1295
- }
1296
- if (match.pathname.groups["0"]) {
1297
- url.pathname = match.pathname.groups["0"] ?? "";
1298
- }
1299
- if (match.search.groups["0"]) {
1300
- url.search = match.search.groups["0"] ?? "";
1301
- }
1302
- if (match.hash.groups["0"]) {
1303
- url.hash = match.hash.groups["0"] ?? "";
1304
- }
1305
- return url;
1306
- }
1307
- /**
1308
- * Fills a URL pattern with values for named groups, supporting all URLPattern-style modifiers.
1309
- *
1310
- * This function will eventually be replaced by https://github.com/whatwg/urlpattern/issues/73
1311
- *
1312
- * Matches:
1313
- * - :name -> Simple
1314
- * - :name? -> Optional
1315
- * - :name+ -> One or more
1316
- * - :name* -> Zero or more
1317
- * - :name(...) -> Regex group
1318
- * - {text} -> Group delimiter
1319
- * - {text}? -> Optional group delimiter
1320
- *
1321
- * If the value is `null`, the segment is removed.
1322
- *
1323
- * @param {string} pattern - The URL pattern containing named groups.
1324
- * @param {Record<string, string | null | undefined>} values - Object of values for named groups.
1325
- * @param {string} origin - Base URL to use for URL construction.
1326
- * @returns {URL} - The constructed URL with named groups filled.
1327
- */
1328
- function fillPattern(pattern, values, origin) {
1329
- // Pre-process the pattern to handle explicit port numbers
1330
- // This detects patterns like "http://localhost:5173" and protects the port number
1331
- // from being interpreted as a parameter
1332
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
1333
- // Replace ":5173" with "#PORT-5173#" to protect it from parameter replacement
1334
- return `${protocol}#PORT-${port}#${slash}`;
1335
- });
1336
- // First, handle group delimiters with curly braces
1337
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
1338
- // For optional group delimiters
1339
- if (modifier === "?") {
1340
- // For optional groups, we'll include the content
1341
- return content;
1342
- }
1343
- // For non-optional group delimiters, always include the content
1344
- return content;
1345
- });
1346
- // Then handle named groups
1347
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
1348
- const value = values[name];
1349
- if (value === null) {
1350
- // If value is null, remove the entire segment including the preceding slash
1351
- return "";
1352
- }
1353
- if (modifier === "?") {
1354
- // Optional segment
1355
- return value !== undefined ? `${slash}${value}` : "";
1356
- }
1357
- if (modifier === "+" || modifier === "*") {
1358
- // Repeatable segments
1359
- if (value === undefined && modifier === "+") {
1360
- throw new Error(`Missing value for "${name}" (one or more required)`);
1361
- }
1362
- return value ? `${slash}${value}` : "";
1363
- }
1364
- // Simple named group (no modifier)
1365
- if (value === undefined) {
1366
- throw new Error(`Missing value for "${name}"`);
1367
- }
1368
- return `${slash}${value}`;
1369
- });
1370
- // Restore port numbers
1371
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
1372
- return new URL(filled, origin);
1373
- }
1374
- /**
1375
- * Aggregates named groups from various parts of the URLPattern match result.
1376
- *
1377
- *
1378
- * @param {any} match - The URLPattern match result object.
1379
- * @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
1380
- */
1381
- export function aggregateGroups(match) {
1382
- return {
1383
- ...match.hash.groups,
1384
- ...match.hostname.groups,
1385
- ...match.password.groups,
1386
- ...match.pathname.groups,
1387
- ...match.port.groups,
1388
- ...match.protocol.groups,
1389
- ...match.search.groups,
1390
- ...match.username.groups,
1391
- };
1392
- }
1393
-
1394
- /**
1395
- * @typedef {object} ShouldRedirectServerInput
1396
- * @property {Request} request
1397
- * @property {string | URL} [effectiveRequestUrl] - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
1398
- * @property {Locale} [locale]
1399
- *
1400
- * @typedef {object} ShouldRedirectClientInput
1401
- * @property {undefined} [request]
1402
- * @property {string | URL} [url]
1403
- * @property {Locale} [locale]
1404
- *
1405
- * @typedef {ShouldRedirectServerInput | ShouldRedirectClientInput} ShouldRedirectInput
1406
- *
1407
- * @typedef {object} ShouldRedirectResult
1408
- * @property {boolean} shouldRedirect - Indicates whether the consumer should perform a redirect.
1409
- * @property {Locale} locale - Locale resolved using the configured strategies.
1410
- * @property {URL | undefined} redirectUrl - Destination URL when a redirect is required.
1411
- */
1412
- /**
1413
- * Determines whether a redirect is required to align the current URL with the active locale.
1414
- *
1415
- * This helper mirrors the logic that powers `paraglideMiddleware`, but works in both server
1416
- * and client environments. It evaluates the configured strategies in order, computes the
1417
- * canonical localized URL, and reports when the current URL does not match.
1418
- *
1419
- * When called in the browser without arguments, the current `window.location.href` is used.
1420
- *
1421
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing#client-side-redirects
1422
- *
1423
- * @example
1424
- * // Client side usage (e.g. TanStack Router beforeLoad hook)
1425
- * async function beforeLoad({ location }) {
1426
- * const decision = await shouldRedirect({ url: location.href });
1427
- *
1428
- * if (decision.shouldRedirect) {
1429
- * throw redirect({ to: decision.redirectUrl.href });
1430
- * }
1431
- * }
1432
- *
1433
- * @example
1434
- * // Server side usage with a Request
1435
- * export async function handle(request) {
1436
- * const decision = await shouldRedirect({ request });
1437
- *
1438
- * if (decision.shouldRedirect) {
1439
- * return Response.redirect(decision.redirectUrl, 307);
1440
- * }
1441
- *
1442
- * return render(request, decision.locale);
1443
- * }
1444
- *
1445
- * @example
1446
- * // Server side usage behind a proxy where request.url is not public-facing
1447
- * export async function handle(request) {
1448
- * const effectiveRequestUrl = new URL(request.url);
1449
- * effectiveRequestUrl.protocol = "https:";
1450
- * effectiveRequestUrl.host = "example.com";
1451
- *
1452
- * const decision = await shouldRedirect({
1453
- * request,
1454
- * effectiveRequestUrl,
1455
- * });
1456
- *
1457
- * if (decision.shouldRedirect) {
1458
- * return Response.redirect(decision.redirectUrl, 307);
1459
- * }
1460
- * }
1461
- *
1462
- * @param {ShouldRedirectInput} [input]
1463
- * @returns {Promise<ShouldRedirectResult>}
1464
- */
1465
- export async function shouldRedirect(input = {}) {
1466
- const currentUrl = resolveUrl(input);
1467
- const locale = await resolveLocale(input, currentUrl);
1468
- const strategy = getStrategyForUrl(currentUrl.href);
1469
- if (isExcludedByRouteStrategy(currentUrl.href) || !strategy.includes("url")) {
1470
- return { shouldRedirect: false, locale, redirectUrl: undefined };
1471
- }
1472
- const localizedUrl = localizeUrl(currentUrl.href, { locale });
1473
- const shouldRedirectToLocalizedUrl = normalizeUrl(localizedUrl.href) !== normalizeUrl(currentUrl.href);
1474
- return {
1475
- shouldRedirect: shouldRedirectToLocalizedUrl,
1476
- locale,
1477
- redirectUrl: shouldRedirectToLocalizedUrl ? localizedUrl : undefined,
1478
- };
1479
- }
1480
- /**
1481
- * Resolves the locale either from the provided input or by using the configured strategies.
1482
- *
1483
- * @param {ShouldRedirectInput} input
1484
- * @param {URL} currentUrl
1485
- * @returns {Promise<Locale>}
1486
- */
1487
- async function resolveLocale(input, currentUrl) {
1488
- const locale = toLocale(input.locale);
1489
- if (locale) {
1490
- return locale;
1491
- }
1492
- if (input.request) {
1493
- return extractLocaleFromRequestAsync(input.request, {
1494
- effectiveRequestUrl: currentUrl,
1495
- });
1496
- }
1497
- if ("url" in input && typeof input.url !== "undefined") {
1498
- return getLocaleForUrl(currentUrl.href);
1499
- }
1500
- return getLocale();
1501
- }
1502
- /**
1503
- * Resolves the current URL from the provided input or runtime context.
1504
- *
1505
- * @param {ShouldRedirectInput} input
1506
- * @returns {URL}
1507
- */
1508
- function resolveUrl(input) {
1509
- if ("effectiveRequestUrl" in input && input.effectiveRequestUrl instanceof URL) {
1510
- return new URL(input.effectiveRequestUrl.href);
1511
- }
1512
- if ("effectiveRequestUrl" in input && typeof input.effectiveRequestUrl === "string") {
1513
- return new URL(input.effectiveRequestUrl, input.request ? input.request.url : getUrlOrigin());
1514
- }
1515
- if (input.request) {
1516
- return new URL(input.request.url);
1517
- }
1518
- if ("url" in input && input.url instanceof URL) {
1519
- return new URL(input.url.href);
1520
- }
1521
- if ("url" in input && typeof input.url === "string") {
1522
- return new URL(input.url, getUrlOrigin());
1523
- }
1524
- if (typeof window !== "undefined" && window?.location?.href) {
1525
- return new URL(window.location.href);
1526
- }
1527
- throw new Error("shouldRedirect() requires either a request, an absolute URL, or must run in a browser environment.");
1528
- }
1529
- /**
1530
- * Normalize url for comparison by stripping the trailing slash.
1531
- *
1532
- * @param {string} url
1533
- * @returns {string}
1534
- */
1535
- function normalizeUrl(url) {
1536
- const urlObj = new URL(url);
1537
- urlObj.pathname = urlObj.pathname.replace(/\/$/, "");
1538
- return urlObj.href;
1539
- }
1540
-
1541
- /**
1542
- * High-level URL localization function optimized for client-side UI usage.
1543
- *
1544
- * This is a convenience wrapper around `localizeUrl()` that provides features
1545
- * needed in UI:
1546
- *
1547
- * - Accepts relative paths (e.g., "/about")
1548
- * - Returns relative paths when possible
1549
- * - Automatically detects current locale if not specified
1550
- * - Handles string input/output instead of URL objects
1551
- *
1552
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
1553
- *
1554
- * @example
1555
- * ```typescript
1556
- * // In a React/Vue/Svelte component
1557
- * const NavLink = ({ href }) => {
1558
- * // Automatically uses current locale, keeps path relative
1559
- * return <a href={localizeHref(href)}>...</a>;
1560
- * };
1561
- *
1562
- * // Examples:
1563
- * localizeHref("/about")
1564
- * // => "/de/about" (if current locale is "de")
1565
- * localizeHref("/store", { locale: "fr" })
1566
- * // => "/fr/store" (explicit locale)
1567
- *
1568
- * // Cross-origin links remain absolute
1569
- * localizeHref("https://other-site.com/about")
1570
- * // => "https://other-site.com/de/about"
1571
- * ```
1572
- *
1573
- * For server-side URL localization (e.g., in middleware), use `localizeUrl()`
1574
- * which provides more precise control over URL handling.
1575
- *
1576
- * @param {string} href - The href to localize (can be relative or absolute)
1577
- * @param {object} [options] - Options for localization
1578
- * @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()`
1579
- * @returns {string} The localized href, relative if input was relative
1580
- */
1581
- export function localizeHref(href, options) {
1582
- const currentLocale = getLocale();
1583
- const locale = options?.locale ?? currentLocale;
1584
- const url = new URL(href, getUrlOrigin());
1585
- const localized = localizeUrl(url, { locale });
1586
- // if the origin is identical and the href is relative,
1587
- // return the relative path
1588
- if (href.startsWith("/") && url.origin === localized.origin) {
1589
- // check for cross origin localization in which case an absolute URL must be returned.
1590
- if (locale !== currentLocale) {
1591
- const localizedCurrentLocale = localizeUrl(url, {
1592
- locale: currentLocale,
1593
- });
1594
- if (localizedCurrentLocale.origin !== localized.origin) {
1595
- return localized.href;
1596
- }
1597
- }
1598
- return localized.pathname + localized.search + localized.hash;
1599
- }
1600
- return localized.href;
1601
- }
1602
- /**
1603
- * High-level URL de-localization function optimized for client-side UI usage.
1604
- *
1605
- * This is a convenience wrapper around `deLocalizeUrl()` that provides features
1606
- * needed in the UI:
1607
- *
1608
- * - Accepts relative paths (e.g., "/de/about")
1609
- * - Returns relative paths when possible
1610
- * - Handles string input/output instead of URL objects
1611
- *
1612
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
1613
- *
1614
- * @example
1615
- * ```typescript
1616
- * // In a React/Vue/Svelte component
1617
- * const LocaleSwitcher = ({ href }) => {
1618
- * // Remove locale prefix before switching
1619
- * const baseHref = deLocalizeHref(href);
1620
- * return locales.map(locale =>
1621
- * <a href={localizeHref(baseHref, { locale })}>
1622
- * Switch to {locale}
1623
- * </a>
1624
- * );
1625
- * };
1626
- *
1627
- * // Examples:
1628
- * deLocalizeHref("/de/about") // => "/about"
1629
- * deLocalizeHref("/fr/store") // => "/store"
1630
- *
1631
- * // Cross-origin links remain absolute
1632
- * deLocalizeHref("https://example.com/de/about")
1633
- * // => "https://example.com/about"
1634
- * ```
1635
- *
1636
- * For server-side URL de-localization (e.g., in middleware), use `deLocalizeUrl()`
1637
- * which provides more precise control over URL handling.
1638
- *
1639
- * @param {string} href - The href to de-localize (can be relative or absolute)
1640
- * @returns {string} The de-localized href, relative if input was relative
1641
- */
1642
- export function deLocalizeHref(href) {
1643
- const url = new URL(href, getUrlOrigin());
1644
- const deLocalized = deLocalizeUrl(url);
1645
- // If the origin is identical and the href is relative,
1646
- // return the relative path instead of the full URL.
1647
- if (href.startsWith("/") && url.origin === deLocalized.origin) {
1648
- return deLocalized.pathname + deLocalized.search + deLocalized.hash;
1649
- }
1650
- return deLocalized.href;
1651
- }
1652
-
1653
- /**
1654
- * @param {string} safeModuleId
1655
- * @param {Locale} locale
1656
- */
1657
- export function trackMessageCall(safeModuleId, locale) {
1658
- if (isServer === false)
1659
- return;
1660
- const store = serverAsyncLocalStorage?.getStore();
1661
- if (store) {
1662
- store.messageCalls?.add(`${safeModuleId}:${locale}`);
1663
- }
1664
- }
1665
-
1666
- /**
1667
- * Generates localized URL variants for all provided URLs based on your configured locales and URL patterns.
1668
- *
1669
- * This function is essential for Static Site Generation (SSG) where you need to tell your framework
1670
- * which pages to pre-render at build time. It's also useful for generating sitemaps and
1671
- * `<link rel="alternate" hreflang>` tags for SEO.
1672
- *
1673
- * The function respects your `urlPatterns` configuration - if you have translated pathnames
1674
- * (e.g., `/about` → `/ueber-uns` for German), it will generate the correct localized paths.
1675
- *
1676
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/static-site-generation
1677
- *
1678
- * @example
1679
- * // Basic usage - generate all locale variants for a list of paths
1680
- * const localizedUrls = generateStaticLocalizedUrls([
1681
- * "/",
1682
- * "/about",
1683
- * "/blog/post-1",
1684
- * ]);
1685
- * // Returns URL objects for each locale:
1686
- * // ["/en/", "/de/", "/en/about", "/de/about", "/en/blog/post-1", "/de/blog/post-1"]
1687
- *
1688
- * @example
1689
- * // Use with framework SSG APIs
1690
- * // SvelteKit
1691
- * export function entries() {
1692
- * const paths = ["/", "/about", "/contact"];
1693
- * return generateStaticLocalizedUrls(paths).map(url => ({
1694
- * locale: extractLocaleFromUrl(url)
1695
- * }));
1696
- * }
1697
- *
1698
- * @example
1699
- * // Sitemap generation
1700
- * const allPages = ["/", "/about", "/blog"];
1701
- * const sitemapUrls = generateStaticLocalizedUrls(allPages);
1702
- *
1703
- * @param {(string | URL)[]} urls - List of canonical URLs or paths to generate localized versions for.
1704
- * Can be absolute URLs (`https://example.com/about`) or paths (`/about`).
1705
- * Paths are resolved against `http://localhost` internally.
1706
- * @returns {URL[]} Array of URL objects representing all localized variants.
1707
- * The order follows each input URL with all its locale variants before moving to the next URL.
1708
- */
1709
- export function generateStaticLocalizedUrls(urls) {
1710
- /** @type {Set<URL>} */
1711
- const localizedUrls = new Set();
1712
- // For default URL pattern, we can optimize the generation
1713
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
1714
- for (const urlInput of urls) {
1715
- const url = urlInput instanceof URL
1716
- ? urlInput
1717
- : new URL(urlInput, "http://localhost");
1718
- // Base locale doesn't get a prefix
1719
- localizedUrls.add(url);
1720
- // Other locales get their code as prefix
1721
- for (const locale of locales) {
1722
- if (locale !== baseLocale) {
1723
- const localizedPath = `/${locale}${url.pathname}${url.search}${url.hash}`;
1724
- const localizedUrl = new URL(localizedPath, url.origin);
1725
- localizedUrls.add(localizedUrl);
1726
- }
1727
- }
1728
- }
1729
- return Array.from(localizedUrls);
1730
- }
1731
- // For custom URL patterns, we need to use localizeUrl for each URL and locale
1732
- for (const urlInput of urls) {
1733
- const url = urlInput instanceof URL
1734
- ? urlInput
1735
- : new URL(urlInput, "http://localhost");
1736
- // Try each URL pattern to find one that matches
1737
- let patternFound = false;
1738
- for (const pattern of urlPatterns) {
1739
- try {
1740
- // Try to match the unlocalized pattern
1741
- const unlocalizedMatch = new URLPattern(pattern.pattern, url.href).exec(url.href);
1742
- if (!unlocalizedMatch)
1743
- continue;
1744
- patternFound = true;
1745
- // Track unique localized URLs to avoid duplicates when patterns are the same
1746
- const seenUrls = new Set();
1747
- // Generate localized URL for each locale
1748
- for (const [locale] of pattern.localized) {
1749
- try {
1750
- const localizedUrl = localizeUrl(url, { locale });
1751
- const urlString = localizedUrl.href;
1752
- // Only add if we haven't seen this exact URL before
1753
- if (!seenUrls.has(urlString)) {
1754
- seenUrls.add(urlString);
1755
- localizedUrls.add(localizedUrl);
1756
- }
1757
- }
1758
- catch {
1759
- // Skip if localization fails for this locale
1760
- continue;
1761
- }
1762
- }
1763
- break;
1764
- }
1765
- catch {
1766
- // Skip if pattern matching fails
1767
- continue;
1768
- }
1769
- }
1770
- // If no pattern matched, use the URL as is
1771
- if (!patternFound) {
1772
- localizedUrls.add(url);
1773
- }
1774
- }
1775
- return Array.from(localizedUrls);
1776
- }
1777
-
1778
- /**
1779
- * @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
1780
- */
1781
- /**
1782
- * @typedef {`custom_${string}`} CustomStrategy
1783
- */
1784
- /**
1785
- * @typedef {BuiltInStrategy | CustomStrategy} Strategy
1786
- */
1787
- /**
1788
- * @typedef {Array<Strategy>} Strategies
1789
- */
1790
- /**
1791
- * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler
1792
- */
1793
- /**
1794
- * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
1795
- */
1796
- /** @type {Map<string, CustomServerStrategyHandler>} */
1797
- export const customServerStrategies = new Map();
1798
- /** @type {Map<string, CustomClientStrategyHandler>} */
1799
- export const customClientStrategies = new Map();
1800
- /**
1801
- * Checks if the given strategy is a custom strategy.
1802
- *
1803
- * @param {unknown} strategy The name of the custom strategy to validate.
1804
- * Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
1805
- * @returns {boolean} Returns true if it is a custom strategy, false otherwise.
1806
- */
1807
- export function isCustomStrategy(strategy) {
1808
- return (typeof strategy === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy));
1809
- }
1810
- /**
1811
- * Defines a custom strategy that is executed on the server.
1812
- *
1813
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
1814
- *
1815
- * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
1816
- * @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement
1817
- * the method getLocale.
1818
- * @returns {void}
1819
- */
1820
- export function defineCustomServerStrategy(strategy, handler) {
1821
- if (!isCustomStrategy(strategy)) {
1822
- throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
1823
- }
1824
- customServerStrategies.set(strategy, handler);
1825
- }
1826
- /**
1827
- * Defines a custom strategy that is executed on the client.
1828
- *
1829
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
1830
- *
1831
- * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
1832
- * @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the
1833
- * methods getLocale and setLocale.
1834
- * @returns {void}
1835
- */
1836
- export function defineCustomClientStrategy(strategy, handler) {
1837
- if (!isCustomStrategy(strategy)) {
1838
- throw new Error(`Invalid custom strategy: "${strategy}". Must be a custom strategy following the pattern custom-name.`);
1839
- }
1840
- customClientStrategies.set(strategy, handler);
1841
- }
1842
-
1843
- // ------ TYPES ------
1844
- export {};
1845
- /**
1846
- * A locale that is available in the project.
1847
- *
1848
- * @example
1849
- * setLocale(request.locale as Locale)
1850
- *
1851
- * @typedef {typeof locales[number]} Locale
1852
- */
1853
- /**
1854
- * A branded type representing a localized string.
1855
- *
1856
- * Message functions return this type instead of \`string\`, enabling TypeScript
1857
- * to distinguish translated strings from regular strings at compile time.
1858
- * This allows you to enforce that only properly localized content is used
1859
- * in your UI components.
1860
- *
1861
- * Since \`LocalizedString\` is a branded subtype of \`string\`, it remains fully
1862
- * backward compatible—you can pass it anywhere a \`string\` is expected.
1863
- *
1864
- * @example
1865
- * // Enforce localized strings in your components
1866
- * function PageTitle(props: { title: LocalizedString }) {
1867
- * return <h1>{props.title}</h1>
1868
- * }
1869
- *
1870
- * // ✅ Correct: using a message function
1871
- * <PageTitle title={m.welcome_title()} />
1872
- *
1873
- * // ❌ Type error: raw strings are not LocalizedString
1874
- * <PageTitle title="Welcome" />
1875
- *
1876
- * @example
1877
- * // LocalizedString is assignable to string (backward compatible)
1878
- * const localized: LocalizedString = m.greeting()
1879
- * const str: string = localized // ✅ works fine
1880
- *
1881
- * // But string is not assignable to LocalizedString
1882
- * const raw: LocalizedString = "Hello" // ❌ Type error
1883
- *
1884
- * @example
1885
- * // Catches accidental string concatenation
1886
- * function showMessage(msg: LocalizedString) { ... }
1887
- *
1888
- * showMessage(m.hello()) // ✅
1889
- * showMessage("Hello " + userName) // ❌ Type error
1890
- * showMessage(m.hello_user({ name: userName })) // ✅ use params instead
1891
- *
1892
- * @typedef {string & { readonly __brand: 'LocalizedString' }} LocalizedString
1893
- */
1894
- /**
1895
- * A single markup option passed to a tag instance.
1896
- *
1897
- * @typedef {{
1898
- * name: string;
1899
- * value: unknown;
1900
- * }} MessageMarkupOption
1901
- */
1902
- /**
1903
- * A single static markup attribute attached to a tag instance.
1904
- *
1905
- * @typedef {{
1906
- * name: string;
1907
- * value: string | true;
1908
- * }} MessageMarkupAttribute
1909
- */
1910
- /**
1911
- * Record of markup options for a tag instance.
1912
- *
1913
- * @typedef {Record<string, unknown>} MessageMarkupOptions
1914
- */
1915
- /**
1916
- * Record of markup attributes for a tag instance.
1917
- *
1918
- * @typedef {Record<string, string | true>} MessageMarkupAttributes
1919
- */
1920
- /**
1921
- * Type-level schema for a single markup tag.
1922
- *
1923
- * @typedef {{
1924
- * options: MessageMarkupOptions;
1925
- * attributes: MessageMarkupAttributes;
1926
- * children: boolean;
1927
- * }} MessageMarkupTag
1928
- */
1929
- /**
1930
- * Type-level schema for all markup tags in a message.
1931
- *
1932
- * @typedef {Record<string, MessageMarkupTag>} MessageMarkupSchema
1933
- */
1934
- /**
1935
- * Type-only metadata attached to compiled message functions.
1936
- *
1937
- * @template Inputs
1938
- * @template Options
1939
- * @template {MessageMarkupSchema} [Markup = MessageMarkupSchema]
1940
- * @typedef {{
1941
- * readonly __paraglide?: {
1942
- * inputs: Inputs;
1943
- * options: Options;
1944
- * markup: Markup;
1945
- * };
1946
- * }} MessageMetadata
1947
- */
1948
- /**
1949
- * A compiled, framework-neutral message part.
1950
- *
1951
- * @typedef {{
1952
- * type: "text";
1953
- * value: string;
1954
- * } | {
1955
- * type: "markup-start";
1956
- * name: string;
1957
- * options: MessageMarkupOptions;
1958
- * attributes: MessageMarkupAttributes;
1959
- * } | {
1960
- * type: "markup-end";
1961
- * name: string;
1962
- * options: MessageMarkupOptions;
1963
- * attributes: MessageMarkupAttributes;
1964
- * } | {
1965
- * type: "markup-standalone";
1966
- * name: string;
1967
- * options: MessageMarkupOptions;
1968
- * attributes: MessageMarkupAttributes;
1969
- * }} MessagePart
1970
- */
1971
- /**
1972
- * A message function is a message for a specific locale.
1973
- *
1974
- * @example
1975
- * m.hello({ name: 'world' })
1976
- *
1977
- * @typedef {(inputs?: Record<string, never>) => LocalizedString} MessageFunction
1978
- */
1979
- /**
1980
- * A message bundle function that selects the message to be returned.
1981
- *
1982
- * Uses `getLocale()` under the hood to determine the locale with an option.
1983
- *
1984
- * @template {string} T
1985
- *
1986
- * @example
1987
- * * m.hello({ name: 'world' }, { locale: "en" })
1988
- *
1989
- * @typedef {(params: Record<string, never>, options: { locale: T }) => LocalizedString} MessageBundleFunction
1990
- */