@salla.sa/twilight-theme-engine 1.0.109 → 1.0.111

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 (309) hide show
  1. package/dist/{AddToCartForm-ZIZKGYJR.js → AddToCartForm-LQUGORMR.js} +3 -3
  2. package/dist/{AddToCartForm-ZIZKGYJR.js.map → AddToCartForm-LQUGORMR.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-GLAYDKIX.js → BlogAuthorPage-CNZRXDPQ.js} +27 -26
  4. package/dist/BlogAuthorPage-CNZRXDPQ.js.map +1 -0
  5. package/dist/{BlogCategoryPage-KPU6LYHK.js → BlogCategoryPage-MO5XBW4Z.js} +27 -26
  6. package/dist/BlogCategoryPage-MO5XBW4Z.js.map +1 -0
  7. package/dist/{BlogPage-VDDHOD33.js → BlogPage-EJZRH3YO.js} +25 -24
  8. package/dist/BlogPage-EJZRH3YO.js.map +1 -0
  9. package/dist/{BlogSinglePage-UWP5MFAS.js → BlogSinglePage-LO6O2MFG.js} +25 -24
  10. package/dist/BlogSinglePage-LO6O2MFG.js.map +1 -0
  11. package/dist/{BlogTagPage-V3Z4AD4C.js → BlogTagPage-HL6HTJ4I.js} +27 -26
  12. package/dist/BlogTagPage-HL6HTJ4I.js.map +1 -0
  13. package/dist/{BrandsPage-ARYKHCTB.js → BrandsPage-T6APSLYK.js} +26 -25
  14. package/dist/BrandsPage-T6APSLYK.js.map +1 -0
  15. package/dist/{Breadcrumb-XT2MP2ZW.js → Breadcrumb-W7JBOHPB.js} +25 -24
  16. package/dist/Breadcrumb-W7JBOHPB.js.map +1 -0
  17. package/dist/{CartItem-4VXVOKVF.js → CartItem-UELEXBHU.js} +25 -24
  18. package/dist/CartItem-UELEXBHU.js.map +1 -0
  19. package/dist/{CartSummary-K23PGOUL.js → CartSummary-6L6TXZOF.js} +25 -24
  20. package/dist/CartSummary-6L6TXZOF.js.map +1 -0
  21. package/dist/{Copyright-KBCQVD5Y.js → Copyright-YAIOATPE.js} +3 -3
  22. package/dist/{Copyright-KBCQVD5Y.js.map → Copyright-YAIOATPE.js.map} +1 -1
  23. package/dist/{CustomerLayout-B77ZKB4X.js → CustomerLayout-4XKCLHWW.js} +25 -24
  24. package/dist/CustomerLayout-4XKCLHWW.js.map +1 -0
  25. package/dist/{Footer-L52M4T24.js → Footer-UHLNZNUZ.js} +5 -4
  26. package/dist/{Footer-L52M4T24.js.map → Footer-UHLNZNUZ.js.map} +1 -1
  27. package/dist/Header-M3Q7KDF5.js +22 -0
  28. package/dist/{Header-QOAV23HD.js.map → Header-M3Q7KDF5.js.map} +1 -1
  29. package/dist/{LoyaltyPage-3OIZG2ZJ.js → LoyaltyPage-MUEAIXZJ.js} +25 -24
  30. package/dist/LoyaltyPage-MUEAIXZJ.js.map +1 -0
  31. package/dist/{LoyaltyPointsPage-I3O3JA7Q.js → LoyaltyPointsPage-GECERR3Q.js} +9 -8
  32. package/dist/LoyaltyPointsPage-GECERR3Q.js.map +1 -0
  33. package/dist/{MainMenu-VIDYUQNX.js → MainMenu-ZQLKN43L.js} +7 -7
  34. package/dist/{MainMenu-VIDYUQNX.js.map → MainMenu-ZQLKN43L.js.map} +1 -1
  35. package/dist/{MasterLayout-FY666JMR.js → MasterLayout-KVMF2U5Z.js} +25 -24
  36. package/dist/{MasterLayout-FY666JMR.js.map → MasterLayout-KVMF2U5Z.js.map} +1 -1
  37. package/dist/{MobileMenu-3ILQKCHA.js → MobileMenu-GPVASHD2.js} +26 -25
  38. package/dist/MobileMenu-GPVASHD2.js.map +1 -0
  39. package/dist/{NotificationsPage-EYTBUS36.js → NotificationsPage-5GQIDZH4.js} +25 -24
  40. package/dist/NotificationsPage-5GQIDZH4.js.map +1 -0
  41. package/dist/{OrderSinglePage-YHA5D2ZI.js → OrderSinglePage-6BCHQ3YG.js} +26 -25
  42. package/dist/OrderSinglePage-6BCHQ3YG.js.map +1 -0
  43. package/dist/{OrdersPage-4A2QINDX.js → OrdersPage-BPKE45CP.js} +25 -24
  44. package/dist/OrdersPage-BPKE45CP.js.map +1 -0
  45. package/dist/{PageSingle-ED24MS2Z.js → PageSingle-7BM4FJBH.js} +6 -6
  46. package/dist/{PageSingle-ED24MS2Z.js.map → PageSingle-7BM4FJBH.js.map} +1 -1
  47. package/dist/{ProductDetails-ZA5A66JW.js → ProductDetails-L65HAYDG.js} +7 -7
  48. package/dist/{ProductDetails-ZA5A66JW.js.map → ProductDetails-L65HAYDG.js.map} +1 -1
  49. package/dist/{ProfilePage-ZTYHIDGE.js → ProfilePage-IYGXRJQJ.js} +25 -24
  50. package/dist/ProfilePage-IYGXRJQJ.js.map +1 -0
  51. package/dist/{ReviewsPage-LTEOFKHW.js → ReviewsPage-6AOYLTID.js} +3 -3
  52. package/dist/{ReviewsPage-LTEOFKHW.js.map → ReviewsPage-6AOYLTID.js.map} +1 -1
  53. package/dist/{SeoCartWidget-3O35VZZO.js → SeoCartWidget-ANNRB6E7.js} +25 -24
  54. package/dist/SeoCartWidget-ANNRB6E7.js.map +1 -0
  55. package/dist/{SettingsPage-3VRJ3AYE.js → SettingsPage-ZRC7YUIB.js} +25 -24
  56. package/dist/SettingsPage-ZRC7YUIB.js.map +1 -0
  57. package/dist/StoreClosedNotification-TL32ZXVT.js +55 -0
  58. package/dist/{StoreClosedNotification-7KACKGVH.js.map → StoreClosedNotification-TL32ZXVT.js.map} +1 -1
  59. package/dist/{TestimonialsPage-LYJFX32D.js → TestimonialsPage-BEMMOE3M.js} +6 -6
  60. package/dist/{TestimonialsPage-LYJFX32D.js.map → TestimonialsPage-BEMMOE3M.js.map} +1 -1
  61. package/dist/{ThankYouPage-Z2S7MJ7J.js → ThankYouPage-ZMHWJAWO.js} +25 -24
  62. package/dist/ThankYouPage-ZMHWJAWO.js.map +1 -0
  63. package/dist/{WalletPage-EZ4RTLGE.js → WalletPage-WSPMXC2P.js} +26 -25
  64. package/dist/WalletPage-WSPMXC2P.js.map +1 -0
  65. package/dist/{WishlistPage-V7Z6GWQI.js → WishlistPage-G5O25DM5.js} +27 -26
  66. package/dist/WishlistPage-G5O25DM5.js.map +1 -0
  67. package/dist/api/advertisement.js +4 -4
  68. package/dist/api/apps.js +4 -4
  69. package/dist/api/blog.js +6 -6
  70. package/dist/api/brands.js +6 -6
  71. package/dist/api/cart.js +6 -6
  72. package/dist/api/category.js +6 -6
  73. package/dist/api/client.js +3 -3
  74. package/dist/api/home.js +4 -4
  75. package/dist/api/loyalty.js +6 -6
  76. package/dist/api/menu.js +4 -4
  77. package/dist/api/notification.js +4 -4
  78. package/dist/api/order.js +6 -6
  79. package/dist/api/page.js +6 -6
  80. package/dist/api/product.js +6 -6
  81. package/dist/api/profile.js +3 -3
  82. package/dist/api/store.js +4 -4
  83. package/dist/api/translations.js +4 -4
  84. package/dist/api/user.js +4 -4
  85. package/dist/api/wallet.js +4 -4
  86. package/dist/api/wishlist.js +7 -7
  87. package/dist/{chunk-SCL6EXHP.js → chunk-2OAG7V35.js} +8 -5
  88. package/dist/chunk-2OAG7V35.js.map +1 -0
  89. package/dist/{chunk-CQ6J4FKU.js → chunk-3ANDBTKR.js} +4 -4
  90. package/dist/{chunk-CQ6J4FKU.js.map → chunk-3ANDBTKR.js.map} +1 -1
  91. package/dist/{chunk-C7CJZ5DK.js → chunk-3DNVQVNY.js} +3 -3
  92. package/dist/{chunk-C7CJZ5DK.js.map → chunk-3DNVQVNY.js.map} +1 -1
  93. package/dist/{chunk-UCJNWQF2.js → chunk-4INSECDW.js} +3 -3
  94. package/dist/{chunk-UCJNWQF2.js.map → chunk-4INSECDW.js.map} +1 -1
  95. package/dist/{chunk-3WMGAFWX.js → chunk-56OZRZIZ.js} +4 -4
  96. package/dist/{chunk-3WMGAFWX.js.map → chunk-56OZRZIZ.js.map} +1 -1
  97. package/dist/{chunk-PFMTPKZO.js → chunk-6NV6T24C.js} +3 -3
  98. package/dist/{chunk-PFMTPKZO.js.map → chunk-6NV6T24C.js.map} +1 -1
  99. package/dist/{chunk-SGZ6TCHB.js → chunk-6T7FUHJY.js} +4 -4
  100. package/dist/{chunk-SGZ6TCHB.js.map → chunk-6T7FUHJY.js.map} +1 -1
  101. package/dist/{chunk-GIAXPCHD.js → chunk-6Z6BGS7P.js} +3 -3
  102. package/dist/{chunk-GIAXPCHD.js.map → chunk-6Z6BGS7P.js.map} +1 -1
  103. package/dist/{chunk-TTTI4W5F.js → chunk-BFA2U7P3.js} +4 -4
  104. package/dist/{chunk-TTTI4W5F.js.map → chunk-BFA2U7P3.js.map} +1 -1
  105. package/dist/{chunk-UO4HPAP5.js → chunk-BGVRYEPA.js} +8 -8
  106. package/dist/{chunk-UO4HPAP5.js.map → chunk-BGVRYEPA.js.map} +1 -1
  107. package/dist/{chunk-HSXQUHZO.js → chunk-CA3QVM6Y.js} +5 -5
  108. package/dist/{chunk-HSXQUHZO.js.map → chunk-CA3QVM6Y.js.map} +1 -1
  109. package/dist/{chunk-WX2UWLMW.js → chunk-CFARTPUQ.js} +3 -3
  110. package/dist/{chunk-WX2UWLMW.js.map → chunk-CFARTPUQ.js.map} +1 -1
  111. package/dist/{chunk-3QJCZSLR.js → chunk-E5PEYI5I.js} +5 -5
  112. package/dist/{chunk-3QJCZSLR.js.map → chunk-E5PEYI5I.js.map} +1 -1
  113. package/dist/{chunk-U46RGTYO.js → chunk-E7AO2Q32.js} +3 -3
  114. package/dist/{chunk-U46RGTYO.js.map → chunk-E7AO2Q32.js.map} +1 -1
  115. package/dist/{chunk-RJ5HY6PN.js → chunk-EJLVOWXU.js} +4 -4
  116. package/dist/{chunk-RJ5HY6PN.js.map → chunk-EJLVOWXU.js.map} +1 -1
  117. package/dist/{chunk-LG2UQKSH.js → chunk-FJQD3LTR.js} +4 -4
  118. package/dist/{chunk-LG2UQKSH.js.map → chunk-FJQD3LTR.js.map} +1 -1
  119. package/dist/{chunk-HSKRX3WR.js → chunk-FMSRB2TT.js} +4 -4
  120. package/dist/{chunk-HSKRX3WR.js.map → chunk-FMSRB2TT.js.map} +1 -1
  121. package/dist/{chunk-VM5Y62RM.js → chunk-FNM2OUPD.js} +4 -4
  122. package/dist/{chunk-VM5Y62RM.js.map → chunk-FNM2OUPD.js.map} +1 -1
  123. package/dist/{chunk-WAYZZVNX.js → chunk-GAGTCI3J.js} +4 -4
  124. package/dist/{chunk-WAYZZVNX.js.map → chunk-GAGTCI3J.js.map} +1 -1
  125. package/dist/{chunk-GGATZRAY.js → chunk-I7WSIN27.js} +3 -3
  126. package/dist/{chunk-GGATZRAY.js.map → chunk-I7WSIN27.js.map} +1 -1
  127. package/dist/{chunk-N5WT7UM3.js → chunk-IAHWLUFK.js} +3 -3
  128. package/dist/{chunk-N5WT7UM3.js.map → chunk-IAHWLUFK.js.map} +1 -1
  129. package/dist/{chunk-KPQEPQ4L.js → chunk-IRK7HSN6.js} +15 -9
  130. package/dist/chunk-IRK7HSN6.js.map +1 -0
  131. package/dist/{chunk-HGA5D4LJ.js → chunk-K7U46BT2.js} +4 -4
  132. package/dist/{chunk-HGA5D4LJ.js.map → chunk-K7U46BT2.js.map} +1 -1
  133. package/dist/{chunk-NEPWW7KM.js → chunk-LU5DRXS5.js} +3 -3
  134. package/dist/{chunk-NEPWW7KM.js.map → chunk-LU5DRXS5.js.map} +1 -1
  135. package/dist/{chunk-6V4SM23M.js → chunk-MEMJOJO4.js} +3 -3
  136. package/dist/{chunk-6V4SM23M.js.map → chunk-MEMJOJO4.js.map} +1 -1
  137. package/dist/{chunk-ZM4J5A4Z.js → chunk-MJ7TL42D.js} +3 -3
  138. package/dist/{chunk-ZM4J5A4Z.js.map → chunk-MJ7TL42D.js.map} +1 -1
  139. package/dist/{chunk-3MTOUUC7.js → chunk-MKCESZHW.js} +4 -4
  140. package/dist/{chunk-3MTOUUC7.js.map → chunk-MKCESZHW.js.map} +1 -1
  141. package/dist/{chunk-TOVC6CV7.js → chunk-MVBMVM22.js} +5 -5
  142. package/dist/{chunk-TOVC6CV7.js.map → chunk-MVBMVM22.js.map} +1 -1
  143. package/dist/{chunk-TUVDPELG.js → chunk-NYXV2PES.js} +8 -8
  144. package/dist/{chunk-TUVDPELG.js.map → chunk-NYXV2PES.js.map} +1 -1
  145. package/dist/{chunk-B272JNRU.js → chunk-OMY65JIW.js} +4 -4
  146. package/dist/{chunk-B272JNRU.js.map → chunk-OMY65JIW.js.map} +1 -1
  147. package/dist/{chunk-YDKPG3AP.js → chunk-ONRRKJWG.js} +7 -7
  148. package/dist/{chunk-YDKPG3AP.js.map → chunk-ONRRKJWG.js.map} +1 -1
  149. package/dist/chunk-OQIIJRAS.js +30 -0
  150. package/dist/chunk-OQIIJRAS.js.map +1 -0
  151. package/dist/{chunk-N6B4LPKS.js → chunk-PF2WSBJ7.js} +4 -4
  152. package/dist/{chunk-N6B4LPKS.js.map → chunk-PF2WSBJ7.js.map} +1 -1
  153. package/dist/{chunk-QEPZPPLH.js → chunk-PKJJ6Z7A.js} +3 -3
  154. package/dist/{chunk-QEPZPPLH.js.map → chunk-PKJJ6Z7A.js.map} +1 -1
  155. package/dist/{chunk-YUI6R2PA.js → chunk-POI4G5EA.js} +112 -7
  156. package/dist/chunk-POI4G5EA.js.map +1 -0
  157. package/dist/{chunk-I2ZO57UV.js → chunk-RCCVUE72.js} +6 -6
  158. package/dist/{chunk-I2ZO57UV.js.map → chunk-RCCVUE72.js.map} +1 -1
  159. package/dist/{chunk-P36CIH6E.js → chunk-ROTFC5YL.js} +7 -7
  160. package/dist/{chunk-P36CIH6E.js.map → chunk-ROTFC5YL.js.map} +1 -1
  161. package/dist/{chunk-VDBDYFAL.js → chunk-TL256OK3.js} +4 -4
  162. package/dist/{chunk-VDBDYFAL.js.map → chunk-TL256OK3.js.map} +1 -1
  163. package/dist/{chunk-4SZZPXM2.js → chunk-TMMK2VYE.js} +50 -17
  164. package/dist/chunk-TMMK2VYE.js.map +1 -0
  165. package/dist/{chunk-IRLKZ3LB.js → chunk-UAMMJPLQ.js} +21 -21
  166. package/dist/{chunk-IRLKZ3LB.js.map → chunk-UAMMJPLQ.js.map} +1 -1
  167. package/dist/{chunk-QZM4ZACO.js → chunk-UFQY2QQ4.js} +3 -3
  168. package/dist/{chunk-QZM4ZACO.js.map → chunk-UFQY2QQ4.js.map} +1 -1
  169. package/dist/chunk-ULC4J3PY.js +14 -0
  170. package/dist/{chunk-2RRZZYH4.js.map → chunk-ULC4J3PY.js.map} +1 -1
  171. package/dist/{chunk-UEOXX7N2.js → chunk-VFXAHTB3.js} +6 -6
  172. package/dist/{chunk-UEOXX7N2.js.map → chunk-VFXAHTB3.js.map} +1 -1
  173. package/dist/{chunk-IXFBHQ5P.js → chunk-WD576F4S.js} +3 -3
  174. package/dist/{chunk-IXFBHQ5P.js.map → chunk-WD576F4S.js.map} +1 -1
  175. package/dist/{chunk-WEN6FKY6.js → chunk-WN35SBLD.js} +3 -3
  176. package/dist/{chunk-WEN6FKY6.js.map → chunk-WN35SBLD.js.map} +1 -1
  177. package/dist/{chunk-L6TSHT52.js → chunk-X2JCU7GY.js} +3 -3
  178. package/dist/{chunk-L6TSHT52.js.map → chunk-X2JCU7GY.js.map} +1 -1
  179. package/dist/{chunk-YZDHDHSN.js → chunk-YYMKDBZV.js} +3 -3
  180. package/dist/{chunk-YZDHDHSN.js.map → chunk-YYMKDBZV.js.map} +1 -1
  181. package/dist/{chunk-N6JUOBYJ.js → chunk-Z4UTYKKV.js} +4 -4
  182. package/dist/{chunk-N6JUOBYJ.js.map → chunk-Z4UTYKKV.js.map} +1 -1
  183. package/dist/{chunk-NEKHAKA7.js → chunk-ZBFTBK4B.js} +96 -18
  184. package/dist/chunk-ZBFTBK4B.js.map +1 -0
  185. package/dist/{chunk-7JAOXOEW.js → chunk-ZDKQL2E4.js} +4 -4
  186. package/dist/{chunk-7JAOXOEW.js.map → chunk-ZDKQL2E4.js.map} +1 -1
  187. package/dist/{chunk-4CCCNO2Q.js → chunk-ZRT6L6TC.js} +3 -3
  188. package/dist/{chunk-4CCCNO2Q.js.map → chunk-ZRT6L6TC.js.map} +1 -1
  189. package/dist/components/cart/index.js +1 -1
  190. package/dist/components/common/index.js +1 -1
  191. package/dist/components/drawer/index.js +23 -22
  192. package/dist/components/home/index.js +27 -26
  193. package/dist/components/layout/Footer.d.ts.map +1 -1
  194. package/dist/components/layout/Header.d.ts.map +1 -1
  195. package/dist/components/layout/MadeWithSalla.d.ts +9 -0
  196. package/dist/components/layout/MadeWithSalla.d.ts.map +1 -0
  197. package/dist/components/layout/index.d.ts +2 -0
  198. package/dist/components/layout/index.d.ts.map +1 -1
  199. package/dist/components/layout/index.js +7 -6
  200. package/dist/components/product/index.js +24 -23
  201. package/dist/components/store/index.js +24 -23
  202. package/dist/components/toast/index.js +4 -4
  203. package/dist/dev/editor/index.js +2 -2
  204. package/dist/dev/index.js +2 -2
  205. package/dist/document-class-RXOPTIM2.js +29 -0
  206. package/dist/{document-class-2PMYG45N.js.map → document-class-RXOPTIM2.js.map} +1 -1
  207. package/dist/hooks/index.js +23 -22
  208. package/dist/hooks/useComments.js +3 -3
  209. package/dist/hooks/useGtm.js +23 -22
  210. package/dist/hooks/useMoney.js +23 -22
  211. package/dist/hooks/useProduct.js +3 -3
  212. package/dist/hooks/useStore.js +23 -22
  213. package/dist/hooks/useUser.js +5 -5
  214. package/dist/hooks/useWishlist.js +3 -3
  215. package/dist/index.js +23 -22
  216. package/dist/index.js.map +1 -1
  217. package/dist/native-app/index.js +3 -3
  218. package/dist/{navigation-3HNNCUGK.js → navigation-NM4AO2OX.js} +7 -7
  219. package/dist/{navigation-3HNNCUGK.js.map → navigation-NM4AO2OX.js.map} +1 -1
  220. package/dist/navigation-S5EUYOVI.js +14 -0
  221. package/dist/{navigation-GF4ODD46.js.map → navigation-S5EUYOVI.js.map} +1 -1
  222. package/dist/{not-found-5YCYDSHS.js → not-found-3XCUVPO3.js} +26 -25
  223. package/dist/not-found-3XCUVPO3.js.map +1 -0
  224. package/dist/providers/index.js +23 -22
  225. package/dist/routes/account/orders.js +8 -8
  226. package/dist/routes/account.js +17 -17
  227. package/dist/routes/blog.js +12 -12
  228. package/dist/routes/brands.js +8 -8
  229. package/dist/routes/cart.js +31 -30
  230. package/dist/routes/cart.js.map +1 -1
  231. package/dist/routes/home.js +28 -27
  232. package/dist/routes/index.js +6 -6
  233. package/dist/routes/loyalty.js +9 -9
  234. package/dist/routes/page.js +8 -8
  235. package/dist/routes/product-listing.js +29 -28
  236. package/dist/routes/product-listing.js.map +1 -1
  237. package/dist/routes/product.js +27 -26
  238. package/dist/routes/product.js.map +1 -1
  239. package/dist/routes/root/beforeLoad.d.ts +6 -0
  240. package/dist/routes/root/beforeLoad.d.ts.map +1 -1
  241. package/dist/routes/seo-redirects.js +6 -6
  242. package/dist/routes/testimonials.js +4 -3
  243. package/dist/routes/testimonials.js.map +1 -1
  244. package/dist/routes/thank-you.js +8 -8
  245. package/dist/skeleton.js +28 -27
  246. package/dist/{store-lookup-TK4QCWNT.js → store-lookup-LVKWUL6Z.js} +11 -11
  247. package/dist/{store-lookup-TK4QCWNT.js.map → store-lookup-LVKWUL6Z.js.map} +1 -1
  248. package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
  249. package/dist/tanstack/store-base.d.ts +10 -2
  250. package/dist/tanstack/store-base.d.ts.map +1 -1
  251. package/dist/tanstack/templates/locale-wrapper.d.ts +2 -1
  252. package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
  253. package/dist/tanstack.js +42 -20
  254. package/dist/tanstack.js.map +1 -1
  255. package/dist/types/index.d.ts +8 -0
  256. package/dist/types/index.d.ts.map +1 -1
  257. package/dist/utils/baseHead.d.ts +6 -1
  258. package/dist/utils/baseHead.d.ts.map +1 -1
  259. package/dist/utils/baseHead.js +3 -1
  260. package/dist/utils/cookies.d.ts +6 -0
  261. package/dist/utils/cookies.d.ts.map +1 -1
  262. package/dist/utils/index.js +6 -6
  263. package/dist/utils/language-cookie.d.ts +10 -0
  264. package/dist/utils/language-cookie.d.ts.map +1 -0
  265. package/dist/utils/shared-host-language.d.ts +72 -0
  266. package/dist/utils/shared-host-language.d.ts.map +1 -0
  267. package/dist/utils/store-base.d.ts +28 -6
  268. package/dist/utils/store-base.d.ts.map +1 -1
  269. package/dist/vite/index.js +41 -5
  270. package/dist/vite/index.js.map +1 -1
  271. package/package.json +1 -1
  272. package/tailwind/components/layout/Footer.tsx.txt +12 -5
  273. package/tailwind/components/layout/Header.tsx.txt +12 -1
  274. package/tailwind/components/layout/MadeWithSalla.tsx.txt +34 -0
  275. package/tailwind/components/layout/index.ts.txt +3 -0
  276. package/tailwind/routes/root/beforeLoad.ts.txt +53 -1
  277. package/dist/BlogAuthorPage-GLAYDKIX.js.map +0 -1
  278. package/dist/BlogCategoryPage-KPU6LYHK.js.map +0 -1
  279. package/dist/BlogPage-VDDHOD33.js.map +0 -1
  280. package/dist/BlogSinglePage-UWP5MFAS.js.map +0 -1
  281. package/dist/BlogTagPage-V3Z4AD4C.js.map +0 -1
  282. package/dist/BrandsPage-ARYKHCTB.js.map +0 -1
  283. package/dist/Breadcrumb-XT2MP2ZW.js.map +0 -1
  284. package/dist/CartItem-4VXVOKVF.js.map +0 -1
  285. package/dist/CartSummary-K23PGOUL.js.map +0 -1
  286. package/dist/CustomerLayout-B77ZKB4X.js.map +0 -1
  287. package/dist/Header-QOAV23HD.js +0 -22
  288. package/dist/LoyaltyPage-3OIZG2ZJ.js.map +0 -1
  289. package/dist/LoyaltyPointsPage-I3O3JA7Q.js.map +0 -1
  290. package/dist/MobileMenu-3ILQKCHA.js.map +0 -1
  291. package/dist/NotificationsPage-EYTBUS36.js.map +0 -1
  292. package/dist/OrderSinglePage-YHA5D2ZI.js.map +0 -1
  293. package/dist/OrdersPage-4A2QINDX.js.map +0 -1
  294. package/dist/ProfilePage-ZTYHIDGE.js.map +0 -1
  295. package/dist/SeoCartWidget-3O35VZZO.js.map +0 -1
  296. package/dist/SettingsPage-3VRJ3AYE.js.map +0 -1
  297. package/dist/StoreClosedNotification-7KACKGVH.js +0 -54
  298. package/dist/ThankYouPage-Z2S7MJ7J.js.map +0 -1
  299. package/dist/WalletPage-EZ4RTLGE.js.map +0 -1
  300. package/dist/WishlistPage-V7Z6GWQI.js.map +0 -1
  301. package/dist/chunk-2RRZZYH4.js +0 -14
  302. package/dist/chunk-4SZZPXM2.js.map +0 -1
  303. package/dist/chunk-KPQEPQ4L.js.map +0 -1
  304. package/dist/chunk-NEKHAKA7.js.map +0 -1
  305. package/dist/chunk-SCL6EXHP.js.map +0 -1
  306. package/dist/chunk-YUI6R2PA.js.map +0 -1
  307. package/dist/document-class-2PMYG45N.js +0 -29
  308. package/dist/navigation-GF4ODD46.js +0 -14
  309. package/dist/not-found-5YCYDSHS.js.map +0 -1
