@monetize.software/sdk-extension 3.0.0-alpha.2 → 3.0.0-alpha.20

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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -20
  3. package/dist/chunks/ar-7cgIM-Vl.js +2 -0
  4. package/dist/chunks/ar-7cgIM-Vl.js.map +1 -0
  5. package/dist/chunks/ar-B2Wg_IrC.js +126 -0
  6. package/dist/chunks/ar-B2Wg_IrC.js.map +1 -0
  7. package/dist/chunks/chrome-port-BEMjZQAH.js +2 -0
  8. package/dist/chunks/chrome-port-BEMjZQAH.js.map +1 -0
  9. package/dist/chunks/{chrome-port-DPFUj1MP.js → chrome-port-bfTUUDz_.js} +332 -211
  10. package/dist/chunks/chrome-port-bfTUUDz_.js.map +1 -0
  11. package/dist/chunks/cs-BNo9Dx0Q.js +122 -0
  12. package/dist/chunks/cs-BNo9Dx0Q.js.map +1 -0
  13. package/dist/chunks/cs-S05PC5AC.js +2 -0
  14. package/dist/chunks/cs-S05PC5AC.js.map +1 -0
  15. package/dist/chunks/da-Bi4zBG14.js +2 -0
  16. package/dist/chunks/da-Bi4zBG14.js.map +1 -0
  17. package/dist/chunks/da-Do9Lq6En.js +122 -0
  18. package/dist/chunks/da-Do9Lq6En.js.map +1 -0
  19. package/dist/chunks/de-C8pDZNvx.js +141 -0
  20. package/dist/chunks/de-C8pDZNvx.js.map +1 -0
  21. package/dist/chunks/de-nCDB6D2W.js +2 -0
  22. package/dist/chunks/de-nCDB6D2W.js.map +1 -0
  23. package/dist/chunks/el-BrKaa978.js +2 -0
  24. package/dist/chunks/el-BrKaa978.js.map +1 -0
  25. package/dist/chunks/el-DzMNX-_P.js +126 -0
  26. package/dist/chunks/el-DzMNX-_P.js.map +1 -0
  27. package/dist/chunks/es-B-Wtyzrl.js +2 -0
  28. package/dist/chunks/es-B-Wtyzrl.js.map +1 -0
  29. package/dist/chunks/es-YrKt-q4w.js +141 -0
  30. package/dist/chunks/es-YrKt-q4w.js.map +1 -0
  31. package/dist/chunks/fi-Bh44pwZ4.js +122 -0
  32. package/dist/chunks/fi-Bh44pwZ4.js.map +1 -0
  33. package/dist/chunks/fi-D1SGXjnO.js +2 -0
  34. package/dist/chunks/fi-D1SGXjnO.js.map +1 -0
  35. package/dist/chunks/fr-Bc0pw4ws.js +141 -0
  36. package/dist/chunks/fr-Bc0pw4ws.js.map +1 -0
  37. package/dist/chunks/fr-BhYf-iKk.js +2 -0
  38. package/dist/chunks/fr-BhYf-iKk.js.map +1 -0
  39. package/dist/chunks/he-BXAaFv6Y.js +2 -0
  40. package/dist/chunks/he-BXAaFv6Y.js.map +1 -0
  41. package/dist/chunks/he-Bfm-bhe3.js +126 -0
  42. package/dist/chunks/he-Bfm-bhe3.js.map +1 -0
  43. package/dist/chunks/hi-D-O-B9Dn.js +126 -0
  44. package/dist/chunks/hi-D-O-B9Dn.js.map +1 -0
  45. package/dist/chunks/hi-xblDO0O7.js +2 -0
  46. package/dist/chunks/hi-xblDO0O7.js.map +1 -0
  47. package/dist/chunks/hu-CmIuAbLL.js +122 -0
  48. package/dist/chunks/hu-CmIuAbLL.js.map +1 -0
  49. package/dist/chunks/hu-Wa46p0y4.js +2 -0
  50. package/dist/chunks/hu-Wa46p0y4.js.map +1 -0
  51. package/dist/chunks/id-CQEo5X94.js +2 -0
  52. package/dist/chunks/id-CQEo5X94.js.map +1 -0
  53. package/dist/chunks/id-DN7IES-A.js +122 -0
  54. package/dist/chunks/id-DN7IES-A.js.map +1 -0
  55. package/dist/chunks/it-8AYCm0xz.js +2 -0
  56. package/dist/chunks/it-8AYCm0xz.js.map +1 -0
  57. package/dist/chunks/it-Cz5Nmqx5.js +141 -0
  58. package/dist/chunks/it-Cz5Nmqx5.js.map +1 -0
  59. package/dist/chunks/ja-BH9BlBh2.js +145 -0
  60. package/dist/chunks/ja-BH9BlBh2.js.map +1 -0
  61. package/dist/chunks/ja-q-COVayn.js +2 -0
  62. package/dist/chunks/ja-q-COVayn.js.map +1 -0
  63. package/dist/chunks/ko-B6HRCscZ.js +2 -0
  64. package/dist/chunks/ko-B6HRCscZ.js.map +1 -0
  65. package/dist/chunks/ko-CYV9QuYs.js +145 -0
  66. package/dist/chunks/ko-CYV9QuYs.js.map +1 -0
  67. package/dist/chunks/nl-BvkB900D.js +141 -0
  68. package/dist/chunks/nl-BvkB900D.js.map +1 -0
  69. package/dist/chunks/nl-CAd6_xlm.js +2 -0
  70. package/dist/chunks/nl-CAd6_xlm.js.map +1 -0
  71. package/dist/chunks/no-3s9_ormb.js +122 -0
  72. package/dist/chunks/no-3s9_ormb.js.map +1 -0
  73. package/dist/chunks/no-CAmz6bz6.js +2 -0
  74. package/dist/chunks/no-CAmz6bz6.js.map +1 -0
  75. package/dist/chunks/pl-C9WTGQtb.js +122 -0
  76. package/dist/chunks/pl-C9WTGQtb.js.map +1 -0
  77. package/dist/chunks/pl-DqUSTCaF.js +2 -0
  78. package/dist/chunks/pl-DqUSTCaF.js.map +1 -0
  79. package/dist/chunks/port-name-CF4WQQ3-.js +2 -0
  80. package/dist/chunks/port-name-CF4WQQ3-.js.map +1 -0
  81. package/dist/chunks/port-name-ervLBWAQ.js +6 -0
  82. package/dist/chunks/port-name-ervLBWAQ.js.map +1 -0
  83. package/dist/chunks/pt-8ARZnH0_.js +2 -0
  84. package/dist/chunks/pt-8ARZnH0_.js.map +1 -0
  85. package/dist/chunks/pt-uFVUv_Op.js +141 -0
  86. package/dist/chunks/pt-uFVUv_Op.js.map +1 -0
  87. package/dist/chunks/ro-BrqQ8Au-.js +122 -0
  88. package/dist/chunks/ro-BrqQ8Au-.js.map +1 -0
  89. package/dist/chunks/ro-D-NMbp2F.js +2 -0
  90. package/dist/chunks/ro-D-NMbp2F.js.map +1 -0
  91. package/dist/chunks/ru-8gbHPh0g.js +2 -0
  92. package/dist/chunks/ru-8gbHPh0g.js.map +1 -0
  93. package/dist/chunks/ru-DK594dA8.js +144 -0
  94. package/dist/chunks/ru-DK594dA8.js.map +1 -0
  95. package/dist/chunks/sv-CHNH8-mq.js +122 -0
  96. package/dist/chunks/sv-CHNH8-mq.js.map +1 -0
  97. package/dist/chunks/sv-D8a8hmx9.js +2 -0
  98. package/dist/chunks/sv-D8a8hmx9.js.map +1 -0
  99. package/dist/chunks/th-DfjUK0Y7.js +2 -0
  100. package/dist/chunks/th-DfjUK0Y7.js.map +1 -0
  101. package/dist/chunks/th-l24Pm5q-.js +126 -0
  102. package/dist/chunks/th-l24Pm5q-.js.map +1 -0
  103. package/dist/chunks/tr-ADpigSY5.js +122 -0
  104. package/dist/chunks/tr-ADpigSY5.js.map +1 -0
  105. package/dist/chunks/tr-BdBpz4tL.js +2 -0
  106. package/dist/chunks/tr-BdBpz4tL.js.map +1 -0
  107. package/dist/chunks/uk-CGqo4jek.js +144 -0
  108. package/dist/chunks/uk-CGqo4jek.js.map +1 -0
  109. package/dist/chunks/uk-Cx1zv1ao.js +2 -0
  110. package/dist/chunks/uk-Cx1zv1ao.js.map +1 -0
  111. package/dist/chunks/vi-Dk9bTu6f.js +122 -0
  112. package/dist/chunks/vi-Dk9bTu6f.js.map +1 -0
  113. package/dist/chunks/vi-oe2dW21I.js +2 -0
  114. package/dist/chunks/vi-oe2dW21I.js.map +1 -0
  115. package/dist/chunks/zh-CwczPMPp.js +2 -0
  116. package/dist/chunks/zh-CwczPMPp.js.map +1 -0
  117. package/dist/chunks/zh-LDkEV2D9.js +145 -0
  118. package/dist/chunks/zh-LDkEV2D9.js.map +1 -0
  119. package/dist/content/PaywallUI.d.ts +1 -1
  120. package/dist/content/RemoteAuthClient.d.ts +8 -4
  121. package/dist/content/RemoteAuthClient.d.ts.map +1 -1
  122. package/dist/content/RemoteAuthClient.test-d.d.ts +2 -0
  123. package/dist/content/RemoteAuthClient.test-d.d.ts.map +1 -0
  124. package/dist/content/RemoteBillingClient.d.ts +36 -3
  125. package/dist/content/RemoteBillingClient.d.ts.map +1 -1
  126. package/dist/content/RemoteBillingClient.test-d.d.ts +2 -0
  127. package/dist/content/RemoteBillingClient.test-d.d.ts.map +1 -0
  128. package/dist/content/RemoteTrialStore.d.ts +2 -2
  129. package/dist/content.cjs +3 -3
  130. package/dist/content.cjs.map +1 -1
  131. package/dist/content.js +2441 -1059
  132. package/dist/content.js.map +1 -1
  133. package/dist/offscreen/server.d.ts +3 -3
  134. package/dist/offscreen/server.d.ts.map +1 -1
  135. package/dist/offscreen.cjs +1 -1
  136. package/dist/offscreen.cjs.map +1 -1
  137. package/dist/offscreen.js +18 -15
  138. package/dist/offscreen.js.map +1 -1
  139. package/dist/shared/messages.d.ts +28 -5
  140. package/dist/shared/messages.d.ts.map +1 -1
  141. package/dist/shared/port-name.d.ts +1 -0
  142. package/dist/shared/port-name.d.ts.map +1 -1
  143. package/dist/shared/protocol.d.ts +1 -1
  144. package/dist/shared/protocol.d.ts.map +1 -1
  145. package/dist/sw.cjs +1 -1
  146. package/dist/sw.cjs.map +1 -1
  147. package/dist/sw.js +14 -14
  148. package/dist/sw.js.map +1 -1
  149. package/package.json +39 -21
  150. package/dist/chunks/chrome-port-DPFUj1MP.js.map +0 -1
  151. package/dist/chunks/chrome-port-MoMohiHB.js +0 -2
  152. package/dist/chunks/chrome-port-MoMohiHB.js.map +0 -1
  153. package/dist/chunks/port-name-BPfQKtdb.js +0 -5
  154. package/dist/chunks/port-name-BPfQKtdb.js.map +0 -1
  155. package/dist/chunks/port-name-qwB109u9.js +0 -2
  156. package/dist/chunks/port-name-qwB109u9.js.map +0 -1