@@ -1,10 +1,13 @@
1
1
  import { getRequestStore } from './chunk-QRHXAKJ3.js';
2
- import { isLocale } from './chunk-T72DAX7R.js';
2
+ import { FALLBACK_LOCALE, isLocale } from './chunk-T72DAX7R.js';
3
3
 
4
4
  // src/utils/cookies.ts
5
5
  var AUTH_TOKEN_COOKIE_NAME = "token";
6
6
  var SCOPE_COOKIE_NAME = "scope";
7
7
  var CURRENCY_COOKIE_NAME = "s-curr";
8
+ var LANGUAGE_COOKIE_NAME = "s-lang";
9
+ var LANGUAGE_PARAM = "lang";
10
+ var LANGUAGE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
8
11
  var STORE_ID_COOKIE_NAME = "salla_sid";
9
12
  var STORE_ID_PARAM = "storeId";
10
13
  var VERSION_ID_COOKIE_NAME = "salla_vid";
@@ -239,6 +242,87 @@ function renderRuntimeEnvScript(env = resolveRuntimeEnv()) {
239
242
  return `window.${RUNTIME_ENV_KEY}=${json};`;
240
243
  }
241
244
 
245
+ // src/utils/shared-host-language.ts
246
+ function knownLocale(value) {
247
+ const code = value?.toLowerCase();
248
+ return isLocale(code) ? code : null;
249
+ }
250
+ function safeDecode(value) {
251
+ try {
252
+ return decodeURIComponent(value);
253
+ } catch {
254
+ return value;
255
+ }
256
+ }
257
+ function langParam(search) {
258
+ for (const part of search.replace(/^\?/, "").split("&")) {
259
+ const [key, value = ""] = part.split("=");
260
+ if (safeDecode(key) === LANGUAGE_PARAM) return safeDecode(value);
261
+ }
262
+ return null;
263
+ }
264
+ function hasLanguageParam(search) {
265
+ return langParam(search) !== null;
266
+ }
267
+ function languageFromCookies(cookieHeader) {
268
+ return knownLocale(extractTokenFromCookies(cookieHeader, LANGUAGE_COOKIE_NAME));
269
+ }
270
+ function virtualLocale(search, cookieHeader) {
271
+ return knownLocale(langParam(search)) ?? languageFromCookies(cookieHeader) ?? FALLBACK_LOCALE;
272
+ }
273
+ function listedLocales(settings) {
274
+ const codes = (settings.languages ?? []).map((language) => (language.iso_code ?? language.code)?.toLowerCase()).filter((code) => Boolean(code));
275
+ return codes.length ? codes : null;
276
+ }
277
+ function isMultilingualStore(settings) {
278
+ if (settings?.store?.settings?.is_multilingual === false) return false;
279
+ return settings?.languages == null || settings.languages.length >= 2;
280
+ }
281
+ function defaultLanguage(settings) {
282
+ const listed = listedLocales(settings);
283
+ if (!listed) return null;
284
+ const marked = settings.languages?.find((language) => Boolean(language.is_default));
285
+ const markedCode = (marked?.iso_code ?? marked?.code)?.toLowerCase();
286
+ if (markedCode) return markedCode;
287
+ return listed.includes(FALLBACK_LOCALE) ? FALLBACK_LOCALE : listed[0];
288
+ }
289
+ function offeredLanguages(settings) {
290
+ const listed = listedLocales(settings);
291
+ if (!listed) return null;
292
+ if (isMultilingualStore(settings)) return listed;
293
+ const only = defaultLanguage(settings);
294
+ return only ? [only] : listed;
295
+ }
296
+ function withLanguageParam(search, code) {
297
+ const kept = search.replace(/^\?/, "").split("&").filter((part) => part && safeDecode(part.split("=")[0]) !== LANGUAGE_PARAM);
298
+ if (code) kept.push(`${LANGUAGE_PARAM}=${encodeURIComponent(code)}`);
299
+ return kept.length ? `?${kept.join("&")}` : "";
300
+ }
301
+ function decideSharedHostLanguage(args) {
302
+ const { settings, locale, href, cookieHeader } = args;
303
+ const offered = offeredLanguages(settings);
304
+ const url = new URL(href, "http://shared-host.invalid");
305
+ const withSearch = (search) => `${url.pathname}${search}${url.hash}`;
306
+ const asked = langParam(url.search);
307
+ if (asked !== null) {
308
+ const wanted = knownLocale(asked);
309
+ if (!wanted || offered && !offered.includes(wanted)) {
310
+ return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search)) };
311
+ }
312
+ const remembered = languageFromCookies(cookieHeader);
313
+ const clean = remembered === wanted || wanted === FALLBACK_LOCALE;
314
+ return {
315
+ cookie: remembered === wanted ? null : wanted,
316
+ redirectTo: clean ? withSearch(withLanguageParam(url.search)) : null
317
+ };
318
+ }
319
+ if (offered && !offered.includes(locale)) {
320
+ const fallback = defaultLanguage(settings);
321
+ return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search, fallback)) };
322
+ }
323
+ return { cookie: null, redirectTo: null };
324
+ }
325
+
242
326
  // src/utils/store-base.ts
243
327
  function stripStoreBase(pathname, base, followsLocale = false) {
244
328
  if (followsLocale) {
@@ -252,15 +336,36 @@ function stripStoreBase(pathname, base, followsLocale = false) {
252
336
  if (pathname === prefix) return "/";
253
337
  return pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;
254
338
  }
339
+ function splitLeadingSegment(rooted) {
340
+ if (!rooted.startsWith("/")) return { first: "", rest: "" };
341
+ let end = 1;
342
+ while (end < rooted.length && rooted[end] !== "/" && rooted[end] !== "?" && rooted[end] !== "#") {
343
+ end += 1;
344
+ }
345
+ return { first: rooted.slice(1, end), rest: rooted.slice(end) };
346
+ }
255
347
  function prefixStoreBase(path, base, followsLocale = false) {
256
- const rooted = path.startsWith("/") ? path : `/${path}`;
348
+ let rooted = path.startsWith("/") ? path : `/${path}`;
257
349
  if (followsLocale) {
258
- const [, first = "", rest = ""] = /^\/([^/?#]*)(.*)$/.exec(rooted) ?? [];
259
- if (isLocale(first)) return `/${first}/${base}${rest}`;
350
+ const { first, rest } = splitLeadingSegment(rooted);
351
+ if (isLocale(first)) rooted = rest.startsWith("/") ? rest : `/${rest}`;
260
352
  }
261
353
  const atRoot = rooted === "/" || rooted[1] === "?" || rooted[1] === "#";
262
354
  return `/${base}${atRoot ? rooted.slice(1) : rooted}`;
263
355
  }
356
+ function legacyLocaleRedirectHref(url, base) {
357
+ let parsed;
358
+ try {
359
+ parsed = new URL(url);
360
+ } catch {
361
+ return null;
362
+ }
363
+ const segments = parsed.pathname.split("/");
364
+ if (!isLocale(segments[1]) || segments[2] !== base) return null;
365
+ const pathname = ["", base, ...segments.slice(3)].join("/");
366
+ const search = parsed.searchParams.has("lang") ? parsed.search : withLanguageParam(parsed.search, segments[1]);
367
+ return `${pathname}${search}`;
368
+ }
264
369
  function withoutStoreUrlBase(pathname, storeUrlPathname, username) {
265
370
  const own = storeUrlSegment(storeUrlPathname, username);
266
371
  if (!own) return pathname;
@@ -338,6 +443,6 @@ function resolveStoreBaseRedirect(username, href) {
338
443
  return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });
339
444
  }
340
445
 
341
- export { AUTH_TOKEN_COOKIE_NAME, CURRENCY_COOKIE_NAME, SCOPE_COOKIE_MAX_AGE, SCOPE_COOKIE_NAME, STORE_BASE_HEADER, clearAuthTokenCookie, escapeForInlineScript, extractCurrencyFromCookies, extractScopeFromCookies, extractScopeFromUrl, extractTokenFromCookies, getInjectedRuntimeEnv, hasStoreUrlBase, isLoopback, loginRedirectHref, prefixStoreBase, readEnv, readSdkScope, rememberDevStoreId, renderRuntimeEnvScript, resolveAddressedStore, resolveRequestScope, resolveRequestVersionId, resolveStoreBase, resolveStoreBaseFollowsLocale, resolveStoreBaseRedirect, resolveStoreIdentifier, sameScope, stripStoreBase, syncScopeCookie, toCurrencyCode, withoutStoreUrlBase };
342
- //# sourceMappingURL=chunk-YUI6R2PA.js.map
343
- //# sourceMappingURL=chunk-YUI6R2PA.js.map
446
+ export { AUTH_TOKEN_COOKIE_NAME, CURRENCY_COOKIE_NAME, LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME, SCOPE_COOKIE_MAX_AGE, SCOPE_COOKIE_NAME, STORE_BASE_HEADER, clearAuthTokenCookie, decideSharedHostLanguage, escapeForInlineScript, extractCurrencyFromCookies, extractScopeFromCookies, extractScopeFromUrl, extractTokenFromCookies, getInjectedRuntimeEnv, hasLanguageParam, hasStoreUrlBase, isLoopback, legacyLocaleRedirectHref, loginRedirectHref, prefixStoreBase, readEnv, readSdkScope, rememberDevStoreId, renderRuntimeEnvScript, resolveAddressedStore, resolveRequestScope, resolveRequestVersionId, resolveStoreBase, resolveStoreBaseFollowsLocale, resolveStoreBaseRedirect, resolveStoreIdentifier, sameScope, splitLeadingSegment, stripStoreBase, syncScopeCookie, toCurrencyCode, virtualLocale, withLanguageParam, withoutStoreUrlBase };
447
+ //# sourceMappingURL=chunk-POI4G5EA.js.map
448
+ //# sourceMappingURL=chunk-POI4G5EA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/cookies.ts","../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/shared-host-language.ts","../src/utils/store-base.ts","../src/utils/store-identity.ts"],"names":[],"mappings":";;;;AAEO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,iBAAA,GAAoB;AAC1B,IAAM,oBAAA,GAAuB;AAE7B,IAAM,oBAAA,GAAuB;AAE7B,IAAM,cAAA,GAAiB,MAAA;AAEvB,IAAM,uBAAA,GAA0B,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK;AAoB/C,IAAM,oBAAA,GAAuB,WAAA;AAG7B,IAAM,cAAA,GAAiB,SAAA;AAsBvB,IAAM,sBAAA,GAAyB,WAAA;AAG/B,IAAM,gBAAA,GAAmB,WAAA;AAchC,SAAS,eAAe,GAAA,EAA+C;AACrE,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,OAAO,oBAAA,CAAqB,IAAA,CAAK,GAAG,CAAA,GAAI,GAAA,GAAM,IAAA;AAChD;AAGO,SAAS,aAAa,GAAA,EAA+C;AAC1E,EAAA,OAAO,eAAe,GAAG,CAAA;AAC3B;AAoCO,IAAM,cAAA,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AAO,SAAA,CAAU,SAAA;AAC1C,EAAA,IAAI,OAAO,IAAA,CAAK,SAAS,CAAA,CAAE,MAAA,GAAS,GAAG,OAAO,IAAA;AAE9C,EAAA,OAAO,wBAAwB,MAAA,CAAO,QAAA,CAAS,IAAA,EAAM,MAAA,CAAO,SAAS,IAAI,CAAA;AAC3E;AAUO,SAAS,6BAAA,GAAyC;AACvD,EAAA,MAAM,EAAE,SAAA,EAAW,sBAAA,EAAuB,GAAI,eAAA,EAAgB;AAC9D,EAAA,IAAI,WAAW,OAAO,sBAAA;AACtB,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAE1C,EAAA,MAAM,YAAY,qBAAA,EAAsB;AACxC,EAAA,OAAO,OAAA,CAAQ,SAAA,CAAU,SAAA,IAAa,SAAA,CAAU,sBAAsB,CAAA;AACxE;AAaO,SAAS,wBAAA,CACd,UACA,IAAA,EACe;AACf,EAAA,MAAM,IAAA,GACJ,iBAAgB,CAAE,WAAA,KAAgB,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,QAAA,CAAS,IAAA,GAAO,IAAA,CAAA;AAC3F,EAAA,OAAO,qBAAA,CAAsB,EAAE,IAAA,EAAM,IAAA,EAAM,kBAAiB,EAAG,QAAA,EAAU,MAAM,CAAA;AACjF","file":"chunk-POI4G5EA.js","sourcesContent":["import { isLocale } from '../providers/locale-constants';\n\nexport const AUTH_TOKEN_COOKIE_NAME = 'token';\nexport const SCOPE_COOKIE_NAME = 'scope';\nexport const CURRENCY_COOKIE_NAME = 's-curr';\n/** The language the SDK's localization modal remembers; host-wide, so shared by every store on a shared host. */\nexport const LANGUAGE_COOKIE_NAME = 's-lang';\n/** Query parameter the localization modal navigates with to ask for a language. */\nexport const LANGUAGE_PARAM = 'lang';\n/** How long a language choice is remembered: one year, like the `scope` cookie. */\nexport const LANGUAGE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\n/**\n * Which store this request is for, when the hostname does not say.\n *\n * A live storefront is reached at its own domain, so the hostname identifies it\n * and nothing else is needed. A preview is not: every theme under review is\n * served from the one preview hostname, so the store has to be named some other\n * way — the dispatcher takes it from `?storeId=` and puts it here, the same way\n * it remembers which theme to serve.\n *\n * Written by the dispatcher rather than the theme, and set on the *forwarded\n * request* as well as the response, because the response cookie only arrives in\n * time for the second page load and the first one has to render too.\n *\n * The literal is a contract with `STORE_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), and **nothing checks the two agree**. Drift does\n * not fail loudly — it renders somebody else's shop. Grep both repos before\n * changing it.\n */\nexport const STORE_ID_COOKIE_NAME = 'salla_sid';\n\n/** Query parameter naming the store, on a host that serves more than one. */\nexport const STORE_ID_PARAM = 'storeId';\n\n/**\n * Which version of the theme's settings to render.\n *\n * A merchant's theme settings are versioned, and the storefront normally shows\n * whichever version is live — the API answers with it, and names it back as\n * `theme.profile.id`. Two places need a different one: the merchant's own theme\n * editor, which previews a draft version before it is published, and a partner\n * running a theme locally against a store whose settings they are editing. Both\n * open the theme inside an iframe, and the version travels in that URL.\n *\n * Named `versionId` rather than the `version_id` the Dashboard uses internally,\n * because it sits beside `?storeId=` and one URL should not spell two ids two\n * ways. The value is the same one either way: the Optimus-encoded version id,\n * which is exactly what `s-version-id` has always carried.\n *\n * The literal is a contract with `VERSION_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), on the same terms as {@link STORE_ID_COOKIE_NAME}:\n * nothing checks the two agree, and drift shows a merchant the wrong version of\n * their own settings rather than failing.\n */\nexport const VERSION_ID_COOKIE_NAME = 'salla_vid';\n\n/** Query parameter naming the theme-settings version, where one may be named. */\nexport const VERSION_ID_PARAM = 'versionId';\n\n/**\n * An id named by a request is an integer, and anything else is not one.\n *\n * Validated rather than passed through because these values end up in an upstream\n * API path and header. Leading zeroes, signs, decimals and whitespace are all\n * rejected: the point is a single canonical form, not the widest set of things\n * that could be coerced into a number.\n *\n * One function for both ids on purpose. They arrive the same way, from the same\n * untrusted place, and are spent the same way; two copies of this rule would be\n * two chances for one of them to be relaxed on its own.\n */\nfunction parseRequestId(raw: string | null | undefined): string | null {\n if (!raw) return null;\n return /^[1-9][0-9]{0,18}$/.test(raw) ? raw : null;\n}\n\n/** A store id in its canonical form, or null when it is not one. */\nexport function parseStoreId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** A theme-settings version id in its canonical form, or null when it is not one. */\nexport function parseVersionId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** The store id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractStoreIdFromCookies(cookieHeader: string | null): string | null {\n return parseStoreId(extractTokenFromCookies(cookieHeader, STORE_ID_COOKIE_NAME));\n}\n\n/** The version id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractVersionIdFromCookies(cookieHeader: string | null): string | null {\n return parseVersionId(extractTokenFromCookies(cookieHeader, VERSION_ID_COOKIE_NAME));\n}\n\n/**\n * The only hosts on which a request may name its own store.\n *\n * **This is a security boundary, not a convenience.** On a merchant's own domain\n * the hostname *is* the store, and it is the only thing that may decide. A theme\n * that also honoured `?storeId=` there would let anyone open\n * `https://reefperfumes.com/?storeId=<someone else>` and be served a different\n * merchant's shop from the domain its owner controls — their branding, their\n * customers' address bar, somebody else's catalogue — and the cookie would keep\n * serving it for the rest of that browser's session. Salla points SaaS domains\n * at this dispatcher, so those hostnames are real and reachable.\n *\n * The override exists for one situation: a host that serves many stores and so\n * cannot identify one from its name. That is the preview host, where every theme\n * under review answers on the same address, and local development.\n *\n * Adding an entry grants that host the ability to render any store on request.\n * Add nothing that a merchant's traffic reaches.\n */\nexport const STORE_ID_HOSTS: readonly string[] = ['preview.salla.design'];\n\n/** The hostname alone — a port never distinguishes one host's authority from another's. */\nfunction hostnameOf(host: string): string {\n const trimmed = host.trim().toLowerCase();\n // IPv6 literals are bracketed, and the colons inside them are not a port.\n if (trimmed.startsWith('[')) return trimmed.slice(0, trimmed.indexOf(']') + 1) || trimmed;\n const colon = trimmed.indexOf(':');\n return colon === -1 ? trimmed : trimmed.slice(0, colon);\n}\n\nexport function isLoopback(hostname: string): boolean {\n return (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '[::1]' ||\n hostname.endsWith('.localhost')\n );\n}\n\n/**\n * Whether this host is allowed to let the request choose a store.\n *\n * Deliberately an allowlist of exact hostnames plus loopback. No suffix matching:\n * a rule like \"anything ending in salla.design\" is one wildcard DNS record away\n * from admitting a host nobody meant to admit, and the list of hosts that serve\n * more than one store is short and known.\n *\n * It gates {@link resolveRequestVersionId} as well, and the name has been left\n * alone rather than generalised because one predicate that both call is the\n * property worth keeping — a second, subtly different list is how a host ends up\n * permitted to name one thing and not the other. A version is worth gating for\n * the same reason a store is: on a merchant's own domain, honouring\n * `?versionId=` would publish whatever draft settings they are still working on\n * to anyone who guessed the URL.\n */\nexport function allowsRequestStoreId(host: string | null | undefined): boolean {\n if (!host) return false;\n const hostname = hostnameOf(host);\n return STORE_ID_HOSTS.includes(hostname) || isLoopback(hostname);\n}\n\n/**\n * Whether this host *is* a store, so its name can be used as the identifier.\n *\n * The exact inverse of {@link allowsRequestStoreId}, and deliberately written as\n * one so the two can never disagree: a host that may name its store is a host\n * that serves more than one, and a host that serves more than one cannot be the\n * answer to \"which store is this?\". `preview.salla.design` and `localhost:5188`\n * are not shops; asking the API about them earns a 422 and a page that reads as\n * a broken theme.\n */\nexport function hostIdentifiesStore(host: string | null | undefined): boolean {\n return Boolean(host) && !allowsRequestStoreId(host);\n}\n\n/**\n * The store this request names, on a host permitted to name one.\n *\n * The host check is inside the resolution rather than at a call site, because a\n * call site is a thing someone can add without reading this comment. There is no\n * way to ask \"what store did the request name?\" without also asking \"is this a\n * host that may say?\" — get it wrong and the answer is a security bug that looks\n * like a feature.\n *\n * Between the two permitted sources the URL wins, the same precedence the\n * dispatcher uses for the theme and for the same reason: a link is how someone\n * switches, and a cookie they cannot see should never beat the address they\n * just typed.\n */\nexport function resolveRequestStoreId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, STORE_ID_PARAM, STORE_ID_COOKIE_NAME);\n}\n\n/**\n * A store username as it can appear as the first segment of a path.\n *\n * Starts with a letter or digit, so nothing the platform mounts at the root of a\n * host — `/_serverFn/`, `/.well-known/` — is ever read as a store. Dots are allowed\n * (`zyros.sa`), but a root file (`/favicon.ico`, `/robots.txt`) is not a store.\n * The value is sent upstream as the `store-identifier` header, so the set is kept\n * narrow on purpose: a username outside it cannot be addressed by path, and\n * `?storeId=` still can.\n */\nconst STORE_BASE_SEGMENT = /^[a-z0-9][a-z0-9._-]{0,62}$/i;\nconst ROOT_FILE =\n /\\.(ico|txt|xml|json|webmanifest|html?|js|mjs|css|map|png|jpe?g|gif|svg|webp|avif|woff2?|ttf|otf|eot|pdf|mp4|webm|wasm)$/i;\n\n/**\n * Whether this could be a store's username in the first segment of a path.\n *\n * A supported locale code never is, in any case: `/ar` and `/EN` are languages,\n * so `preview.salla.design/en/cart` is the English cart of the store the cookie\n * names. That makes a store whose username is a locale code (`ar` is one)\n * unreachable by path; `?storeId=` still reaches it.\n *\n * The same predicate decides whether a username may become a path's root\n * (`storeBaseRedirectHref`). That is what stops the redirect from looping: a\n * store called `ar`, sent to `/ar/…`, would find no store there and be sent again.\n */\nexport function isStoreBaseSegment(value: string | null | undefined): value is string {\n return (\n typeof value === 'string' &&\n STORE_BASE_SEGMENT.test(value) &&\n !ROOT_FILE.test(value) &&\n !isLocale(value.toLowerCase())\n );\n}\n\n/**\n * The store the first segment of this request's path names, on a host permitted\n * to name one.\n *\n * On such a host the first segment **is** the store. It is the root of the\n * application there, so `https://preview.salla.design/mtgr-alaatr-2/cart` is the\n * cart of the store whose username is `mtgr-alaatr-2`. This is a rule rather than\n * a guess, and it has to be: `cart`, `offers` and `search` are all real store\n * usernames, so a store cannot be told from a page by looking at the segment.\n * `/cart` on these hosts is the store called `cart`.\n *\n * The one segment that is not a store is a supported locale code (see\n * {@link isStoreBaseSegment}). `/ar/cart` names a language, and the store comes\n * from the cookie or `VITE_STORE_DOMAIN`, as it would at `/`.\n *\n * A URL that carries `storeId` is not read this way at all, whatever its value.\n * That is how `salla theme dev` names a store (`/ar?storeId=…`), on a path that\n * begins with a page; the root loader then redirects to the store's own address.\n * Checking for a *valid* id instead would let a malformed one hand the page's\n * first segment the store's job. (On the preview host the dispatcher removes the\n * parameter and sends a cookie; the editor opens that host at `/`, where there is\n * no segment to read.)\n *\n * Same gate as {@link resolveRequestStoreId}, for the same reason: on a merchant's\n * own domain the hostname is the store and the path is only ever a page.\n */\nexport function resolveRequestStoreBase(\n url: string,\n host: string | null | undefined\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.searchParams.has(STORE_ID_PARAM)) return null;\n\n const first = parsed.pathname.split('/')[1];\n return isStoreBaseSegment(first) ? first : null;\n}\n\n/** Which store a request addressed, and how. At most one of the two is set. */\nexport interface RequestStore {\n /** Named by `?storeId=`, or by the cookie remembering it. */\n storeId: string | null;\n /** Named by the first segment of the path. */\n storeBase: string | null;\n}\n\n/**\n * The store this request addressed: the query, then the path, then the cookie.\n *\n * The path outranks the cookie because it is the address the visitor can see.\n * The cookie is one value for the whole preview host, so with two stores open in\n * two tabs it names whichever was opened last; the path names the one in front\n * of them.\n */\nexport function resolveRequestStore(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): RequestStore {\n const storeBase = resolveRequestStoreBase(url, host);\n return {\n storeBase,\n storeId: storeBase ? null : resolveRequestStoreId(url, cookieHeader, host),\n };\n}\n\n/**\n * The header the storefront dispatcher names the store in, on a Salla shared host\n * that routes by username: `demostore.salla.sa/ar/dev-x/cart` is store `dev-x`.\n *\n * There the hostname belongs to every store, so the API cannot be asked about it\n * (it answers 422 and the page reads \"Store Unavailable\"), and only the dispatcher\n * has already read the username out of the path to choose this theme.\n *\n * Trusted because nothing else can set it. A theme worker is reached only through\n * the dispatcher, which hands it the headers on its own allowlist and then this one;\n * a visitor's copy never arrives. On a merchant's own domain the dispatcher does\n * not send it, so the hostname stays the store there.\n */\nexport const STORE_BASE_HEADER = 'x-salla-store-base';\n\n/** {@link RequestStore}, plus where the store segment sits in the path. */\nexport interface AddressedStore extends RequestStore {\n /**\n * True when the store segment follows the locale (`/ar/dev-x/cart`), as on a\n * Salla shared host; false when it is the root (`/mtgr-alaatr-2/ar/cart`), as on\n * the preview host and a dev server.\n */\n storeBaseFollowsLocale: boolean;\n}\n\n/**\n * The store this request addressed, counting the one the dispatcher named.\n *\n * The dispatcher's answer comes first and replaces the others: on a shared host it\n * is the address the visitor typed, read by the service that routed it here. Any\n * other request is resolved as {@link resolveRequestStore} always has, with the\n * segment at the root.\n */\nexport function resolveAddressedStore(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined,\n dispatchedStoreBase: string | null | undefined\n): AddressedStore {\n if (isStoreBaseSegment(dispatchedStoreBase)) {\n return { storeBase: dispatchedStoreBase, storeId: null, storeBaseFollowsLocale: true };\n }\n return { ...resolveRequestStore(url, cookieHeader, host), storeBaseFollowsLocale: false };\n}\n\n/**\n * The theme-settings version this request names, on a host permitted to name one.\n *\n * Same shape and the same host gate as {@link resolveRequestStoreId}, deliberately:\n * both answer \"what did this request ask to be shown?\", both are reached only on\n * a host that serves more than one thing, and a version that could be named where\n * a store could not would be a second rule to keep in step with the first.\n *\n * Null is the ordinary answer, and it is not a failure — it means nothing\n * addressed a version, so the store's own live one is what gets rendered.\n */\nexport function resolveRequestVersionId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, VERSION_ID_PARAM, VERSION_ID_COOKIE_NAME);\n}\n\n/**\n * The id this request names, from the query first and the cookie after.\n *\n * The host check lives here rather than at either call site, for the reason the\n * two wrappers above are wrappers at all: there must be no way to ask what a\n * request named without also asking whether this host may say.\n */\nfunction resolveRequestId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined,\n param: string,\n cookieName: string\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let fromQuery: string | null = null;\n try {\n fromQuery = parseRequestId(new URL(url).searchParams.get(param));\n } catch {\n /* a relative or malformed URL simply names nothing */\n }\n return fromQuery ?? parseRequestId(extractTokenFromCookies(cookieHeader, cookieName));\n}\n\n/**\n * Deletes the auth `token` cookie. This cookie is written client-side by the theme\n * (TwilightProvider), not by the SDK — `salla.cookie.clearAll()` only clears its own\n * allowlist and leaves `token` behind — so logout must clear it here. Client-only.\n */\n/**\n * On a dev server, remembers the store the page is showing, so a later URL that\n * names no store keeps it instead of falling back to `VITE_STORE_DOMAIN`.\n * Loopback only: on the preview host this cookie belongs to the dispatcher. Client-only.\n */\nexport function rememberDevStoreId(id: string | number | null | undefined): void {\n if (typeof document === 'undefined' || !isLoopback(window.location.hostname)) return;\n const storeId = parseStoreId(id == null ? null : String(id));\n if (storeId) document.cookie = `${STORE_ID_COOKIE_NAME}=${storeId}; path=/; SameSite=Lax`;\n}\n\nexport function clearAuthTokenCookie(): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n}\n\nexport function extractTokenFromCookies(\n cookieHeader: string | null,\n cookieName: string\n): string | null {\n if (!cookieHeader) return null;\n\n const prefix = `${cookieName}=`;\n let start = 0;\n\n while (start < cookieHeader.length) {\n const idx = cookieHeader.indexOf(prefix, start);\n if (idx === -1) return null;\n\n const prevChar = idx > 0 ? cookieHeader[idx - 1] : '';\n if (prevChar === '' || prevChar === ';' || prevChar === ' ') {\n let end = cookieHeader.indexOf(';', idx);\n if (end === -1) end = cookieHeader.length;\n\n const value = cookieHeader.slice(idx + prefix.length, end).trim();\n try {\n return decodeURIComponent(value) || null;\n } catch {\n return value || null;\n }\n }\n\n start = idx + prefix.length;\n }\n\n return null;\n}\n\n/**\n * The scope the Salla SDK persists as `scope`: the market (`id`/`type`) plus, once\n * bullet delivery confirms an address or branch, the allocation. The SDK sends all\n * four as request headers (`s-scope-id`, `s-scope-type`, `s-scope-allocation-type`,\n * `s-scope-allocation-id`) and the API resolves stock per allocation — a scope sent\n * without its allocation is a different question, answered from a different branch.\n */\nexport interface ActiveScope {\n id: string;\n type?: string;\n allocation_type?: string;\n allocation_id?: string;\n}\n\n/** The SDK stores the scope either as its full object or as a bare id. */\nfunction normalizeScope(raw: unknown): ActiveScope | null {\n if (raw == null) return null;\n if (typeof raw !== 'object') return { id: String(raw) };\n const s = raw as Record<string, unknown>;\n if (s.id == null) return null;\n const scope: ActiveScope = { id: String(s.id) };\n if (s.type != null) scope.type = String(s.type);\n if (s.allocation_type != null) scope.allocation_type = String(s.allocation_type);\n if (s.allocation_id != null) scope.allocation_id = String(s.allocation_id);\n return scope;\n}\n\n/**\n * Reads the active scope from the `scope` cookie, which Salla persists as a JSON\n * object (e.g. `{\"id\":123,\"type\":\"scope\",\"allocation_type\":\"branch\",\"allocation_id\":\"9\"}`).\n * Returns null when the cookie is missing or unparseable. Used server-side, where\n * `salla.storage` is absent.\n */\nexport function extractScopeFromCookies(cookieHeader: string | null): ActiveScope | null {\n const raw = extractTokenFromCookies(cookieHeader, SCOPE_COOKIE_NAME);\n if (!raw) return null;\n try {\n return normalizeScope(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\n/** `value` when it is a currency code, else null: the cookie's value goes into a request header. */\nexport function toCurrencyCode(value: string | null | undefined): string | null {\n return value && /^[A-Z]{3}$/.test(value) ? value : null;\n}\n\n/** The currency the visitor chose (`s-curr`, written by the SDK), or null for the store's own. */\nexport function extractCurrencyFromCookies(cookieHeader: string | null): string | null {\n return toCurrencyCode(extractTokenFromCookies(cookieHeader, CURRENCY_COOKIE_NAME));\n}\n\n/** {@link extractScopeFromCookies} reduced to the id. */\nexport function extractScopeIdFromCookies(cookieHeader: string | null): string | null {\n return extractScopeFromCookies(cookieHeader)?.id ?? null;\n}\n\n/**\n * The scope the Salla SDK persisted in its storage (`salla.storage.get('scope')`).\n *\n * Returns `undefined` when the SDK storage API isn't ready yet — deliberately\n * distinct from `null` (\"no branch selected\"), so callers can't mistake a\n * not-yet-hydrated SDK for a cleared selection. Client-only.\n *\n * Storage the SDK has loaded but not yet initialised counts as not ready: it is\n * what the previous visit left, and `init` replaces it with the scope the page\n * was rendered for and the one `?scope=` names. Read before that, it would\n * outvote the `scope` cookie the server wrote for this page.\n */\nexport function readSdkScope(): ActiveScope | null | undefined {\n const sdk = typeof window !== 'undefined' ? window.salla : undefined;\n const storage = sdk?.storage;\n if (typeof storage?.get !== 'function') return undefined;\n const status = (sdk as { status?: unknown } | undefined)?.status;\n if (status !== undefined && status !== 'ready') return undefined;\n return normalizeScope(storage.get(SCOPE_COOKIE_NAME));\n}\n\n/** The type of a multi-market (Country Scopes) store's scopes, which `s-scope-type` must name. */\nconst MARKET_SCOPE_TYPE = 'scope';\n\nconst ALLOCATION_TYPES = ['address', 'branch'];\n\n/** An encoded branch id, or the `msa_` token several branches are packed into. */\nconst ALLOCATION_ID = /^(?:[1-9][0-9]{0,18}|msa_[A-Za-z0-9+/=_-]{1,2048})$/;\n\n/**\n * The scope a page URL names, the way Twig storefronts switch market: the SDK's\n * scopes modal reloads the page with `?scope=<id>`, and a branch picked for it\n * travels as `allocation_type` / `allocation_id`. Null when the URL names none\n * or names it malformed; an allocation is kept only when both halves are valid.\n */\nexport function extractScopeFromUrl(url: string): ActiveScope | null {\n let params: URLSearchParams;\n try {\n params = new URL(url).searchParams;\n } catch {\n return null;\n }\n const id = parseRequestId(params.get('scope'));\n if (!id) return null;\n\n const scope: ActiveScope = { id };\n const allocationType = params.get('allocation_type');\n const allocationId = params.get('allocation_id');\n if (\n allocationType &&\n ALLOCATION_TYPES.includes(allocationType) &&\n allocationId &&\n ALLOCATION_ID.test(allocationId)\n ) {\n scope.allocation_type = allocationType;\n scope.allocation_id = allocationId;\n }\n return scope;\n}\n\n/**\n * The scope a request is for: the one its URL names, else the `scope` cookie.\n *\n * The URL wins because it is the newer choice: it is how a market is switched,\n * and the cookie still holds the one switched from. Merged with that cookie only\n * when both name the same scope; a different scope does not inherit the previous\n * one's branch. The type is store-wide, so it comes from the cookie, or is the\n * multi-market one when there is no cookie yet — the settings answer corrects it\n * for a store that browses by branch or city (see `rootBeforeLoad`).\n */\nexport function resolveRequestScope(url: string, cookieHeader: string | null): ActiveScope | null {\n const fromCookie = extractScopeFromCookies(cookieHeader);\n const fromUrl = extractScopeFromUrl(url);\n if (!fromUrl) return fromCookie;\n if (fromCookie?.id === fromUrl.id) return { ...fromCookie, ...fromUrl };\n return { ...fromUrl, type: fromCookie?.type ?? MARKET_SCOPE_TYPE };\n}\n\n/** {@link readSdkScope} reduced to the id; keeps the not-ready/none distinction. */\nexport function readSdkScopeId(): string | null | undefined {\n const scope = readSdkScope();\n return scope === undefined ? undefined : (scope?.id ?? null);\n}\n\n/** One year — the SDK keeps the selected branch in localStorage indefinitely. */\nexport const SCOPE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\nexport const sameScope = (a: ActiveScope | null, b: ActiveScope | null): boolean =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Mirrors the scope the Salla SDK selected into the `scope` cookie so the SERVER\n * can see it. The SDK persists the selection in localStorage ONLY and writes no\n * cookie, so without this the server computes scope=null for every visitor who\n * picked a branch while the client computes the branch id — the dehydrated settings\n * query key never matches and the client refetches store settings on every page\n * load (SAL-122).\n *\n * Written in the SDK's own JSON shape so {@link extractScopeFromCookies} parses it,\n * allocation included: the bullet-delivery component writes the same cookie with the\n * full object, and rewriting it with the id alone would drop the branch the server\n * needs. Returns true when the cookie was (re)written. Client-only; no-op on the server.\n */\nexport function writeScopeCookie(scope: ActiveScope | null): boolean {\n if (typeof document === 'undefined') return false;\n if (sameScope(extractScopeFromCookies(document.cookie), scope)) return false;\n\n if (scope == null) {\n document.cookie = `${SCOPE_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n return true;\n }\n\n const value = encodeURIComponent(JSON.stringify(scope));\n document.cookie = `${SCOPE_COOKIE_NAME}=${value}; path=/; max-age=${SCOPE_COOKIE_MAX_AGE}; samesite=lax`;\n return true;\n}\n\n/**\n * Keeps the `scope` cookie in step with the SDK's selected branch. Call on every\n * client navigation; it no-ops while the SDK storage API is still hydrating so a\n * late-loading SDK can't wipe a valid cookie.\n */\nexport function syncScopeCookie(): boolean {\n const scope = readSdkScope();\n return scope === undefined ? false : writeScopeCookie(scope);\n}\n","/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n /**\n * True when {@link storeBase} sits behind the locale (`/ar/dev-x/cart`), as on a\n * Salla shared host. Published with it: a client router that put the segment in\n * the other place would build every link to a page the dispatcher cannot route.\n * Absent when false, like the other flags here.\n */\n storeBaseFollowsLocale?: boolean;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, storeBaseFollowsLocale, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n storeBaseFollowsLocale:\n injected.storeBaseFollowsLocale || (storeBase ? storeBaseFollowsLocale : false) || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview The language of a page on a Salla shared host, where the URL does not carry it.\n *\n * On `demostore.salla.sa` and `salla.sa` a store is addressed `/dev-x/cart`. The route tree\n * still has a `/{-$locale}` segment, so the router puts a *virtual* locale in front of the\n * path on the way in and takes it off on the way out (`tanstack/store-base.ts`). This file\n * decides which one, and what to do when the choice is not one the store offers. See\n * `docs/store-base-path.md`.\n *\n * Pure: no request, no cookies written. The callers read and write those.\n */\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { extractTokenFromCookies, LANGUAGE_COOKIE_NAME, LANGUAGE_PARAM } from './cookies';\n\n/** A language code from a request, if it is one the engine knows. Case is not significant. */\nfunction knownLocale(value: string | null | undefined): string | null {\n const code = value?.toLowerCase();\n return isLocale(code) ? code : null;\n}\n\nfunction safeDecode(value: string): string {\n try {\n return decodeURIComponent(value);\n } catch {\n return value;\n }\n}\n\n/** The value of `?lang=` in a query string (with or without the `?`), or null when absent. */\nfunction langParam(search: string): string | null {\n for (const part of search.replace(/^\\?/, '').split('&')) {\n const [key, value = ''] = part.split('=');\n if (safeDecode(key) === LANGUAGE_PARAM) return safeDecode(value);\n }\n return null;\n}\n\n/** Whether a query string (with or without the `?`) carries `lang`, whatever its value. */\nexport function hasLanguageParam(search: string): boolean {\n return langParam(search) !== null;\n}\n\n/** The language the `s-lang` cookie remembers, if it is a known one. */\nexport function languageFromCookies(cookieHeader: string | null): string | null {\n return knownLocale(extractTokenFromCookies(cookieHeader, LANGUAGE_COOKIE_NAME));\n}\n\n/**\n * The language a request on a shared host is for, before the store's settings are known:\n * `?lang=`, then the `s-lang` cookie, then {@link FALLBACK_LOCALE}. Each must be a language\n * the engine knows; whether the store offers it is {@link decideSharedHostLanguage}'s\n * question.\n */\nexport function virtualLocale(search: string, cookieHeader: string | null): string {\n return knownLocale(langParam(search)) ?? languageFromCookies(cookieHeader) ?? FALLBACK_LOCALE;\n}\n\n/** The ISO codes (lower case) a store lists, or null when its settings did not say. */\nfunction listedLocales(settings: StoreContext): string[] | null {\n const codes = (settings.languages ?? [])\n .map((language) => (language.iso_code ?? language.code)?.toLowerCase())\n .filter((code): code is string => Boolean(code));\n return codes.length ? codes : null;\n}\n\n/**\n * Whether the store has more than one language to choose between.\n *\n * Both signals count: the merchant's `is_multilingual` switch, and the number of languages\n * the settings list. Either one saying \"single\" makes the store single-language. The count\n * is only used when the settings carry the list at all.\n */\nexport function isMultilingualStore(settings: StoreContext | null | undefined): boolean {\n if (settings?.store?.settings?.is_multilingual === false) return false;\n return settings?.languages == null || settings.languages.length >= 2;\n}\n\n/** The store's default language: the one marked, else the engine's fallback, else the first listed. */\nexport function defaultLanguage(settings: StoreContext): string | null {\n const listed = listedLocales(settings);\n if (!listed) return null;\n const marked = settings.languages?.find((language) => Boolean(language.is_default));\n const markedCode = (marked?.iso_code ?? marked?.code)?.toLowerCase();\n if (markedCode) return markedCode;\n return listed.includes(FALLBACK_LOCALE) ? FALLBACK_LOCALE : listed[0];\n}\n\n/**\n * The languages this store can be shown in, or null when its settings did not list any\n * (nothing to check against). A store that is not multilingual shows its default only.\n */\nexport function offeredLanguages(settings: StoreContext): string[] | null {\n const listed = listedLocales(settings);\n if (!listed) return null;\n if (isMultilingualStore(settings)) return listed;\n const only = defaultLanguage(settings);\n return only ? [only] : listed;\n}\n\n/** `search` (a query string, with or without `?`) without `lang`, and then `lang=<code>` if given. */\nexport function withLanguageParam(search: string, code?: string): string {\n const kept = search\n .replace(/^\\?/, '')\n .split('&')\n .filter((part) => part && safeDecode(part.split('=')[0]) !== LANGUAGE_PARAM);\n if (code) kept.push(`${LANGUAGE_PARAM}=${encodeURIComponent(code)}`);\n return kept.length ? `?${kept.join('&')}` : '';\n}\n\nexport interface SharedHostLanguage {\n /** A language to remember in the `s-lang` cookie, or null to leave the cookie alone. */\n cookie: string | null;\n /** Where to send the visitor (path, query and hash, in the address the browser uses), or null to render. */\n redirectTo: string | null;\n}\n\n/**\n * What to do with the language of a page on a shared host, once the store's settings are in.\n *\n * - `?lang=` asking for a language the store offers is remembered in the cookie. It is taken\n * off the URL with a redirect when that cannot change what the next request renders: the\n * cookie already says it, or it is the fallback a cookieless request gets anyway. Otherwise\n * it stays, so a visitor whose browser drops the cookie is not sent round in circles.\n * - `?lang=` asking for one the store does not offer is dropped, and nothing is remembered.\n * - No `?lang=`, and the language the request resolved to is not offered (a stale cookie\n * from another store on this host, or the fallback of a store that does not offer it):\n * sent to `?lang=<the store's default>`.\n *\n * Every redirect either removes `?lang=` or adds one for an offered language, so none\n * returns the request to itself.\n *\n * @param href - the browser's address for this page: path (with the store segment, without\n * a language), query and hash.\n * @param locale - the language the request resolved to ({@link virtualLocale}).\n */\nexport function decideSharedHostLanguage(args: {\n settings: StoreContext;\n locale: string;\n href: string;\n cookieHeader: string | null;\n}): SharedHostLanguage {\n const { settings, locale, href, cookieHeader } = args;\n const offered = offeredLanguages(settings);\n const url = new URL(href, 'http://shared-host.invalid');\n const withSearch = (search: string) => `${url.pathname}${search}${url.hash}`;\n\n const asked = langParam(url.search);\n if (asked !== null) {\n const wanted = knownLocale(asked);\n if (!wanted || (offered && !offered.includes(wanted))) {\n return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search)) };\n }\n const remembered = languageFromCookies(cookieHeader);\n const clean = remembered === wanted || wanted === FALLBACK_LOCALE;\n return {\n cookie: remembered === wanted ? null : wanted,\n redirectTo: clean ? withSearch(withLanguageParam(url.search)) : null,\n };\n }\n\n if (offered && !offered.includes(locale)) {\n const fallback = defaultLanguage(settings) as string;\n return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search, fallback)) };\n }\n return { cookie: null, redirectTo: null };\n}\n","/**\n * @fileoverview Paths on a host where the store is part of every address.\n *\n * On `preview.salla.design` and a dev server a store is addressed by the first\n * segment of the path — `/mtgr-alaatr-2/cart` — and that segment is the root of\n * the application. No route knows about it: the router takes it off every URL on\n * the way in and puts it back on every URL on the way out\n * (`tanstack/store-base.ts`), so pages, links and loaders all see `/cart`.\n *\n * On a Salla shared host (`demostore.salla.sa`, `salla.sa`) the store is the\n * root too — `/dev-x/cart`, with no language in the address — and the storefront\n * dispatcher names it (`resolveAddressedStore`). The old shape, `/ar/dev-x/cart`,\n * is still read, and redirected once by `twilightMiddleware`. The same two\n * functions move the segment, told which host it is.\n *\n * Which segment it is, and on which hosts, is decided once, in `utils/cookies.ts`.\n * This file only moves it on and off a path. See `docs/store-base-path.md`.\n */\nimport { allowsRequestStoreId, isStoreBaseSegment, STORE_ID_PARAM } from './cookies';\nimport { isLocale } from '../providers/locale-constants';\nimport { withLanguageParam } from './shared-host-language';\n\n/**\n * An application pathname, without the store segment in front.\n *\n * Only a whole segment is removed, so `/mtgr-alaatr-2x/cart` is left alone, and a\n * pathname that does not start with the segment comes back unchanged.\n *\n * With `followsLocale` the segment is also taken from behind a leading locale,\n * where Salla's shared hosts used to put it (`/ar/dev-x/cart` → `/ar/cart`). It is\n * looked for there first, then at the root, which is where it is now\n * (`/dev-x/cart`).\n */\nexport function stripStoreBase(pathname: string, base: string, followsLocale = false): string {\n if (followsLocale) {\n const segments = pathname.split('/');\n if (isLocale(segments[1]) && segments[2] === base) {\n segments.splice(2, 1);\n return segments.join('/');\n }\n }\n\n const prefix = `/${base}`;\n if (pathname === prefix) return '/';\n return pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;\n}\n\n/**\n * A rooted path split into its first segment and what follows it (a path, a query, a hash, or\n * nothing). The segment ends at the first `/`, `?` or `#`. Plain string work, no pattern.\n */\nexport function splitLeadingSegment(rooted: string): { first: string; rest: string } {\n if (!rooted.startsWith('/')) return { first: '', rest: '' };\n let end = 1;\n while (end < rooted.length && rooted[end] !== '/' && rooted[end] !== '?' && rooted[end] !== '#') {\n end += 1;\n }\n return { first: rooted.slice(1, end), rest: rooted.slice(end) };\n}\n\n/**\n * An application path as the browser addresses it, with the store segment in front.\n *\n * It never checks whether the segment is already there, because that cannot be\n * told apart from a page of the same name: a store called `cart` keeps its cart at\n * `/cart/cart`. Callers pass application paths only.\n *\n * With `followsLocale` (a Salla shared host) the address has no language in it at\n * all: a leading locale is dropped (`/ar/cart` → `/dev-x/cart`). The language comes\n * back from `?lang=` or the `s-lang` cookie on the way in (`tanstack/store-base.ts`).\n */\nexport function prefixStoreBase(path: string, base: string, followsLocale = false): string {\n let rooted = path.startsWith('/') ? path : `/${path}`;\n\n if (followsLocale) {\n const { first, rest } = splitLeadingSegment(rooted);\n // What follows the locale is a path (`/cart`), a query or a hash, or nothing: the root.\n if (isLocale(first)) rooted = rest.startsWith('/') ? rest : `/${rest}`;\n }\n\n // The store's root is `/<base>`, not `/<base>/`, with or without a query or hash.\n const atRoot = rooted === '/' || rooted[1] === '?' || rooted[1] === '#';\n return `/${base}${atRoot ? rooted.slice(1) : rooted}`;\n}\n\n/**\n * Where to send a request that still uses the old shared-host address, or null when it\n * does not.\n *\n * Shared hosts used to put the language in front of the store (`/ar/dev-x/cart`) and now\n * leave it out (`/dev-x/cart`). A link in the old shape is sent once to the new one,\n * carrying its language as `?lang=` so the visitor keeps it; the page then remembers it\n * and the language stays out of the address (`rootBeforeLoad`).\n *\n * Only a path that *starts* with a locale and then names this store as a whole segment\n * matches, so a page whose slug is a locale code, or that is spelled like the store, is\n * never redirected. The result is a relative path: it cannot leave the host.\n */\nexport function legacyLocaleRedirectHref(url: string, base: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n\n const segments = parsed.pathname.split('/');\n if (!isLocale(segments[1]) || segments[2] !== base) return null;\n\n const pathname = ['', base, ...segments.slice(3)].join('/');\n // An explicit `?lang=` outranks the old path's language, as it did when it was rewritten\n // into the path.\n const search = parsed.searchParams.has('lang')\n ? parsed.search\n : withLanguageParam(parsed.search, segments[1]);\n return `${pathname}${search}`;\n}\n\n/**\n * A pathname from a link the Salla API handed out, without the store's username in it.\n *\n * A store with no domain of its own is served under its username on a shared host,\n * and every URL the API returns for it carries that segment. Its `store.url` is\n * `/{lang}/{username}/` when the store is multilingual and `/{username}/` when it is\n * not: `https://demostore.salla.sa/ar/dev-vgckq3fssfhjewwi/`, `https://salla.sa/cart/`.\n * The segment there belongs to Salla's host, not to the application. Left in, it\n * lands where a page slug is expected and matches no route.\n *\n * The username is the last segment of `store.url`, but only when it equals the\n * store's username. Neither its position nor its spelling says so on its own: `/ar/`\n * is the locale of `https://3tir.com/ar/`, a store on its own domain whose links carry\n * no username, and it is also the whole address of the store called `ar`,\n * `https://salla.sa/ar/`. Without a username to compare against, a last segment\n * spelled like a locale is taken to be one, which is wrong only for a store whose\n * username is a locale code.\n *\n * The locale stays wherever the link put it.\n */\nexport function withoutStoreUrlBase(\n pathname: string,\n storeUrlPathname: string,\n username?: string | null\n): string {\n const own = storeUrlSegment(storeUrlPathname, username);\n if (!own) return pathname;\n\n const segments = pathname.split('/');\n // Salla puts the locale first (`/ar/dev-x/…`); a store that is not multilingual has\n // none (`/dev-x/…`). Checked in that order, `/ar/ar/…` for a store called `ar` keeps\n // its locale.\n let at = -1;\n if (isLocale(segments[1]) && segments[2] === own) at = 2;\n else if (segments[1] === own) at = 1;\n if (at === -1) return pathname;\n\n segments.splice(at, 1);\n return segments.join('/') || '/';\n}\n\n/**\n * Whether a pathname on the store's host is this store's.\n *\n * On a shared host the origin belongs to every store there, and a link names its store\n * by the username in its path, where {@link withoutStoreUrlBase} looks for it. One\n * without it is another store's page, or the host's own. A store on its own domain has\n * no such segment, and every path on its host is its own.\n */\nexport function hasStoreUrlBase(\n pathname: string,\n storeUrlPathname: string,\n username?: string | null\n): boolean {\n const own = storeUrlSegment(storeUrlPathname, username);\n if (!own) return true;\n\n const segments = pathname.split('/');\n return segments[1] === own || (isLocale(segments[1]) && segments[2] === own);\n}\n\n/** The segment `store.url` serves the store under, or null when it has none. */\nfunction storeUrlSegment(storeUrlPathname: string, username?: string | null): string | null {\n const last = storeUrlPathname.split('/').filter(Boolean).pop();\n if (!last) return null;\n if (username) return last === username ? last : null;\n return isLocale(last) ? null : last;\n}\n\n/**\n * Where to send a page whose store was not named by its own first segment, or null\n * when it already was.\n *\n * On a host where the store is the root, every page has one address,\n * `/<username>/…`. A request that found its store some other way (`?storeId=`, the\n * preview cookie, `VITE_STORE_DOMAIN`, or a first segment that named the store by\n * another spelling, such as its numeric id) is sent there once the store's settings\n * say what its username is.\n *\n * `storeId` is dropped from the query on the way. It has to be: a URL carrying it\n * is never read for a store segment, so keeping it would redirect to an address\n * that redirects again, forever. For the same reason a username that could not be\n * read back out of a path produces no redirect at all.\n *\n * `href` is the application's own href (path, query and hash, already without any\n * store segment), which the router keeps percent-encoded, so the result is safe to\n * put in a `Location` header.\n */\nexport function storeBaseRedirectHref(args: {\n host: string | null | undefined;\n base: string | null;\n username: string | null | undefined;\n href: string;\n}): string | null {\n const { host, base, username, href } = args;\n if (!allowsRequestStoreId(host) || !isStoreBaseSegment(username) || username === base) {\n return null;\n }\n\n const url = new URL(href, 'http://store-base.invalid');\n url.searchParams.delete(STORE_ID_PARAM);\n return `${prefixStoreBase(url.pathname, username)}${url.search}${url.hash}`;\n}\n\n/**\n * Where to send a guest who opened a customer-only page: the locale's home with\n * `intended_to`, which the SDK reads to open the login modal and come back after.\n * Null when already there, so the redirect cannot loop.\n */\nexport function loginRedirectHref(args: {\n pathname: string;\n searchStr: string;\n origin: string;\n base: string | null;\n baseFollowsLocale?: boolean;\n}): string | null {\n const { pathname, searchStr, origin, base, baseFollowsLocale = false } = args;\n const first = pathname.split('/')[1];\n const home = isLocale(first) ? `/${first}` : '/';\n if ((pathname.replace(/\\/$/, '') || '/') === home) return null;\n\n const browserPath = (path: string) =>\n base ? prefixStoreBase(path, base, baseFollowsLocale) : path;\n const intended = `${origin}${browserPath(pathname)}${searchStr}`;\n return `${browserPath(home)}?intended_to=${encodeURIComponent(intended)}`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * Whether {@link resolveStoreBase}'s segment sits behind the locale\n * (`/ar/dev-x/cart`) rather than at the root of the path.\n *\n * True only on a Salla shared host, where the dispatcher named the store. Read\n * from the same place as the segment, so the two always describe one address: the\n * request on the server, what SSR published in the browser.\n */\nexport function resolveStoreBaseFollowsLocale(): boolean {\n const { storeBase, storeBaseFollowsLocale } = getRequestStore();\n if (storeBase) return storeBaseFollowsLocale;\n if (typeof window === 'undefined') return false;\n\n const published = getInjectedRuntimeEnv();\n return Boolean(published.storeBase && published.storeBaseFollowsLocale);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { HomeComponentRenderer, ReorderProducts } from './chunk-YDKPG3AP.js';
2
- import { home } from './chunk-U46RGTYO.js';
3
- import { useDevHomeBlocks } from './chunk-HSKRX3WR.js';
4
- import { storePageUrl, buildHreflangAlternates } from './chunk-4SZZPXM2.js';
1
+ import { HomeComponentRenderer, ReorderProducts } from './chunk-ONRRKJWG.js';
2
+ import { home } from './chunk-E7AO2Q32.js';
3
+ import { useDevHomeBlocks } from './chunk-FMSRB2TT.js';
4
+ import { storePageUrl, buildHreflangAlternates } from './chunk-TMMK2VYE.js';
5
5
  import { RouteId } from './chunk-OUW6WESU.js';
6
6
  import { HookSlot } from './chunk-5XDPAKF5.js';
7
7
  import { getTwilightContext } from './chunk-QRHXAKJ3.js';
@@ -87,5 +87,5 @@ function head(ctx) {
87
87
  var Home = { id: RouteId.INDEX, loader, head, Component: HomePage };
88
88
 
89
89
  export { Home, HomeSkeleton, homeLoader };
90
- //# sourceMappingURL=chunk-I2ZO57UV.js.map
91
- //# sourceMappingURL=chunk-I2ZO57UV.js.map
90
+ //# sourceMappingURL=chunk-RCCVUE72.js.map
91
+ //# sourceMappingURL=chunk-RCCVUE72.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,K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AAAA,MACT,IAAA,EAAM,SAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM,IAAA;AAAA,MACd;AAAA,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-I2ZO57UV.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport type { HomePageProps } from './types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {renderedComponents.map((data, index) => (\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. Position is unique; a dev\n // layout block keeps its own id so a reorder doesn't remount the rest.\n <HomeComponentRenderer key={data.__dev_id ?? index} data={data} index={index} />\n ))}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
1
+ {"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AAAM,GAC9B;AACA,EAAA,OAAO,MAAA;AACT;AChBO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAI,SAAA,EAAU,uCAAA,EACb,8BAAC,KAAA,EAAA,EA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AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-RCCVUE72.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport type { HomePageProps } from './types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {renderedComponents.map((data, index) => (\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. Position is unique; a dev\n // layout block keeps its own id so a reorder doesn't remount the rest.\n <HomeComponentRenderer key={data.__dev_id ?? index} data={data} index={index} />\n ))}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
@@ -1,21 +1,21 @@
1
1
  import { lazy } from 'react';
2
2
 
3
3
  // src/components/layout/lazy.ts
4
- var LazyHeader = lazy(() => import('./Header-QOAV23HD.js').then((m) => ({ default: m.Header })));
5
- var LazyFooter = lazy(() => import('./Footer-L52M4T24.js').then((m) => ({ default: m.Footer })));
4
+ var LazyHeader = lazy(() => import('./Header-M3Q7KDF5.js').then((m) => ({ default: m.Header })));
5
+ var LazyFooter = lazy(() => import('./Footer-UHLNZNUZ.js').then((m) => ({ default: m.Footer })));
6
6
  var LazyCopyright = lazy(
7
- () => import('./Copyright-KBCQVD5Y.js').then((m) => ({ default: m.Copyright }))
7
+ () => import('./Copyright-YAIOATPE.js').then((m) => ({ default: m.Copyright }))
8
8
  );
9
9
  var LazyMasterLayout = lazy(
10
- () => import('./MasterLayout-FY666JMR.js').then((m) => ({ default: m.MasterLayout }))
10
+ () => import('./MasterLayout-KVMF2U5Z.js').then((m) => ({ default: m.MasterLayout }))
11
11
  );
12
12
  var LazyWidgetHead = lazy(
13
13
  () => import('./WidgetHead-BCRIXIJQ.js').then((m) => ({ default: m.WidgetHead }))
14
14
  );
15
15
  var LazyCustomerLayout = lazy(
16
- () => import('./CustomerLayout-B77ZKB4X.js').then((m) => ({ default: m.CustomerLayout }))
16
+ () => import('./CustomerLayout-4XKCLHWW.js').then((m) => ({ default: m.CustomerLayout }))
17
17
  );
18
18
 
19
19
  export { LazyCopyright, LazyCustomerLayout, LazyFooter, LazyHeader, LazyMasterLayout, LazyWidgetHead };
20
- //# sourceMappingURL=chunk-P36CIH6E.js.map
21
- //# sourceMappingURL=chunk-P36CIH6E.js.map
20
+ //# sourceMappingURL=chunk-ROTFC5YL.js.map
21
+ //# sourceMappingURL=chunk-ROTFC5YL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/layout/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,UAAA,GAAa,IAAA,CAAK,MAAM,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,GAAS,CAAC;AAErF,IAAM,UAAA,GAAa,IAAA,CAAK,MAAM,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,GAAS,CAAC;AAErF,IAAM,aAAA,GAAgB,IAAA;AAAA,EAAK,MAChC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,gBAAA,GAAmB,IAAA;AAAA,EAAK,MACnC,OAAO,4BAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,YAAA,EAAa,CAAE;AACpE;AAEO,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE","file":"chunk-P36CIH6E.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded layout components\n * Use these for code-splitting layout sections\n */\nexport const LazyHeader = lazy(() => import('./Header').then((m) => ({ default: m.Header })));\n\nexport const LazyFooter = lazy(() => import('./Footer').then((m) => ({ default: m.Footer })));\n\nexport const LazyCopyright = lazy(() =>\n import('./Copyright').then((m) => ({ default: m.Copyright }))\n);\n\nexport const LazyMasterLayout = lazy(() =>\n import('./MasterLayout').then((m) => ({ default: m.MasterLayout }))\n);\n\nexport const LazyWidgetHead = lazy(() =>\n import('./WidgetHead').then((m) => ({ default: m.WidgetHead }))\n);\n\nexport const LazyCustomerLayout = lazy(() =>\n import('./CustomerLayout').then((m) => ({ default: m.CustomerLayout }))\n);\n"]}
1
+ {"version":3,"sources":["../src/components/layout/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,UAAA,GAAa,IAAA,CAAK,MAAM,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,GAAS,CAAC;AAErF,IAAM,UAAA,GAAa,IAAA,CAAK,MAAM,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,GAAS,CAAC;AAErF,IAAM,aAAA,GAAgB,IAAA;AAAA,EAAK,MAChC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,gBAAA,GAAmB,IAAA;AAAA,EAAK,MACnC,OAAO,4BAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,YAAA,EAAa,CAAE;AACpE;AAEO,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE","file":"chunk-ROTFC5YL.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded layout components\n * Use these for code-splitting layout sections\n */\nexport const LazyHeader = lazy(() => import('./Header').then((m) => ({ default: m.Header })));\n\nexport const LazyFooter = lazy(() => import('./Footer').then((m) => ({ default: m.Footer })));\n\nexport const LazyCopyright = lazy(() =>\n import('./Copyright').then((m) => ({ default: m.Copyright }))\n);\n\nexport const LazyMasterLayout = lazy(() =>\n import('./MasterLayout').then((m) => ({ default: m.MasterLayout }))\n);\n\nexport const LazyWidgetHead = lazy(() =>\n import('./WidgetHead').then((m) => ({ default: m.WidgetHead }))\n);\n\nexport const LazyCustomerLayout = lazy(() =>\n import('./CustomerLayout').then((m) => ({ default: m.CustomerLayout }))\n);\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-3QJCZSLR.js';
2
- import { api } from './chunk-TTTI4W5F.js';
1
+ import { orThrow } from './chunk-E5PEYI5I.js';
2
+ import { api } from './chunk-BFA2U7P3.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var page = {
@@ -17,5 +17,5 @@ var page = {
17
17
  };
18
18
 
19
19
  export { page };
20
- //# sourceMappingURL=chunk-VDBDYFAL.js.map
21
- //# sourceMappingURL=chunk-VDBDYFAL.js.map
20
+ //# sourceMappingURL=chunk-TL256OK3.js.map
21
+ //# sourceMappingURL=chunk-TL256OK3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/page.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,IAAA,EAAM,OAAO,IAAA,KAA2C;AACtD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AAChF,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,IAAA,KAA2C,QAAQ,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,EAEhF,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,IAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,OAAA,EAAS,QAAA,EAAU,IAAI,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAI;AAAA,KAC9B;AAAA;AAEP","file":"chunk-VDBDYFAL.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { ApiPageResponse } from '../routes/page/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const page = {\n find: async (slug: string): Promise<ApiPageResponse> => {\n const { data } = await api.get(`pages/${slug}`).json<{ data: ApiPageResponse }>();\n return data;\n },\n\n findOrThrow: (slug: string): Promise<ApiPageResponse> => orThrow(page.find(slug)),\n\n queries: {\n detail: (slug: string) =>\n queryOptions({\n queryKey: ['pages', 'detail', slug],\n queryFn: () => page.find(slug),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/page.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,IAAA,EAAM,OAAO,IAAA,KAA2C;AACtD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AAChF,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,IAAA,KAA2C,QAAQ,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,EAEhF,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,IAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,OAAA,EAAS,QAAA,EAAU,IAAI,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAI;AAAA,KAC9B;AAAA;AAEP","file":"chunk-TL256OK3.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { ApiPageResponse } from '../routes/page/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const page = {\n find: async (slug: string): Promise<ApiPageResponse> => {\n const { data } = await api.get(`pages/${slug}`).json<{ data: ApiPageResponse }>();\n return data;\n },\n\n findOrThrow: (slug: string): Promise<ApiPageResponse> => orThrow(page.find(slug)),\n\n queries: {\n detail: (slug: string) =>\n queryOptions({\n queryKey: ['pages', 'detail', slug],\n queryFn: () => page.find(slug),\n }),\n },\n};\n"]}
@@ -1,3 +1,4 @@
1
+ import { resolveStoreBase, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-POI4G5EA.js';
1
2
  import { FALLBACK_LOCALE, isLocale } from './chunk-T72DAX7R.js';
2
3
 
3
4
  // src/utils/baseHead.ts
@@ -10,16 +11,20 @@ function localeToOgLocale(locale) {
10
11
  const base = locale.split(/[-_]/)[0].toLowerCase();
11
12
  return LOCALE_OG_MAP[base] ?? `${base}_${base.toUpperCase()}`;
12
13
  }
14
+ function pageSegmentsOfUrl(pathname, storePath) {
15
+ const parts = pathname.split("/").filter(Boolean);
16
+ const store = storePath.split("/").filter(Boolean);
17
+ const storeAt = (index) => store.length > 0 && store.every((segment, i) => parts[index + i] === segment);
18
+ const localeAt = (index) => parts[index]?.length === 2;
19
+ if (storeAt(0)) return parts.slice(store.length + (localeAt(store.length) ? 1 : 0));
20
+ if (localeAt(0) && storeAt(1)) return parts.slice(1 + store.length);
21
+ return parts.slice(localeAt(0) ? 1 : 0);
22
+ }
13
23
  function extractPath(urlOrPath, storePath = "") {
14
24
  if (!urlOrPath) return "/";
15
25
  try {
16
26
  const parsed = new URL(urlOrPath);
17
- const pathname = storePath && parsed.pathname.startsWith(`${storePath}/`) ? parsed.pathname.slice(storePath.length) : parsed.pathname;
18
- const pathParts = pathname.split("/").filter(Boolean);
19
- if (pathParts.length > 0 && pathParts[0].length === 2) {
20
- pathParts.shift();
21
- }
22
- return "/" + pathParts.join("/");
27
+ return "/" + pageSegmentsOfUrl(parsed.pathname, storePath).join("/");
23
28
  } catch {
24
29
  const pathParts = urlOrPath.split("/").filter(Boolean);
25
30
  if (pathParts.length > 0 && pathParts[0].length === 2) {
@@ -38,15 +43,39 @@ function extractBaseUrl(storeUrl) {
38
43
  return storeUrl.replace(/\/[a-z]{2}\/?$/i, "").replace(/\/$/, "");
39
44
  }
40
45
  }
46
+ function storeRootUrl(storeUrl) {
47
+ const base = resolveStoreBase();
48
+ if (base && resolveStoreBaseFollowsLocale()) {
49
+ try {
50
+ return `${new URL(storeUrl).origin}/${base}`;
51
+ } catch {
52
+ }
53
+ }
54
+ return extractBaseUrl(storeUrl);
55
+ }
56
+ function languageInQuery() {
57
+ return Boolean(resolveStoreBase() && resolveStoreBaseFollowsLocale());
58
+ }
59
+ function sharedHostPage(routerPath, fallbackLocale) {
60
+ const { first, rest } = splitLeadingSegment(routerPath);
61
+ const leading = isLocale(first);
62
+ const remainder = leading ? rest : routerPath;
63
+ const locale = leading ? first : fallbackLocale;
64
+ return {
65
+ path: remainder === "/" ? "" : remainder,
66
+ search: locale ? `?lang=${encodeURIComponent(locale)}` : ""
67
+ };
68
+ }
41
69
  function storePageUrl(settings, path) {
42
70
  const storeUrl = settings?.store?.url;
43
71
  if (!storeUrl) return void 0;
44
- const base = extractBaseUrl(storeUrl);
45
- if (path === "/") return base;
72
+ const base = storeRootUrl(storeUrl);
73
+ const page = languageInQuery() ? sharedHostPage(path) : { path: path === "/" ? "" : path, search: "" };
74
+ if (!page.path && !page.search) return base;
46
75
  try {
47
- return new URL(`${base}${path}`).href;
76
+ return new URL(`${base}${page.path}${page.search}`).href;
48
77
  } catch {
49
- return `${base}${path}`;
78
+ return `${base}${page.path}${page.search}`;
50
79
  }
51
80
  }
52
81
  function buildHreflangAlternates(settings, path) {
@@ -54,11 +83,13 @@ function buildHreflangAlternates(settings, path) {
54
83
  if (!languages?.length) {
55
84
  return void 0;
56
85
  }
57
- const baseUrl = settings?.store?.url ? extractBaseUrl(settings.store.url) : "";
86
+ const baseUrl = settings?.store?.url ? storeRootUrl(settings.store.url) : "";
58
87
  const extractedPath = extractPath(path, baseUrl.replace(/^https?:\/\/[^/]+/, ""));
59
88
  const defaultLang = languages.find((l) => l.code === FALLBACK_LOCALE) ?? languages[0];
89
+ const inQuery = languageInQuery();
60
90
  const buildUrl = (langCode) => {
61
- return `${baseUrl}/${langCode}${extractedPath === "/" ? "" : extractedPath}`;
91
+ const pagePath = extractedPath === "/" ? "" : extractedPath;
92
+ return inQuery ? `${baseUrl}${pagePath}?lang=${encodeURIComponent(langCode)}` : `${baseUrl}/${langCode}${pagePath}`;
62
93
  };
63
94
  return [
64
95
  { hreflang: "x-default", href: buildUrl(defaultLang.code) },
@@ -71,9 +102,11 @@ function buildBaseHead(settings, locale = FALLBACK_LOCALE, path) {
71
102
  const title = store.meta?.title || store.name;
72
103
  const description = store.meta?.description || store.description || void 0;
73
104
  const keywords = store.meta?.keywords || void 0;
74
- const baseUrl = store.url ? extractBaseUrl(store.url) : void 0;
75
- const canonicalUrl = path && baseUrl ? `${baseUrl}${path}` : void 0;
76
- const ogUrl = path && baseUrl ? `${baseUrl}/${locale}${path === "/" ? "" : path}` : void 0;
105
+ const baseUrl = store.url ? storeRootUrl(store.url) : void 0;
106
+ const page = path && languageInQuery() ? sharedHostPage(path, locale) : null;
107
+ const canonicalUrl = path && baseUrl ? page ? `${baseUrl}${page.path}${page.search}` : `${baseUrl}${path}` : void 0;
108
+ const pagePath = path === "/" ? "" : path;
109
+ const ogUrl = path && baseUrl ? page ? canonicalUrl : `${baseUrl}/${locale}${pagePath}` : void 0;
77
110
  const twitterHandle = store.social?.twitter?.split("?")[0].replace(/\/+$/, "").split("/").pop()?.replace(/^@/, "");
78
111
  const twitterSite = twitterHandle ? `@${twitterHandle}` : void 0;
79
112
  return {
@@ -102,5 +135,5 @@ function buildBaseHead(settings, locale = FALLBACK_LOCALE, path) {
102
135
  }
103
136
 
104
137
  export { buildBaseHead, buildHreflangAlternates, localeToOgLocale, storePageUrl };
105
- //# sourceMappingURL=chunk-4SZZPXM2.js.map
106
- //# sourceMappingURL=chunk-4SZZPXM2.js.map
138
+ //# sourceMappingURL=chunk-TMMK2VYE.js.map
139
+ //# sourceMappingURL=chunk-TMMK2VYE.js.map