package/dist/content.js CHANGED
@@ -1,16 +1,58 @@
1
- import { P as T, B as ae, E as ce, c as ue, A as H, w as he, a as R, r as de, b as pe } from "./chunks/chrome-port-DPFUj1MP.js";
2
- import { render as z, h as G } from "preact";
3
- import { jsxs as u, jsx as o, Fragment as ne } from "preact/jsx-runtime";
4
- import { useRef as B, useEffect as M, useState as x, useMemo as ie } from "preact/hooks";
5
- import { P as fe } from "./chunks/port-name-BPfQKtdb.js";
6
- const oe = '@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --color-red-50: oklch(97.1% .013 17.38); --color-red-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --color-red-400: oklch(70.4% .191 22.216); --color-red-500: oklch(63.7% .237 25.331); --color-red-600: oklch(57.7% .245 27.325); --color-red-700: oklch(50.5% .213 27.518); --color-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --color-slate-950: oklch(12.9% .042 264.695); --color-gray-50: oklch(98.5% .002 247.839); --color-gray-100: oklch(96.7% .003 264.542); --color-gray-200: oklch(92.8% .006 264.531); --color-gray-300: oklch(87.2% .01 258.338); --color-gray-400: oklch(70.7% .022 261.325); --color-gray-500: oklch(55.1% .027 264.364); --color-gray-600: oklch(44.6% .03 256.802); --color-gray-700: oklch(37.3% .034 259.733); --color-gray-800: oklch(27.8% .033 256.848); --color-gray-900: oklch(21% .034 264.665); --color-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{:host{all:initial;color-scheme:light;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}';
7
- let W = !1;
8
- function ge() {
9
- if (W || (W = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
1
+ import { P as L, B as Re, E as ze, c as qe, A as ue, w as Ne, a as J, r as Fe, b as $e } from "./chunks/chrome-port-bfTUUDz_.js";
2
+ import { render as Q, h as de, createContext as Ve } from "preact";
3
+ import { jsx as o, jsxs as u, Fragment as ae } from "preact/jsx-runtime";
4
+ import { useState as k, useEffect as P, useContext as He, useRef as D, useMemo as Ge, useLayoutEffect as We } from "preact/hooks";
5
+ import { P as Ze } from "./chunks/port-name-ervLBWAQ.js";
6
+ function Ye(r) {
7
+ return `pw-offer-${r}-start`;
8
+ }
9
+ function N(r, e) {
10
+ if (!r || r.length === 0) return null;
11
+ const t = r.find(
12
+ (i) => i.price_id === e && (i.discount_percent ?? 0) > 0
13
+ );
14
+ return t || (r.find(
15
+ (i) => i.price_id == null && (i.discount_percent ?? 0) > 0
16
+ ) ?? null);
17
+ }
18
+ function Ke(r, e = {}) {
19
+ const t = r.discount_percent ?? 0;
20
+ if (t <= 0) return null;
21
+ const n = e.now ?? Date.now(), i = Xe(r, e.readStart), s = Je(r, i), a = i !== null ? Math.max(0, i - n) : null;
22
+ return i !== null && i <= n ? null : { offer: r, discountPercent: t, remainingMs: a, totalMs: s, expiresAt: i };
23
+ }
24
+ function Xe(r, e) {
25
+ if (r.expires_at) {
26
+ const t = Date.parse(r.expires_at);
27
+ return Number.isFinite(t) ? t : null;
28
+ }
29
+ if (r.duration_minutes && r.duration_minutes > 0 && e) {
30
+ const t = e(r.id);
31
+ if (!t) return null;
32
+ const n = Date.parse(t);
33
+ return Number.isFinite(n) ? n + r.duration_minutes * 6e4 : null;
34
+ }
35
+ return null;
36
+ }
37
+ function Je(r, e) {
38
+ return r.duration_minutes && r.duration_minutes > 0 ? r.duration_minutes * 6e4 : e !== null ? e - Date.now() : null;
39
+ }
40
+ function Qe(r) {
41
+ if (typeof window > "u") return null;
42
+ try {
43
+ return window.localStorage.getItem(Ye(r));
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+ const Se = '@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --color-red-50: oklch(97.1% .013 17.38); --color-red-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --color-red-400: oklch(70.4% .191 22.216); --color-red-500: oklch(63.7% .237 25.331); --color-red-600: oklch(57.7% .245 27.325); --color-red-700: oklch(50.5% .213 27.518); --color-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --color-slate-950: oklch(12.9% .042 264.695); --color-gray-50: oklch(98.5% .002 247.839); --color-gray-100: oklch(96.7% .003 264.542); --color-gray-200: oklch(92.8% .006 264.531); --color-gray-300: oklch(87.2% .01 258.338); --color-gray-400: oklch(70.7% .022 261.325); --color-gray-500: oklch(55.1% .027 264.364); --color-gray-600: oklch(44.6% .03 256.802); --color-gray-700: oklch(37.3% .034 259.733); --color-gray-800: oklch(27.8% .033 256.848); --color-gray-900: oklch(21% .034 264.665); --color-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 0); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 0); --color-neutral-100: oklch(97% 0 0); --color-neutral-200: oklch(92.2% 0 0); --color-neutral-300: oklch(87% 0 0); --color-neutral-400: oklch(70.8% 0 0); --color-neutral-500: oklch(55.6% 0 0); --color-neutral-600: oklch(43.9% 0 0); --color-neutral-700: oklch(37.1% 0 0); --color-neutral-800: oklch(26.9% 0 0); --color-neutral-900: oklch(20.5% 0 0); --color-neutral-950: oklch(14.5% 0 0); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 0); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}@source "../**/*.{ts,tsx,js,jsx}";@layer base{:host{all:initial;color-scheme:light;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}*,*:before,*:after{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:before,*:after{box-sizing:border-box}button{font-family:inherit;cursor:pointer}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}.pw-cta-shimmer:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.35) 50%,transparent);animation:pw-cta-shimmer 3s infinite;z-index:1}@keyframes pw-cta-shimmer{0%{left:-100%}to{left:100%}}';
49
+ let he = !1;
50
+ function et() {
51
+ if (he || (he = !0, typeof CSS > "u" || typeof CSS.registerProperty != "function")) return;
10
52
  let r;
11
53
  try {
12
54
  const e = new CSSStyleSheet();
13
- e.replaceSync(oe), r = e.cssRules;
55
+ e.replaceSync(Se), r = e.cssRules;
14
56
  } catch {
15
57
  return;
16
58
  }
@@ -28,12 +70,12 @@ function ge() {
28
70
  }
29
71
  }
30
72
  }
31
- function me(r, e, t = {}) {
73
+ function tt(r, e, t = {}) {
32
74
  if (typeof document > "u")
33
75
  throw new Error("mountShadow called in non-DOM environment");
34
- ge();
76
+ et();
35
77
  const n = t.host ?? document.createElement("div");
36
- n.setAttribute("data-paywall-host", ""), n.style.cssText = "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", n.isConnected || document.body.appendChild(n);
78
+ n.setAttribute("data-paywall-host", ""), n.style.cssText = t.inline ? "all: initial; position: absolute; inset: 0; z-index: 1; pointer-events: none;" : "all: initial; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;", !n.isConnected && !t.inline && document.body.appendChild(n);
37
79
  const i = n.attachShadow({ mode: t.shadowMode ?? "closed" }), s = `
38
80
  :host {
39
81
  all: initial !important;
@@ -52,124 +94,230 @@ function me(r, e, t = {}) {
52
94
  cursor: auto !important;
53
95
  visibility: visible !important;
54
96
  }
55
- `, l = document.createElement("style");
56
- l.textContent = s + oe + (t.injectCss ?? ""), i.appendChild(l);
57
- const a = document.createElement("div");
58
- a.style.pointerEvents = "auto", i.appendChild(a);
59
- let c = e;
60
- return z(G(r, c), a), {
97
+ `, a = document.createElement("style");
98
+ a.textContent = s + Se + (t.injectCss ?? ""), i.appendChild(a);
99
+ const c = document.createElement("div");
100
+ c.style.pointerEvents = "auto", i.appendChild(c);
101
+ let l = e;
102
+ return Q(de(r, l), c), {
61
103
  shadowRoot: i,
62
- update(p) {
63
- c = { ...c, ...p }, z(G(r, c), a);
104
+ update(h) {
105
+ l = { ...l, ...h }, Q(de(r, l), c);
64
106
  },
65
107
  unmount() {
66
- z(null, a), n.remove();
108
+ Q(null, c), n.remove();
109
+ }
110
+ };
111
+ }
112
+ const rt = (r, e, t) => {
113
+ const n = r[e];
114
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
115
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
116
+ s.bind(
117
+ null,
118
+ new Error(
119
+ "Unknown variable dynamic import: " + e + (e.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
120
+ )
121
+ )
122
+ );
123
+ });
124
+ }, nt = [
125
+ "ru",
126
+ "uk",
127
+ "de",
128
+ "es",
129
+ "fr",
130
+ "it",
131
+ "pt",
132
+ "pl",
133
+ "cs",
134
+ "hu",
135
+ "ro",
136
+ "nl",
137
+ "sv",
138
+ "da",
139
+ "no",
140
+ "fi",
141
+ "el",
142
+ "tr",
143
+ "id",
144
+ "ar",
145
+ "ja",
146
+ "ko",
147
+ "zh",
148
+ "hi",
149
+ "th",
150
+ "vi",
151
+ "he"
152
+ ], Ce = (r, e, t) => Ae(e, t), Ie = Ve({ t: Ce, locale: "en" });
153
+ function Ae(r, e) {
154
+ if (!e) return r;
155
+ let t = r;
156
+ for (const [n, i] of Object.entries(e))
157
+ t = t.split(`{${n}}`).join(String(i));
158
+ return t;
159
+ }
160
+ const ee = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
161
+ function Le(r) {
162
+ return nt.includes(r);
163
+ }
164
+ function it(r) {
165
+ const e = [];
166
+ if (typeof navigator < "u" && navigator.language) {
167
+ e.push(navigator.language);
168
+ const n = navigator.language.split("-")[0];
169
+ n && n !== navigator.language && e.push(n);
170
+ }
171
+ const t = r.settings.locale_default;
172
+ if (t) {
173
+ e.push(t);
174
+ const n = t.split("-")[0];
175
+ n && n !== t && e.push(n);
176
+ }
177
+ for (const n of e)
178
+ if (Le(n)) return n;
179
+ return null;
180
+ }
181
+ function ot(r, e) {
182
+ return !!r.locales && r.locales[e] !== void 0;
183
+ }
184
+ async function st(r) {
185
+ const e = ee.get(r);
186
+ if (e) return e;
187
+ const t = te.get(r);
188
+ if (t) return t;
189
+ const n = rt(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./chunks/ar-B2Wg_IrC.js"), "./locales/cs.ts": () => import("./chunks/cs-BNo9Dx0Q.js"), "./locales/da.ts": () => import("./chunks/da-Do9Lq6En.js"), "./locales/de.ts": () => import("./chunks/de-C8pDZNvx.js"), "./locales/el.ts": () => import("./chunks/el-DzMNX-_P.js"), "./locales/es.ts": () => import("./chunks/es-YrKt-q4w.js"), "./locales/fi.ts": () => import("./chunks/fi-Bh44pwZ4.js"), "./locales/fr.ts": () => import("./chunks/fr-Bc0pw4ws.js"), "./locales/he.ts": () => import("./chunks/he-Bfm-bhe3.js"), "./locales/hi.ts": () => import("./chunks/hi-D-O-B9Dn.js"), "./locales/hu.ts": () => import("./chunks/hu-CmIuAbLL.js"), "./locales/id.ts": () => import("./chunks/id-DN7IES-A.js"), "./locales/it.ts": () => import("./chunks/it-Cz5Nmqx5.js"), "./locales/ja.ts": () => import("./chunks/ja-BH9BlBh2.js"), "./locales/ko.ts": () => import("./chunks/ko-CYV9QuYs.js"), "./locales/nl.ts": () => import("./chunks/nl-BvkB900D.js"), "./locales/no.ts": () => import("./chunks/no-3s9_ormb.js"), "./locales/pl.ts": () => import("./chunks/pl-C9WTGQtb.js"), "./locales/pt.ts": () => import("./chunks/pt-uFVUv_Op.js"), "./locales/ro.ts": () => import("./chunks/ro-BrqQ8Au-.js"), "./locales/ru.ts": () => import("./chunks/ru-DK594dA8.js"), "./locales/sv.ts": () => import("./chunks/sv-CHNH8-mq.js"), "./locales/th.ts": () => import("./chunks/th-l24Pm5q-.js"), "./locales/tr.ts": () => import("./chunks/tr-ADpigSY5.js"), "./locales/uk.ts": () => import("./chunks/uk-CGqo4jek.js"), "./locales/vi.ts": () => import("./chunks/vi-Dk9bTu6f.js"), "./locales/zh.ts": () => import("./chunks/zh-LDkEV2D9.js") }), `./locales/${r}.ts`, 3).then((i) => {
190
+ const s = i.default ?? {};
191
+ return ee.set(r, s), s;
192
+ }).catch((i) => {
193
+ console.warn(`[paywall] failed to load locale chunk "${r}"`, i);
194
+ const s = {};
195
+ return ee.set(r, s), s;
196
+ }).finally(() => {
197
+ te.delete(r);
198
+ });
199
+ return te.set(r, n), n;
200
+ }
201
+ function at({ bootstrap: r, forceLocale: e, children: t }) {
202
+ const [n, i] = k("en"), [s, a] = k(null);
203
+ P(() => {
204
+ const h = (e && Le(e) ? e : null) ?? (() => {
205
+ if (!r) return null;
206
+ const g = it(r);
207
+ return !g || !ot(r, g) ? null : g;
208
+ })();
209
+ if (!h) {
210
+ (s !== null || n !== "en") && (i("en"), a(null));
211
+ return;
67
212
  }
213
+ if (h === n && s) return;
214
+ let d = !1;
215
+ return st(h).then((g) => {
216
+ d || (i(h), a(g));
217
+ }), () => {
218
+ d = !0;
219
+ };
220
+ }, [r, e]);
221
+ const c = {
222
+ locale: n,
223
+ t: s ? (l, h, d) => Ae(s[l] ?? h, d) : Ce
68
224
  };
225
+ return /* @__PURE__ */ o(Ie.Provider, { value: c, children: t });
226
+ }
227
+ function S() {
228
+ return He(Ie);
69
229
  }
70
- const Z = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
71
- function ye({
230
+ const pe = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
231
+ function lt({
72
232
  open: r,
73
233
  onClose: e,
74
234
  labelledBy: t,
75
235
  brandColor: n,
76
- testMode: i,
236
+ topBanner: i,
77
237
  allowClose: s = !0,
238
+ hideCloseButton: a = !1,
239
+ inline: c = !1,
78
240
  children: l
79
241
  }) {
80
- const a = B(null), c = B(null);
81
- return M(() => {
242
+ const { t: h } = S(), d = D(null), g = D(null);
243
+ return P(() => {
82
244
  if (!r) return;
83
- c.current = document.activeElement ?? null;
84
- const b = a.current;
85
- b && (b.querySelector(Z) ?? b).focus({ preventScroll: !0 });
86
- const f = (y) => {
245
+ g.current = document.activeElement ?? null;
246
+ const m = d.current;
247
+ m && (m.querySelector(pe) ?? m).focus({ preventScroll: !0 });
248
+ const A = (y) => {
87
249
  if (y.key === "Escape") {
88
250
  if (!s) return;
89
251
  y.stopPropagation(), e();
90
252
  return;
91
253
  }
92
- if (y.key !== "Tab" || !a.current) return;
93
- const _ = Array.from(
94
- a.current.querySelectorAll(Z)
95
- ).filter((w) => !w.hasAttribute("disabled") && w.tabIndex !== -1);
96
- if (_.length === 0) {
254
+ if (y.key !== "Tab" || !d.current) return;
255
+ const C = Array.from(
256
+ d.current.querySelectorAll(pe)
257
+ ).filter((O) => !O.hasAttribute("disabled") && O.tabIndex !== -1);
258
+ if (C.length === 0) {
97
259
  y.preventDefault();
98
260
  return;
99
261
  }
100
- const A = _[0], v = _[_.length - 1], S = document.activeElement;
101
- y.shiftKey && S === A ? (y.preventDefault(), v.focus()) : !y.shiftKey && S === v && (y.preventDefault(), A.focus());
262
+ const I = C[0], U = C[C.length - 1], M = document.activeElement;
263
+ y.shiftKey && M === I ? (y.preventDefault(), U.focus()) : !y.shiftKey && M === U && (y.preventDefault(), I.focus());
102
264
  };
103
- document.addEventListener("keydown", f, !0);
104
- const m = document.body.style.overflow;
105
- return document.body.style.overflow = "hidden", () => {
106
- document.removeEventListener("keydown", f, !0), document.body.style.overflow = m, c.current?.focus?.({ preventScroll: !0 });
265
+ document.addEventListener("keydown", A, !0);
266
+ const b = document.body.style.overflow;
267
+ return c || (document.body.style.overflow = "hidden"), () => {
268
+ document.removeEventListener("keydown", A, !0), c || (document.body.style.overflow = b), g.current?.focus?.({ preventScroll: !0 });
107
269
  };
108
- }, [r, e, s]), r ? /* @__PURE__ */ u(
270
+ }, [r, e, s, c]), r ? /* @__PURE__ */ u(
109
271
  "div",
110
272
  {
111
- class: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]",
112
- onClick: (b) => {
113
- s && b.target === b.currentTarget && e();
273
+ class: `${c ? "absolute z-[1]" : "fixed z-[2147483647]"} inset-0 flex items-center justify-center bg-slate-950/50 p-2 sm:p-4 backdrop-blur-md animate-[pw-fade-in_180ms_ease-out]`,
274
+ onClick: (m) => {
275
+ s && m.target === m.currentTarget && e();
114
276
  },
115
277
  "data-pw-root": !0,
116
278
  children: [
117
279
  /* @__PURE__ */ u(
118
280
  "div",
119
281
  {
120
- ref: a,
121
- role: "dialog",
122
- "aria-modal": "true",
123
- "aria-labelledby": t,
124
- tabIndex: -1,
125
- class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full max-w-md flex-col overflow-hidden rounded-3xl bg-white outline-none ring-1 ring-black/5 animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
126
- style: {
127
- "--pw-accent": n ?? "#3b82f6",
128
- boxShadow: "0 1px 2px rgba(15,23,42,0.04), 0 12px 32px -8px rgba(15,23,42,0.18), 0 24px 64px -16px rgba(15,23,42,0.22)"
129
- },
282
+ class: "relative flex w-full max-w-[400px] flex-col animate-[pw-scale-in_220ms_cubic-bezier(0.16,1,0.3,1)]",
283
+ style: { "--pw-accent": n ?? "#3b82f6" },
130
284
  children: [
131
- i && /* @__PURE__ */ u(
285
+ i,
286
+ /* @__PURE__ */ u(
132
287
  "div",
133
288
  {
134
- class: "flex items-center justify-center gap-1.5 bg-gradient-to-r from-amber-300 to-amber-400 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-amber-950",
135
- role: "status",
289
+ ref: d,
290
+ role: "dialog",
291
+ "aria-modal": "true",
292
+ "aria-labelledby": t,
293
+ tabIndex: -1,
294
+ class: "relative flex max-h-[calc(100dvh-1rem)] sm:max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl bg-white outline-none",
295
+ style: {
296
+ boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
297
+ },
136
298
  children: [
137
- /* @__PURE__ */ u("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
138
- /* @__PURE__ */ o(
139
- "path",
140
- {
141
- d: "M8 1L15 14H1L8 1Z",
142
- stroke: "currentColor",
143
- "stroke-width": "1.5",
144
- "stroke-linejoin": "round"
145
- }
146
- ),
147
- /* @__PURE__ */ o("path", { d: "M8 6v3", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }),
148
- /* @__PURE__ */ o("circle", { cx: "8", cy: "11.5", r: "0.5", fill: "currentColor" })
149
- ] }),
150
- "Test mode — no real charge"
299
+ l,
300
+ s && !a ? /* @__PURE__ */ o(
301
+ "button",
302
+ {
303
+ type: "button",
304
+ onClick: e,
305
+ "aria-label": h("modal.close_aria", "Close"),
306
+ class: "absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-500 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
307
+ children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
308
+ "path",
309
+ {
310
+ d: "M3 3l10 10M13 3L3 13",
311
+ stroke: "currentColor",
312
+ "stroke-width": "1.75",
313
+ "stroke-linecap": "round"
314
+ }
315
+ ) })
316
+ }
317
+ ) : null
151
318
  ]
152
319
  }
153
- ),
154
- /* @__PURE__ */ o("div", { class: "flex-1 overflow-y-auto p-7", children: l }),
155
- s ? /* @__PURE__ */ o(
156
- "button",
157
- {
158
- type: "button",
159
- onClick: e,
160
- "aria-label": "Close",
161
- class: `absolute right-3 ${i ? "top-10" : "top-3"} z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white/80 text-gray-400 backdrop-blur-sm transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]`,
162
- children: /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
163
- "path",
164
- {
165
- d: "M3 3l10 10M13 3L3 13",
166
- stroke: "currentColor",
167
- "stroke-width": "1.75",
168
- "stroke-linecap": "round"
169
- }
170
- ) })
171
- }
172
- ) : null
320
+ )
173
321
  ]
174
322
  }
175
323
  ),
@@ -184,20 +332,60 @@ function ye({
184
332
  }
185
333
  ) : null;
186
334
  }
187
- const xe = {
188
- google: "Continue with Google",
189
- apple: "Continue with Apple",
190
- github: "Continue with GitHub",
191
- facebook: "Continue with Facebook"
192
- };
193
- function se({ block: r, ctx: e }) {
194
- const t = e.auth, n = e.authSession, i = r.allow_signup !== !1, s = r.allow_password_reset !== !1, l = r.hide_when_authenticated !== !1;
335
+ function ct(r, e) {
336
+ switch (r) {
337
+ case "google":
338
+ return e("auth.continue_with_google", "Continue with Google");
339
+ case "apple":
340
+ return e("auth.continue_with_apple", "Continue with Apple");
341
+ case "github":
342
+ return e("auth.continue_with_github", "Continue with GitHub");
343
+ case "facebook":
344
+ return e("auth.continue_with_facebook", "Continue with Facebook");
345
+ }
346
+ }
347
+ function fe(r, e, t) {
348
+ const n = e === "signup" ? t("auth.signup_failed", "Sign-up failed") : t("auth.signin_failed", "Sign-in failed");
349
+ if (!(r instanceof L)) return n;
350
+ switch (r.code) {
351
+ case "invalid_credentials":
352
+ return t("auth.invalid_credentials", "Invalid email or password");
353
+ case "email_not_confirmed":
354
+ return t("auth.email_not_confirmed", "Please confirm your email before signing in.");
355
+ case "email_exists":
356
+ case "user_already_exists":
357
+ return t("auth.email_exists", "An account with this email already exists.");
358
+ case "weak_password":
359
+ return t("auth.weak_password", "Password is too weak.");
360
+ case "invalid_otp":
361
+ case "otp_expired":
362
+ case "token_expired":
363
+ return t("auth.invalid_otp", "The code is invalid or has expired.");
364
+ case "over_email_send_rate_limit":
365
+ case "over_request_rate_limit":
366
+ case "rate_limited":
367
+ case "http_429":
368
+ return t("auth.rate_limited", "Too many requests. Please try again later.");
369
+ case "network_error":
370
+ return t("auth.network_error", "Network error. Please check your connection and try again.");
371
+ case "upstream":
372
+ case "upstream_error":
373
+ case "http_502":
374
+ case "http_503":
375
+ case "http_504":
376
+ return t("auth.service_unavailable", "Service is temporarily unavailable. Please try again.");
377
+ default:
378
+ return n;
379
+ }
380
+ }
381
+ function Me({ block: r, ctx: e }) {
382
+ const t = e.auth, n = e.authSession, i = r.allow_signup !== !1, s = r.allow_password_reset !== !1, a = r.hide_when_authenticated !== !1;
195
383
  if (!t)
196
384
  return typeof console < "u" && console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"), null;
197
- const a = n && !n.user.is_anonymous ? n : null;
198
- return a && l ? null : a ? /* @__PURE__ */ o(be, { email: a.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
385
+ const c = n && !n.user.is_anonymous ? n : null;
386
+ return c && a ? null : c ? /* @__PURE__ */ o(ut, { email: c.user.email ?? "", onSignOut: () => t.signOut().catch(() => {
199
387
  }) }) : /* @__PURE__ */ o(
200
- ke,
388
+ dt,
201
389
  {
202
390
  block: r,
203
391
  allowSignup: i,
@@ -206,10 +394,11 @@ function se({ block: r, ctx: e }) {
206
394
  }
207
395
  );
208
396
  }
209
- function be({ email: r, onSignOut: e }) {
210
- return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3", children: [
397
+ function ut({ email: r, onSignOut: e }) {
398
+ const { t } = S();
399
+ return /* @__PURE__ */ u("div", { class: "flex items-center justify-between gap-3 rounded-2xl bg-gray-100 px-4 py-3", children: [
211
400
  /* @__PURE__ */ u("div", { class: "flex flex-col", children: [
212
- /* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: "Signed in" }),
401
+ /* @__PURE__ */ o("span", { class: "text-[10px] font-semibold uppercase tracking-wider text-gray-500", children: t("auth.signed_in", "Signed in") }),
213
402
  /* @__PURE__ */ o("span", { class: "text-sm font-medium text-gray-900", children: r })
214
403
  ] }),
215
404
  /* @__PURE__ */ o(
@@ -218,723 +407,1294 @@ function be({ email: r, onSignOut: e }) {
218
407
  type: "button",
219
408
  onClick: e,
220
409
  class: "rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-600 transition-colors hover:bg-white hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
221
- children: "Sign out"
410
+ children: t("auth.sign_out", "Sign out")
222
411
  }
223
412
  )
224
413
  ] });
225
414
  }
226
- function ke({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
227
- const i = n.auth, s = r.providers ?? [], [l, a] = x("signin"), [c, p] = x(""), [g, b] = x(""), [f, m] = x(""), [y, _] = x(null), [A, v] = x(null), [S, w] = x(null), P = async (C) => {
228
- if (C.preventDefault(), !y) {
229
- _("email"), v(null), w(null);
415
+ function dt({ block: r, allowSignup: e, allowReset: t, ctx: n }) {
416
+ const { t: i } = S(), s = n.auth, a = r.providers ?? [], c = n.initialAuthMode === "signup" && e ? "signup" : "signin", [l, h] = k(c), [d, g] = k(""), [_, p] = k(""), [v, m] = k(""), [A, b] = k(""), [y, C] = k(null), I = D(!1), [U, M] = k(null), [O, j] = k(null), [R, T] = k(!1), [E, z] = k(null);
417
+ P(() => {
418
+ if (typeof s.getLastLogin != "function") return;
419
+ let f = !1;
420
+ return s.getLastLogin().then(
421
+ (w) => {
422
+ f || !w || (z(w), w.email && g((B) => B === "" ? w.email : B));
423
+ },
424
+ () => {
425
+ }
426
+ ), () => {
427
+ f = !0;
428
+ };
429
+ }, [s]);
430
+ const q = (f) => {
431
+ h(f), M(null), j(null), T(!1);
432
+ }, Y = async (f) => {
433
+ if (f.preventDefault(), !(I.current || y)) {
434
+ I.current = !0;
230
435
  try {
231
- l === "signin" ? await i.signInWithEmail({ email: c, password: g }) : l === "signup" ? (await i.signUp({ email: c, password: g })).kind === "confirmation_required" && (a("reset_verify"), w("Check your email for a confirmation code.")) : l === "forgot" ? (await i.requestPasswordReset({ email: c }), a("reset_sent"), w("If that email exists, a reset code has been sent.")) : l === "reset_verify" && (await i.verifyOtp({
232
- email: c,
233
- token: f,
234
- type: g ? "recovery" : "email"
235
- }), g && await i.updatePassword({ password: g }));
236
- } catch (I) {
237
- const d = I instanceof T ? I.message : "Something went wrong";
238
- v(d);
436
+ if (M(null), j(null), l === "signup" && !R) {
437
+ if (!d.trim()) return;
438
+ T(!0);
439
+ return;
440
+ }
441
+ if (l === "signup" && _ !== v) {
442
+ M(i("auth.passwords_mismatch", "Passwords don't match"));
443
+ return;
444
+ }
445
+ C("email");
446
+ try {
447
+ l === "signin" ? await s.signInWithEmail({ email: d, password: _ }) : l === "signup" ? (await s.signUp({ email: d, password: _ })).kind === "confirmation_required" && (p(""), h("signup_verify"), j(i("auth.check_email_message", "Check your email for a confirmation code."))) : l === "forgot" ? (await s.requestPasswordReset({ email: d }), h("reset_sent"), j(
448
+ i("auth.reset_sent_message", "If that email exists, a reset code has been sent.")
449
+ )) : l === "signup_verify" ? await s.verifyOtp({ email: d, token: A, type: "email" }) : l === "reset_verify" && (await s.verifyOtp({
450
+ email: d,
451
+ token: A,
452
+ type: _ ? "recovery" : "email"
453
+ }), _ && await s.updatePassword({ password: _ }));
454
+ } catch (w) {
455
+ M(fe(w, l === "signup" ? "signup" : l === "signup_verify" || l === "reset_verify" ? "otp" : l === "forgot" ? "reset" : "signin", i));
456
+ } finally {
457
+ C(null);
458
+ }
239
459
  } finally {
240
- _(null);
460
+ I.current = !1;
241
461
  }
242
462
  }
243
- }, L = async (C) => {
244
- if (!y) {
245
- _(C), v(null), w(null);
463
+ }, V = async (f) => {
464
+ if (!(I.current || y)) {
465
+ I.current = !0, C(f), M(null), j(null);
246
466
  try {
247
- await i.signInWithOAuth({
248
- provider: C,
249
- onPopupOpened: () => _(null)
467
+ await s.signInWithOAuth({
468
+ provider: f,
469
+ onPopupOpened: () => C(null)
250
470
  });
251
- } catch (I) {
252
- if (I instanceof T) {
253
- if (I.code === "oauth_cancelled" || I.code === "oauth_timeout") return;
254
- v(I.message);
255
- } else
256
- v("Sign-in failed");
471
+ } catch (w) {
472
+ if (w instanceof L && (w.code === "oauth_cancelled" || w.code === "oauth_timeout"))
473
+ return;
474
+ M(fe(w, "signin", i));
257
475
  } finally {
258
- _(null);
476
+ I.current = !1, C(null);
259
477
  }
260
478
  }
261
- };
262
- return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
263
- r.heading ? /* @__PURE__ */ o("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: r.heading }) : null,
264
- s.length > 0 && (l === "signin" || l === "signup") ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
265
- s.map((C) => /* @__PURE__ */ u(
266
- "button",
267
- {
268
- type: "button",
269
- onClick: () => L(C),
270
- disabled: y !== null,
271
- class: "flex h-11 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 text-sm font-medium text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.04)] transition-all hover:-translate-y-px hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:shadow-[0_1px_0_rgba(15,23,42,0.04)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
272
- children: [
273
- y === C ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ o(_e, { provider: C }),
274
- /* @__PURE__ */ o("span", { children: xe[C] })
275
- ]
276
- },
277
- C
278
- )),
279
- /* @__PURE__ */ o(ve, {})
479
+ }, K = a.length > 0 && (l === "signin" || l === "signup"), X = l === "signin" || l === "signup" || l === "forgot", x = l === "signin" || l === "signup" && R;
480
+ return /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
481
+ /* @__PURE__ */ o(ht, { mode: l, customHeading: r.heading, customSubheading: r.subheading }),
482
+ K ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-2.5", children: [
483
+ a.map((f) => /* @__PURE__ */ u("div", { class: "relative", children: [
484
+ /* @__PURE__ */ u(
485
+ "button",
486
+ {
487
+ type: "button",
488
+ onClick: () => V(f),
489
+ disabled: y !== null,
490
+ class: "flex h-12 w-full items-center justify-center gap-2.5 rounded-full border-1 border-gray-200 bg-white px-5 text-base font-medium text-gray-900 transition-all hover:border-gray-300 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
491
+ children: [
492
+ y === f ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" }) : /* @__PURE__ */ o(vt, { provider: f }),
493
+ /* @__PURE__ */ o("span", { children: ct(f, i) })
494
+ ]
495
+ }
496
+ ),
497
+ E?.method === f ? /* @__PURE__ */ o(xt, { email: E.email }) : null
498
+ ] }, f)),
499
+ /* @__PURE__ */ o(kt, {})
280
500
  ] }) : null,
281
- /* @__PURE__ */ u("form", { onSubmit: P, class: "flex flex-col gap-2", children: [
282
- (l === "signin" || l === "signup" || l === "forgot") && /* @__PURE__ */ o(
283
- j,
501
+ /* @__PURE__ */ u("form", { onSubmit: Y, class: "flex flex-col gap-3", children: [
502
+ X && /* @__PURE__ */ o(
503
+ ge,
284
504
  {
285
505
  type: "email",
286
- label: "Email",
287
- value: c,
288
- onInput: p,
506
+ placeholder: i("auth.email", "Email address"),
507
+ value: d,
508
+ onInput: g,
289
509
  autocomplete: "email",
290
510
  required: !0
291
511
  }
292
512
  ),
293
- (l === "signin" || l === "signup") && /* @__PURE__ */ o(
294
- j,
513
+ x && /* @__PURE__ */ o(
514
+ re,
295
515
  {
296
- type: "password",
297
- label: "Password",
298
- value: g,
299
- onInput: b,
516
+ placeholder: i("auth.password", "Password"),
517
+ value: _,
518
+ onInput: p,
300
519
  autocomplete: l === "signin" ? "current-password" : "new-password",
301
520
  required: !0
302
521
  }
303
522
  ),
304
- l === "reset_verify" && /* @__PURE__ */ u(ne, { children: [
305
- /* @__PURE__ */ o(
306
- j,
307
- {
308
- type: "text",
309
- label: "Confirmation code",
310
- value: f,
311
- onInput: m,
312
- autocomplete: "one-time-code",
313
- inputMode: "numeric",
314
- required: !0
315
- }
316
- ),
317
- /* @__PURE__ */ o(
318
- j,
319
- {
320
- type: "password",
321
- label: "New password (optional — only for password reset)",
322
- value: g,
323
- onInput: b,
324
- autocomplete: "new-password"
325
- }
326
- )
327
- ] }),
328
- l === "reset_sent" && S && /* @__PURE__ */ o("p", { class: "rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600", children: S }),
329
- A && /* @__PURE__ */ o("p", { class: "text-xs text-red-600", children: A }),
330
- S && l !== "reset_sent" && /* @__PURE__ */ o("p", { class: "text-xs text-gray-500", children: S }),
523
+ l === "signup" && R && /* @__PURE__ */ o(
524
+ re,
525
+ {
526
+ placeholder: i("auth.repeat_password", "Repeat password"),
527
+ value: v,
528
+ onInput: m,
529
+ autocomplete: "new-password",
530
+ required: !0
531
+ }
532
+ ),
533
+ (l === "signup_verify" || l === "reset_verify") && /* @__PURE__ */ o(
534
+ ge,
535
+ {
536
+ type: "text",
537
+ placeholder: i("auth.confirmation_code", "Confirmation code"),
538
+ value: A,
539
+ onInput: b,
540
+ autocomplete: "one-time-code",
541
+ inputMode: "numeric",
542
+ required: !0
543
+ }
544
+ ),
545
+ l === "reset_verify" && /* @__PURE__ */ o(
546
+ re,
547
+ {
548
+ placeholder: i(
549
+ "auth.new_password_optional",
550
+ "New password (optional — only for password reset)"
551
+ ),
552
+ value: _,
553
+ onInput: p,
554
+ autocomplete: "new-password"
555
+ }
556
+ ),
557
+ l === "reset_sent" && O && /* @__PURE__ */ o("p", { class: "rounded-2xl bg-gray-100 px-4 py-3 text-sm text-gray-600", children: O }),
558
+ l === "signin" && t && /* @__PURE__ */ o("div", { class: "flex justify-end text-sm", children: /* @__PURE__ */ o(Z, { onClick: () => q("forgot"), children: i("auth.forgot_password", "Forgot password?") }) }),
559
+ U && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: U }),
560
+ O && l !== "reset_sent" && /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: O }),
331
561
  l !== "reset_sent" && /* @__PURE__ */ o(
332
- "button",
562
+ mt,
333
563
  {
334
- type: "submit",
335
- disabled: y !== null,
336
- class: "flex h-11 w-full items-center justify-center rounded-xl px-4 text-sm font-semibold tracking-tight text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
337
- style: {
338
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
339
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
340
- },
341
- children: y === "email" ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : we(l)
564
+ busy: y === "email",
565
+ label: ft(l, R, r.submit_label ?? r.heading, i)
342
566
  }
343
567
  )
344
568
  ] }),
345
- /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500", children: [
346
- l === "signin" && e && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signup"), class: "font-medium text-gray-700 hover:underline", children: "Create account" }),
347
- l === "signup" && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signin"), class: "font-medium text-gray-700 hover:underline", children: "I already have an account" }),
348
- l === "signin" && t && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "forgot"), class: "hover:underline", children: "Forgot password?" }),
349
- (l === "forgot" || l === "reset_sent" || l === "reset_verify") && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "signin"), class: "hover:underline", children: "Back to sign in" }),
350
- l === "reset_sent" && /* @__PURE__ */ o("button", { type: "button", onClick: () => O(a, v, w, "reset_verify"), class: "font-medium text-gray-700 hover:underline", children: "I have a code" })
351
- ] })
569
+ /* @__PURE__ */ o(
570
+ gt,
571
+ {
572
+ mode: l,
573
+ allowSignup: e,
574
+ onSwitch: q
575
+ }
576
+ )
352
577
  ] });
353
578
  }
354
- function we(r) {
579
+ function ht({
580
+ mode: r,
581
+ customHeading: e,
582
+ customSubheading: t
583
+ }) {
584
+ const { t: n } = S(), i = pt(r, n), s = r === "signin" || r === "signup", a = s && e ? e : i.title, c = s && t !== void 0 ? t || null : i.subtitle;
585
+ return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
586
+ /* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: a }),
587
+ c ? /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: c }) : null
588
+ ] });
589
+ }
590
+ function pt(r, e) {
591
+ switch (r) {
592
+ case "signin":
593
+ return {
594
+ title: e("auth.welcome", "Welcome back!"),
595
+ subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
596
+ };
597
+ case "signup":
598
+ return {
599
+ title: e("auth.welcome_signup", "Welcome!"),
600
+ subtitle: e("auth.default_subtitle", "Sign in to access all features and sync your data.")
601
+ };
602
+ case "forgot":
603
+ return {
604
+ title: e("auth.forgot_password_title", "Forgot password?"),
605
+ subtitle: e(
606
+ "auth.forgot_subtitle",
607
+ "Enter your email and we'll send you a password reset link."
608
+ )
609
+ };
610
+ case "reset_sent":
611
+ return {
612
+ title: e("auth.check_email_title", "Check your email"),
613
+ subtitle: null
614
+ };
615
+ case "reset_verify":
616
+ return {
617
+ title: e("auth.reset_password_title", "Reset password"),
618
+ subtitle: e(
619
+ "auth.reset_password_subtitle",
620
+ "Enter the code from your email and a new password."
621
+ )
622
+ };
623
+ case "signup_verify":
624
+ return {
625
+ title: e("auth.confirm_email_title", "Confirm your email"),
626
+ subtitle: e(
627
+ "auth.confirm_email_subtitle",
628
+ "Enter the code we sent to your email to finish creating your account."
629
+ )
630
+ };
631
+ }
632
+ }
633
+ function ft(r, e, t, n) {
634
+ if (r === "signin" && t) return t;
355
635
  switch (r) {
356
636
  case "signin":
357
- return "Sign in";
637
+ return n("auth.log_in", "Sign In");
358
638
  case "signup":
359
- return "Create account";
639
+ return e ? n("auth.create_account", "Create Account") : n("auth.sign_up", "Sign Up");
360
640
  case "forgot":
361
- return "Send reset code";
641
+ return n("auth.send_reset", "Send Reset Email");
642
+ case "signup_verify":
362
643
  case "reset_verify":
363
- return "Verify";
644
+ return n("auth.verify", "Verify");
364
645
  default:
365
- return "Continue";
646
+ return n("cta.continue", "Continue");
366
647
  }
367
648
  }
368
- function O(r, e, t, n) {
369
- r(n), e(null), t(null);
649
+ function gt({
650
+ mode: r,
651
+ allowSignup: e,
652
+ onSwitch: t
653
+ }) {
654
+ const { t: n } = S();
655
+ return r === "signin" && e ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
656
+ n("auth.no_account", "Don't have an account?"),
657
+ " ",
658
+ /* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
659
+ ] }) : r === "signup" || r === "signup_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
660
+ n("auth.have_account", "Already have an account?"),
661
+ " ",
662
+ /* @__PURE__ */ o(Z, { onClick: () => t("signin"), children: n("auth.log_in_link", "Log In") })
663
+ ] }) : r === "forgot" || r === "reset_sent" || r === "reset_verify" ? /* @__PURE__ */ u("p", { class: "text-center text-sm text-gray-600", children: [
664
+ n("auth.no_account", "Don't have an account?"),
665
+ " ",
666
+ /* @__PURE__ */ o(Z, { onClick: () => t("signup"), children: n("auth.sign_up_link", "Sign Up") })
667
+ ] }) : null;
668
+ }
669
+ function Z({
670
+ onClick: r,
671
+ children: e
672
+ }) {
673
+ return /* @__PURE__ */ o(
674
+ "button",
675
+ {
676
+ type: "button",
677
+ onClick: r,
678
+ class: "font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:opacity-80",
679
+ style: { color: "var(--pw-accent)" },
680
+ children: e
681
+ }
682
+ );
683
+ }
684
+ function mt({ busy: r, label: e }) {
685
+ return /* @__PURE__ */ o(
686
+ "button",
687
+ {
688
+ type: "submit",
689
+ disabled: r,
690
+ class: "pw-cta-shimmer relative mt-1 flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
691
+ style: {
692
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
693
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
694
+ },
695
+ children: r ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: e })
696
+ }
697
+ );
698
+ }
699
+ function ge({ type: r, placeholder: e, value: t, onInput: n, autocomplete: i, inputMode: s, required: a }) {
700
+ return /* @__PURE__ */ o(
701
+ "input",
702
+ {
703
+ type: r,
704
+ value: t,
705
+ placeholder: e,
706
+ onInput: (c) => n(c.target.value),
707
+ autocomplete: i,
708
+ inputMode: s,
709
+ required: a,
710
+ class: "h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
711
+ }
712
+ );
370
713
  }
371
- function j({ type: r, label: e, value: t, onInput: n, autocomplete: i, inputMode: s, required: l }) {
372
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
373
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: e }),
714
+ function re({ placeholder: r, value: e, onInput: t, autocomplete: n, required: i }) {
715
+ const { t: s } = S(), [a, c] = k(!1), l = D(null);
716
+ P(() => {
717
+ const g = l.current;
718
+ g && g.value !== e && (g.value = e);
719
+ }, [a, e]);
720
+ const h = s("auth.show_password", "Show password"), d = s("auth.hide_password", "Hide password");
721
+ return /* @__PURE__ */ u("div", { class: "relative", children: [
374
722
  /* @__PURE__ */ o(
375
723
  "input",
376
724
  {
377
- type: r,
378
- value: t,
379
- onInput: (a) => n(a.target.value),
380
- autocomplete: i,
381
- inputMode: s,
382
- required: l,
383
- class: "h-11 w-full rounded-xl border border-gray-200 bg-white px-3.5 text-sm text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"
725
+ ref: l,
726
+ type: a ? "text" : "password",
727
+ value: e,
728
+ placeholder: r,
729
+ onInput: (g) => t(g.target.value),
730
+ autocomplete: n,
731
+ required: i,
732
+ class: "h-14 w-full rounded-2xl bg-gray-100 pl-5 pr-12 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"
733
+ }
734
+ ),
735
+ /* @__PURE__ */ o(
736
+ "button",
737
+ {
738
+ type: "button",
739
+ onClick: () => c((g) => !g),
740
+ "aria-label": a ? d : h,
741
+ tabIndex: -1,
742
+ class: "absolute right-4 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
743
+ children: a ? /* @__PURE__ */ o(bt, {}) : /* @__PURE__ */ o(yt, {})
744
+ }
745
+ )
746
+ ] });
747
+ }
748
+ function yt() {
749
+ return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
750
+ /* @__PURE__ */ o(
751
+ "path",
752
+ {
753
+ d: "M1.667 10S4.583 4.167 10 4.167 18.333 10 18.333 10 15.417 15.833 10 15.833 1.667 10 1.667 10Z",
754
+ stroke: "currentColor",
755
+ "stroke-width": "1.5",
756
+ "stroke-linecap": "round",
757
+ "stroke-linejoin": "round"
758
+ }
759
+ ),
760
+ /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", "stroke-width": "1.5" })
761
+ ] });
762
+ }
763
+ function bt() {
764
+ return /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
765
+ /* @__PURE__ */ o(
766
+ "path",
767
+ {
768
+ d: "M8.236 4.293A6.96 6.96 0 0 1 10 4.167C15.417 4.167 18.333 10 18.333 10a13.5 13.5 0 0 1-1.92 2.755M11.768 11.768A2.5 2.5 0 0 1 8.233 8.233",
769
+ stroke: "currentColor",
770
+ "stroke-width": "1.5",
771
+ "stroke-linecap": "round",
772
+ "stroke-linejoin": "round"
773
+ }
774
+ ),
775
+ /* @__PURE__ */ o(
776
+ "path",
777
+ {
778
+ d: "M14.953 14.953A8.84 8.84 0 0 1 10 15.833C4.583 15.833 1.667 10 1.667 10a13.5 13.5 0 0 1 3.38-3.953M1.667 1.667l16.666 16.666",
779
+ stroke: "currentColor",
780
+ "stroke-width": "1.5",
781
+ "stroke-linecap": "round",
782
+ "stroke-linejoin": "round"
384
783
  }
385
784
  )
386
785
  ] });
387
786
  }
388
- function ve() {
389
- return /* @__PURE__ */ u("div", { class: "flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400", children: [
390
- /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent" }),
391
- /* @__PURE__ */ o("span", { children: "or" }),
392
- /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gradient-to-r from-transparent to-gray-200" })
787
+ function xt({ email: r }) {
788
+ const { t: e } = S(), t = r ? e("auth.last_used", "Last · {email}", { email: wt(r) }) : e("auth.last_used_no_email", "Last");
789
+ return /* @__PURE__ */ o("span", { class: "pointer-events-none absolute -top-2 right-3 max-w-[75%] truncate rounded-full bg-gray-900 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white shadow-sm", children: t });
790
+ }
791
+ function wt(r) {
792
+ const [e, t] = r.split("@");
793
+ return t ? `${e.slice(0, 3)}*****@${t}` : r;
794
+ }
795
+ function kt() {
796
+ const { t: r } = S();
797
+ return /* @__PURE__ */ u("div", { class: "flex items-center gap-3 py-1 text-sm text-gray-400", children: [
798
+ /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" }),
799
+ /* @__PURE__ */ o("span", { children: r("auth.or", "or") }),
800
+ /* @__PURE__ */ o("div", { class: "h-px flex-1 bg-gray-200" })
393
801
  ] });
394
802
  }
395
- function _e({ provider: r }) {
396
- return r === "google" ? /* @__PURE__ */ u("svg", { width: "16", height: "16", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
803
+ function vt({ provider: r }) {
804
+ return r === "google" ? /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 18 18", "aria-hidden": "true", children: [
397
805
  /* @__PURE__ */ o("path", { fill: "#4285F4", d: "M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.49h4.84a4.14 4.14 0 0 1-1.79 2.71v2.26h2.9c1.7-1.56 2.69-3.87 2.69-6.62Z" }),
398
806
  /* @__PURE__ */ o("path", { fill: "#34A853", d: "M9 18c2.43 0 4.47-.8 5.96-2.18l-2.9-2.26c-.8.54-1.83.86-3.06.86-2.36 0-4.36-1.59-5.07-3.74H.92v2.33A9 9 0 0 0 9 18Z" }),
399
807
  /* @__PURE__ */ o("path", { fill: "#FBBC05", d: "M3.93 10.68a5.4 5.4 0 0 1 0-3.36V4.99H.92a9 9 0 0 0 0 8.02l3-2.33Z" }),
400
808
  /* @__PURE__ */ o("path", { fill: "#EA4335", d: "M9 3.58c1.32 0 2.5.45 3.44 1.34l2.58-2.58A9 9 0 0 0 .92 4.99l3.01 2.33C4.64 5.17 6.64 3.58 9 3.58Z" })
401
- ] }) : r === "apple" ? /* @__PURE__ */ o("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M11.4 8.5c0-2 1.6-3 1.7-3-.9-1.3-2.4-1.5-2.9-1.5-1.2-.1-2.4.7-3 .7-.6 0-1.6-.7-2.6-.7-1.3 0-2.6.8-3.3 2C-.4 8.4.7 12.5 2.2 14.7c.7 1.1 1.6 2.3 2.7 2.3 1.1 0 1.5-.7 2.8-.7 1.3 0 1.7.7 2.8.7 1.2 0 1.9-1.1 2.6-2.2.6-.9 1-1.8 1.1-2.7-1.4-.5-2.8-1.7-2.8-3.6Zm-2-6.5C10 1.3 10.4.4 10.3 0c-.7 0-1.6.5-2.1 1.1-.5.5-1 1.4-.9 2.2.7 0 1.5-.4 2.1-1.3Z" }) }) : r === "github" ? /* @__PURE__ */ o("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ o("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M14 2.7C14 1.2 12.8 0 11.3 0H2.7C1.2 0 0 1.2 0 2.7v10.6C0 14.8 1.2 16 2.7 16h4V9.8H4.7v-2H6.7V6.4c0-2 1.2-3.1 3-3.1.9 0 1.7.1 2 .2V5h-1.4c-.8 0-1 .4-1 1v1.5h2.4l-.3 2H9.3V16h2c1.5 0 2.7-1.2 2.7-2.7V2.7Z" }) });
809
+ ] }) : r === "apple" ? (
810
+ // viewBox 0 0 24 24 даёт воздух сверху/снизу пути, поэтому визуально
811
+ // Apple-яблоко выглядит меньше Google. Компенсируем увеличенным
812
+ // width/height — 26×26 даёт примерно equal optical size с Google 20×20.
813
+ /* @__PURE__ */ o("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) })
814
+ ) : r === "github" ? /* @__PURE__ */ o("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M8 0C3.6 0 0 3.6 0 8a8 8 0 0 0 5.5 7.6c.4.1.5-.2.5-.4v-1.5c-2.2.5-2.7-1-2.7-1-.4-.9-.9-1.2-.9-1.2-.7-.5.1-.5.1-.5.8.1 1.2.8 1.2.8.7 1.2 1.9.9 2.4.7 0-.5.3-.9.5-1.1-1.8-.2-3.6-.9-3.6-4 0-.9.3-1.6.8-2.1-.1-.2-.4-1 .1-2.1 0 0 .7-.2 2.2.8a7.6 7.6 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.4 1.1.2 1.9.1 2.1.5.5.8 1.2.8 2.1 0 3.1-1.9 3.7-3.6 3.9.3.3.6.8.6 1.6V15c0 .2.1.5.6.4A8 8 0 0 0 16 8c0-4.4-3.6-8-8-8Z" }) }) : /* @__PURE__ */ o("svg", { width: "18", height: "20", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M14 2.7C14 1.2 12.8 0 11.3 0H2.7C1.2 0 0 1.2 0 2.7v10.6C0 14.8 1.2 16 2.7 16h4V9.8H4.7v-2H6.7V6.4c0-2 1.2-3.1 3-3.1.9 0 1.7.1 2 .2V5h-1.4c-.8 0-1 .4-1 1v1.5h2.4l-.3 2H9.3V16h2c1.5 0 2.7-1.2 2.7-2.7V2.7Z" }) });
402
815
  }
403
- function Se({
816
+ function _t({
404
817
  block: r,
405
818
  bootstrap: e,
406
819
  auth: t,
407
820
  authSession: n,
408
821
  onBack: i,
409
- showBack: s = !0
822
+ showBack: s = !0,
823
+ intent: a = "preauth",
824
+ initialMode: c
410
825
  }) {
411
- return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
412
- s ? /* @__PURE__ */ o(
413
- "button",
414
- {
415
- type: "button",
416
- onClick: i,
417
- class: "-ml-1 self-start rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
418
- children: "← Back"
419
- }
420
- ) : null,
421
- /* @__PURE__ */ o(se, { block: r, ctx: {
422
- bootstrap: e,
423
- selectedPriceId: null,
424
- setSelectedPriceId: () => {
425
- },
426
- onAction: () => {
826
+ const { t: l } = S(), h = {
827
+ bootstrap: e,
828
+ selectedPriceId: null,
829
+ setSelectedPriceId: () => {
830
+ },
831
+ onAction: () => {
832
+ },
833
+ auth: t,
834
+ authSession: n,
835
+ initialAuthMode: c
836
+ }, d = a === "restore" ? {
837
+ ...r,
838
+ heading: l("auth.restore_purchases_heading", "Restore Purchases"),
839
+ subheading: l(
840
+ "auth.restore_purchases_subheading",
841
+ "Please sign in to restore your purchases."
842
+ )
843
+ } : a === "preauth" ? {
844
+ ...r,
845
+ heading: l("auth.login_continue_purchase", "Log in to continue your purchase"),
846
+ subheading: l(
847
+ "auth.link_purchase_subheading",
848
+ "We'll link the purchase to your account to keep access."
849
+ ),
850
+ // Preauth heading — descriptive sentence ("Log in to continue your
851
+ // purchase"), а не action verb. Длинные локализации (RU: "Войдите,
852
+ // чтобы продолжить покупку") в pill-кнопку h-12 не помещаются и
853
+ // переносятся на 2 строки. Явный короткий submit_label решает.
854
+ submit_label: l("auth.log_in", "Sign In")
855
+ } : r;
856
+ return /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 overflow-y-auto p-6 sm:p-8", children: [
857
+ s ? /* @__PURE__ */ o(St, { onClick: i, ariaLabel: l("nav.back_aria", "Back") }) : null,
858
+ /* @__PURE__ */ o(Me, { block: d, ctx: h })
859
+ ] });
860
+ }
861
+ function St({ onClick: r, ariaLabel: e }) {
862
+ return /* @__PURE__ */ o(
863
+ "button",
864
+ {
865
+ type: "button",
866
+ onClick: r,
867
+ "aria-label": e,
868
+ class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
869
+ children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
870
+ /* @__PURE__ */ o(
871
+ "path",
872
+ {
873
+ d: "M5 8h8a4 4 0 0 1 0 8H9",
874
+ stroke: "currentColor",
875
+ "stroke-width": "1.75",
876
+ "stroke-linecap": "round",
877
+ "stroke-linejoin": "round"
878
+ }
879
+ ),
880
+ /* @__PURE__ */ o(
881
+ "path",
882
+ {
883
+ d: "M8 4 4 8l4 4",
884
+ stroke: "currentColor",
885
+ "stroke-width": "1.75",
886
+ "stroke-linecap": "round",
887
+ "stroke-linejoin": "round"
888
+ }
889
+ )
890
+ ] })
891
+ }
892
+ );
893
+ }
894
+ const Ee = (r) => `pw-offer-${r}-start`;
895
+ function ne(r) {
896
+ const e = r - Date.now();
897
+ return e <= 0 ? { days: 0, hours: 0, minutes: 0, seconds: 0, expired: !0 } : {
898
+ days: Math.floor(e / (1e3 * 60 * 60 * 24)),
899
+ hours: Math.floor(e % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)),
900
+ minutes: Math.floor(e % (1e3 * 60 * 60) / (1e3 * 60)),
901
+ seconds: Math.floor(e % (1e3 * 60) / 1e3),
902
+ expired: !1
903
+ };
904
+ }
905
+ function Ct(r) {
906
+ if (r.expires_at) {
907
+ const e = Date.parse(r.expires_at);
908
+ return Number.isFinite(e) ? e : null;
909
+ }
910
+ if (r.duration_minutes && r.duration_minutes > 0) {
911
+ if (typeof window > "u") return null;
912
+ try {
913
+ const e = Ee(r.id);
914
+ let t = window.localStorage.getItem(e);
915
+ return t || (t = (/* @__PURE__ */ new Date()).toISOString(), window.localStorage.setItem(e, t)), Date.parse(t) + r.duration_minutes * 6e4;
916
+ } catch {
917
+ return null;
918
+ }
919
+ }
920
+ return null;
921
+ }
922
+ function Te(r, e) {
923
+ if (!r || r.length === 0) return null;
924
+ if (e) {
925
+ const t = r.find((n) => n.id === e);
926
+ if (t) return t;
927
+ }
928
+ return r.find((t) => t.expires_at || t.duration_minutes) ?? null;
929
+ }
930
+ function Be(r) {
931
+ const e = r ? Ct(r) : null, [t, n] = k(
932
+ () => e !== null ? ne(e) : null
933
+ ), i = D(e);
934
+ return i.current = e, P(() => {
935
+ if (e === null) {
936
+ n(null);
937
+ return;
938
+ }
939
+ n(ne(e));
940
+ const s = setInterval(() => {
941
+ const a = ne(i.current ?? 0);
942
+ if (n(a), a.expired && (clearInterval(s), r?.duration_minutes && typeof window < "u"))
943
+ try {
944
+ window.localStorage.removeItem(Ee(r.id));
945
+ } catch {
946
+ }
947
+ }, 1e3);
948
+ return () => clearInterval(s);
949
+ }, [e, r?.duration_minutes, r?.id]), t;
950
+ }
951
+ function It({ block: r, ctx: e }) {
952
+ const { t } = S(), n = Te(e.bootstrap.offers, r.offer_id), i = Be(n);
953
+ if (!n || i === null || i.expired && !r.force) return null;
954
+ const s = r.title ?? n.label ?? t("offer.limited_time", "Limited-time offer"), a = n.discount_percent ? `${s} ${n.discount_percent}%` : s;
955
+ return /* @__PURE__ */ u(
956
+ "div",
957
+ {
958
+ class: "flex flex-wrap items-center justify-center gap-2 rounded-2xl px-4 py-3 text-[15px] font-semibold leading-tight text-white",
959
+ style: {
960
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
961
+ textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
427
962
  },
428
- auth: t,
429
- authSession: n
430
- } })
963
+ role: "status",
964
+ children: [
965
+ /* @__PURE__ */ o(Oe, {}),
966
+ /* @__PURE__ */ o("span", { children: a }),
967
+ /* @__PURE__ */ o(Pe, { value: i, t })
968
+ ]
969
+ }
970
+ );
971
+ }
972
+ function Pe({ value: r, t: e }) {
973
+ return /* @__PURE__ */ u("div", { class: "flex items-center gap-1 font-mono text-sm", children: [
974
+ r.days > 0 ? /* @__PURE__ */ u(ae, { children: [
975
+ /* @__PURE__ */ o(H, { children: String(r.days) }),
976
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.d", "d") })
977
+ ] }) : null,
978
+ /* @__PURE__ */ o(H, { children: String(r.hours).padStart(2, "0") }),
979
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.h", "h") }),
980
+ /* @__PURE__ */ o(H, { children: String(r.minutes).padStart(2, "0") }),
981
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.m", "m") }),
982
+ /* @__PURE__ */ o(H, { children: String(r.seconds).padStart(2, "0") }),
983
+ /* @__PURE__ */ o("span", { class: "text-xs", children: e("countdown.s", "s") })
431
984
  ] });
432
985
  }
433
- function Ce({
434
- auth: r,
435
- onSuccess: e,
436
- onBack: t,
437
- heading: n = "Continue as guest",
438
- description: i = "Setting up your guest session…"
439
- }) {
440
- const [s, l] = x({ kind: "signing-in" }), a = B(!0);
441
- M(() => () => {
442
- a.current = !1;
443
- }, []);
444
- const c = () => {
445
- l({ kind: "signing-in" }), (async () => {
446
- try {
447
- const p = await r.signInAnonymously();
448
- if (!a.current) return;
449
- e(p);
450
- } catch (p) {
451
- if (!a.current) return;
452
- l({
453
- kind: "error",
454
- message: p instanceof Error ? p.message : "Anonymous sign-in failed"
455
- });
456
- }
457
- })();
458
- };
459
- return M(() => {
460
- c();
461
- }, []), /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
462
- t ? /* @__PURE__ */ o(
463
- "button",
464
- {
465
- type: "button",
466
- onClick: t,
467
- class: "-ml-1 self-start rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
468
- children: "← Back"
469
- }
470
- ) : null,
471
- /* @__PURE__ */ u("div", { class: "flex flex-col gap-1", children: [
472
- /* @__PURE__ */ o("h2", { class: "text-xl font-semibold text-gray-900", children: n }),
473
- /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: i })
474
- ] }),
475
- s.kind === "signing-in" ? /* @__PURE__ */ o("div", { class: "flex items-center justify-center py-6", children: /* @__PURE__ */ o(Ie, {}) }) : null,
476
- s.kind === "error" ? /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
477
- /* @__PURE__ */ o("div", { class: "rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700", children: s.message }),
478
- /* @__PURE__ */ o(
479
- "button",
986
+ function H({ children: r }) {
987
+ return /* @__PURE__ */ o("span", { class: "rounded bg-black/20 px-1.5 py-0.5 text-xs font-bold", children: r });
988
+ }
989
+ function At({ offer: r }) {
990
+ const { t: e } = S(), t = Be(r);
991
+ if (t === null || t.expired) return null;
992
+ const n = r.label ?? e("offer.limited_time", "Limited-time offer"), i = r.discount_percent ? `${n} ${r.discount_percent}%` : n;
993
+ return /* @__PURE__ */ u(
994
+ "div",
995
+ {
996
+ class: "-mb-2 flex flex-wrap items-center justify-center gap-2 rounded-t-xl px-4 pb-5 pt-3 text-[15px] font-semibold leading-tight text-white",
997
+ style: {
998
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)",
999
+ textShadow: "0 0 2px rgba(0, 0, 0, 0.25)"
1000
+ },
1001
+ role: "status",
1002
+ children: [
1003
+ /* @__PURE__ */ o(Oe, {}),
1004
+ /* @__PURE__ */ o("span", { children: i }),
1005
+ /* @__PURE__ */ o(Pe, { value: t, t: e })
1006
+ ]
1007
+ }
1008
+ );
1009
+ }
1010
+ function Oe() {
1011
+ return /* @__PURE__ */ o(
1012
+ "svg",
1013
+ {
1014
+ width: "16",
1015
+ height: "16",
1016
+ viewBox: "0 0 12 12",
1017
+ fill: "none",
1018
+ "aria-hidden": "true",
1019
+ children: /* @__PURE__ */ o(
1020
+ "path",
480
1021
  {
481
- type: "button",
482
- onClick: c,
483
- class: "self-start rounded-md bg-[var(--pw-accent)] px-3 py-1.5 text-sm font-medium text-white hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)] focus-visible:ring-offset-2",
484
- children: "Try again"
1022
+ fill: "currentColor",
1023
+ d: "m9.44 5.359-2.394-.895.61-3.036c.062-.31-.345-.531-.57-.291L2.434 6.105a.336.336 0 0 0 .126.537l2.395.894-.61 3.037c-.062.31.345.53.57.29l4.653-4.968a.336.336 0 0 0-.126-.536Z"
485
1024
  }
486
1025
  )
487
- ] }) : null
488
- ] });
489
- }
490
- function Ie() {
491
- return /* @__PURE__ */ u("svg", { class: "h-5 w-5 animate-spin text-[var(--pw-accent)]", viewBox: "0 0 24 24", fill: "none", children: [
492
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "3", "stroke-opacity": "0.2" }),
493
- /* @__PURE__ */ o("path", { d: "M22 12a10 10 0 0 0-10-10", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" })
494
- ] });
1026
+ }
1027
+ );
495
1028
  }
496
- const D = 3, F = 200, V = 5e3, $ = 5, Ae = 10 * 1024 * 1024, X = ["image/jpeg", "image/png", "image/webp"], Y = /.+@.+\..+/;
497
- function Te({ client: r, authSession: e, origin: t, onBack: n }) {
498
- const i = e?.user.email ?? "", s = i || null, [l, a] = x(i), [c, p] = x(""), [g, b] = x(""), [f, m] = x([]), [y, _] = x(!1), [A, v] = x(null), [S, w] = x({}), P = ie(() => {
499
- const d = (s ?? l).trim().toLowerCase(), h = c.trim(), k = g.trim();
500
- return Y.test(d) && h.length >= D && h.length <= F && k.length >= 1 && k.length <= V;
501
- }, [s, l, c, g]), L = () => {
502
- const d = {}, h = (s ?? l).trim(), k = c.trim(), U = g.trim();
503
- return h ? Y.test(h.toLowerCase()) || (d.email = "Invalid email") : d.email = "Required", (k.length < D || k.length > F) && (d.subject = `${D}–${F} characters`), (U.length < 1 || U.length > V) && (d.message = `1–${V} characters`), w(d), Object.keys(d).length === 0;
504
- }, C = async (d) => {
505
- if (d.preventDefault(), !y && L()) {
506
- _(!0), w((h) => ({ ...h, submit: void 0 }));
1029
+ const me = 3, ye = 200, be = 5e3, ie = 5, Lt = 10 * 1024 * 1024, xe = ["image/jpeg", "image/png", "image/webp"], Mt = /.+@.+\..+/;
1030
+ function Et({ client: r, authSession: e, origin: t, onBack: n }) {
1031
+ const { t: i } = S(), s = e?.user.email ?? "", a = s || null, [c, l] = k(s), [h, d] = k(""), [g, _] = k(""), [p, v] = k([]), [m, A] = k(!1), [b, y] = k(null), [C, I] = k({}), U = () => {
1032
+ const T = {}, E = (a ?? c).trim(), z = h.trim(), q = g.trim();
1033
+ return E ? Mt.test(E.toLowerCase()) || (T.email = i("support.invalid_email", "Invalid email")) : T.email = i("support.required", "Required"), (z.length < me || z.length > ye) && (T.subject = i("support.subject_length", "{min}–{max} characters", {
1034
+ min: me,
1035
+ max: ye
1036
+ })), (q.length < 1 || q.length > be) && (T.message = i("support.message_length", "{min}{max} characters", {
1037
+ min: 1,
1038
+ max: be
1039
+ })), I(T), Object.keys(T).length === 0;
1040
+ }, M = async (T) => {
1041
+ if (T.preventDefault(), !m && U()) {
1042
+ A(!0), I((E) => ({ ...E, submit: void 0 }));
507
1043
  try {
508
- const h = (s ?? l).trim();
1044
+ const E = (a ?? c).trim();
509
1045
  await r.createSupportTicket({
510
- subject: c.trim(),
1046
+ subject: h.trim(),
511
1047
  content: g.trim(),
512
- email: h || void 0,
513
- files: f.length > 0 ? f : void 0
514
- }), v(h);
515
- } catch (h) {
516
- const k = h instanceof T && h.message || "Failed to send. Please try again.";
517
- w((U) => ({ ...U, submit: k }));
1048
+ email: E || void 0,
1049
+ files: p.length > 0 ? p : void 0
1050
+ }), y(E);
1051
+ } catch (E) {
1052
+ const z = E instanceof L && E.message || "Failed to send. Please try again.";
1053
+ I((q) => ({ ...q, submit: z }));
518
1054
  } finally {
519
- _(!1);
1055
+ A(!1);
520
1056
  }
521
1057
  }
522
- }, I = () => {
523
- p(""), b(""), m([]), w({}), v(null);
524
- };
525
- return A ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-4 py-2 text-center", children: [
526
- /* @__PURE__ */ o(
527
- "div",
528
- {
529
- class: "flex h-14 w-14 items-center justify-center rounded-full",
530
- style: {
531
- background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
532
- color: "#fff",
533
- boxShadow: "0 0 0 8px color-mix(in srgb, var(--pw-accent) 12%, transparent), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 45%, transparent)"
534
- },
535
- "aria-hidden": "true",
536
- children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ o(
537
- "path",
538
- {
539
- fill: "currentColor",
540
- d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.93 8.2-6.85 9.29a1.01 1.01 0 0 1-1.43.19L5.76 13.77a1 1 0 1 1 1.25-1.56l4.08 3.26 6.23-8.45a1 1 0 1 1 1.61 1.18Z"
541
- }
542
- ) })
543
- }
544
- ),
545
- /* @__PURE__ */ o("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Request submitted" }),
546
- /* @__PURE__ */ u("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
547
- "We've received your message and will respond to",
548
- " ",
549
- /* @__PURE__ */ o("b", { class: "text-gray-700", children: A }),
550
- "."
1058
+ }, O = () => {
1059
+ d(""), _(""), v([]), I({}), y(null);
1060
+ }, j = "flex flex-col gap-3 bg-white px-6 pb-6 pt-3 sm:px-8", R = { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" };
1061
+ return b ? /* @__PURE__ */ u("div", { class: "relative flex-1 min-h-0 flex flex-col", children: [
1062
+ /* @__PURE__ */ u("div", { class: "flex-1 min-h-0 overflow-y-auto flex flex-col items-center gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8 text-center", children: [
1063
+ /* @__PURE__ */ o(
1064
+ "div",
1065
+ {
1066
+ class: "flex h-14 w-14 items-center justify-center rounded-full",
1067
+ style: {
1068
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",
1069
+ color: "#fff",
1070
+ boxShadow: "0 0 0 8px color-mix(in srgb, var(--pw-accent) 12%, transparent), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 45%, transparent)"
1071
+ },
1072
+ "aria-hidden": "true",
1073
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", class: "h-7 w-7", children: /* @__PURE__ */ o(
1074
+ "path",
1075
+ {
1076
+ fill: "currentColor",
1077
+ d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.93 8.2-6.85 9.29a1.01 1.01 0 0 1-1.43.19L5.76 13.77a1 1 0 1 1 1.25-1.56l4.08 3.26 6.23-8.45a1 1 0 1 1 1.61 1.18Z"
1078
+ }
1079
+ ) })
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ o("div", { class: "text-lg font-semibold tracking-tight text-gray-900", children: i("support.success_heading", "Request submitted") }),
1083
+ /* @__PURE__ */ u("div", { class: "max-w-[320px] text-sm leading-relaxed text-gray-500", children: [
1084
+ i(
1085
+ "support.success_message_prefix",
1086
+ "We've received your message and will respond to"
1087
+ ),
1088
+ " ",
1089
+ /* @__PURE__ */ o("b", { class: "text-gray-700", children: b }),
1090
+ "."
1091
+ ] })
551
1092
  ] }),
552
- /* @__PURE__ */ u("div", { class: "mt-2 flex items-center justify-center gap-3", children: [
1093
+ /* @__PURE__ */ o("div", { class: j, style: R, children: /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
553
1094
  /* @__PURE__ */ o(
554
1095
  "button",
555
1096
  {
556
1097
  type: "button",
557
1098
  onClick: n,
558
1099
  class: "rounded-xl px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
559
- children: t === "standalone" ? "Done" : "Back"
1100
+ children: t === "standalone" ? i("support.done_button", "Done") : i("nav.back_aria", "Back")
560
1101
  }
561
1102
  ),
562
1103
  /* @__PURE__ */ o(
563
1104
  "button",
564
1105
  {
565
1106
  type: "button",
566
- onClick: I,
1107
+ onClick: O,
567
1108
  class: "flex h-10 items-center justify-center rounded-xl px-4 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
568
1109
  style: {
569
1110
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
570
1111
  boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
571
1112
  },
572
- children: "Send another request"
1113
+ children: i("support.send_another", "Send another request")
573
1114
  }
574
1115
  )
575
- ] })
576
- ] }) : /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
577
- /* @__PURE__ */ o("div", { class: "flex items-center justify-between", children: /* @__PURE__ */ u(
578
- "button",
579
- {
580
- type: "button",
581
- onClick: n,
582
- class: "-ml-1 rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
583
- children: [
584
- " ",
585
- t === "standalone" ? "Close" : "Back"
586
- ]
587
- }
588
- ) }),
589
- /* @__PURE__ */ o("h2", { class: "text-lg font-semibold tracking-tight text-gray-900", children: "Contact Support" }),
590
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: "Fill out the form below and we'll get back to you." }),
591
- /* @__PURE__ */ u("form", { onSubmit: C, class: "flex flex-col gap-3", children: [
592
- s ? /* @__PURE__ */ u("div", { class: "rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500", children: [
593
- "Sending as ",
594
- /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: s })
595
- ] }) : /* @__PURE__ */ o(
596
- J,
597
- {
598
- type: "email",
599
- label: "Your email",
600
- value: l,
601
- onInput: a,
602
- error: S.email,
603
- autocomplete: "email",
604
- required: !0
605
- }
606
- ),
607
- /* @__PURE__ */ o(
608
- J,
609
- {
610
- type: "text",
611
- label: "Subject",
612
- value: c,
613
- onInput: p,
614
- error: S.subject,
615
- required: !0
616
- }
617
- ),
618
- /* @__PURE__ */ o(
619
- Me,
620
- {
621
- label: "Message",
622
- value: g,
623
- onInput: b,
624
- error: S.message,
625
- required: !0
626
- }
627
- ),
628
- /* @__PURE__ */ o(Be, { files: f, onChange: m, disabled: y }),
629
- S.submit && /* @__PURE__ */ o("p", { class: "text-xs text-red-600", children: S.submit }),
630
- /* @__PURE__ */ u("div", { class: "mt-1 flex items-center justify-end gap-2", children: [
1116
+ ] }) })
1117
+ ] }) : /* @__PURE__ */ u("form", { onSubmit: M, class: "relative flex-1 min-h-0 flex flex-col", children: [
1118
+ /* @__PURE__ */ o(Tt, { onClick: n, ariaLabel: i("nav.back_aria", "Back") }),
1119
+ /* @__PURE__ */ o("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ u("div", { class: "flex flex-col gap-5", children: [
1120
+ /* @__PURE__ */ u("div", { class: "flex flex-col gap-2 pr-10", children: [
1121
+ /* @__PURE__ */ o("h2", { class: "text-3xl font-bold tracking-tight text-gray-900", children: i("support.heading", "Support") }),
1122
+ /* @__PURE__ */ o("p", { class: "text-base leading-relaxed text-gray-600", children: i("support.instruction", "Please fill out the form below to submit your support request.") })
1123
+ ] }),
1124
+ /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
1125
+ a ? /* @__PURE__ */ u("div", { class: "rounded-2xl bg-gray-100 px-5 py-3 text-sm text-gray-600", children: [
1126
+ i("support.sending_as", "Sending as"),
1127
+ " ",
1128
+ /* @__PURE__ */ o("b", { class: "font-medium text-gray-900", children: a })
1129
+ ] }) : /* @__PURE__ */ o(
1130
+ we,
1131
+ {
1132
+ type: "email",
1133
+ placeholder: i("support.email_placeholder", "Enter your email *"),
1134
+ value: c,
1135
+ onInput: l,
1136
+ error: C.email,
1137
+ autocomplete: "email",
1138
+ required: !0
1139
+ }
1140
+ ),
1141
+ /* @__PURE__ */ o(
1142
+ we,
1143
+ {
1144
+ type: "text",
1145
+ placeholder: i("support.subject_placeholder", "Enter your subject *"),
1146
+ value: h,
1147
+ onInput: d,
1148
+ error: C.subject,
1149
+ required: !0
1150
+ }
1151
+ ),
1152
+ /* @__PURE__ */ o(
1153
+ Bt,
1154
+ {
1155
+ placeholder: i("support.message_placeholder", "Enter your message *"),
1156
+ value: g,
1157
+ onInput: _,
1158
+ error: C.message,
1159
+ required: !0
1160
+ }
1161
+ ),
1162
+ /* @__PURE__ */ o(Pt, { files: p, onChange: v, disabled: m })
1163
+ ] })
1164
+ ] }) }),
1165
+ /* @__PURE__ */ u("div", { class: j, style: R, children: [
1166
+ C.submit && /* @__PURE__ */ o("p", { class: "text-sm text-red-600", children: C.submit }),
1167
+ /* @__PURE__ */ u("div", { class: "flex items-center justify-end gap-3", children: [
631
1168
  /* @__PURE__ */ o(
632
1169
  "button",
633
1170
  {
634
1171
  type: "button",
635
1172
  onClick: n,
636
- disabled: y,
637
- class: "rounded-xl px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
638
- children: t === "standalone" ? "Close" : "Back"
1173
+ disabled: m,
1174
+ class: "rounded-full px-4 py-2 text-base font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1175
+ children: t === "standalone" ? i("support.close_button", "Close") : i("nav.back_aria", "Back")
639
1176
  }
640
1177
  ),
641
1178
  /* @__PURE__ */ o(
642
1179
  "button",
643
1180
  {
644
1181
  type: "submit",
645
- disabled: !P || y,
646
- class: "flex h-10 items-center justify-center rounded-xl px-4 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1182
+ disabled: m,
1183
+ class: "pw-cta-shimmer relative flex h-12 items-center justify-center overflow-hidden rounded-full px-8 text-base font-semibold text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
647
1184
  style: {
648
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
649
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1185
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
1186
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
650
1187
  },
651
- children: y ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : "Send"
1188
+ children: m ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: i("support.send_button", "Send") })
652
1189
  }
653
1190
  )
654
1191
  ] })
655
1192
  ] })
656
1193
  ] });
657
1194
  }
658
- function J({ type: r, label: e, value: t, onInput: n, error: i, autocomplete: s, required: l }) {
659
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
660
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: e }),
1195
+ function Tt({ onClick: r, ariaLabel: e }) {
1196
+ return /* @__PURE__ */ o(
1197
+ "button",
1198
+ {
1199
+ type: "button",
1200
+ onClick: r,
1201
+ "aria-label": e,
1202
+ class: "absolute right-4 top-4 z-10 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1203
+ children: /* @__PURE__ */ u("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1204
+ /* @__PURE__ */ o(
1205
+ "path",
1206
+ {
1207
+ d: "M5 8h8a4 4 0 0 1 0 8H9",
1208
+ stroke: "currentColor",
1209
+ "stroke-width": "1.75",
1210
+ "stroke-linecap": "round",
1211
+ "stroke-linejoin": "round"
1212
+ }
1213
+ ),
1214
+ /* @__PURE__ */ o(
1215
+ "path",
1216
+ {
1217
+ d: "M8 4 4 8l4 4",
1218
+ stroke: "currentColor",
1219
+ "stroke-width": "1.75",
1220
+ "stroke-linecap": "round",
1221
+ "stroke-linejoin": "round"
1222
+ }
1223
+ )
1224
+ ] })
1225
+ }
1226
+ );
1227
+ }
1228
+ function we({
1229
+ type: r,
1230
+ placeholder: e,
1231
+ value: t,
1232
+ onInput: n,
1233
+ error: i,
1234
+ autocomplete: s,
1235
+ required: a
1236
+ }) {
1237
+ return /* @__PURE__ */ u("div", { children: [
661
1238
  /* @__PURE__ */ o(
662
1239
  "input",
663
1240
  {
664
1241
  type: r,
665
1242
  value: t,
666
- onInput: (a) => n(a.target.value),
1243
+ placeholder: e,
1244
+ onInput: (c) => n(c.target.value),
667
1245
  autocomplete: s,
668
- required: l,
669
- class: `h-11 w-full rounded-xl border bg-white px-3.5 text-sm text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 ${i ? "border-red-400 focus:border-red-500 focus:shadow-[0_0_0_3px_rgba(239,68,68,0.18)]" : "border-gray-200 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"}`
1246
+ required: a,
1247
+ class: `h-14 w-full rounded-2xl bg-gray-100 px-5 text-base text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${i ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
670
1248
  }
671
1249
  ),
672
- i && /* @__PURE__ */ o("span", { class: "text-xs text-red-600", children: i })
1250
+ i && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: i })
673
1251
  ] });
674
1252
  }
675
- function Me({ label: r, value: e, onInput: t, error: n, required: i }) {
676
- return /* @__PURE__ */ u("label", { class: "flex flex-col gap-1.5", children: [
677
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: r }),
1253
+ function Bt({
1254
+ placeholder: r,
1255
+ value: e,
1256
+ onInput: t,
1257
+ error: n,
1258
+ required: i
1259
+ }) {
1260
+ return /* @__PURE__ */ u("div", { children: [
678
1261
  /* @__PURE__ */ o(
679
1262
  "textarea",
680
1263
  {
681
1264
  value: e,
1265
+ placeholder: r,
682
1266
  onInput: (s) => t(s.target.value),
683
1267
  required: i,
684
- rows: 4,
685
- class: `min-h-[104px] w-full rounded-xl border bg-white px-3.5 py-2.5 text-sm leading-relaxed text-gray-900 shadow-[0_1px_0_rgba(15,23,42,0.02)] outline-none transition-all placeholder:text-gray-400 ${n ? "border-red-400 focus:border-red-500 focus:shadow-[0_0_0_3px_rgba(239,68,68,0.18)]" : "border-gray-200 hover:border-gray-300 focus:border-[var(--pw-accent)] focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_18%,transparent)]"}`
1268
+ rows: 5,
1269
+ class: `min-h-[120px] w-full rounded-2xl bg-gray-100 px-5 py-3.5 text-base leading-relaxed text-gray-900 outline-none transition-all placeholder:text-gray-500 hover:bg-gray-200/60 focus:bg-gray-200/60 ${n ? "shadow-[0_0_0_2px_rgba(239,68,68,0.5)]" : "focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--pw-accent)_30%,transparent)]"}`
686
1270
  }
687
1271
  ),
688
- n && /* @__PURE__ */ o("span", { class: "text-xs text-red-600", children: n })
1272
+ n && /* @__PURE__ */ o("span", { class: "mt-1 ml-2 block text-sm text-red-600", children: n })
689
1273
  ] });
690
1274
  }
691
- function Be({ files: r, onChange: e, disabled: t }) {
692
- const n = B(null), [i, s] = x(!1), [l, a] = x(null), c = (p) => {
693
- if (!p || t) return;
694
- a(null);
695
- const g = Array.from(p);
696
- if (r.length + g.length > $) {
697
- a(`Up to ${$} files`);
1275
+ function Pt({ files: r, onChange: e, disabled: t }) {
1276
+ const { t: n } = S(), i = D(null), [s, a] = k(!1), [c, l] = k(null), h = (d) => {
1277
+ if (!d || t) return;
1278
+ l(null);
1279
+ const g = Array.from(d);
1280
+ if (r.length + g.length > ie) {
1281
+ l(n("support.too_many_files", "Up to {max} files", { max: ie }));
698
1282
  return;
699
1283
  }
700
- const b = g.filter(
701
- (f) => X.includes(f.type) && f.size <= Ae
1284
+ const _ = g.filter(
1285
+ (p) => xe.includes(p.type) && p.size <= Lt
702
1286
  );
703
- if (b.length !== g.length) {
704
- a("Only JPEG/PNG/WebP, ≤ 10MB each");
1287
+ if (_.length !== g.length) {
1288
+ l(n("support.invalid_file", "Only JPEG/PNG/WebP, ≤ 10MB each"));
705
1289
  return;
706
1290
  }
707
- e([...r, ...b]);
1291
+ e([...r, ..._]);
708
1292
  };
709
1293
  return /* @__PURE__ */ u("div", { children: [
710
- /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: "Attachments (optional)" }),
1294
+ /* @__PURE__ */ o("span", { class: "text-xs font-medium text-gray-700", children: n("support.attachments_label", "Attachments (optional)") }),
711
1295
  /* @__PURE__ */ u(
712
1296
  "div",
713
1297
  {
714
1298
  role: "button",
715
1299
  tabIndex: 0,
716
- "aria-label": "Attachments upload",
717
- onClick: () => !t && n.current?.click(),
718
- onDragOver: (p) => {
719
- p.preventDefault(), t || s(!0);
1300
+ "aria-label": n("support.attachments_aria", "Attachments upload"),
1301
+ onClick: () => !t && i.current?.click(),
1302
+ onDragOver: (d) => {
1303
+ d.preventDefault(), t || a(!0);
720
1304
  },
721
- onDragLeave: () => s(!1),
722
- onDrop: (p) => {
723
- p.preventDefault(), s(!1), c(p.dataTransfer?.files ?? null);
1305
+ onDragLeave: () => a(!1),
1306
+ onDrop: (d) => {
1307
+ d.preventDefault(), a(!1), h(d.dataTransfer?.files ?? null);
724
1308
  },
725
- class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${i ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${t ? "cursor-not-allowed opacity-60" : ""}`,
1309
+ class: `mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${s ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)]" : "border-gray-300 hover:border-gray-400 hover:bg-gray-50/60"} ${t ? "cursor-not-allowed opacity-60" : ""}`,
726
1310
  children: [
727
- /* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: "Drop images here or click to select" }),
728
- /* @__PURE__ */ u("div", { class: "mt-0.5 text-[11px] text-gray-400", children: [
729
- "JPEG/PNG/WebP, up to ",
730
- $,
731
- " files, ≤ 10MB each"
732
- ] })
1311
+ /* @__PURE__ */ o("div", { class: "text-xs text-gray-500", children: n("support.dropzone_text", "Drop images here or click to select") }),
1312
+ /* @__PURE__ */ o("div", { class: "mt-0.5 text-[11px] text-gray-400", children: n("support.file_requirements", "JPEG/PNG/WebP, up to {max} files, ≤ 10MB each", {
1313
+ max: ie
1314
+ }) })
733
1315
  ]
734
1316
  }
735
1317
  ),
736
1318
  /* @__PURE__ */ o(
737
1319
  "input",
738
1320
  {
739
- ref: n,
1321
+ ref: i,
740
1322
  type: "file",
741
1323
  multiple: !0,
742
- accept: X.join(","),
1324
+ accept: xe.join(","),
743
1325
  class: "hidden",
744
- onChange: (p) => {
745
- c(p.target.files), p.currentTarget.value = "";
1326
+ onChange: (d) => {
1327
+ h(d.target.files), d.currentTarget.value = "";
746
1328
  }
747
1329
  }
748
1330
  ),
749
- l && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: l }),
750
- r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((p, g) => /* @__PURE__ */ u(
1331
+ c && /* @__PURE__ */ o("p", { class: "mt-1 text-xs text-red-600", children: c }),
1332
+ r.length > 0 && /* @__PURE__ */ o("ul", { class: "mt-2 flex flex-col gap-1", children: r.map((d, g) => /* @__PURE__ */ u(
751
1333
  "li",
752
1334
  {
753
1335
  class: "flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",
754
1336
  children: [
755
- /* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: p.name }),
1337
+ /* @__PURE__ */ o("span", { class: "truncate text-gray-700", children: d.name }),
756
1338
  /* @__PURE__ */ o(
757
1339
  "button",
758
1340
  {
759
1341
  type: "button",
760
1342
  onClick: () => {
761
- const b = [...r];
762
- b.splice(g, 1), e(b);
1343
+ const _ = [...r];
1344
+ _.splice(g, 1), e(_);
763
1345
  },
764
1346
  disabled: t,
765
1347
  class: "text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60",
766
- "aria-label": `Remove ${p.name}`,
1348
+ "aria-label": n("support.remove_file_aria", "Remove {filename}", { filename: d.name }),
767
1349
  children: "✕"
768
1350
  }
769
1351
  )
770
1352
  ]
771
1353
  },
772
- `${p.name}-${p.size}-${g}`
1354
+ `${d.name}-${d.size}-${g}`
773
1355
  )) })
774
1356
  ] });
775
1357
  }
776
- function Ee({ block: r, ctx: e }) {
777
- const [t, n] = x(!1), i = r.priceId ?? e.selectedPriceId, s = t || r.action === "checkout" && !i;
778
- return /* @__PURE__ */ o(
1358
+ const Ot = {
1359
+ day: "cta.get_plan_daily",
1360
+ week: "cta.get_plan_weekly",
1361
+ month: "cta.get_plan_monthly",
1362
+ year: "cta.get_plan_yearly"
1363
+ }, Ut = {
1364
+ day: "Get Daily Plan",
1365
+ week: "Get Weekly Plan",
1366
+ month: "Get Monthly Plan",
1367
+ year: "Get Yearly Plan"
1368
+ };
1369
+ function jt(r, e, t, n) {
1370
+ if (e === "close") return n("cta.close", "Close");
1371
+ if (!r) return n("cta.continue", "Continue");
1372
+ if (!t && r.trial_days && r.interval && r.interval !== "lifetime")
1373
+ return n("cta.start_trial", "Start {days}-Day Free Trial", { days: r.trial_days });
1374
+ if (!r.interval || r.interval === "lifetime")
1375
+ return n("cta.get_lifetime_access", "Get Lifetime Access");
1376
+ const i = Ot[r.interval];
1377
+ return i ? n(i, Ut[r.interval]) : n("cta.get_plan_generic", "Get {interval} Plan", {
1378
+ interval: Dt(r.interval)
1379
+ });
1380
+ }
1381
+ function Dt(r) {
1382
+ return r.length ? r[0].toUpperCase() + r.slice(1) : r;
1383
+ }
1384
+ function Rt({ block: r, ctx: e }) {
1385
+ const { t } = S(), [n, i] = k(!1), s = r.priceId ?? e.selectedPriceId, a = n || r.action === "checkout" && !s, c = s ? e.bootstrap.prices.find((g) => g.id === s) ?? null : null, l = e.bootstrap.user?.had_previous_trial ?? !1, h = r.label ?? jt(c, r.action, l, t);
1386
+ return /* @__PURE__ */ u(
779
1387
  "button",
780
1388
  {
781
1389
  type: "button",
782
- disabled: s,
1390
+ disabled: a,
783
1391
  onClick: async () => {
784
- if (!s) {
785
- n(!0);
1392
+ if (!a) {
1393
+ i(!0);
786
1394
  try {
787
- await e.onAction(r.action, { priceId: i });
1395
+ await e.onAction(r.action, { priceId: s });
788
1396
  } finally {
789
- n(!1);
1397
+ i(!1);
790
1398
  }
791
1399
  }
792
1400
  },
793
- class: "relative flex h-12 w-full items-center justify-center overflow-hidden rounded-2xl px-4 text-sm font-semibold tracking-tight text-white transition-all duration-150 hover:-translate-y-px hover:brightness-105 active:translate-y-0 active:brightness-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1401
+ class: "pw-cta-shimmer relative flex min-h-12 w-full items-center justify-center overflow-hidden rounded-3xl px-5 py-2 text-center text-base font-semibold leading-tight text-white transition-transform duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
794
1402
  style: {
795
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
796
- boxShadow: "0 1px 0 rgba(255,255,255,0.25) inset, 0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1403
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 55%, white) 0%, var(--pw-accent) 55%, color-mix(in srgb, var(--pw-accent) 90%, black) 100%)",
1404
+ boxShadow: "0 0 20px 0 color-mix(in srgb, var(--pw-accent) 25%, transparent), inset 0 0 8px 0 color-mix(in srgb, white 25%, transparent)"
797
1405
  },
798
- children: t ? /* @__PURE__ */ o("span", { class: "inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : r.label
1406
+ children: [
1407
+ /* @__PURE__ */ o(
1408
+ "span",
1409
+ {
1410
+ class: "absolute inset-0 opacity-40",
1411
+ style: {
1412
+ background: "radial-gradient(circle at 50% 0%, color-mix(in srgb, white 40%, transparent) 0%, transparent 70%)"
1413
+ },
1414
+ "aria-hidden": "true"
1415
+ }
1416
+ ),
1417
+ n ? /* @__PURE__ */ o("span", { class: "relative z-10 inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white" }) : /* @__PURE__ */ o("span", { class: "relative z-10", children: h })
1418
+ ]
799
1419
  }
800
1420
  );
801
1421
  }
802
- function Pe({ ctx: r }) {
803
- const e = r.authSession, t = r.auth, [n, i] = x(!1), s = () => r.onAction("support");
804
- if (e && !e.user.is_anonymous) {
805
- const l = async () => {
806
- if (!(!t || n)) {
807
- i(!0);
1422
+ function zt({ ctx: r }) {
1423
+ const { t: e } = S(), t = r.authSession, n = r.auth, [i, s] = k(!1), a = () => r.onAction("support");
1424
+ if (t && !t.user.is_anonymous) {
1425
+ const c = async () => {
1426
+ if (!(!n || i)) {
1427
+ s(!0);
808
1428
  try {
809
- await t.signOut();
1429
+ await n.signOut();
810
1430
  } catch {
811
1431
  } finally {
812
- i(!1);
1432
+ s(!1);
813
1433
  }
814
1434
  }
815
1435
  };
816
- return /* @__PURE__ */ u("div", { class: "mt-2 text-center text-xs text-gray-500", children: [
817
- /* @__PURE__ */ o("span", { children: "Signed in as " }),
818
- /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: e.user.email }),
819
- /* @__PURE__ */ u("div", { class: "mt-1 flex items-center justify-center gap-3", children: [
820
- /* @__PURE__ */ o(
821
- "button",
822
- {
823
- type: "button",
824
- onClick: l,
825
- disabled: !t || n,
826
- class: "font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",
827
- children: n ? "Signing out…" : "Sign out"
828
- }
829
- ),
830
- /* @__PURE__ */ o(Q, {}),
831
- /* @__PURE__ */ o(K, { onClick: s })
1436
+ return /* @__PURE__ */ u("div", { class: "-mt-3 flex flex-col items-center gap-1.5 pt-1 text-center text-[13px] text-gray-500", children: [
1437
+ /* @__PURE__ */ u("span", { children: [
1438
+ e("session.signed_in_as_prefix", "Signed in as"),
1439
+ " ",
1440
+ /* @__PURE__ */ o("b", { class: "font-medium text-gray-700", children: t.user.email })
1441
+ ] }),
1442
+ /* @__PURE__ */ u("div", { class: "flex items-center justify-center gap-3", children: [
1443
+ /* @__PURE__ */ o(G, { onClick: c, disabled: !n || i, children: i ? e("session.signing_out", "Signing out…") : e("session.sign_out", "Sign Out") }),
1444
+ /* @__PURE__ */ o(ke, {}),
1445
+ /* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
832
1446
  ] })
833
1447
  ] });
834
1448
  }
835
- return /* @__PURE__ */ u("div", { class: "mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500", children: [
836
- /* @__PURE__ */ o(
837
- "button",
838
- {
839
- type: "button",
840
- onClick: () => r.onAction("restore"),
841
- class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
842
- children: "Restore purchases"
843
- }
844
- ),
845
- /* @__PURE__ */ o(Q, {}),
846
- /* @__PURE__ */ o(K, { onClick: s })
1449
+ return /* @__PURE__ */ u("div", { class: "-mt-3 flex items-center justify-center gap-3 pt-1 text-center text-[13px]", children: [
1450
+ /* @__PURE__ */ o(G, { onClick: () => r.onAction("restore"), children: e("session.restore_purchases", "Restore purchases") }),
1451
+ /* @__PURE__ */ o(ke, {}),
1452
+ /* @__PURE__ */ o(G, { onClick: a, children: e("session.contact_support", "Contact Support") })
847
1453
  ] });
848
1454
  }
849
- function K({ onClick: r }) {
1455
+ function G({
1456
+ onClick: r,
1457
+ disabled: e,
1458
+ children: t
1459
+ }) {
850
1460
  return /* @__PURE__ */ o(
851
1461
  "button",
852
1462
  {
853
1463
  type: "button",
854
1464
  onClick: r,
855
- class: "font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",
856
- children: "Contact Support"
1465
+ disabled: e,
1466
+ class: "font-semibold transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:opacity-80",
1467
+ style: { color: "var(--pw-accent)" },
1468
+ children: t
857
1469
  }
858
1470
  );
859
1471
  }
860
- function Q() {
1472
+ function ke() {
861
1473
  return /* @__PURE__ */ o("span", { class: "h-1 w-1 rounded-full bg-gray-300", "aria-hidden": "true" });
862
1474
  }
863
- function Le({ block: r }) {
1475
+ function qt({ block: r }) {
864
1476
  return r.items.length ? /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2.5", role: "list", children: r.items.map((e) => /* @__PURE__ */ u("li", { class: "flex items-start gap-3 text-sm text-gray-700", children: [
865
1477
  /* @__PURE__ */ o(
866
- "span",
1478
+ "svg",
867
1479
  {
868
- class: "mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",
869
- style: {
870
- background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
871
- color: "var(--pw-accent)"
872
- },
1480
+ width: "18",
1481
+ height: "18",
1482
+ viewBox: "0 0 20 20",
1483
+ fill: "none",
1484
+ class: "mt-0.5 flex-shrink-0 text-emerald-500",
873
1485
  "aria-hidden": "true",
874
- children: /* @__PURE__ */ o("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ o(
1486
+ children: /* @__PURE__ */ o(
875
1487
  "path",
876
1488
  {
877
- d: "M5 10l3 3 7-7",
1489
+ d: "M4 10.5l3.5 3.5 8.5-8.5",
878
1490
  stroke: "currentColor",
879
1491
  "stroke-width": "2.5",
880
1492
  "stroke-linecap": "round",
881
1493
  "stroke-linejoin": "round"
882
1494
  }
883
- ) })
1495
+ )
884
1496
  }
885
1497
  ),
886
1498
  /* @__PURE__ */ u("div", { class: "flex flex-col gap-0.5", children: [
887
1499
  /* @__PURE__ */ o("span", { class: "font-medium leading-snug text-gray-900", children: e.name }),
888
- e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-500", children: e.desc }) : null
1500
+ e.desc ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-400", children: e.desc }) : null
889
1501
  ] })
890
1502
  ] }, e.id)) }) : null;
891
1503
  }
892
- const le = 26, Ue = 14, Oe = 2;
893
- function je(r, e) {
894
- const t = e * Oe;
895
- let n = le;
896
- for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Ue; )
1504
+ function Nt({ block: r }) {
1505
+ const { t: e } = S(), t = r.title ?? e("pricing.money_back", "30-day money-back guarantee"), n = r.subtitle, i = (r.icon ?? "dollar_shield") !== "none", s = Ft(t);
1506
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-1.5 border-b-1 pb-4 mb-1 border-gray-100", children: [
1507
+ /* @__PURE__ */ u("div", { class: "inline-flex items-center gap-2 text-[12px] text-gray-700", children: [
1508
+ i ? /* @__PURE__ */ o($t, {}) : null,
1509
+ s ? /* @__PURE__ */ u("span", { children: [
1510
+ /* @__PURE__ */ o("b", { class: "font-bold text-gray-900", children: s.bold }),
1511
+ " ",
1512
+ /* @__PURE__ */ o("span", { class: "font-medium", children: s.rest })
1513
+ ] }) : /* @__PURE__ */ o("span", { class: "font-medium", children: t })
1514
+ ] }),
1515
+ n ? /* @__PURE__ */ o("span", { class: "text-center text-xs leading-relaxed text-gray-500", children: n }) : null
1516
+ ] });
1517
+ }
1518
+ function Ft(r) {
1519
+ const e = r.match(/^(\d+[-\s]?days?)\s+(.+)$/i);
1520
+ return e ? { bold: e[1], rest: e[2] } : null;
1521
+ }
1522
+ function $t() {
1523
+ return /* @__PURE__ */ u(
1524
+ "svg",
1525
+ {
1526
+ xmlns: "http://www.w3.org/2000/svg",
1527
+ viewBox: "0 0 24 24",
1528
+ fill: "none",
1529
+ width: "16",
1530
+ height: "16",
1531
+ class: "flex-shrink-0 text-emerald-500",
1532
+ "aria-hidden": "true",
1533
+ children: [
1534
+ /* @__PURE__ */ o(
1535
+ "path",
1536
+ {
1537
+ d: "M12 2 4 5v6c0 5.25 3.5 9.5 8 11 4.5-1.5 8-5.75 8-11V5l-8-3Z",
1538
+ stroke: "currentColor",
1539
+ "stroke-width": "2",
1540
+ "stroke-linejoin": "round"
1541
+ }
1542
+ ),
1543
+ /* @__PURE__ */ o(
1544
+ "path",
1545
+ {
1546
+ d: "m9 12 2 2 4-4",
1547
+ stroke: "currentColor",
1548
+ "stroke-width": "2",
1549
+ "stroke-linecap": "round",
1550
+ "stroke-linejoin": "round"
1551
+ }
1552
+ )
1553
+ ]
1554
+ }
1555
+ );
1556
+ }
1557
+ const Ue = 24, Vt = 16, Ht = 2;
1558
+ function Gt(r, e) {
1559
+ const t = e * Ht;
1560
+ let n = Ue;
1561
+ for (r.style.fontSize = `${n}px`; r.scrollHeight > t && n > Vt; )
897
1562
  n -= 1, r.style.fontSize = `${n}px`;
898
1563
  }
899
- function qe({ block: r, ctx: e }) {
900
- const t = r.level ?? 1, n = `h${t}`, i = t === 1 ? "text-[1.625rem] font-semibold leading-tight text-gray-900 tracking-[-0.02em]" : t === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = B(null), l = t === 1 && !!e.bootstrap.settings.title_auto_fit;
901
- return M(() => {
902
- if (!l || !s.current) return;
903
- const a = getComputedStyle(s.current), c = parseFloat(a.lineHeight) || le * 1.5;
904
- je(s.current, c);
905
- }, [l, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
1564
+ function Wt({ block: r, ctx: e }) {
1565
+ const t = r.level ?? 1, n = `h${t}`, i = t === 1 ? "text-[22px] sm:text-2xl font-semibold leading-tight text-center text-balance text-gray-800" : t === 2 ? "text-xl font-semibold leading-snug text-gray-900 tracking-tight" : "text-base font-medium text-gray-900", s = D(null), a = t === 1 && !!e.bootstrap.settings.title_auto_fit;
1566
+ return P(() => {
1567
+ if (!a || !s.current) return;
1568
+ const c = getComputedStyle(s.current), l = parseFloat(c.lineHeight) || Ue * 1.5;
1569
+ Gt(s.current, l);
1570
+ }, [a, r.text]), /* @__PURE__ */ o(n, { ref: s, class: i, children: r.text });
906
1571
  }
907
- function Re(r) {
1572
+ function Zt(r) {
908
1573
  const e = r.local ?? { currency: r.currency, amount: r.amount };
1574
+ if (r.interval === "year") {
1575
+ const t = (r.interval_count ?? 1) * 12;
1576
+ return { amount: e.amount / t, currency: e.currency };
1577
+ }
1578
+ return { amount: e.amount, currency: e.currency };
1579
+ }
1580
+ function oe(r, e) {
1581
+ const t = r % 1 !== 0 ? 2 : 0;
909
1582
  try {
910
- return new Intl.NumberFormat(void 0, {
1583
+ const n = new Intl.NumberFormat(void 0, {
911
1584
  style: "currency",
912
- currency: e.currency,
913
- maximumFractionDigits: e.amount % 1 === 0 ? 0 : 2
914
- }).format(e.amount);
1585
+ currency: e,
1586
+ currencyDisplay: "narrowSymbol",
1587
+ maximumFractionDigits: t,
1588
+ minimumFractionDigits: t
1589
+ }).formatToParts(r);
1590
+ let i = "", s = "";
1591
+ for (const a of n)
1592
+ a.type === "currency" ? i = a.value : a.type !== "literal" && (s += a.value);
1593
+ return { currency: i || e, amount: s.trim() };
915
1594
  } catch {
916
- return `${e.amount} ${e.currency}`;
1595
+ return { currency: e, amount: String(r) };
917
1596
  }
918
1597
  }
919
- function ee(r) {
920
- if (!r.interval || r.interval === "lifetime") return "one-time";
921
- const e = r.interval_count ?? 1;
922
- return e === 1 ? `per ${r.interval}` : `every ${e} ${r.interval}s`;
1598
+ function le(r, e) {
1599
+ const { amount: t, currency: n } = Zt(r);
1600
+ if (!e) {
1601
+ const { currency: c, amount: l } = oe(t, n);
1602
+ return { currency: c, amount: l, originalAmount: null };
1603
+ }
1604
+ const i = t * (1 - e / 100), s = oe(i, n), a = oe(t, n);
1605
+ return {
1606
+ currency: s.currency,
1607
+ amount: s.amount,
1608
+ originalAmount: `${a.currency}${a.amount}`
1609
+ };
1610
+ }
1611
+ function je(r, e) {
1612
+ if (r.label) return r.label.toUpperCase();
1613
+ if (!r.interval || r.interval === "lifetime")
1614
+ return e("pricing.plan_label.lifetime", "LIFETIME");
1615
+ const n = {
1616
+ day: { key: "pricing.plan_label.daily", fallback: "DAILY PLAN" },
1617
+ week: { key: "pricing.plan_label.weekly", fallback: "WEEKLY PLAN" },
1618
+ month: { key: "pricing.plan_label.monthly", fallback: "MONTHLY PLAN" },
1619
+ year: { key: "pricing.plan_label.yearly", fallback: "YEARLY PLAN" }
1620
+ }[r.interval];
1621
+ return n ? e(n.key, n.fallback) : `${r.interval.toUpperCase()} PLAN`;
1622
+ }
1623
+ function ce(r, e) {
1624
+ if (!r.interval || r.interval === "lifetime")
1625
+ return e("pricing.interval.lifetime_short", "lifetime");
1626
+ if (r.interval === "year") return e("pricing.interval.month", "month");
1627
+ const t = r.interval_count ?? 1;
1628
+ return t === 1 ? e(`pricing.interval.${r.interval}`, r.interval) : `${t} ${r.interval}s`;
923
1629
  }
924
- function ze({ block: r, ctx: e }) {
925
- const t = r.priceIds && r.priceIds.length > 0 ? new Set(r.priceIds) : null, n = e.bootstrap.prices.filter((a) => !t || t.has(a.id));
926
- if (n.length === 0)
927
- return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: "No prices available." });
928
- const i = r.view === "horizontal", s = r.popular_label ?? "Most popular", l = i ? Math.min(n.length, 3) : 1;
1630
+ function Yt({ block: r, ctx: e }) {
1631
+ const { t } = S(), n = r.priceIds && r.priceIds.length > 0 ? new Set(r.priceIds) : null, i = e.bootstrap.prices.filter((a) => !n || n.has(a.id));
1632
+ if (i.length === 0)
1633
+ return /* @__PURE__ */ o("p", { class: "text-sm text-gray-500", children: t("pricing.no_prices", "No prices available.") });
1634
+ const s = r.popular_label ?? t("pricing.most_popular", "Most popular");
1635
+ if (r.view === "compact")
1636
+ return /* @__PURE__ */ o(
1637
+ "div",
1638
+ {
1639
+ class: "flex w-full flex-col rounded-xl border border-gray-200 bg-gray-50",
1640
+ role: "radiogroup",
1641
+ "aria-label": t("pricing.plans_aria", "Plans"),
1642
+ children: i.map((a, c) => /* @__PURE__ */ o(
1643
+ Xt,
1644
+ {
1645
+ price: a,
1646
+ isLast: c === i.length - 1,
1647
+ isPopular: r.popular_price_id === a.id,
1648
+ popularLabel: s,
1649
+ offer: N(e.bootstrap.offers, a.id),
1650
+ selected: e.selectedPriceId === a.id,
1651
+ onSelect: () => {
1652
+ e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
1653
+ },
1654
+ t
1655
+ },
1656
+ a.id
1657
+ ))
1658
+ }
1659
+ );
1660
+ if (r.view === "horizontal") {
1661
+ const a = Math.min(i.length, 3), c = i.some(
1662
+ (l) => (N(e.bootstrap.offers, l.id)?.discount_percent ?? 0) > 0
1663
+ );
1664
+ return /* @__PURE__ */ o(
1665
+ "div",
1666
+ {
1667
+ class: "grid items-stretch gap-2",
1668
+ style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` },
1669
+ role: "radiogroup",
1670
+ "aria-label": t("pricing.plans_aria", "Plans"),
1671
+ children: i.map((l) => /* @__PURE__ */ o(
1672
+ Jt,
1673
+ {
1674
+ price: l,
1675
+ isPopular: r.popular_price_id === l.id,
1676
+ popularLabel: s,
1677
+ offer: N(e.bootstrap.offers, l.id),
1678
+ reserveStrikeRow: c,
1679
+ selected: e.selectedPriceId === l.id,
1680
+ onSelect: () => {
1681
+ e.setSelectedPriceId(l.id), e.onAction("price_selected", { priceId: l.id, price: l });
1682
+ },
1683
+ t
1684
+ },
1685
+ l.id
1686
+ ))
1687
+ }
1688
+ );
1689
+ }
929
1690
  return /* @__PURE__ */ o(
930
1691
  "div",
931
1692
  {
932
- class: i ? "grid gap-2.5" : "flex flex-col gap-2.5",
933
- style: i ? { gridTemplateColumns: `repeat(${l}, minmax(0, 1fr))` } : void 0,
1693
+ class: "flex flex-col gap-2",
934
1694
  role: "radiogroup",
935
- "aria-label": "Plans",
936
- children: n.map((a) => {
937
- const c = e.selectedPriceId === a.id, p = r.popular_price_id === a.id;
1695
+ "aria-label": t("pricing.plans_aria", "Plans"),
1696
+ children: i.map((a) => {
1697
+ const c = e.selectedPriceId === a.id, l = r.popular_price_id === a.id, d = N(e.bootstrap.offers, a.id)?.discount_percent ?? null, { currency: g, amount: _, originalAmount: p } = le(a, d);
938
1698
  return /* @__PURE__ */ u(
939
1699
  "button",
940
1700
  {
@@ -945,441 +1705,745 @@ function ze({ block: r, ctx: e }) {
945
1705
  e.setSelectedPriceId(a.id), e.onAction("price_selected", { priceId: a.id, price: a });
946
1706
  },
947
1707
  class: [
948
- "group relative rounded-2xl border px-4 py-3.5 text-left transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
949
- i ? "flex w-full flex-col items-start gap-1" : "flex w-full items-center justify-between gap-3",
950
- c ? "border-[var(--pw-accent)] bg-[color-mix(in_srgb,var(--pw-accent)_6%,white)] shadow-[0_0_0_3px_color-mix(in_srgb,var(--pw-accent)_12%,transparent)]" : "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm",
951
- p ? "mt-2.5" : ""
1708
+ "group relative inline-flex w-full mx-auto items-center justify-between flex-row-reverse gap-4 rounded-2xl border-2 px-4 py-3.5 text-left transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1709
+ // Везде border 2px selection выражается только цветом, layout
1710
+ // не прыгает (равная толщина у selected/unselected). Цветовая
1711
+ // разница accent vs gray достаточно сильная для visual hierarchy.
1712
+ c ? "border-[var(--pw-accent)] bg-transparent" : "border-gray-200 bg-transparent hover:bg-gray-50"
1713
+ ].join(" "),
1714
+ children: [
1715
+ /* @__PURE__ */ o(
1716
+ "span",
1717
+ {
1718
+ class: [
1719
+ "flex h-6.5 w-6.5 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
1720
+ c ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent",
1721
+ // Popular-label badge сидит absolute сверху-справа карточки и
1722
+ // визуально сдвигает центр content'а вниз. flex items-center
1723
+ // на карточке держит галочку по геометрическому центру, что
1724
+ // делает её визуально выше — компенсируем небольшим mt'ом.
1725
+ l ? "mt-3" : ""
1726
+ ].join(" "),
1727
+ style: c ? {
1728
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
1729
+ } : void 0,
1730
+ "aria-hidden": "true",
1731
+ children: /* @__PURE__ */ o(
1732
+ "svg",
1733
+ {
1734
+ width: "14",
1735
+ height: "10",
1736
+ viewBox: "0 0 17 12",
1737
+ fill: "none",
1738
+ xmlns: "http://www.w3.org/2000/svg",
1739
+ class: c ? "opacity-100" : "opacity-0",
1740
+ children: /* @__PURE__ */ o(
1741
+ "path",
1742
+ {
1743
+ d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
1744
+ fill: "currentColor"
1745
+ }
1746
+ )
1747
+ }
1748
+ )
1749
+ }
1750
+ ),
1751
+ /* @__PURE__ */ u("div", { class: "flex flex-1 flex-col gap-0.5", children: [
1752
+ /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
1753
+ /* @__PURE__ */ o("span", { class: "text-xs font-normal uppercase tracking-normal text-gray-800/70", children: je(a, t) }),
1754
+ p ? (
1755
+ // opacity-60 приглушает strike: глаз сначала ловит label
1756
+ // и discount-badge, потом main price; original «бывшая цена»
1757
+ // — третичная информация, не должна конкурировать с label.
1758
+ /* @__PURE__ */ o("span", { class: "text-[15px] font-normal text-gray-400 opacity-60 line-through decoration-gray-400 decoration-[1.5px]", children: p })
1759
+ ) : null,
1760
+ d ? (
1761
+ // Emerald pill — фиксированный «успех/выгода», не зависит от
1762
+ // brand_color. Читается даже на тёмных бренд-акцентах.
1763
+ /* @__PURE__ */ u("span", { class: "rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold leading-none text-emerald-700", children: [
1764
+ "-",
1765
+ d,
1766
+ "%"
1767
+ ] })
1768
+ ) : null
1769
+ ] }),
1770
+ /* @__PURE__ */ o("div", { class: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ u("span", { class: "text-[26px] leading-tight whitespace-nowrap text-gray-800 font-medium", children: [
1771
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: g }),
1772
+ _,
1773
+ /* @__PURE__ */ u("span", { class: "text-sm font-normal text-gray-500", children: [
1774
+ " ",
1775
+ "/ ",
1776
+ ce(a, t)
1777
+ ] })
1778
+ ] }) }),
1779
+ a.description ? /* @__PURE__ */ o("span", { class: "mt-1 text-xs leading-relaxed text-gray-500", children: a.description }) : null
1780
+ ] }),
1781
+ l ? /* @__PURE__ */ o(
1782
+ "span",
1783
+ {
1784
+ class: "absolute -top-[9px] -right-[6px] rounded-[11px] border-[5px] border-white px-2 py-1 text-[12px] font-semibold text-white",
1785
+ style: { background: "var(--pw-accent)" },
1786
+ children: s
1787
+ }
1788
+ ) : null
1789
+ ]
1790
+ },
1791
+ a.id
1792
+ );
1793
+ })
1794
+ }
1795
+ );
1796
+ }
1797
+ function Kt(r, e) {
1798
+ return r.label ? r.label : !r.interval || r.interval === "lifetime" ? e("pricing.interval.lifetime_short", "lifetime") : e(`pricing.interval.${r.interval}`, r.interval);
1799
+ }
1800
+ function Xt({
1801
+ price: r,
1802
+ isLast: e,
1803
+ isPopular: t,
1804
+ popularLabel: n,
1805
+ offer: i,
1806
+ selected: s,
1807
+ onSelect: a,
1808
+ t: c
1809
+ }) {
1810
+ const l = i?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, l);
1811
+ return /* @__PURE__ */ u(
1812
+ "button",
1813
+ {
1814
+ type: "button",
1815
+ role: "radio",
1816
+ "aria-checked": s,
1817
+ onClick: a,
1818
+ class: "group relative inline-flex w-full max-w-[360px] mx-auto items-center justify-between gap-4 px-4 pt-3.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--pw-accent)]",
1819
+ children: [
1820
+ /* @__PURE__ */ o(
1821
+ "span",
1822
+ {
1823
+ class: [
1824
+ "flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border transition-colors mb-3",
1825
+ s ? "border-[var(--pw-accent)] text-white" : "border-gray-300 bg-transparent text-transparent"
1826
+ ].join(" "),
1827
+ style: s ? {
1828
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 70%, white) 0%, var(--pw-accent) 50%, color-mix(in srgb, var(--pw-accent) 85%, black) 100%)"
1829
+ } : void 0,
1830
+ "aria-hidden": "true",
1831
+ children: /* @__PURE__ */ o(
1832
+ "svg",
1833
+ {
1834
+ width: "14",
1835
+ height: "10",
1836
+ viewBox: "0 0 17 12",
1837
+ fill: "none",
1838
+ xmlns: "http://www.w3.org/2000/svg",
1839
+ class: s ? "opacity-100" : "opacity-0",
1840
+ children: /* @__PURE__ */ o(
1841
+ "path",
1842
+ {
1843
+ d: "M16.5234 0.476562C16.9805 0.898438 16.9805 1.63672 16.5234 2.05859L7.52344 11.0586C7.10156 11.5156 6.36328 11.5156 5.94141 11.0586L1.44141 6.55859C0.984375 6.13672 0.984375 5.39844 1.44141 4.97656C1.86328 4.51953 2.60156 4.51953 3.02344 4.97656L6.75 8.66797L14.9414 0.476562C15.3633 0.0195312 16.1016 0.0195312 16.5234 0.476562Z",
1844
+ fill: "currentColor"
1845
+ }
1846
+ )
1847
+ }
1848
+ )
1849
+ }
1850
+ ),
1851
+ /* @__PURE__ */ u(
1852
+ "div",
1853
+ {
1854
+ class: [
1855
+ "flex flex-1 items-center gap-1.5 pb-3.5",
1856
+ e ? "" : "border-b border-gray-200"
952
1857
  ].join(" "),
953
1858
  children: [
954
- p ? /* @__PURE__ */ o(
955
- "span",
956
- {
957
- class: "absolute -top-2.5 left-4 rounded-full px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white shadow-sm",
958
- style: {
959
- background: "linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"
960
- },
961
- children: s
962
- }
963
- ) : null,
964
- /* @__PURE__ */ u("div", { class: i ? "flex w-full items-start gap-2.5" : "flex flex-1 items-start gap-2.5", children: [
965
- /* @__PURE__ */ o(
966
- "span",
967
- {
968
- class: [
969
- "mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",
970
- c ? "border-[var(--pw-accent)] bg-[var(--pw-accent)]" : "border-gray-300 bg-white group-hover:border-gray-400"
971
- ].join(" "),
972
- "aria-hidden": "true",
973
- children: c ? /* @__PURE__ */ o("span", { class: "h-1.5 w-1.5 rounded-full bg-white" }) : null
974
- }
975
- ),
976
- /* @__PURE__ */ u("div", { class: "flex flex-col", children: [
977
- /* @__PURE__ */ o("span", { class: "text-sm font-semibold text-gray-900", children: a.label ?? ee(a) }),
978
- a.description ? /* @__PURE__ */ o("span", { class: "text-xs leading-relaxed text-gray-500", children: a.description }) : null,
979
- a.trial_days ? /* @__PURE__ */ u("span", { class: "text-xs font-medium text-[var(--pw-accent)]", children: [
980
- a.trial_days,
981
- "-day free trial"
982
- ] }) : null
983
- ] })
1859
+ /* @__PURE__ */ u("div", { class: "flex flex-wrap items-center gap-1 gap-x-1.5", children: [
1860
+ /* @__PURE__ */ o("span", { class: "text-base font-normal capitalize text-gray-800", children: Kt(r, c) }),
1861
+ t ? (
1862
+ // Pastel brand-mix pill точно как `badge` в TelegramPricingRadio.
1863
+ // Низкий visual weight: pill про "имя плана" (most popular), а не
1864
+ // про savings не должна конкурировать с -X% discount-pill.
1865
+ /* @__PURE__ */ o(
1866
+ "span",
1867
+ {
1868
+ class: "rounded-[9px] px-2 py-1 text-[10px] font-bold",
1869
+ style: {
1870
+ background: "linear-gradient(160deg, color-mix(in srgb, var(--pw-accent) 6%, white) 0%, color-mix(in srgb, var(--pw-accent) 15%, white) 100%)",
1871
+ color: "var(--pw-accent)"
1872
+ },
1873
+ children: n
1874
+ }
1875
+ )
1876
+ ) : null,
1877
+ l ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
1878
+ "-",
1879
+ l,
1880
+ "%"
1881
+ ] }) : null
984
1882
  ] }),
985
- /* @__PURE__ */ u("div", { class: i ? "mt-1 flex flex-col items-start" : "flex flex-col items-end", children: [
986
- /* @__PURE__ */ o("span", { class: "text-base font-semibold tracking-tight text-gray-900", children: Re(a) }),
987
- /* @__PURE__ */ o("span", { class: "text-[11px] text-gray-500", children: ee(a) })
1883
+ /* @__PURE__ */ o("div", { class: "flex-1" }),
1884
+ /* @__PURE__ */ u("span", { class: "flex items-baseline gap-1.5 text-base font-normal text-gray-600", children: [
1885
+ g ? /* @__PURE__ */ o("span", { class: "text-xs text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
1886
+ /* @__PURE__ */ u("span", { class: "whitespace-nowrap", children: [
1887
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
1888
+ d,
1889
+ /* @__PURE__ */ u("span", { class: "text-xs text-gray-400", children: [
1890
+ " ",
1891
+ "/ ",
1892
+ ce(r, c)
1893
+ ] })
1894
+ ] })
988
1895
  ] })
989
1896
  ]
990
- },
991
- a.id
992
- );
993
- })
1897
+ }
1898
+ )
1899
+ ]
1900
+ }
1901
+ );
1902
+ }
1903
+ function Jt({
1904
+ price: r,
1905
+ isPopular: e,
1906
+ popularLabel: t,
1907
+ offer: n,
1908
+ reserveStrikeRow: i,
1909
+ selected: s,
1910
+ onSelect: a,
1911
+ t: c
1912
+ }) {
1913
+ const l = n?.discount_percent ?? null, { currency: h, amount: d, originalAmount: g } = le(r, l);
1914
+ return /* @__PURE__ */ u(
1915
+ "button",
1916
+ {
1917
+ type: "button",
1918
+ role: "radio",
1919
+ "aria-checked": s,
1920
+ onClick: a,
1921
+ class: [
1922
+ "group relative flex h-full flex-col items-center justify-start gap-1 rounded-2xl border-2 px-3 pb-4 pt-3.5 text-center transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1923
+ s ? "border-[var(--pw-accent)]" : "border-gray-200 hover:bg-gray-50"
1924
+ ].join(" "),
1925
+ style: s ? { background: "color-mix(in srgb, var(--pw-accent) 6%, transparent)" } : void 0,
1926
+ children: [
1927
+ /* @__PURE__ */ o("span", { class: "flex min-h-[2.4em] items-center text-[10px] font-normal uppercase leading-tight text-gray-800/70", children: je(r, c) }),
1928
+ i ? /* @__PURE__ */ u("div", { class: "flex h-[22px] items-center justify-center gap-1.5", children: [
1929
+ g ? /* @__PURE__ */ o("span", { class: "text-[12px] text-gray-400 line-through decoration-gray-400 decoration-[1.5px]", children: g }) : null,
1930
+ l ? /* @__PURE__ */ u("span", { class: "rounded-md bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700", children: [
1931
+ "-",
1932
+ l,
1933
+ "%"
1934
+ ] }) : null
1935
+ ] }) : null,
1936
+ /* @__PURE__ */ u("span", { class: "text-[26px] leading-none whitespace-nowrap text-gray-800 font-medium", children: [
1937
+ /* @__PURE__ */ o("span", { class: "opacity-90", children: h }),
1938
+ d
1939
+ ] }),
1940
+ /* @__PURE__ */ u("span", { class: "text-xs font-normal text-gray-500", children: [
1941
+ "/ ",
1942
+ ce(r, c)
1943
+ ] }),
1944
+ e ? /* @__PURE__ */ o(
1945
+ "span",
1946
+ {
1947
+ class: "absolute -top-[10px] left-1/2 -translate-x-1/2 whitespace-nowrap rounded-[11px] border-[3px] border-white px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",
1948
+ style: { background: "var(--pw-accent)" },
1949
+ children: t
1950
+ }
1951
+ ) : null
1952
+ ]
994
1953
  }
995
1954
  );
996
1955
  }
997
- function De({ block: r }) {
1956
+ function Qt({ block: r }) {
998
1957
  return /* @__PURE__ */ o("p", { class: "text-[0.9375rem] leading-relaxed text-gray-600", children: r.text });
999
1958
  }
1000
- const Fe = {
1959
+ const er = {
1001
1960
  week: 0.25,
1002
1961
  month: 1,
1003
1962
  year: 12
1004
1963
  };
1005
- function Ve(r) {
1006
- return r || "period";
1964
+ function tr(r, e) {
1965
+ return r ? e(`pricing.interval.${r}`, r) : e("pricing.interval.period", "period");
1007
1966
  }
1008
- function $e({ block: r, ctx: e }) {
1967
+ function rr({ block: r, ctx: e }) {
1968
+ const { t } = S();
1009
1969
  if (!r.queries.length) return null;
1010
- const n = e.bootstrap.prices.find((s) => s.id === e.selectedPriceId)?.interval ?? null, i = n ? Fe[n] : void 0;
1970
+ const i = e.bootstrap.prices.find((a) => a.id === e.selectedPriceId)?.interval ?? null, s = i ? er[i] : void 0;
1011
1971
  return /* @__PURE__ */ u("div", { class: "flex flex-col gap-2", children: [
1012
- /* @__PURE__ */ u("div", { class: "text-sm font-semibold text-gray-800", children: [
1013
- "Included per ",
1014
- /* @__PURE__ */ o("span", { children: Ve(n) }),
1015
- ":"
1016
- ] }),
1017
- /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((s) => {
1018
- const l = Number.isFinite(s.count) ? s.count : 0, a = i !== void 0 ? Math.round(l * i) : l;
1019
- return /* @__PURE__ */ u("li", { class: `flex gap-2 ${s.desc ? "" : "items-center"}`, children: [
1972
+ /* @__PURE__ */ o("div", { class: "text-sm font-semibold text-gray-800", children: !i || i === "lifetime" ? t("pricing.included_total", "Included for lifetime:") : t("pricing.included_per", "Included per {interval}:", {
1973
+ interval: tr(i, t)
1974
+ }) }),
1975
+ /* @__PURE__ */ o("ul", { class: "flex flex-col gap-2", role: "list", children: r.queries.map((a) => {
1976
+ const c = Number.isFinite(a.count) ? a.count : 0, l = s !== void 0 ? Math.round(c * s) : c;
1977
+ return /* @__PURE__ */ u("li", { class: `flex gap-3 ${a.desc ? "items-start" : "items-center"}`, children: [
1020
1978
  /* @__PURE__ */ o(
1021
- "span",
1979
+ "svg",
1022
1980
  {
1023
- class: `flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${s.desc ? "mt-0.5" : ""}`,
1024
- style: {
1025
- background: "color-mix(in srgb, var(--pw-accent) 12%, white)",
1026
- color: "var(--pw-accent)"
1027
- },
1981
+ width: "18",
1982
+ height: "18",
1983
+ viewBox: "0 0 20 20",
1984
+ fill: "none",
1985
+ class: `flex-shrink-0 text-emerald-500 ${a.desc ? "mt-0.5" : ""}`,
1028
1986
  "aria-hidden": "true",
1029
- children: /* @__PURE__ */ o("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ o(
1987
+ children: /* @__PURE__ */ o(
1030
1988
  "path",
1031
1989
  {
1032
- d: "M5 10l3 3 7-7",
1990
+ d: "M4 10.5l3.5 3.5 8.5-8.5",
1033
1991
  stroke: "currentColor",
1034
1992
  "stroke-width": "2.5",
1035
1993
  "stroke-linecap": "round",
1036
1994
  "stroke-linejoin": "round"
1037
1995
  }
1038
- ) })
1996
+ )
1039
1997
  }
1040
1998
  ),
1041
1999
  /* @__PURE__ */ u("div", { children: [
1042
- /* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: a }),
2000
+ /* @__PURE__ */ o("span", { class: "font-semibold text-gray-900 text-sm", children: l }),
1043
2001
  " ",
1044
- /* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: s.name }),
1045
- s.desc ? /* @__PURE__ */ u(ne, { children: [
2002
+ /* @__PURE__ */ o("span", { class: "text-sm text-gray-800", children: a.name }),
2003
+ a.desc ? /* @__PURE__ */ u(ae, { children: [
1046
2004
  /* @__PURE__ */ o("br", {}),
1047
- /* @__PURE__ */ o("span", { class: "text-xs text-gray-500", children: s.desc })
2005
+ /* @__PURE__ */ o("span", { class: "text-xs text-gray-400", children: a.desc })
1048
2006
  ] }) : null
1049
2007
  ] })
1050
- ] }, s.id);
2008
+ ] }, a.id);
1051
2009
  }) })
1052
2010
  ] });
1053
2011
  }
1054
- const Ne = {
1055
- heading: qe,
1056
- text: De,
1057
- price_grid: ze,
1058
- cta_button: Ee,
1059
- auth_panel: se,
1060
- current_session: Pe,
1061
- features_list: Le,
1062
- tokenization_gate: $e
2012
+ const nr = {
2013
+ heading: Wt,
2014
+ text: Qt,
2015
+ price_grid: Yt,
2016
+ cta_button: Rt,
2017
+ auth_panel: Me,
2018
+ current_session: zt,
2019
+ features_list: qt,
2020
+ tokenization_gate: rr,
2021
+ guarantee_badge: Nt,
2022
+ offer_banner: It
1063
2023
  };
1064
- function He({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i }) {
1065
- const s = ie(() => e.prices[0]?.id ?? null, [e.prices]), [l, a] = x(s), c = {
2024
+ function ir({ layout: r, bootstrap: e, onAction: t, auth: n, authSession: i, hasTopBanner: s }) {
2025
+ const a = Ge(() => {
2026
+ for (const v of r.blocks)
2027
+ if (v.type === "price_grid" && v.popular_price_id && e.prices.some((m) => m.id === v.popular_price_id))
2028
+ return v.popular_price_id;
2029
+ return e.prices[0]?.id ?? null;
2030
+ }, [r.blocks, e.prices]), [c, l] = k(a), h = {
1066
2031
  bootstrap: e,
1067
- selectedPriceId: l,
1068
- setSelectedPriceId: a,
2032
+ selectedPriceId: c,
2033
+ setSelectedPriceId: l,
1069
2034
  onAction: t,
1070
2035
  auth: n,
1071
2036
  authSession: i
2037
+ }, d = r.blocks.findIndex((v) => v.type === "cta_button"), g = d === -1 ? r.blocks : r.blocks.slice(0, d), _ = d === -1 ? [] : r.blocks.slice(d), p = (v, m) => {
2038
+ const A = nr[v.type];
2039
+ return A ? /* @__PURE__ */ o(A, { block: v, ctx: h }, `${v.type}-${m}`) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${v.type}`), null);
1072
2040
  };
1073
- return /* @__PURE__ */ o("div", { class: "flex flex-col gap-4", children: r.blocks.map((p, g) => {
1074
- const b = Ne[p.type];
1075
- return b ? /* @__PURE__ */ o(b, { block: p, ctx: c }, g) : (typeof console < "u" && console.warn(`[paywall] unknown block type: ${p.type}`), null);
1076
- }) });
2041
+ return /* @__PURE__ */ u(ae, { children: [
2042
+ /* @__PURE__ */ o("div", { class: "flex-1 min-h-0 overflow-y-auto px-6 pb-3 pt-6 sm:px-8 sm:pb-4 sm:pt-8", children: /* @__PURE__ */ o("div", { class: "flex flex-col gap-6", children: g.map(p) }) }),
2043
+ _.length > 0 ? (
2044
+ // Тонкий shadow-top вместо border-t — создаёт depth, читается как
2045
+ // «footer закреплён к низу dialog'а». Линия выглядела как divider
2046
+ // в обычном flow, не передавала sticky-character.
2047
+ /* @__PURE__ */ o(
2048
+ "div",
2049
+ {
2050
+ class: "flex flex-col gap-4 bg-white px-6 pb-6 pt-3 sm:px-8",
2051
+ style: { boxShadow: "0 -4px 12px -4px rgba(15,23,42,0.06)" },
2052
+ children: _.map((v, m) => p(v, g.length + m))
2053
+ }
2054
+ )
2055
+ ) : null
2056
+ ] });
1077
2057
  }
1078
- function Ge(r, e, t, n) {
1079
- return r ? n ? { open: !0, view: "purchased", error: null } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null } : e.status === "error" ? { open: !0, view: "error", error: e.error } : t.kind === "support" ? { open: !0, view: "support", error: null } : t.kind === "auth_gate" ? { open: !0, view: "auth", error: null } : t.kind === "anon_gate" ? { open: !0, view: "anon", error: null } : t.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null } : t.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null } : t.kind === "purchase_success" ? { open: !0, view: "purchased", error: null } : t.kind === "verifying" ? { open: !0, view: "loading", error: null } : { open: !0, view: "layout", error: null } : { open: !1, view: null, error: null };
2058
+ function or(r, e, t, n) {
2059
+ return r ? n ? { open: !0, view: "purchased", error: null, processing: !1 } : e.status === "idle" || e.status === "loading" ? { open: !0, view: "loading", error: null, processing: !1 } : e.status === "error" ? { open: !0, view: "error", error: e.error, processing: !1 } : t.kind === "support" ? { open: !0, view: "support", error: null, processing: !1 } : t.kind === "auth_gate" ? { open: !0, view: "auth", error: null, processing: !1 } : t.kind === "awaiting_payment" ? { open: !0, view: "awaiting_payment", error: null, processing: !1 } : t.kind === "popup_blocked" ? { open: !0, view: "popup_blocked", error: null, processing: !1 } : t.kind === "purchase_success" ? { open: !0, view: "purchased", error: null, processing: !1 } : t.kind === "verifying" ? { open: !0, view: "loading", error: null, processing: !1 } : { open: !0, view: "layout", error: null, processing: !1 } : { open: !1, view: null, error: null, processing: !1 };
1080
2060
  }
1081
- function We(r, e) {
1082
- return r.open === e.open && r.view === e.view && r.error === e.error;
2061
+ function sr(r, e) {
2062
+ return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
1083
2063
  }
1084
- function Ze({
2064
+ function ar({
1085
2065
  client: r,
1086
2066
  open: e,
1087
2067
  onClose: t,
1088
2068
  onEvent: n,
1089
2069
  initialView: i,
1090
- purchased: s,
1091
- renew: l,
1092
- onState: a
2070
+ initialAuthMode: s,
2071
+ initialCheckoutPriceId: a,
2072
+ initialCheckoutUrl: c,
2073
+ purchased: l,
2074
+ renew: h,
2075
+ onState: d,
2076
+ inline: g,
2077
+ locale: _
1093
2078
  }) {
1094
- const [c, p] = x({ status: "idle" }), [g, b] = x(
2079
+ const [p, v] = k({ status: "idle" }), [m, A] = k(
1095
2080
  () => r.auth?.getCachedSession() ?? null
1096
- ), [f, m] = x(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? { kind: "auth_gate", origin: "standalone" } : i === "anon" ? { kind: "anon_gate", origin: "standalone" } : { kind: "layout" }), y = B(!1), _ = B(null);
1097
- M(() => {
1098
- if (!a) return;
1099
- const d = Ge(e, c, f, s), h = _.current;
1100
- h && We(h, d) || (_.current = d, a(d));
1101
- }, [e, c, f, s, a]), M(() => {
2081
+ ), [b, y] = k(() => i === "support" ? { kind: "support", origin: "standalone" } : i === "auth" ? a ? {
2082
+ kind: "auth_gate",
2083
+ pendingCheckout: { priceId: a, direct: !0 },
2084
+ origin: "standalone",
2085
+ intent: "preauth"
2086
+ } : { kind: "auth_gate", origin: "standalone" } : i === "awaiting_payment" && a && c ? {
2087
+ kind: "awaiting_payment",
2088
+ priceId: a,
2089
+ url: c
2090
+ } : i === "popup_blocked" && a && c ? {
2091
+ kind: "popup_blocked",
2092
+ priceId: a,
2093
+ url: c
2094
+ } : { kind: "layout" }), C = i === "awaiting_payment" || i === "popup_blocked" || i === "auth" && !!a, I = D(!1), U = D(null);
2095
+ P(() => {
2096
+ if (!d) return;
2097
+ const x = or(e, p, b, l), f = U.current;
2098
+ f && sr(f, x) || (U.current = x, d(x));
2099
+ }, [e, p, b, l, d]), P(() => {
1102
2100
  if (r.auth)
1103
- return r.auth.onAuthChange((d) => b(d));
1104
- }, [r.auth]), M(() => {
2101
+ return r.auth.onAuthChange((x, f) => A(f));
2102
+ }, [r.auth]), P(() => {
1105
2103
  if (typeof r.onBootstrapChange == "function")
1106
- return r.onBootstrapChange((d) => {
1107
- p(
1108
- (h) => h.status === "ready" ? { status: "ready", data: d } : h
2104
+ return r.onBootstrapChange((x) => {
2105
+ v(
2106
+ (f) => f.status === "ready" ? { status: "ready", data: x } : f
1109
2107
  );
1110
2108
  });
1111
- }, [r]), M(() => {
1112
- if (!e || c.status === "ready" || c.status === "loading") return;
1113
- let d = !1;
1114
- return p({ status: "loading" }), r.bootstrap().then((h) => {
1115
- d || (p({ status: "ready", data: h }), n("ready", h), h.user?.has_active_subscription && !l && (n("purchase_completed", {
1116
- priceId: null,
2109
+ }, [r]), P(() => {
2110
+ if (!e || p.status === "ready" || p.status === "loading") return;
2111
+ let x = !1;
2112
+ return v({ status: "loading" }), r.bootstrap().then((f) => {
2113
+ if (x) return;
2114
+ v({ status: "ready", data: f }), n("ready", f);
2115
+ const w = i === "support" || i === "auth" || C;
2116
+ f.user?.has_active_subscription && !h && !w && (n("purchase_completed", {
2117
+ priceId: a ?? null,
1117
2118
  sessionId: null,
1118
2119
  restored: !0
1119
- }), m({ kind: "purchase_success", restored: !0 })));
1120
- }).catch((h) => {
1121
- if (d) return;
1122
- const k = h instanceof T ? h : new T("unknown", "Failed to load paywall", { cause: h });
1123
- p({ status: "error", error: k }), n("error", k);
2120
+ }), y({ kind: "purchase_success", restored: !0 }));
2121
+ }).catch((f) => {
2122
+ if (x) return;
2123
+ const w = f instanceof L ? f : new L("unknown", "Failed to load paywall", { cause: f });
2124
+ v({ status: "error", error: w }), n("error", w);
1124
2125
  }), () => {
1125
- d = !0;
2126
+ x = !0;
1126
2127
  };
1127
- }, [e, r]), M(() => {
2128
+ }, [e, r]), We(() => {
1128
2129
  if (!e) {
1129
- m({ kind: "layout" }), y.current = !1;
2130
+ y({ kind: "layout" }), I.current = !1;
1130
2131
  return;
1131
2132
  }
1132
- i === "support" ? m({ kind: "support", origin: "standalone" }) : i === "auth" ? m({ kind: "auth_gate", origin: "standalone" }) : i === "anon" && m({ kind: "anon_gate", origin: "standalone" });
1133
- }, [e, i]);
1134
- const A = async (d) => {
2133
+ i === "support" ? y({ kind: "support", origin: "standalone" }) : i === "auth" ? y(a ? {
2134
+ kind: "auth_gate",
2135
+ pendingCheckout: { priceId: a, direct: !0 },
2136
+ origin: "standalone",
2137
+ intent: "preauth"
2138
+ } : { kind: "auth_gate", origin: "standalone" }) : i === "awaiting_payment" && a && c ? y({
2139
+ kind: "awaiting_payment",
2140
+ priceId: a,
2141
+ url: c
2142
+ }) : i === "popup_blocked" && a && c && y({
2143
+ kind: "popup_blocked",
2144
+ priceId: a,
2145
+ url: c
2146
+ });
2147
+ }, [e, i, a, c]);
2148
+ const M = async (x) => {
1135
2149
  try {
1136
- const h = await r.createCheckout({
1137
- priceId: d,
1138
- ignoreActivePurchase: l === !0
2150
+ const f = r.getCachedOffers?.() ?? null, w = f ? N(f, x) : null, B = await r.createCheckout({
2151
+ priceId: x,
2152
+ offerId: w?.id,
2153
+ ignoreActivePurchase: h === !0
1139
2154
  });
1140
- if (n("checkout_started", { priceId: d, url: h.url, acquiring: h.acquiring }), typeof window > "u" || !h.url) return;
1141
- const k = window.open(h.url, "_blank");
1142
- if (k) {
2155
+ if (n("checkout_started", { priceId: x, url: B.url, acquiring: B.acquiring }), typeof window > "u" || !B.url) return;
2156
+ const $ = window.open(B.url, "_blank");
2157
+ if ($) {
1143
2158
  try {
1144
- k.opener = null;
2159
+ $.opener = null;
1145
2160
  } catch {
1146
2161
  }
1147
- m({ kind: "awaiting_payment", priceId: d, url: h.url });
2162
+ y({ kind: "awaiting_payment", priceId: x, url: B.url });
1148
2163
  } else
1149
- m({ kind: "popup_blocked", priceId: d, url: h.url });
1150
- } catch (h) {
1151
- if (h instanceof T && h.code === "already_purchased") {
2164
+ y({ kind: "popup_blocked", priceId: x, url: B.url });
2165
+ } catch (f) {
2166
+ if (f instanceof L && f.code === "already_purchased") {
1152
2167
  try {
1153
2168
  await r.getUser({ force: !0 });
1154
2169
  } catch {
1155
2170
  }
1156
- n("purchase_completed", { priceId: d, sessionId: null, restored: !0 }), m({ kind: "purchase_success", restored: !0 });
2171
+ n("purchase_completed", { priceId: x, sessionId: null, restored: !0 }), C ? t() : y({ kind: "purchase_success", restored: !0 });
1157
2172
  return;
1158
2173
  }
1159
- const k = h instanceof T ? h : new T("checkout_failed", "Checkout failed", { cause: h });
1160
- n("error", k), m({ kind: "layout" });
2174
+ const w = f instanceof L ? f : new L("checkout_failed", "Checkout failed", { cause: f });
2175
+ n("error", w), C ? t() : y({ kind: "layout" });
1161
2176
  }
1162
- }, v = (d, h) => {
2177
+ }, O = (x, f) => {
1163
2178
  if (typeof window > "u") return;
1164
- const k = window.open(h, "_blank");
1165
- if (k) {
2179
+ const w = window.open(f, "_blank");
2180
+ if (w) {
1166
2181
  try {
1167
- k.opener = null;
2182
+ w.opener = null;
1168
2183
  } catch {
1169
2184
  }
1170
- m({ kind: "awaiting_payment", priceId: d, url: h });
2185
+ y({ kind: "awaiting_payment", priceId: x, url: f });
1171
2186
  }
1172
2187
  };
1173
- M(() => {
1174
- if (f.kind !== "auth_gate" || !g || g.user.is_anonymous || y.current) return;
1175
- y.current = !0;
1176
- const d = f.pendingCheckout, h = f.origin;
1177
- m({ kind: "verifying" }), (async () => {
1178
- if (!l)
2188
+ P(() => {
2189
+ if (b.kind !== "auth_gate" || !m || m.user.is_anonymous || I.current) return;
2190
+ I.current = !0;
2191
+ const x = b.pendingCheckout, f = b.origin;
2192
+ y({ kind: "verifying" }), (async () => {
2193
+ if (!h)
1179
2194
  try {
1180
2195
  if ((await r.getUser({ force: !0 })).has_active_subscription) {
1181
2196
  n("purchase_completed", {
1182
- priceId: d?.priceId ?? null,
2197
+ priceId: x?.priceId ?? null,
1183
2198
  sessionId: null,
1184
2199
  restored: !0
1185
- }), m({ kind: "purchase_success", restored: !0 });
2200
+ }), x?.direct ? t() : y({ kind: "purchase_success", restored: !0 });
1186
2201
  return;
1187
2202
  }
1188
2203
  } catch {
1189
2204
  }
1190
- if (!d) {
1191
- h === "standalone" ? t() : m({ kind: "layout" });
2205
+ if (!x) {
2206
+ f === "standalone" ? t() : y({ kind: "layout" });
1192
2207
  return;
1193
2208
  }
1194
- await A(d.priceId);
2209
+ await M(x.priceId);
1195
2210
  })().finally(() => {
1196
- y.current = !1;
2211
+ I.current = !1;
1197
2212
  });
1198
- }, [g, f]);
1199
- const S = async (d, h) => {
1200
- if (d === "close") {
2213
+ }, [m, b]);
2214
+ const j = async (x, f) => {
2215
+ if (x === "close") {
1201
2216
  t();
1202
2217
  return;
1203
2218
  }
1204
- if (d === "price_selected") {
1205
- n("price_selected", h);
2219
+ if (x === "price_selected") {
2220
+ n("price_selected", f);
1206
2221
  return;
1207
2222
  }
1208
- if (d === "restore") {
1209
- if (!r.auth || r.auth.getCachedSession()) return;
1210
- m({ kind: "auth_gate" });
2223
+ if (x === "restore") {
2224
+ if (!r.auth) return;
2225
+ const w = r.auth.getCachedSession();
2226
+ if (w && !w.user.is_anonymous) return;
2227
+ y({ kind: "auth_gate", intent: "restore" });
1211
2228
  return;
1212
2229
  }
1213
- if (d === "support") {
1214
- m({ kind: "support", origin: "layout" });
2230
+ if (x === "support") {
2231
+ y({ kind: "support", origin: "layout" });
1215
2232
  return;
1216
2233
  }
1217
- if (d === "checkout" && c.status === "ready") {
1218
- const k = h?.priceId;
1219
- if (!k) {
1220
- n("error", new T("no_price", "No price selected"));
2234
+ if (x === "checkout" && p.status === "ready") {
2235
+ const w = f?.priceId;
2236
+ if (!w) {
2237
+ n("error", new L("no_price", "No price selected"));
1221
2238
  return;
1222
2239
  }
1223
- if ((c.data.settings.checkout_mode ?? "guest") === "preauth" && !!r.auth && !r.auth.getCachedSession()) {
1224
- m({ kind: "auth_gate", pendingCheckout: { priceId: k } });
2240
+ const B = p.data.settings.checkout_mode ?? "guest", $ = r.auth?.getCachedSession() ?? null, De = !!$ && !$.user.is_anonymous;
2241
+ if (B === "preauth" && !!r.auth && !De) {
2242
+ y({ kind: "auth_gate", pendingCheckout: { priceId: w } });
1225
2243
  return;
1226
2244
  }
1227
- await A(k);
2245
+ await M(w);
1228
2246
  }
1229
- }, w = c.status === "ready" ? c.data.settings.brand_color : null, P = c.status === "ready" ? !!c.data.settings.is_test_mode : !1, L = c.status === "ready" ? c.data.settings.allow_close !== !1 : !0, C = {
2247
+ }, R = p.status === "ready" ? p.data.settings.brand_color : null, T = p.status === "ready" ? p.data.settings.allow_close !== !1 : !0, z = b.kind === "layout" && p.status === "ready" ? Te(p.data.offers) : null, q = z ? /* @__PURE__ */ o(At, { offer: z }) : null, Y = {
1230
2248
  type: "auth_panel",
1231
- heading: "Sign in to continue",
2249
+ // Заголовок не задаём — AuthGate сам решит по intent'у (restore →
2250
+ // "Restore Purchases", остальные → дефолтный "Welcome back!").
1232
2251
  allow_signup: !0,
1233
2252
  allow_password_reset: !0,
1234
2253
  // Не скрываем при наличии сессии — auto-resume useEffect отрабатывает быстрее,
1235
2254
  // чем хотим показывать "Signed in as ..." промежуточным экраном.
1236
2255
  hide_when_authenticated: !1,
1237
- providers: c.status === "ready" ? c.data.settings.auth_providers : void 0
1238
- }, I = f.kind === "support" ? /* @__PURE__ */ o(
1239
- Te,
2256
+ providers: p.status === "ready" ? p.data.settings.auth_providers : void 0
2257
+ }, V = b.kind === "support" ? /* @__PURE__ */ o(
2258
+ Et,
1240
2259
  {
1241
2260
  client: r,
1242
- authSession: g,
1243
- origin: f.origin,
2261
+ authSession: m,
2262
+ origin: b.origin,
1244
2263
  onBack: () => {
1245
- f.origin === "standalone" ? t() : m({ kind: "layout" });
2264
+ b.origin === "standalone" ? t() : y({ kind: "layout" });
1246
2265
  }
1247
2266
  }
1248
- ) : null;
1249
- return /* @__PURE__ */ o(
1250
- ye,
2267
+ ) : null, K = b.kind === "auth_gate" && b.origin !== "standalone" || b.kind === "support", X = p.status === "ready" ? p.data : null;
2268
+ return /* @__PURE__ */ o(at, { bootstrap: X, forceLocale: _, children: /* @__PURE__ */ o(
2269
+ lt,
1251
2270
  {
1252
2271
  open: e,
1253
2272
  onClose: t,
1254
- brandColor: w,
1255
- testMode: P,
1256
- allowClose: L,
2273
+ brandColor: R,
2274
+ topBanner: q,
2275
+ allowClose: T,
2276
+ hideCloseButton: K,
2277
+ inline: g,
1257
2278
  labelledBy: "pw-title",
1258
- children: s ? /* @__PURE__ */ o(te, { onContinue: t }) : f.kind === "purchase_success" ? /* @__PURE__ */ o(te, { restored: f.restored, onContinue: t }) : I || (c.status === "loading" || c.status === "idle" || f.kind === "verifying" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
1259
- /* @__PURE__ */ o("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
1260
- /* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: f.kind === "verifying" ? "Checking your subscription…" : "Loading…" })
1261
- ] }) : c.status === "error" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
1262
- /* @__PURE__ */ o("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1263
- /* @__PURE__ */ o(
1264
- "path",
1265
- {
1266
- d: "M10 6v5M10 14h.01",
1267
- stroke: "#dc2626",
1268
- "stroke-width": "2",
1269
- "stroke-linecap": "round"
1270
- }
1271
- ),
1272
- /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
1273
- ] }) }),
1274
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Something went wrong" }),
1275
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: c.error.message })
1276
- ] }) : f.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
1277
- Se,
2279
+ children: l ? /* @__PURE__ */ o(ve, { onContinue: t }) : b.kind === "purchase_success" ? /* @__PURE__ */ o(ve, { restored: b.restored, onContinue: t }) : V || (p.status === "loading" || p.status === "idle" || b.kind === "verifying" ? /* @__PURE__ */ o(lr, { verifying: b.kind === "verifying" }) : p.status === "error" ? /* @__PURE__ */ o(cr, { message: p.error.message }) : b.kind === "auth_gate" && r.auth ? /* @__PURE__ */ o(
2280
+ _t,
1278
2281
  {
1279
- block: C,
1280
- bootstrap: c.data,
2282
+ block: Y,
2283
+ bootstrap: p.data,
1281
2284
  auth: r.auth,
1282
- authSession: g,
1283
- showBack: f.origin !== "standalone",
2285
+ authSession: m,
2286
+ showBack: b.origin !== "standalone",
2287
+ intent: b.intent ?? (b.origin === "standalone" ? "standalone" : "preauth"),
2288
+ initialMode: b.origin === "standalone" ? s : void 0,
1284
2289
  onBack: () => {
1285
- f.origin === "standalone" ? t() : m({ kind: "layout" });
2290
+ b.origin === "standalone" ? t() : y({ kind: "layout" });
1286
2291
  }
1287
2292
  }
1288
- ) : f.kind === "anon_gate" && r.auth ? /* @__PURE__ */ o(
1289
- Ce,
1290
- {
1291
- auth: r.auth,
1292
- onSuccess: () => {
1293
- f.origin === "standalone" ? t() : m({ kind: "layout" });
1294
- },
1295
- onBack: f.origin === "standalone" ? void 0 : () => m({ kind: "layout" })
1296
- }
1297
- ) : f.kind === "awaiting_payment" ? /* @__PURE__ */ o(
1298
- Xe,
2293
+ ) : b.kind === "awaiting_payment" ? /* @__PURE__ */ o(
2294
+ dr,
1299
2295
  {
1300
2296
  client: r,
1301
- onBack: () => m({ kind: "layout" }),
2297
+ onBack: () => y({ kind: "layout" }),
1302
2298
  onReopen: () => {
1303
2299
  if (typeof window > "u") return;
1304
- const d = window.open(f.url, "_blank");
1305
- if (d)
2300
+ const x = window.open(b.url, "_blank");
2301
+ if (x)
1306
2302
  try {
1307
- d.opener = null;
2303
+ x.opener = null;
1308
2304
  } catch {
1309
2305
  }
1310
2306
  },
1311
- onRetry: () => A(f.priceId)
2307
+ onRetry: () => M(b.priceId)
1312
2308
  }
1313
- ) : f.kind === "popup_blocked" ? /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
1314
- /* @__PURE__ */ o(
1315
- "div",
1316
- {
1317
- class: "flex h-11 w-11 items-center justify-center rounded-full",
1318
- style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
1319
- "aria-hidden": "true",
1320
- children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
1321
- /* @__PURE__ */ o(
1322
- "path",
1323
- {
1324
- d: "M4 5h12v10H4z",
1325
- stroke: "currentColor",
1326
- "stroke-width": "1.75",
1327
- "stroke-linejoin": "round"
1328
- }
1329
- ),
1330
- /* @__PURE__ */ o("path", { d: "M7 9l3 3 4-5", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })
1331
- ] })
1332
- }
1333
- ),
1334
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Allow popups to continue" }),
1335
- /* @__PURE__ */ o("p", { class: "max-w-[18rem] text-xs leading-relaxed text-gray-500", children: "Your browser blocked the checkout tab. Click below to open it." }),
1336
- /* @__PURE__ */ o(
1337
- "button",
1338
- {
1339
- type: "button",
1340
- onClick: () => v(f.priceId, f.url),
1341
- class: "mt-1 rounded-xl px-4 py-2 text-xs font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1342
- style: {
1343
- background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1344
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1345
- },
1346
- children: "Open checkout"
1347
- }
1348
- )
1349
- ] }) : /* @__PURE__ */ o(
1350
- He,
2309
+ ) : b.kind === "popup_blocked" ? /* @__PURE__ */ o(ur, { onReopen: () => O(b.priceId, b.url) }) : /* @__PURE__ */ o(
2310
+ ir,
1351
2311
  {
1352
- layout: c.data.layout,
1353
- bootstrap: c.data,
1354
- onAction: S,
2312
+ layout: p.data.layout,
2313
+ bootstrap: p.data,
2314
+ onAction: j,
1355
2315
  auth: r.auth,
1356
- authSession: g
2316
+ authSession: m
1357
2317
  }
1358
2318
  ))
1359
2319
  }
1360
- );
2320
+ ) });
2321
+ }
2322
+ function lr({ verifying: r }) {
2323
+ const { t: e } = S();
2324
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center justify-center gap-3 py-12", children: [
2325
+ /* @__PURE__ */ o("span", { class: "inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" }),
2326
+ /* @__PURE__ */ o("span", { class: "text-xs font-medium tracking-wide text-gray-500", children: r ? e("modal.verifying_subscription", "Checking your subscription…") : e("modal.loading", "Loading…") })
2327
+ ] });
2328
+ }
2329
+ function cr({ message: r }) {
2330
+ const { t: e } = S();
2331
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-2 py-8 text-center", children: [
2332
+ /* @__PURE__ */ o("div", { class: "flex h-11 w-11 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
2333
+ /* @__PURE__ */ o("path", { d: "M10 6v5M10 14h.01", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round" }),
2334
+ /* @__PURE__ */ o("circle", { cx: "10", cy: "10", r: "8", stroke: "#dc2626", "stroke-width": "1.75" })
2335
+ ] }) }),
2336
+ /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: e("modal.error_generic", "Something went wrong") }),
2337
+ /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: r })
2338
+ ] });
2339
+ }
2340
+ function ur({ onReopen: r }) {
2341
+ const { t: e } = S();
2342
+ return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
2343
+ /* @__PURE__ */ o(
2344
+ "div",
2345
+ {
2346
+ class: "flex h-14 w-14 items-center justify-center rounded-full",
2347
+ style: { background: "color-mix(in srgb, var(--pw-accent) 12%, white)", color: "var(--pw-accent)" },
2348
+ "aria-hidden": "true",
2349
+ children: /* @__PURE__ */ u("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", children: [
2350
+ /* @__PURE__ */ o(
2351
+ "path",
2352
+ {
2353
+ d: "M14 4h6v6",
2354
+ stroke: "currentColor",
2355
+ "stroke-width": "2",
2356
+ "stroke-linecap": "round",
2357
+ "stroke-linejoin": "round"
2358
+ }
2359
+ ),
2360
+ /* @__PURE__ */ o(
2361
+ "path",
2362
+ {
2363
+ d: "M20 4l-9 9",
2364
+ stroke: "currentColor",
2365
+ "stroke-width": "2",
2366
+ "stroke-linecap": "round",
2367
+ "stroke-linejoin": "round"
2368
+ }
2369
+ ),
2370
+ /* @__PURE__ */ o(
2371
+ "path",
2372
+ {
2373
+ d: "M19 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",
2374
+ stroke: "currentColor",
2375
+ "stroke-width": "2",
2376
+ "stroke-linecap": "round",
2377
+ "stroke-linejoin": "round"
2378
+ }
2379
+ )
2380
+ ] })
2381
+ }
2382
+ ),
2383
+ /* @__PURE__ */ o(
2384
+ "p",
2385
+ {
2386
+ id: "pw-title",
2387
+ class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
2388
+ children: e("payment.popup_blocked_title", "Allow popups to continue")
2389
+ }
2390
+ ),
2391
+ /* @__PURE__ */ o("p", { class: "max-w-[20rem] text-sm leading-relaxed text-gray-500", children: e("payment.popup_blocked_message", "Your browser blocked the checkout tab. Click below to open it.") }),
2392
+ /* @__PURE__ */ o(
2393
+ "button",
2394
+ {
2395
+ type: "button",
2396
+ onClick: r,
2397
+ class: "mt-3 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
2398
+ style: {
2399
+ background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
2400
+ boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
2401
+ },
2402
+ children: e("payment.open_checkout_button", "Open checkout")
2403
+ }
2404
+ )
2405
+ ] });
1361
2406
  }
1362
- function Xe({
2407
+ function dr({
1363
2408
  client: r,
1364
2409
  onBack: e,
1365
2410
  onReopen: t,
1366
2411
  onRetry: n
1367
2412
  }) {
1368
- const [i, s] = x(!1), [l, a] = x(!1), c = B(null);
1369
- return M(() => () => {
1370
- c.current !== null && clearTimeout(c.current);
1371
- }, []), /* @__PURE__ */ u("div", { class: "flex flex-col gap-3", children: [
2413
+ const { t: i } = S(), [s, a] = k(!1), [c, l] = k(!1), h = D(null);
2414
+ P(() => () => {
2415
+ h.current !== null && clearTimeout(h.current);
2416
+ }, []);
2417
+ const d = async () => {
2418
+ if (!s) {
2419
+ a(!0), l(!1);
2420
+ try {
2421
+ if ((await r.getUser({ force: !0 })).has_active_subscription) {
2422
+ typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
2423
+ return;
2424
+ }
2425
+ l(!0), h.current !== null && clearTimeout(h.current), h.current = setTimeout(() => {
2426
+ l(!1), h.current = null;
2427
+ }, 5e3);
2428
+ } catch {
2429
+ l(!0);
2430
+ } finally {
2431
+ a(!1);
2432
+ }
2433
+ }
2434
+ };
2435
+ return /* @__PURE__ */ u("div", { class: "flex flex-col gap-3 px-6 pb-6 pt-4 sm:px-8 sm:pb-8 sm:pt-5", children: [
1372
2436
  /* @__PURE__ */ o(
1373
2437
  "button",
1374
2438
  {
1375
2439
  type: "button",
1376
2440
  onClick: e,
1377
2441
  class: "-ml-1 self-start rounded-md px-1.5 py-0.5 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1378
- children: "← Back"
2442
+ children: i("nav.back", "← Back")
1379
2443
  }
1380
2444
  ),
1381
2445
  /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-6 text-center", children: [
1382
- /* @__PURE__ */ u("div", { class: "relative flex h-12 w-12 items-center justify-center", children: [
2446
+ /* @__PURE__ */ u("div", { class: "relative flex h-14 w-14 items-center justify-center", children: [
1383
2447
  /* @__PURE__ */ o(
1384
2448
  "span",
1385
2449
  {
@@ -1388,52 +2452,45 @@ function Xe({
1388
2452
  "aria-hidden": "true"
1389
2453
  }
1390
2454
  ),
1391
- /* @__PURE__ */ o("span", { class: "relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
2455
+ /* @__PURE__ */ o("span", { class: "relative inline-block h-8 w-8 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]" })
1392
2456
  ] }),
1393
- /* @__PURE__ */ o("p", { class: "text-sm font-semibold tracking-tight text-gray-900", children: "Complete payment in the new tab" }),
1394
- /* @__PURE__ */ o("p", { class: "max-w-[20rem] text-xs leading-relaxed text-gray-500", children: "We'll detect your payment automatically — or click below once you're done." }),
2457
+ /* @__PURE__ */ o(
2458
+ "p",
2459
+ {
2460
+ id: "pw-title",
2461
+ class: "mt-1 text-lg font-semibold tracking-tight text-gray-900",
2462
+ children: i("payment.awaiting_title", "Complete payment in the new tab")
2463
+ }
2464
+ ),
2465
+ /* @__PURE__ */ o("p", { class: "max-w-[22rem] text-sm leading-relaxed text-gray-500", children: i(
2466
+ "payment.awaiting_subtitle",
2467
+ "We'll detect your payment automatically — or click below once you're done."
2468
+ ) }),
1395
2469
  /* @__PURE__ */ o(
1396
2470
  "button",
1397
2471
  {
1398
2472
  type: "button",
1399
- onClick: async () => {
1400
- if (!i) {
1401
- s(!0), a(!1);
1402
- try {
1403
- if ((await r.getUser({ force: !0 })).has_active_subscription) {
1404
- typeof window < "u" && window.postMessage({ type: "paywall_purchase" }, "*");
1405
- return;
1406
- }
1407
- a(!0), c.current !== null && clearTimeout(c.current), c.current = setTimeout(() => {
1408
- a(!1), c.current = null;
1409
- }, 5e3);
1410
- } catch {
1411
- a(!0);
1412
- } finally {
1413
- s(!1);
1414
- }
1415
- }
1416
- },
1417
- disabled: i,
1418
- class: "mt-1 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
2473
+ onClick: d,
2474
+ disabled: s,
2475
+ class: "mt-3 rounded-xl px-5 py-2.5 text-sm font-semibold text-white transition-all hover:-translate-y-px hover:brightness-105 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:brightness-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--pw-accent)]",
1419
2476
  style: {
1420
2477
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1421
- boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
2478
+ boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1422
2479
  },
1423
- children: i ? "Checking…" : "I've paid"
2480
+ children: s ? i("payment.checking", "Checking…") : i("payment.ive_paid", "I've paid")
1424
2481
  }
1425
2482
  ),
1426
- l ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: "Payment is still being processed. Please try again in a moment." }) : null
2483
+ c ? /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-500", children: i("payment.still_processing", "Payment is still being processed. Please try again in a moment.") }) : null
1427
2484
  ] }),
1428
2485
  /* @__PURE__ */ u("div", { class: "rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5", children: [
1429
- /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: "Checkout window didn't open or got blocked? Click here to open it again." }),
2486
+ /* @__PURE__ */ o("p", { class: "text-xs leading-relaxed text-gray-600", children: i("payment.popup_help_text", "Checkout window didn't open or got blocked? Click here to open it again.") }),
1430
2487
  /* @__PURE__ */ o(
1431
2488
  "button",
1432
2489
  {
1433
2490
  type: "button",
1434
2491
  onClick: t,
1435
2492
  class: "mt-2.5 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1436
- children: "Open checkout again"
2493
+ children: i("payment.open_checkout_again", "Open checkout again")
1437
2494
  }
1438
2495
  )
1439
2496
  ] }),
@@ -1443,15 +2500,16 @@ function Xe({
1443
2500
  type: "button",
1444
2501
  onClick: n,
1445
2502
  class: "self-center rounded-md px-2 py-1 text-xs text-gray-500 underline-offset-2 hover:text-gray-900 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--pw-accent)]",
1446
- children: "Tab closed? Try again"
2503
+ children: i("payment.tab_closed_retry", "Tab closed? Try again")
1447
2504
  }
1448
2505
  )
1449
2506
  ] });
1450
2507
  }
1451
- function te({
2508
+ function ve({
1452
2509
  onContinue: r,
1453
2510
  restored: e = !1
1454
2511
  }) {
2512
+ const { t } = S();
1455
2513
  return /* @__PURE__ */ u("div", { class: "flex flex-col items-center gap-3 py-8 text-center", children: [
1456
2514
  /* @__PURE__ */ o(
1457
2515
  "div",
@@ -1476,8 +2534,11 @@ function te({
1476
2534
  ) })
1477
2535
  }
1478
2536
  ),
1479
- /* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? "Subscription restored" : "Payment received" }),
1480
- /* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? "Welcome back — your subscription is already active." : "Your subscription is now active." }),
2537
+ /* @__PURE__ */ o("p", { id: "pw-title", class: "mt-1 text-lg font-semibold tracking-tight text-gray-900", children: e ? t("modal.purchase_restored_title", "Subscription restored") : t("modal.purchase_success_title", "Payment received") }),
2538
+ /* @__PURE__ */ o("p", { class: "text-sm leading-relaxed text-gray-500", children: e ? t(
2539
+ "modal.purchase_restored_subtitle",
2540
+ "Welcome back — your subscription is already active."
2541
+ ) : t("modal.purchase_success_subtitle", "Your subscription is now active.") }),
1481
2542
  /* @__PURE__ */ o(
1482
2543
  "button",
1483
2544
  {
@@ -1488,22 +2549,22 @@ function te({
1488
2549
  background: "linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",
1489
2550
  boxShadow: "0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"
1490
2551
  },
1491
- children: "Continue"
2552
+ children: t("modal.continue", "Continue")
1492
2553
  }
1493
2554
  )
1494
2555
  ] });
1495
2556
  }
1496
- const Ye = 10 * 6e4, Je = 5e3, Ke = 3e4;
1497
- class Qe {
2557
+ const hr = 10 * 6e4, pr = 5e3, fr = 3e4;
2558
+ class gr {
1498
2559
  constructor(e) {
1499
2560
  this.timer = null, this.timeoutTimer = null, this.visibilityHandler = null, this.focusHandler = null, this.messageHandler = null, this.stopped = !1, this.checking = !1, this.opts = {
1500
2561
  client: e.client,
1501
2562
  onActive: e.onActive,
1502
2563
  onTimeout: e.onTimeout ?? (() => {
1503
2564
  }),
1504
- timeoutMs: e.timeoutMs ?? Ye,
1505
- visibleIntervalMs: e.visibleIntervalMs ?? Je,
1506
- hiddenIntervalMs: e.hiddenIntervalMs ?? Ke
2565
+ timeoutMs: e.timeoutMs ?? hr,
2566
+ visibleIntervalMs: e.visibleIntervalMs ?? pr,
2567
+ hiddenIntervalMs: e.hiddenIntervalMs ?? fr
1507
2568
  };
1508
2569
  }
1509
2570
  start() {
@@ -1542,22 +2603,27 @@ class Qe {
1542
2603
  !t || typeof t != "object" || t.type === "paywall_purchase" && this.check();
1543
2604
  }
1544
2605
  }
1545
- function et() {
2606
+ function mr() {
1546
2607
  return !(typeof document > "u" || typeof window > "u" || typeof location < "u" && location.protocol === "chrome-extension:");
1547
2608
  }
1548
- const N = { open: !1, view: null, error: null }, E = {
2609
+ const se = {
2610
+ open: !1,
2611
+ view: null,
2612
+ error: null,
2613
+ processing: !1
2614
+ }, F = {
1549
2615
  status: "paywall_status",
1550
2616
  priceId: "paywall_price_id",
1551
2617
  sessionId: "paywall_session_id"
1552
2618
  };
1553
- let tt = class {
2619
+ let yr = class {
1554
2620
  constructor(e) {
1555
- this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = N, this.stateListeners = /* @__PURE__ */ new Set();
1556
- const { auth: t, ownsAuth: n } = rt(e);
1557
- this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new ae({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.userUnsub = this.billing.onUserChange((i) => {
2621
+ this.handle = null, this.isOpen = !1, this.listeners = /* @__PURE__ */ new Map(), this.userUnsub = null, this.authUnsub = null, this.watcher = null, this.tracker = null, this.purchased = !1, this.trialStore = null, this.trialStoreConfig = null, this.lastTrialStatus = null, this.trialExpiredFired = !1, this.lastVisibility = null, this.currentState = se, this.stateListeners = /* @__PURE__ */ new Set();
2622
+ const { auth: t, ownsAuth: n } = br(e);
2623
+ this.auth = t, this.ownsAuth = n, this.billing = e.client ?? new Re({ ...e, auth: this.auth }), this.host = e.host, this.shadowMode = e.shadowMode ?? "closed", this.mountThenLoad = e.mountThenLoad ?? !0, this.inline = e.inline === !0, this.forceLocale = e.locale ?? null, this.userUnsub = this.billing.onUserChange((i) => {
1558
2624
  this.emit("userChange", i);
1559
- }), this.auth && (this.authUnsub = this.auth.onAuthChange((i) => {
1560
- this.emit("authChange", i);
2625
+ }), this.auth && (this.authUnsub = this.auth.onAuthChange((i, s) => {
2626
+ this.emit("authChange", { event: i, session: s });
1561
2627
  })), this.initTracker(e.analytics), e.autoDetectReturn !== !1 && typeof window < "u" && queueMicrotask(() => this.checkReturn());
1562
2628
  }
1563
2629
  initTracker(e) {
@@ -1565,7 +2631,7 @@ let tt = class {
1565
2631
  const t = typeof e == "object" && e !== null ? e : {};
1566
2632
  if (t.enabled === !1) return;
1567
2633
  const n = t.endpoint ?? `${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;
1568
- this.tracker = new ce({
2634
+ this.tracker = new ze({
1569
2635
  endpoint: n,
1570
2636
  paywallId: this.billing.paywallId,
1571
2637
  capabilities: this.billing.capabilities,
@@ -1652,6 +2718,18 @@ let tt = class {
1652
2718
  setBootstrap(e) {
1653
2719
  this.billing.setBootstrap(e);
1654
2720
  }
2721
+ /**
2722
+ * Сменить force-locale на лету — для live-preview редактора админки, когда
2723
+ * юзер переключает «Preview as user from <country>». Грузит соответствующий
2724
+ * static-чанк и форсит re-render через handle.update. См. PaywallUIOptions.locale.
2725
+ *
2726
+ * Передай `null`/`undefined`, чтобы вернуть автоматическую резолв-логику
2727
+ * (navigator.language → locale_default).
2728
+ */
2729
+ setLocale(e) {
2730
+ const t = e ?? null;
2731
+ t !== this.forceLocale && (this.forceLocale = t, this.handle && this.handle.update({ locale: t }));
2732
+ }
1655
2733
  on(e, t) {
1656
2734
  let n = this.listeners.get(e);
1657
2735
  return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t), () => n.delete(t);
@@ -1666,8 +2744,8 @@ let tt = class {
1666
2744
  for (const s of n)
1667
2745
  try {
1668
2746
  s(i);
1669
- } catch (l) {
1670
- typeof console < "u" && console.error("[paywall] listener error", l);
2747
+ } catch (a) {
2748
+ typeof console < "u" && console.error("[paywall] listener error", a);
1671
2749
  }
1672
2750
  }
1673
2751
  open(e = {}) {
@@ -1720,43 +2798,247 @@ let tt = class {
1720
2798
  this.auth && this.openInternal("auth", { ...e, skipTrial: !0 });
1721
2799
  }
1722
2800
  /**
1723
- * Открывает модалку с anonymous-gate. AnonGate сразу зовёт
1724
- * `auth.signInAnonymously()`:
1725
- * - если в storage есть `anonRefreshToken` silent resume через
1726
- * /auth/refresh, модалка схлопывается мгновенно (юзер видит лёгкий
1727
- * спиннер ~100мс);
1728
- * - иначе — fresh POST /auth/anonymous/signin без captcha (защита от
1729
- * abuse держится на Supabase per-real-IP rate-limit + CF Bot Fight Mode).
2801
+ * Шорткат над `openAuth()` открывает модалку сразу на signin-форме.
2802
+ * Эквивалент `openAuth()` (signin — дефолт). Существует для симметрии с
2803
+ * `openSignup()` и читаемости host-кода:
2804
+ * - `paywall.openSignin()` «вход в существующий аккаунт»
2805
+ * - `paywall.openSignup()` — «новая регистрация»
2806
+ * Без managed-auth no-op.
2807
+ */
2808
+ openSignin(e = {}) {
2809
+ this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signin" });
2810
+ }
2811
+ /**
2812
+ * Открывает модалку с auth-gate сразу в режиме регистрации (signup-mode
2813
+ * AuthPanel'а — email/password/repeat). Если в paywall layout админ
2814
+ * отключил allow_signup, AuthPanel игнорит mode и стартует с signin —
2815
+ * соблюдается admin-конфиг.
2816
+ * Без managed-auth — no-op.
2817
+ */
2818
+ openSignup(e = {}) {
2819
+ this.auth && this.openInternal("auth", { ...e, skipTrial: !0, authMode: "signup" });
2820
+ }
2821
+ /**
2822
+ * Direct-checkout: создать checkout-URL по конкретной цене и сразу открыть
2823
+ * платёжного провайдера, минуя layout с тарифами. Полезно когда
2824
+ * host-приложение рендерит pricing-карточки/таблицу собственным UI и
2825
+ * хочет, чтобы клик по «Buy / Get this plan» вёл прямо в Stripe/Paddle.
2826
+ *
2827
+ * **Late-mount UX.** В отличие от `open()`, модалка не появляется во время
2828
+ * фоновой работы (bootstrap + visibility/trial gates + createCheckout).
2829
+ * Хост на этой фазе показывает busy-state прямо на своей кнопке (через
2830
+ * `state.processing === true` из `paywall.getState()` — или автоматически
2831
+ * через `<PaywallButton priceId>` в sdk-react). Модалка монтируется
2832
+ * ТОЛЬКО когда реально нужна UI:
2833
+ * - `checkout_mode='preauth'` + managed-auth + не залогинен → auth-gate
2834
+ * (форма signin'а); после успеха auto-resume в createCheckout.
2835
+ * - popup провайдера заблокирован браузером → popup_blocked view с
2836
+ * retry-кнопкой под fresh user gesture.
2837
+ * - popup открылся успешно → awaiting_payment view (индикатор «оплати
2838
+ * в новой вкладке» + I've paid).
2839
+ *
2840
+ * Что эмитится без модалки:
2841
+ * - `purchase_completed{restored:true, priceId}` когда юзер уже подписан
2842
+ * (cached user, fresh bootstrap, или 409 hasActivePurchase от бэка) —
2843
+ * headless reject;
2844
+ * - `error` когда createCheckout упал или identity.email отсутствует;
2845
+ * - `visibility_blocked` / `trial_blocked` — стандартные gate-эвенты.
2846
+ *
2847
+ * Что эмитится одновременно с модалкой:
2848
+ * - `checkout_started{priceId, url, acquiring}` ровно когда headless URL
2849
+ * получен, ДО mount'а awaiting_payment/popup_blocked.
2850
+ *
2851
+ * Offer (countdown-скидка) автоматически резолвится из cached offers'ов
2852
+ * через `getOfferForPrice(priceId)` и передаётся в createCheckout как
2853
+ * `offerId` — чтобы duration_minutes-офферы тоже применились на бэке
2854
+ * (для них нет server-side таймера, без явного offer-id скидка теряется).
2855
+ *
2856
+ * Требования:
2857
+ * - `identity.email` должен быть выставлен (через `opts.identity`, либо
2858
+ * managed-auth, либо ранний `setIdentity`/`paywall.open({identity})`).
2859
+ * Без email бэк `/start-checkout` 400'нёт; SDK эмитнет `error`.
2860
+ * - В `checkout_mode='preauth'` без managed-auth — backend требует
2861
+ * email-юзера; убедись что `identity.email` явно задан.
1730
2862
  *
1731
- * После успешного signIn'а модалка закрывается; host подхватывает свежую
1732
- * session через `auth.onAuthChange` или `paywall.onUserChange`. Для UX
1733
- * "просто залогиниться чтобы api-gateway работал, без покупок".
2863
+ * Без модалки совсем (когда host рендерит свой awaiting-payment экран) —
2864
+ * используй `paywall.billing.createCheckout({priceId, offerId})` напрямую,
2865
+ * но тогда auth-gate / popup_blocked / awaiting_payment придётся рисовать
2866
+ * самостоятельно.
2867
+ */
2868
+ checkout(e, t = {}) {
2869
+ if (t.identity && this.billing.setIdentity(t.identity), t.renew !== !0 && this.billing.getCachedUser()?.has_active_subscription) {
2870
+ this.emit("purchase_completed", {
2871
+ priceId: e,
2872
+ sessionId: null,
2873
+ restored: !0
2874
+ });
2875
+ return;
2876
+ }
2877
+ this.runDirectCheckout(e, t);
2878
+ }
2879
+ /** Headless prep-work для `checkout(priceId, opts)`: bootstrap → gates →
2880
+ * preauth check → createCheckout → mount модалки с финальным view.
2881
+ * Вынесено отдельным методом ради чистого async/await flow вместо вложенных
2882
+ * then-chain'ов (5+ ветвей). Любая ошибка не пробрасывается наружу: эмитим
2883
+ * через `paywall.emit('error')` и выходим — host подписан на `error`-event. */
2884
+ async runDirectCheckout(e, t) {
2885
+ const n = t.renew === !0, i = t.skipTrial === !0, s = t.skipVisibility === !0;
2886
+ this.applyProcessing(!0);
2887
+ const a = () => {
2888
+ this.applyProcessing(!1);
2889
+ };
2890
+ let c;
2891
+ try {
2892
+ c = await this.billing.bootstrap();
2893
+ } catch (m) {
2894
+ const A = m instanceof L ? m : new L("unknown", "Failed to load paywall", { cause: m });
2895
+ this.emit("error", A), a();
2896
+ return;
2897
+ }
2898
+ if (!s) {
2899
+ const m = c.settings.visibility;
2900
+ if (m && (this.lastVisibility = m, !m.visible)) {
2901
+ this.emit("visibility_blocked", m), a();
2902
+ return;
2903
+ }
2904
+ }
2905
+ if (!i && await this.checkTrialBeforeCheckout(c)) {
2906
+ a();
2907
+ return;
2908
+ }
2909
+ if (!n && c.user?.has_active_subscription) {
2910
+ this.emit("purchase_completed", {
2911
+ priceId: e,
2912
+ sessionId: null,
2913
+ restored: !0
2914
+ }), a();
2915
+ return;
2916
+ }
2917
+ const l = c.settings.checkout_mode ?? "guest", h = this.auth?.getCachedSession() ?? null, d = !!h && !h.user.is_anonymous;
2918
+ if (l === "preauth" && !!this.auth && !d) {
2919
+ this.purchased = !1, this.mountAndShow("auth", {
2920
+ renew: n,
2921
+ authMode: "signin",
2922
+ checkoutPriceId: e
2923
+ });
2924
+ return;
2925
+ }
2926
+ const _ = this.getOfferForPrice(e);
2927
+ let p;
2928
+ try {
2929
+ p = await this.billing.createCheckout({
2930
+ priceId: e,
2931
+ offerId: _?.offer.id,
2932
+ ignoreActivePurchase: n
2933
+ });
2934
+ } catch (m) {
2935
+ if (m instanceof L && m.code === "already_purchased") {
2936
+ try {
2937
+ await this.billing.getUser({ force: !0 });
2938
+ } catch {
2939
+ }
2940
+ this.emit("purchase_completed", {
2941
+ priceId: e,
2942
+ sessionId: null,
2943
+ restored: !0
2944
+ }), a();
2945
+ return;
2946
+ }
2947
+ const A = m instanceof L ? m : new L("checkout_failed", "Checkout failed", { cause: m });
2948
+ this.emit("error", A), a();
2949
+ return;
2950
+ }
2951
+ if (this.emit("checkout_started", {
2952
+ priceId: e,
2953
+ url: p.url,
2954
+ acquiring: p.acquiring
2955
+ }), this.startUserWatcher(), typeof window > "u" || !p.url) {
2956
+ this.mountAndShow("awaiting_payment", {
2957
+ renew: n,
2958
+ checkoutPriceId: e,
2959
+ checkoutUrl: p.url
2960
+ });
2961
+ return;
2962
+ }
2963
+ const v = window.open(p.url, "_blank");
2964
+ if (this.purchased = !1, v) {
2965
+ try {
2966
+ v.opener = null;
2967
+ } catch {
2968
+ }
2969
+ this.mountAndShow("awaiting_payment", {
2970
+ renew: n,
2971
+ checkoutPriceId: e,
2972
+ checkoutUrl: p.url
2973
+ });
2974
+ } else
2975
+ this.mountAndShow("popup_blocked", {
2976
+ renew: n,
2977
+ checkoutPriceId: e,
2978
+ checkoutUrl: p.url
2979
+ });
2980
+ }
2981
+ /** Trial-check без mount'а (для late-mount direct-checkout). Возвращает
2982
+ * true если trial заблокировал — caller должен прекратить flow. На любой
2983
+ * storage-ошибке log+продолжаем (не блокируем продажу). */
2984
+ async checkTrialBeforeCheckout(e) {
2985
+ const t = e.settings.trial;
2986
+ if (!t) return !1;
2987
+ const n = this.ensureTrialStore(t);
2988
+ try {
2989
+ const i = await n.check();
2990
+ if (this.lastTrialStatus = i, i.mode === "none") return !1;
2991
+ if (i.blocked) {
2992
+ const s = await n.recordBlock();
2993
+ return this.lastTrialStatus = s, this.emit("trial_blocked", s), !0;
2994
+ }
2995
+ return this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), !1;
2996
+ } catch (i) {
2997
+ return typeof console < "u" && console.warn("[paywall] trial check failed", i), !1;
2998
+ }
2999
+ }
3000
+ applyProcessing(e) {
3001
+ this.currentState.processing !== e && this.applyState({ ...this.currentState, processing: e });
3002
+ }
3003
+ /**
3004
+ * Headless anonymous signin без открытия модалки. Внутри:
3005
+ * idempotent (если уже анон — instant return) → resume через сохранённый
3006
+ * refresh_token → fresh /auth/anonymous/signin. Дедуплицирует
3007
+ * параллельные вызовы внутри AuthClient'а.
1734
3008
  *
1735
- * Без managed-auth (`auth` не подключён) методno-op. Триал и
1736
- * visibility-таргетинг этот flow обходит: анон-логин не должен зависеть
1737
- * от страны юзера или trial-стейджа.
3009
+ * Удобно для host-кнопок типа «Continue as guest» host сам управляет
3010
+ * loading-стейтом на своей кнопке, без полупустой модалки со спиннером.
3011
+ * Без managed-auth резолвится rejected promise'ом (нет AuthClient'а
3012
+ * чтобы делать signin).
1738
3013
  */
1739
- openAnonGate(e = {}) {
1740
- this.auth && this.openInternal("anon", { ...e, skipTrial: !0, skipVisibility: !0 });
3014
+ signInAnonymously() {
3015
+ return this.auth ? this.auth.signInAnonymously() : Promise.reject(
3016
+ new L(
3017
+ "invalid_config",
3018
+ "signInAnonymously requires managed-auth. Pass `auth: true` to PaywallUI."
3019
+ )
3020
+ );
1741
3021
  }
1742
3022
  openInternal(e, t) {
1743
3023
  t.identity && this.billing.setIdentity(t.identity), this.purchased = !1;
1744
- const n = t.skipTrial === !0 || e === "support", i = t.skipVisibility === !0 || e === "support" || e === "auth" || e === "anon", s = t.renew === !0;
3024
+ const n = t.skipTrial === !0 || e === "support", i = t.skipVisibility === !0 || e === "support" || e === "auth", s = t.renew === !0;
1745
3025
  if (n && i) {
1746
- this.mountAndShow(e, { renew: s });
3026
+ this.mountAndShow(e, { renew: s, authMode: t.authMode });
1747
3027
  return;
1748
3028
  }
1749
- const l = this.billing.getCachedBootstrap();
1750
- if (l) {
1751
- this.runOpenGates(e, l, { skipTrial: n, skipVisibility: i, renew: s });
3029
+ const a = this.billing.getCachedBootstrap();
3030
+ if (a) {
3031
+ this.runOpenGates(e, a, { skipTrial: n, skipVisibility: i, renew: s });
1752
3032
  return;
1753
3033
  }
1754
3034
  if (this.mountThenLoad) {
1755
- this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((a) => this.runDelayedGates(a, { skipTrial: n, skipVisibility: i })).catch(() => {
3035
+ this.mountAndShow(e, { renew: s }), this.billing.bootstrap().then((c) => this.runDelayedGates(c, { skipTrial: n, skipVisibility: i })).catch(() => {
1756
3036
  });
1757
3037
  return;
1758
3038
  }
1759
- this.billing.bootstrap().then((a) => this.runOpenGates(e, a, { skipTrial: n, skipVisibility: i, renew: s })).catch(() => {
3039
+ this.billing.bootstrap().then(
3040
+ (c) => this.runOpenGates(e, c, { skipTrial: n, skipVisibility: i, renew: s })
3041
+ ).catch(() => {
1760
3042
  this.mountAndShow(e, { renew: s });
1761
3043
  });
1762
3044
  }
@@ -1779,9 +3061,9 @@ let tt = class {
1779
3061
  i.check().then(async (s) => {
1780
3062
  if (this.isOpen && (this.lastTrialStatus = s, s.mode !== "none")) {
1781
3063
  if (s.blocked) {
1782
- const l = await i.recordBlock();
1783
- if (this.lastTrialStatus = l, !this.isOpen) return;
1784
- this.close(), this.emit("trial_blocked", l);
3064
+ const a = await i.recordBlock();
3065
+ if (this.lastTrialStatus = a, !this.isOpen) return;
3066
+ this.close(), this.emit("trial_blocked", a);
1785
3067
  return;
1786
3068
  }
1787
3069
  this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired"));
@@ -1815,53 +3097,66 @@ let tt = class {
1815
3097
  return;
1816
3098
  }
1817
3099
  const s = this.ensureTrialStore(i);
1818
- s.check().then(async (l) => {
1819
- if (this.lastTrialStatus = l, l.mode === "none") {
3100
+ s.check().then(async (a) => {
3101
+ if (this.lastTrialStatus = a, a.mode === "none") {
1820
3102
  this.mountAndShow(e, { renew: n });
1821
3103
  return;
1822
3104
  }
1823
- if (l.blocked) {
1824
- const a = await s.recordBlock();
1825
- this.lastTrialStatus = a, this.emit("trial_blocked", a);
3105
+ if (a.blocked) {
3106
+ const c = await s.recordBlock();
3107
+ this.lastTrialStatus = c, this.emit("trial_blocked", c);
1826
3108
  return;
1827
3109
  }
1828
3110
  this.trialExpiredFired || (this.trialExpiredFired = !0, this.emit("trial_expired")), this.mountAndShow(e, { renew: n });
1829
- }).catch((l) => {
1830
- typeof console < "u" && console.warn("[paywall] trial check failed", l), this.mountAndShow(e, { renew: n });
3111
+ }).catch((a) => {
3112
+ typeof console < "u" && console.warn("[paywall] trial check failed", a), this.mountAndShow(e, { renew: n });
1831
3113
  });
1832
3114
  }
1833
3115
  ensureTrialStore(e) {
1834
- if (this.trialStore && this.trialStoreConfig && ot(this.trialStoreConfig, e))
3116
+ if (this.trialStore && this.trialStoreConfig && kr(this.trialStoreConfig, e))
1835
3117
  return this.trialStore;
1836
3118
  this.trialStoreConfig = e;
1837
3119
  const t = this.billing.createTrialStore;
1838
- return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : ue(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
3120
+ return this.trialStore = typeof t == "function" ? t.call(this.billing, e) : qe(this.billing.getStorage(), this.billing.paywallId, e), this.trialStore;
1839
3121
  }
1840
3122
  mountAndShow(e, t = {}) {
1841
- const n = t.renew === !0;
3123
+ const n = t.renew === !0, i = t.authMode, a = e === "auth" || e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutPriceId ?? null : null, c = e === "awaiting_payment" || e === "popup_blocked" ? t.checkoutUrl ?? null : null;
1842
3124
  if (this.handle) {
1843
- this.isOpen = !0, this.handle.update({ open: !0, initialView: e, purchased: !1, renew: n }), this.emit("open");
3125
+ this.isOpen = !0, this.handle.update({
3126
+ open: !0,
3127
+ initialView: e,
3128
+ initialAuthMode: i,
3129
+ initialCheckoutPriceId: a,
3130
+ initialCheckoutUrl: c,
3131
+ purchased: !1,
3132
+ renew: n
3133
+ }), this.emit("open");
1844
3134
  return;
1845
3135
  }
1846
- this.isOpen = !0, this.handle = me(
1847
- Ze,
3136
+ this.isOpen = !0, this.handle = tt(
3137
+ ar,
1848
3138
  {
1849
3139
  client: this.billing,
1850
3140
  open: !0,
1851
3141
  initialView: e,
3142
+ initialAuthMode: i,
3143
+ initialCheckoutPriceId: a,
3144
+ initialCheckoutUrl: c,
1852
3145
  purchased: !1,
1853
3146
  renew: n,
1854
3147
  onClose: () => this.close(),
1855
- onEvent: (i, s) => {
1856
- this.emit(i, s), i === "checkout_started" && this.startUserWatcher();
3148
+ onEvent: (l, h) => {
3149
+ this.emit(l, h), l === "checkout_started" && this.startUserWatcher();
1857
3150
  },
1858
- onState: (i) => this.applyState(i)
3151
+ onState: (l) => this.applyState(l),
3152
+ inline: this.inline,
3153
+ locale: this.forceLocale
1859
3154
  },
1860
- { host: this.host, shadowMode: this.shadowMode }
3155
+ { host: this.host, shadowMode: this.shadowMode, inline: this.inline }
1861
3156
  ), this.emit("open");
1862
3157
  }
1863
3158
  applyState(e) {
1864
- if (!it(this.currentState, e)) {
3159
+ if (!wr(this.currentState, e)) {
1865
3160
  this.currentState = e;
1866
3161
  for (const t of this.stateListeners)
1867
3162
  try {
@@ -1939,6 +3234,36 @@ let tt = class {
1939
3234
  getCachedPrices() {
1940
3235
  return this.billing.getCachedPrices();
1941
3236
  }
3237
+ /** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
3238
+ * Бэк уже применил серверный targeting (страны/email/режим) — наружу
3239
+ * выезжает только то, что применимо к текущему юзеру. */
3240
+ getCachedOffers() {
3241
+ return this.billing.getCachedOffers();
3242
+ }
3243
+ /**
3244
+ * Резолвит активный offer для конкретной цены: price_id-таргетинг +
3245
+ * countdown (`expires_at` ИЛИ `duration_minutes` от первого открытия
3246
+ * пейвола, см. clientStorage `pw-offer-{id}-start`).
3247
+ *
3248
+ * Read-only — НЕ записывает start для `duration_minutes`-офферов. Запись
3249
+ * стартует только когда модалка реально открыта (renderer'ом). До этого
3250
+ * `getOfferForPrice` вернёт `null` для duration-only офферов, чтобы
3251
+ * страницы-хосты вне модалки (pricing, landing) не активировали countdown
3252
+ * раньше времени.
3253
+ *
3254
+ * Хост-странице нужен countdown, который тикает каждую секунду — для
3255
+ * этого использовать React-хук `usePaywallOffer(priceId)` из sdk-react
3256
+ * либо обёртку поверх `setInterval(1000)` + повторный вызов этого метода.
3257
+ */
3258
+ getOfferForPrice(e) {
3259
+ const t = this.billing.getCachedOffers();
3260
+ if (!t) return null;
3261
+ const n = N(t, e);
3262
+ return n ? Ke(n, {
3263
+ now: Date.now(),
3264
+ readStart: Qe
3265
+ }) : null;
3266
+ }
1942
3267
  /** Снимок текущего «языка юзера» — proxy над `billing.getUserLanguage()`.
1943
3268
  * Используй, чтобы синхронизировать i18n host'а с тем, что фактически
1944
3269
  * показывает пейвол. См. подробности в `BillingClient.getUserLanguage`. */
@@ -1972,22 +3297,22 @@ let tt = class {
1972
3297
  try {
1973
3298
  t = await this.billing.bootstrap({ signal: e.signal });
1974
3299
  } catch {
1975
- const l = this.billing.getCachedUser();
1976
- return l?.has_active_subscription ? {
3300
+ const a = this.billing.getCachedUser();
3301
+ return a?.has_active_subscription ? {
1977
3302
  access: "granted",
1978
3303
  reason: "has_subscription",
1979
3304
  visibility: null,
1980
3305
  trial: null,
1981
- user: l
3306
+ user: a
1982
3307
  } : {
1983
3308
  access: "blocked",
1984
3309
  reason: "no_subscription",
1985
3310
  visibility: null,
1986
3311
  trial: null,
1987
- user: l
3312
+ user: a
1988
3313
  };
1989
3314
  }
1990
- const n = t.user ?? null;
3315
+ const n = this.billing.getCachedUser() ?? t.user ?? null;
1991
3316
  if (n?.has_active_subscription)
1992
3317
  return {
1993
3318
  access: "granted",
@@ -1998,19 +3323,19 @@ let tt = class {
1998
3323
  };
1999
3324
  let i = null;
2000
3325
  if (!e.skipVisibility) {
2001
- const l = t.settings.visibility;
2002
- if (l && (i = l, this.lastVisibility = l, !l.visible))
3326
+ const a = t.settings.visibility;
3327
+ if (a && (i = a, this.lastVisibility = a, !a.visible))
2003
3328
  return { access: "granted", reason: "visibility_blocked", visibility: i, trial: null, user: n };
2004
3329
  }
2005
3330
  let s = null;
2006
3331
  if (!e.skipTrial) {
2007
- const l = t.settings.trial;
2008
- if (l)
3332
+ const a = t.settings.trial;
3333
+ if (a)
2009
3334
  try {
2010
- if (s = await this.ensureTrialStore(l).check(), this.lastTrialStatus = s, s.blocked)
3335
+ if (s = await this.ensureTrialStore(a).check(), this.lastTrialStatus = s, s.blocked)
2011
3336
  return { access: "granted", reason: "trial_blocked", visibility: i, trial: s, user: n };
2012
- } catch (a) {
2013
- typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", a);
3337
+ } catch (c) {
3338
+ typeof console < "u" && console.warn("[paywall] getAccess: trial check failed", c);
2014
3339
  }
2015
3340
  }
2016
3341
  return { access: "blocked", reason: "no_subscription", visibility: i, trial: s, user: n };
@@ -2027,7 +3352,7 @@ let tt = class {
2027
3352
  // В extension popup runtime — no-op (popup не доживёт). Там полагаемся на
2028
3353
  // bootstrap при следующем открытии.
2029
3354
  startUserWatcher() {
2030
- this.watcher || et() && (this.watcher = new Qe({
3355
+ this.watcher || mr() && (this.watcher = new gr({
2031
3356
  client: this.billing,
2032
3357
  onActive: (e) => {
2033
3358
  this.watcher = null, this.emit("purchase_completed", { priceId: null, sessionId: null });
@@ -2046,7 +3371,7 @@ let tt = class {
2046
3371
  }), this.watcher.start());
2047
3372
  }
2048
3373
  close() {
2049
- !this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(N), this.emit("close"));
3374
+ !this.isOpen || !this.handle || (this.isOpen = !1, this.purchased = !1, this.handle.update({ open: !1, purchased: !1 }), this.applyState(se), this.emit("close"));
2050
3375
  }
2051
3376
  /**
2052
3377
  * Сканирует текущий URL на маркеры возврата с checkout и эмитит
@@ -2056,23 +3381,23 @@ let tt = class {
2056
3381
  */
2057
3382
  checkReturn() {
2058
3383
  if (typeof window > "u") return;
2059
- const e = new URL(window.location.href), t = re(e.hash.replace(/^#/, "")), n = re(e.search.replace(/^\?/, "")), i = t ?? n;
3384
+ const e = new URL(window.location.href), t = _e(e.hash.replace(/^#/, "")), n = _e(e.search.replace(/^\?/, "")), i = t ?? n;
2060
3385
  i && (i.status === "paid" ? (this.emit("purchase_completed", {
2061
3386
  priceId: i.priceId,
2062
3387
  sessionId: i.sessionId
2063
- }), st(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), lt(e));
3388
+ }), vr(i)) : (i.status === "failed" || i.status === "cancelled") && this.emit("purchase_failed", { reason: i.status }), _r(e));
2064
3389
  }
2065
3390
  destroy() {
2066
- this.tracker?.destroy(), this.tracker = null, this.listeners.clear(), this.stateListeners.clear(), this.watcher?.stop(), this.watcher = null, this.userUnsub?.(), this.userUnsub = null, this.authUnsub?.(), this.authUnsub = null, this.ownsAuth && this.auth && this.auth.destroy?.(), this.ownsAuth = !1, this.billing.destroy?.(), this.handle?.unmount(), this.handle = null, this.isOpen = !1, this.currentState = N;
3391
+ this.tracker?.destroy(), this.tracker = null, this.listeners.clear(), this.stateListeners.clear(), this.watcher?.stop(), this.watcher = null, this.userUnsub?.(), this.userUnsub = null, this.authUnsub?.(), this.authUnsub = null, this.ownsAuth && this.auth && this.auth.destroy?.(), this.ownsAuth = !1, this.billing.destroy?.(), this.handle?.unmount(), this.handle = null, this.isOpen = !1, this.currentState = se;
2067
3392
  }
2068
3393
  };
2069
- function rt(r) {
3394
+ function br(r) {
2070
3395
  if (!r.auth) return { auth: void 0, ownsAuth: !1 };
2071
- if (r.auth instanceof H || nt(r.auth))
3396
+ if (r.auth instanceof ue || xr(r.auth))
2072
3397
  return { auth: r.auth, ownsAuth: !1 };
2073
3398
  const e = r.auth === !0 ? {} : r.auth;
2074
3399
  return {
2075
- auth: new H({
3400
+ auth: new ue({
2076
3401
  paywallId: r.paywallId,
2077
3402
  apiOrigin: e.apiOrigin ?? r.apiOrigin,
2078
3403
  storage: e.storage ?? r.storage,
@@ -2082,27 +3407,27 @@ function rt(r) {
2082
3407
  ownsAuth: !0
2083
3408
  };
2084
3409
  }
2085
- function nt(r) {
3410
+ function xr(r) {
2086
3411
  if (typeof r != "object" || r === null) return !1;
2087
3412
  const e = r;
2088
3413
  return typeof e.onAuthChange == "function" && typeof e.getCachedSession == "function" && typeof e.signOut == "function";
2089
3414
  }
2090
- function it(r, e) {
2091
- return r.open === e.open && r.view === e.view && r.error === e.error;
3415
+ function wr(r, e) {
3416
+ return r.open === e.open && r.view === e.view && r.error === e.error && r.processing === e.processing;
2092
3417
  }
2093
- function ot(r, e) {
3418
+ function kr(r, e) {
2094
3419
  return r.mode === e.mode && r.payload === e.payload && r.storage === e.storage;
2095
3420
  }
2096
- function re(r) {
3421
+ function _e(r) {
2097
3422
  if (!r) return null;
2098
- const e = new URLSearchParams(r), t = e.get(E.status);
3423
+ const e = new URLSearchParams(r), t = e.get(F.status);
2099
3424
  return t ? {
2100
3425
  status: t,
2101
- priceId: e.get(E.priceId),
2102
- sessionId: e.get(E.sessionId)
3426
+ priceId: e.get(F.priceId),
3427
+ sessionId: e.get(F.sessionId)
2103
3428
  } : null;
2104
3429
  }
2105
- function st(r) {
3430
+ function vr(r) {
2106
3431
  if (!(typeof window > "u" || !window.opener))
2107
3432
  try {
2108
3433
  window.opener.postMessage(
@@ -2117,17 +3442,17 @@ function st(r) {
2117
3442
  } catch {
2118
3443
  }
2119
3444
  }
2120
- function lt(r) {
3445
+ function _r(r) {
2121
3446
  const e = (n, i) => {
2122
3447
  if (!n) return "";
2123
3448
  const s = new URLSearchParams(n.replace(/^[?#]/, ""));
2124
- s.delete(E.status), s.delete(E.priceId), s.delete(E.sessionId);
2125
- const l = s.toString();
2126
- return l ? i + l : "";
3449
+ s.delete(F.status), s.delete(F.priceId), s.delete(F.sessionId);
3450
+ const a = s.toString();
3451
+ return a ? i + a : "";
2127
3452
  }, t = r.pathname + e(r.search, "?") + e(r.hash, "#");
2128
3453
  window.history.replaceState(null, "", t);
2129
3454
  }
2130
- class at {
3455
+ class Sr {
2131
3456
  constructor(e, t, n) {
2132
3457
  this.transport = e, this.paywallId = t, this.config = n;
2133
3458
  }
@@ -2150,9 +3475,9 @@ class at {
2150
3475
  });
2151
3476
  }
2152
3477
  }
2153
- class ct {
3478
+ class Cr {
2154
3479
  constructor(e, t) {
2155
- this.transport = e, this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null, this.userListeners = /* @__PURE__ */ new Set(), this.balanceListeners = /* @__PURE__ */ new Set(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.remoteStorageAdapter = {
3480
+ this.transport = e, this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null, this.userListeners = /* @__PURE__ */ new Set(), this.balanceListeners = /* @__PURE__ */ new Set(), this.bootstrapListeners = /* @__PURE__ */ new Set(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.remoteStorageAdapter = {
2156
3481
  getItem: (n) => this.transport.request("storage.get", { key: n }),
2157
3482
  setItem: async (n, i) => {
2158
3483
  await this.transport.request("storage.set", { key: n, value: i });
@@ -2176,11 +3501,39 @@ class ct {
2176
3501
  { force: e.force },
2177
3502
  { signal: e.signal }
2178
3503
  );
2179
- return this.cachedBootstrap = t, t.user && this.applyUser(t.user), t;
3504
+ return this.applyBootstrap(t), t.user && this.applyUser(t.user), t;
2180
3505
  }
2181
3506
  getCachedBootstrap() {
2182
3507
  return this.cachedBootstrap;
2183
3508
  }
3509
+ /** Подписка на bootstrap-state. Структурно совместима с
3510
+ * `BillingClient.onBootstrapChange` — те же микротаск-семантики для initial
3511
+ * snapshot. В extension-режиме offscreen пока не broadcast'ит bootstrapChange,
3512
+ * поэтому listener срабатывает только на self-инициированные `bootstrap()`
3513
+ * внутри этого RemoteBillingClient'а (popup перезапрашивает bootstrap → mirror
3514
+ * обновляется → listener вызывается). Cross-surface revalidate (другая вкладка
3515
+ * обновила bootstrap) не доезжает до popup'а — для этого нужен отдельный
3516
+ * bootstrapChange-broadcast в protocol.ts/server.ts. */
3517
+ onBootstrapChange(e, t = {}) {
3518
+ this.bootstrapListeners.add(e);
3519
+ const n = t.immediate ?? "microtask";
3520
+ if (this.cachedBootstrap && n !== "none") {
3521
+ const i = this.cachedBootstrap;
3522
+ if (n === "sync")
3523
+ try {
3524
+ e(i);
3525
+ } catch (s) {
3526
+ console.warn("[paywall] onBootstrapChange initial sync threw", s);
3527
+ }
3528
+ else
3529
+ queueMicrotask(() => {
3530
+ this.bootstrapListeners.has(e) && e(i);
3531
+ });
3532
+ }
3533
+ return () => {
3534
+ this.bootstrapListeners.delete(e);
3535
+ };
3536
+ }
2184
3537
  /** Шорткат над `bootstrap()` — возвращает цены пейвола (locale-оверрайды
2185
3538
  * уже применены в offscreen'е). Те же кэш-семантики, что у `bootstrap()`. */
2186
3539
  async getPrices(e = {}) {
@@ -2190,6 +3543,12 @@ class ct {
2190
3543
  getCachedPrices() {
2191
3544
  return this.cachedBootstrap?.prices ?? null;
2192
3545
  }
3546
+ /** Sync-снимок офферов. null = bootstrap не загружали, [] = пейвол без офферов.
3547
+ * Серверный таргетинг (страны/email/режим) уже применён бэком — наружу
3548
+ * выезжает только то, что применимо к текущему юзеру. */
3549
+ getCachedOffers() {
3550
+ return this.cachedBootstrap?.offers ?? null;
3551
+ }
2193
3552
  // === Visitor ===
2194
3553
  async getVisitorId() {
2195
3554
  return this.transport.request("billing.getVisitorId", void 0);
@@ -2276,6 +3635,13 @@ class ct {
2276
3635
  signal: e.signal
2277
3636
  })];
2278
3637
  }
3638
+ /** Саппорт-тикет через offscreen'овский BillingClient. File-объекты
3639
+ * переживают chrome.runtime structured-clone (port forward'ит as-is) —
3640
+ * Bearer-токен/email-substitution делает offscreen, как в обычном
3641
+ * BillingClient. */
3642
+ async createSupportTicket(e) {
3643
+ return this.transport.request("billing.createSupportTicket", e);
3644
+ }
2279
3645
  /** Отменить подписку через бэк. По умолчанию cancel в конце текущего
2280
3646
  * периода (юзер сохраняет access до renewal date'ы). reason обязательна
2281
3647
  * (валидируется бэком) — собирается через select причин в host-UI. */
@@ -2296,7 +3662,7 @@ class ct {
2296
3662
  * read-modify-write. PaywallUI duck-types этот метод и предпочитает его
2297
3663
  * локальной фабрике, если он есть. */
2298
3664
  createTrialStore(e) {
2299
- return new at(this.transport, this.paywallId, e);
3665
+ return new Sr(this.transport, this.paywallId, e);
2300
3666
  }
2301
3667
  // === Identity ===
2302
3668
  getIdentity() {
@@ -2313,17 +3679,26 @@ class ct {
2313
3679
  return this.identity = e, e;
2314
3680
  }
2315
3681
  destroy() {
2316
- this.unsubUserBroadcast?.(), this.unsubBalancesBroadcast?.(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.userListeners.clear(), this.balanceListeners.clear(), this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null;
3682
+ this.unsubUserBroadcast?.(), this.unsubBalancesBroadcast?.(), this.unsubUserBroadcast = null, this.unsubBalancesBroadcast = null, this.userListeners.clear(), this.balanceListeners.clear(), this.bootstrapListeners.clear(), this.cachedBootstrap = null, this.cachedUser = null, this.cachedBalances = null, this.identity = null;
3683
+ }
3684
+ applyBootstrap(e) {
3685
+ this.cachedBootstrap = e;
3686
+ for (const t of [...this.bootstrapListeners])
3687
+ try {
3688
+ t(e);
3689
+ } catch (n) {
3690
+ console.warn("[paywall] onBootstrapChange listener threw", n);
3691
+ }
2317
3692
  }
2318
3693
  /** Обновить mirror user'а и эмитнуть listener'ам если он реально изменился.
2319
3694
  * Используется и для self-инициированных RPC (bootstrap/getUser), и для
2320
3695
  * broadcast'ов от offscreen — чтобы host'овский onUserChange handler
2321
3696
  * получил signal независимо от того, кто триггернул обновление. */
2322
3697
  applyUser(e) {
2323
- ut(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
3698
+ Ir(this.cachedUser, e) || (this.cachedUser = e, this.fireUserListeners(e));
2324
3699
  }
2325
3700
  applyBalances(e) {
2326
- ht(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
3701
+ Ar(this.cachedBalances, e) || (this.cachedBalances = e, this.fireBalanceListeners(e));
2327
3702
  }
2328
3703
  fireUserListeners(e) {
2329
3704
  for (const t of [...this.userListeners])
@@ -2342,22 +3717,22 @@ class ct {
2342
3717
  }
2343
3718
  }
2344
3719
  }
2345
- function ut(r, e) {
3720
+ function Ir(r, e) {
2346
3721
  return r === e ? !0 : !r || !e ? !1 : r.has_active_subscription === e.has_active_subscription && (r.purchases?.length ?? 0) === (e.purchases?.length ?? 0);
2347
3722
  }
2348
- function ht(r, e) {
3723
+ function Ar(r, e) {
2349
3724
  if (r === e) return !0;
2350
3725
  if (!r || !e || r.length !== e.length) return !1;
2351
3726
  for (let t = 0; t < r.length; t++)
2352
3727
  if (r[t].type !== e[t].type || r[t].count !== e[t].count) return !1;
2353
3728
  return !0;
2354
3729
  }
2355
- class dt {
3730
+ class Lr {
2356
3731
  constructor(e, t) {
2357
- this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", (n) => {
2358
- this.applySession(n);
3732
+ this.transport = e, this.session = null, this.listeners = /* @__PURE__ */ new Set(), this.unsubBroadcast = null, this.paywallId = t.paywallId, this.apiOrigin = t.apiOrigin, this.unsubBroadcast = this.transport.on("authChange", ({ event: n, session: i }) => {
3733
+ this.applySession(n, i);
2359
3734
  }), this.hydrated = this.transport.request("auth.getCachedSession", void 0).then((n) => {
2360
- this.session === null && n !== null && this.applySession(n);
3735
+ this.session === null && n !== null && (this.session = n);
2361
3736
  }).catch(() => {
2362
3737
  });
2363
3738
  }
@@ -2373,31 +3748,32 @@ class dt {
2373
3748
  return this.session?.user ?? null;
2374
3749
  }
2375
3750
  onAuthChange(e) {
2376
- if (this.listeners.add(e), this.session) {
2377
- const t = this.session;
2378
- queueMicrotask(() => {
2379
- this.listeners.has(e) && e(t);
2380
- });
2381
- }
2382
- return () => {
3751
+ return this.listeners.add(e), this.hydrated.then(() => {
3752
+ if (this.listeners.has(e))
3753
+ try {
3754
+ e("INITIAL_SESSION", this.session);
3755
+ } catch (t) {
3756
+ console.warn("[paywall] onAuthChange INITIAL_SESSION threw", t);
3757
+ }
3758
+ }), () => {
2383
3759
  this.listeners.delete(e);
2384
3760
  };
2385
3761
  }
2386
3762
  // === Email/password ===
2387
3763
  async signInWithEmail(e) {
2388
3764
  const t = await this.transport.request("auth.signInWithEmail", e);
2389
- return this.applySession(t), t;
3765
+ return this.applySession("SIGNED_IN", t), t;
2390
3766
  }
2391
3767
  async signUp(e) {
2392
3768
  const t = await this.transport.request("auth.signUp", e);
2393
- return t.kind === "signed_in" && this.applySession(t.session), t;
3769
+ return t.kind === "signed_in" && this.applySession("SIGNED_IN", t.session), t;
2394
3770
  }
2395
3771
  async signOut() {
2396
3772
  await this.transport.request("auth.signOut", void 0);
2397
3773
  }
2398
3774
  async refresh() {
2399
3775
  const e = await this.transport.request("auth.refresh", void 0);
2400
- return this.applySession(e), e;
3776
+ return this.applySession(e ? "TOKEN_REFRESHED" : "SIGNED_OUT", e), e;
2401
3777
  }
2402
3778
  // === OTP / password reset / confirmation ===
2403
3779
  async sendOtp(e) {
@@ -2405,7 +3781,7 @@ class dt {
2405
3781
  }
2406
3782
  async verifyOtp(e) {
2407
3783
  const t = await this.transport.request("auth.verifyOtp", e);
2408
- return this.applySession(t), t;
3784
+ return this.applySession(e.type === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", t), t;
2409
3785
  }
2410
3786
  async resendConfirmation(e) {
2411
3787
  await this.transport.request("auth.resendConfirmation", e);
@@ -2419,18 +3795,24 @@ class dt {
2419
3795
  async revokeAllSessions() {
2420
3796
  await this.transport.request("auth.revokeAllSessions", void 0);
2421
3797
  }
3798
+ /** Last-used auth method + email — читается из offscreen-storage. AuthPanel
3799
+ * использует для "Last used"-бейджа и pre-fill'а email. Storage paywall-
3800
+ * scoped, и offscreen — единый источник правды для всех вкладок/popup'ов. */
3801
+ async getLastLogin() {
3802
+ return this.transport.request("auth.getLastLogin", void 0);
3803
+ }
2422
3804
  // === Anonymous sign-in ===
2423
3805
  /** Анонимный sign-in (Supabase user без email). Логика (idempotent-check +
2424
3806
  * resume через сохранённый refresh_token + fresh signin) живёт в
2425
3807
  * offscreen-AuthClient'е — content только проксирует. captchaToken и
2426
- * forceCaptcha — pass-through для forward-compat / switch-account flow. */
3808
+ * forceNewAnon — pass-through для forward-compat / switch-account flow. */
2427
3809
  async signInAnonymously(e = {}) {
2428
3810
  const t = await this.transport.request("auth.signInAnonymously", {
2429
3811
  captchaToken: e.captchaToken,
2430
3812
  userMeta: e.userMeta,
2431
- forceCaptcha: e.forceCaptcha
3813
+ forceNewAnon: e.forceNewAnon
2432
3814
  });
2433
- return this.applySession(t), t;
3815
+ return this.applySession("SIGNED_IN", t), t;
2434
3816
  }
2435
3817
  /** Текущий access token (lazy-refreshable в offscreen'е). content/popup
2436
3818
  * использует для Bearer'а в внешние fetch'и — ApiGatewayClient в
@@ -2456,14 +3838,14 @@ class dt {
2456
3838
  */
2457
3839
  async signInWithOAuth(e) {
2458
3840
  if (typeof window > "u")
2459
- throw new T("oauth_unavailable", "window is required for OAuth");
3841
+ throw new L("oauth_unavailable", "window is required for OAuth");
2460
3842
  const t = `pw-oauth-pending-${Math.random().toString(36).slice(2, 10)}`, n = window.open("about:blank", t, "width=480,height=640,popup=yes");
2461
3843
  if (!n)
2462
- throw new T(
3844
+ throw new L(
2463
3845
  "popup_blocked",
2464
3846
  "browser blocked auth popup — call from a user gesture"
2465
3847
  );
2466
- gt(n, e.provider);
3848
+ Tr(n, e.provider);
2467
3849
  try {
2468
3850
  const { authorizeUrl: i, state: s } = await this.transport.request("auth.oauthStart", {
2469
3851
  provider: e.provider,
@@ -2471,8 +3853,8 @@ class dt {
2471
3853
  userMeta: e.userMeta
2472
3854
  });
2473
3855
  n.name = `pw-oauth-${s}`, n.location.replace(i), e.onPopupOpened?.();
2474
- const l = await he(n, s), a = await this.transport.request("auth.oauthExchange", { state: s, code: l });
2475
- return this.applySession(a), a;
3856
+ const a = await Ne(n, s), c = await this.transport.request("auth.oauthExchange", { state: s, code: a });
3857
+ return this.applySession("SIGNED_IN", c), c;
2476
3858
  } catch (i) {
2477
3859
  try {
2478
3860
  n.close();
@@ -2484,29 +3866,29 @@ class dt {
2484
3866
  destroy() {
2485
3867
  this.unsubBroadcast?.(), this.unsubBroadcast = null, this.listeners.clear(), this.session = null;
2486
3868
  }
2487
- applySession(e) {
2488
- if (!pt(this.session, e)) {
2489
- this.session = e;
2490
- for (const t of [...this.listeners])
3869
+ applySession(e, t) {
3870
+ if (!Mr(this.session, t)) {
3871
+ this.session = t;
3872
+ for (const n of [...this.listeners])
2491
3873
  try {
2492
- t(e);
2493
- } catch (n) {
2494
- console.warn("[paywall] onAuthChange listener threw", n);
3874
+ n(e, t);
3875
+ } catch (i) {
3876
+ console.warn("[paywall] onAuthChange listener threw", i);
2495
3877
  }
2496
3878
  }
2497
3879
  }
2498
3880
  }
2499
- function pt(r, e) {
3881
+ function Mr(r, e) {
2500
3882
  return r === e ? !0 : !r || !e ? !1 : r.access_token === e.access_token && r.refresh_token === e.refresh_token && r.expires_at === e.expires_at && r.user.id === e.user.id;
2501
3883
  }
2502
- const ft = {
3884
+ const Er = {
2503
3885
  google: "Google",
2504
3886
  apple: "Apple",
2505
3887
  github: "GitHub",
2506
3888
  facebook: "Facebook"
2507
3889
  };
2508
- function gt(r, e) {
2509
- const t = ft[e] ?? e;
3890
+ function Tr(r, e) {
3891
+ const t = Er[e] ?? e;
2510
3892
  try {
2511
3893
  const n = r.document;
2512
3894
  n.title = `Sign in with ${t}`;
@@ -2514,14 +3896,14 @@ function gt(r, e) {
2514
3896
  i.textContent = "html,body{margin:0;padding:0;height:100%;font-family:-apple-system,system-ui,sans-serif;background:#fafafa;color:#475569}.pw-oauth-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px}.pw-oauth-spinner{width:36px;height:36px;border:3px solid #e2e8f0;border-top-color:#7c3aed;border-radius:50%;animation:pw-oauth-spin 800ms linear infinite}.pw-oauth-label{font-size:14px;font-weight:500;letter-spacing:-0.01em}@keyframes pw-oauth-spin{to{transform:rotate(360deg)}}", n.head.appendChild(i);
2515
3897
  const s = n.createElement("div");
2516
3898
  s.className = "pw-oauth-wrap";
2517
- const l = n.createElement("div");
2518
- l.className = "pw-oauth-spinner";
2519
3899
  const a = n.createElement("div");
2520
- a.className = "pw-oauth-label", a.textContent = `Connecting to ${t}…`, s.appendChild(l), s.appendChild(a), n.body.appendChild(s);
3900
+ a.className = "pw-oauth-spinner";
3901
+ const c = n.createElement("div");
3902
+ c.className = "pw-oauth-label", c.textContent = `Connecting to ${t}…`, s.appendChild(a), s.appendChild(c), n.body.appendChild(s);
2521
3903
  } catch {
2522
3904
  }
2523
3905
  }
2524
- class mt {
3906
+ class Br {
2525
3907
  constructor(e) {
2526
3908
  this.transport = e;
2527
3909
  }
@@ -2533,7 +3915,7 @@ class mt {
2533
3915
  });
2534
3916
  }
2535
3917
  }
2536
- class yt {
3918
+ class Pr {
2537
3919
  constructor(e) {
2538
3920
  this.factory = e, this.channel = null, this.channelDisposers = [], this.pending = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.destroyed = !1, this.nextId = 0, this.clientId = `c-${Math.random().toString(36).slice(2, 10)}`;
2539
3921
  }
@@ -2547,21 +3929,21 @@ class yt {
2547
3929
  this.channel = e;
2548
3930
  const t = e.onMessage((i) => this.handleMessage(i)), n = e.onDisconnect(() => this.handleDisconnect());
2549
3931
  return this.channelDisposers = [t, n], this.request("handshake", {
2550
- protocolVersion: R,
3932
+ protocolVersion: J,
2551
3933
  clientId: this.clientId
2552
3934
  }).then((i) => {
2553
- i.protocolVersion !== R && console.warn(
2554
- `[sdk-extension] protocol version mismatch: client=${R}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
3935
+ i.protocolVersion !== J && console.warn(
3936
+ `[sdk-extension] protocol version mismatch: client=${J}, offscreen=${i.protocolVersion}. Update host's @monetize.software/sdk-extension.`
2555
3937
  );
2556
3938
  }).catch(() => {
2557
3939
  }), e;
2558
3940
  }
2559
3941
  handleMessage(e) {
2560
- if (bt(e)) {
3942
+ if (Ur(e)) {
2561
3943
  if (e.type === "response") {
2562
3944
  const t = this.pending.get(e.id);
2563
3945
  if (!t) return;
2564
- this.pending.delete(e.id), t.signal?.removeEventListener("abort", t.abortListener), e.ok ? t.resolve(e.result) : t.reject(de(e.error));
3946
+ this.pending.delete(e.id), t.signal?.removeEventListener("abort", t.abortListener), e.ok ? t.resolve(e.result) : t.reject(Fe(e.error));
2565
3947
  return;
2566
3948
  }
2567
3949
  if (e.type === "event") {
@@ -2582,7 +3964,7 @@ class yt {
2582
3964
  const e = Array.from(this.pending.values());
2583
3965
  this.pending.clear();
2584
3966
  for (const t of e)
2585
- t.signal?.removeEventListener("abort", t.abortListener), t.reject(new xt());
3967
+ t.signal?.removeEventListener("abort", t.abortListener), t.reject(new Or());
2586
3968
  }
2587
3969
  request(e, t, n = {}) {
2588
3970
  if (this.destroyed)
@@ -2590,31 +3972,31 @@ class yt {
2590
3972
  if (n.signal?.aborted)
2591
3973
  return Promise.reject(new DOMException("Aborted", "AbortError"));
2592
3974
  const i = this.ensureChannel(), s = `r${++this.nextId}`;
2593
- return new Promise((l, a) => {
2594
- const c = {
2595
- resolve: l,
2596
- reject: a,
3975
+ return new Promise((a, c) => {
3976
+ const l = {
3977
+ resolve: a,
3978
+ reject: c,
2597
3979
  signal: n.signal
2598
3980
  };
2599
- n.signal && (c.abortListener = () => {
3981
+ n.signal && (l.abortListener = () => {
2600
3982
  if (this.pending.delete(s)) {
2601
- a(new DOMException("Aborted", "AbortError"));
3983
+ c(new DOMException("Aborted", "AbortError"));
2602
3984
  try {
2603
3985
  i.send({ type: "cancel", id: s });
2604
3986
  } catch {
2605
3987
  }
2606
3988
  }
2607
- }, n.signal.addEventListener("abort", c.abortListener)), this.pending.set(s, c);
2608
- const p = {
3989
+ }, n.signal.addEventListener("abort", l.abortListener)), this.pending.set(s, l);
3990
+ const h = {
2609
3991
  type: "request",
2610
3992
  id: s,
2611
3993
  kind: e,
2612
3994
  params: t
2613
3995
  };
2614
3996
  try {
2615
- i.send(p);
2616
- } catch (g) {
2617
- this.pending.delete(s), n.signal?.removeEventListener("abort", c.abortListener), a(g);
3997
+ i.send(h);
3998
+ } catch (d) {
3999
+ this.pending.delete(s), n.signal?.removeEventListener("abort", l.abortListener), c(d);
2618
4000
  }
2619
4001
  });
2620
4002
  }
@@ -2638,28 +4020,28 @@ class yt {
2638
4020
  this.channel?.close(), this.channel = null;
2639
4021
  }
2640
4022
  }
2641
- class xt extends Error {
4023
+ class Or extends Error {
2642
4024
  constructor() {
2643
4025
  super("Transport channel disconnected mid-request"), this.code = "transport_disconnected", this.name = "TransportDisconnectedError";
2644
4026
  }
2645
4027
  }
2646
- function bt(r) {
4028
+ function Ur(r) {
2647
4029
  if (typeof r != "object" || r === null) return !1;
2648
4030
  const e = r.type;
2649
4031
  return e === "request" || e === "response" || e === "event";
2650
4032
  }
2651
- let q = null;
2652
- function kt() {
2653
- return q || (q = new yt(() => pe(fe)), q);
4033
+ let W = null;
4034
+ function jr() {
4035
+ return W || (W = new Pr(() => $e(Ze)), W);
2654
4036
  }
2655
- class Tt extends tt {
4037
+ class Vr extends yr {
2656
4038
  constructor(e) {
2657
- const t = kt(), n = new ct(t, {
4039
+ const t = jr(), n = new Cr(t, {
2658
4040
  paywallId: e.paywallId,
2659
4041
  apiOrigin: e.apiOrigin
2660
4042
  });
2661
4043
  let i;
2662
- e.auth === !0 ? i = new dt(t, {
4044
+ e.auth === !0 ? i = new Lr(t, {
2663
4045
  paywallId: e.paywallId,
2664
4046
  apiOrigin: e.apiOrigin
2665
4047
  }) : e.auth && console.warn(
@@ -2675,7 +4057,7 @@ class Tt extends tt {
2675
4057
  // Внутренний EventTracker отключаем — единственный tracker живёт в
2676
4058
  // offscreen'е. Манчиально подписываемся ниже.
2677
4059
  analytics: !1
2678
- }), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new mt(t), this.bindAnalytics());
4060
+ }), this.remoteTracker = null, this.trackerUnsubs = [], e.analytics !== !1 && (this.remoteTracker = new Br(t), this.bindAnalytics());
2679
4061
  }
2680
4062
  /** Зеркало sdk/PaywallUI.initTracker'овских биндингов, но с RemoteEventTracker.
2681
4063
  * Когда @monetize.software/sdk экспоузнет публичный hook для inject'а tracker'а,
@@ -2733,11 +4115,11 @@ class Tt extends tt {
2733
4115
  }
2734
4116
  }
2735
4117
  export {
2736
- R as PROTOCOL_VERSION,
2737
- Tt as PaywallUI,
2738
- dt as RemoteAuthClient,
2739
- ct as RemoteBillingClient,
2740
- mt as RemoteEventTracker,
2741
- kt as getContentTransport
4118
+ J as PROTOCOL_VERSION,
4119
+ Vr as PaywallUI,
4120
+ Lr as RemoteAuthClient,
4121
+ Cr as RemoteBillingClient,
4122
+ Br as RemoteEventTracker,
4123
+ jr as getContentTransport
2742
4124
  };
2743
4125
  //# sourceMappingURL=content.js.map