@monetize.software/sdk 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.
- package/README.md +34 -13
- package/dist/chunks/PaywallUI-BXEOgPTK.js +3555 -0
- package/dist/chunks/PaywallUI-BXEOgPTK.js.map +1 -0
- package/dist/chunks/PaywallUI-Cybo6wdO.js +26 -0
- package/dist/chunks/PaywallUI-Cybo6wdO.js.map +1 -0
- package/dist/chunks/ar-OnxZkqWR.js +2 -0
- package/dist/chunks/ar-OnxZkqWR.js.map +1 -0
- package/dist/chunks/ar-rSKgwKvp.js +129 -0
- package/dist/chunks/ar-rSKgwKvp.js.map +1 -0
- package/dist/chunks/cs-Cb2KZ70r.js +2 -0
- package/dist/chunks/cs-Cb2KZ70r.js.map +1 -0
- package/dist/chunks/cs-DIWkcge_.js +125 -0
- package/dist/chunks/cs-DIWkcge_.js.map +1 -0
- package/dist/chunks/da-DdMW98j3.js +125 -0
- package/dist/chunks/da-DdMW98j3.js.map +1 -0
- package/dist/chunks/da-DyQC12xy.js +2 -0
- package/dist/chunks/da-DyQC12xy.js.map +1 -0
- package/dist/chunks/de-CWM13wnK.js +2 -0
- package/dist/chunks/de-CWM13wnK.js.map +1 -0
- package/dist/chunks/de-D1bSmD_-.js +144 -0
- package/dist/chunks/de-D1bSmD_-.js.map +1 -0
- package/dist/chunks/el-BtKuORsc.js +2 -0
- package/dist/chunks/el-BtKuORsc.js.map +1 -0
- package/dist/chunks/el-C4LtWpfP.js +129 -0
- package/dist/chunks/el-C4LtWpfP.js.map +1 -0
- package/dist/chunks/es-Bhx7w85J.js +144 -0
- package/dist/chunks/es-Bhx7w85J.js.map +1 -0
- package/dist/chunks/es-qLcKnBft.js +2 -0
- package/dist/chunks/es-qLcKnBft.js.map +1 -0
- package/dist/chunks/fi-C34Oc6rg.js +125 -0
- package/dist/chunks/fi-C34Oc6rg.js.map +1 -0
- package/dist/chunks/fi-kGtbK51C.js +2 -0
- package/dist/chunks/fi-kGtbK51C.js.map +1 -0
- package/dist/chunks/fr-BrWtqej3.js +144 -0
- package/dist/chunks/fr-BrWtqej3.js.map +1 -0
- package/dist/chunks/fr-CScwFVNj.js +2 -0
- package/dist/chunks/fr-CScwFVNj.js.map +1 -0
- package/dist/chunks/he-Byr2r07x.js +129 -0
- package/dist/chunks/he-Byr2r07x.js.map +1 -0
- package/dist/chunks/he-ChFVbP_S.js +2 -0
- package/dist/chunks/he-ChFVbP_S.js.map +1 -0
- package/dist/chunks/hi-BIswPYL2.js +2 -0
- package/dist/chunks/hi-BIswPYL2.js.map +1 -0
- package/dist/chunks/hi-CABVgpKU.js +129 -0
- package/dist/chunks/hi-CABVgpKU.js.map +1 -0
- package/dist/chunks/hu-CSQ9avfJ.js +125 -0
- package/dist/chunks/hu-CSQ9avfJ.js.map +1 -0
- package/dist/chunks/hu-CT_jwL0k.js +2 -0
- package/dist/chunks/hu-CT_jwL0k.js.map +1 -0
- package/dist/chunks/id-2lYf7ogC.js +2 -0
- package/dist/chunks/id-2lYf7ogC.js.map +1 -0
- package/dist/chunks/id-BJ5w6RSU.js +125 -0
- package/dist/chunks/id-BJ5w6RSU.js.map +1 -0
- package/dist/chunks/it-CEMhCvXU.js +2 -0
- package/dist/chunks/it-CEMhCvXU.js.map +1 -0
- package/dist/chunks/it-Df8ChmTK.js +144 -0
- package/dist/chunks/it-Df8ChmTK.js.map +1 -0
- package/dist/chunks/ja-CkpO3n78.js +2 -0
- package/dist/chunks/ja-CkpO3n78.js.map +1 -0
- package/dist/chunks/ja-a53E5b2s.js +148 -0
- package/dist/chunks/ja-a53E5b2s.js.map +1 -0
- package/dist/chunks/ko-AZ8GrmXu.js +148 -0
- package/dist/chunks/ko-AZ8GrmXu.js.map +1 -0
- package/dist/chunks/ko-BKdzk0jX.js +2 -0
- package/dist/chunks/ko-BKdzk0jX.js.map +1 -0
- package/dist/chunks/nl-Bek7IiHL.js +2 -0
- package/dist/chunks/nl-Bek7IiHL.js.map +1 -0
- package/dist/chunks/nl-sF6ms5FU.js +144 -0
- package/dist/chunks/nl-sF6ms5FU.js.map +1 -0
- package/dist/chunks/no-BztcQKh8.js +2 -0
- package/dist/chunks/no-BztcQKh8.js.map +1 -0
- package/dist/chunks/no-DGf5PuW5.js +125 -0
- package/dist/chunks/no-DGf5PuW5.js.map +1 -0
- package/dist/chunks/pl-CMF2KerQ.js +2 -0
- package/dist/chunks/pl-CMF2KerQ.js.map +1 -0
- package/dist/chunks/pl-Dd-Ze6wn.js +125 -0
- package/dist/chunks/pl-Dd-Ze6wn.js.map +1 -0
- package/dist/chunks/pt-BL9X8Du2.js +144 -0
- package/dist/chunks/pt-BL9X8Du2.js.map +1 -0
- package/dist/chunks/pt-DF9cd_iW.js +2 -0
- package/dist/chunks/pt-DF9cd_iW.js.map +1 -0
- package/dist/chunks/ro-CGYmtR8q.js +125 -0
- package/dist/chunks/ro-CGYmtR8q.js.map +1 -0
- package/dist/chunks/ro-DpPc1UhJ.js +2 -0
- package/dist/chunks/ro-DpPc1UhJ.js.map +1 -0
- package/dist/chunks/ru-gt3-clOi.js +2 -0
- package/dist/chunks/ru-gt3-clOi.js.map +1 -0
- package/dist/chunks/ru-oPoQtUxk.js +147 -0
- package/dist/chunks/ru-oPoQtUxk.js.map +1 -0
- package/dist/chunks/sv-Cg7O9Uh3.js +2 -0
- package/dist/chunks/sv-Cg7O9Uh3.js.map +1 -0
- package/dist/chunks/sv-kXHP1Ct3.js +125 -0
- package/dist/chunks/sv-kXHP1Ct3.js.map +1 -0
- package/dist/chunks/th-DMcmb36d.js +129 -0
- package/dist/chunks/th-DMcmb36d.js.map +1 -0
- package/dist/chunks/th-pvtT9u-U.js +2 -0
- package/dist/chunks/th-pvtT9u-U.js.map +1 -0
- package/dist/chunks/tr-gAn3KCul.js +2 -0
- package/dist/chunks/tr-gAn3KCul.js.map +1 -0
- package/dist/chunks/tr-zjLbddlL.js +125 -0
- package/dist/chunks/tr-zjLbddlL.js.map +1 -0
- package/dist/chunks/uk-BYSiM14V.js +147 -0
- package/dist/chunks/uk-BYSiM14V.js.map +1 -0
- package/dist/chunks/uk-HIaOETe4.js +2 -0
- package/dist/chunks/uk-HIaOETe4.js.map +1 -0
- package/dist/chunks/vi-B7DVCjxx.js +2 -0
- package/dist/chunks/vi-B7DVCjxx.js.map +1 -0
- package/dist/chunks/vi-FbVRwy9D.js +125 -0
- package/dist/chunks/vi-FbVRwy9D.js.map +1 -0
- package/dist/chunks/zh-007yK7rl.js +2 -0
- package/dist/chunks/zh-007yK7rl.js.map +1 -0
- package/dist/chunks/zh-Cv0Yw4qR.js +148 -0
- package/dist/chunks/zh-Cv0Yw4qR.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +260 -26
- package/dist/core.js +505 -338
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +411 -45
- package/dist/index.js +14 -10
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +376 -44
- package/dist/ui.js +1 -1
- package/package.json +32 -31
- package/dist/chunks/PaywallUI-CRTEPjJm.js +0 -2229
- package/dist/chunks/PaywallUI-CRTEPjJm.js.map +0 -1
- package/dist/chunks/PaywallUI-CbbcfXXZ.js +0 -26
- package/dist/chunks/PaywallUI-CbbcfXXZ.js.map +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";const C=require("../core.cjs"),P=require("preact"),e=require("preact/jsx-runtime"),u=require("preact/hooks"),V=3600*1e3;function B(r){return`paywall-${r}-trial-time-first-open`}function R(r){return`paywall-${r}-skip-times`}class tt{constructor(t,i,n){this.storage=t,this.paywallId=i,this.config=n}async check(){return this.config.mode==="time"?this.checkTime():this.checkOpens()}async recordBlock(){return this.config.mode==="time"?this.recordTime():this.recordOpens()}async reset(){await this.storage.removeItem(this.config.mode==="time"?B(this.paywallId):R(this.paywallId))}async checkTime(){const t=this.config.payload*V,i=await this.storage.getItem(B(this.paywallId)),n=i?Number(i):null;if(!n||!Number.isFinite(n))return{mode:"time",blocked:!0,startedAt:null,expiresAt:null,remainingMs:t,totalMs:t};const a=n+t,s=Math.max(0,a-Date.now());return{mode:"time",blocked:s>0,startedAt:n,expiresAt:a,remainingMs:s,totalMs:t}}async checkOpens(){const t=this.config.payload,i=await this.storage.getItem(R(this.paywallId)),n=i?Number(i):0,a=Number.isFinite(n)?n:0,s=a<t,o=Math.max(0,t-a);return{mode:"opens",blocked:s,remainingActions:o,totalActions:t}}async recordTime(){const t=this.config.payload*V,i=B(this.paywallId),n=await this.storage.getItem(i);let a=n?Number(n):null;(!a||!Number.isFinite(a))&&(a=Date.now(),await this.storage.setItem(i,String(a)));const s=a+t,o=Math.max(0,s-Date.now());return{mode:"time",blocked:o>0,startedAt:a,expiresAt:s,remainingMs:o,totalMs:t}}async recordOpens(){const t=this.config.payload,i=R(this.paywallId),n=await this.storage.getItem(i),a=n?Number(n):0,s=Number.isFinite(a)?a:0,o=Math.min(t,s+1);await this.storage.setItem(i,String(o));const l=Math.max(0,t-o);return{mode:"opens",blocked:o<t,remainingActions:l,totalActions:t}}}let D=!1;class nt{constructor(t,i,n){D||(D=!0,console.warn('[paywall] trial.storage="server" is not implemented yet — falling back to client storage. State lives in localStorage; users can reset trial by clearing site data.')),this.fallback=new tt(t,i,n)}check(){return this.fallback.check()}recordBlock(){return this.fallback.recordBlock()}reset(){return this.fallback.reset()}}function st(r,t,i){return i.storage==="server"?new nt(r,t,i):new tt(r,t,i)}const et='/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--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-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-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-950:oklch(27.9% .077 45.635);--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-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--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);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--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:var(--default-font-feature-settings,normal);font-variation-settings:var(--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:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}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{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}: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:currentColor}@supports (color:color-mix(in lab,red,red)){::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{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-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]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}: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{cursor:pointer;font-family:inherit}button:disabled{cursor:not-allowed}[role=button],[role=radio]{cursor:pointer}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.-top-2\\.5{top:calc(var(--spacing) * -2.5)}.top-3{top:calc(var(--spacing) * 3)}.top-10{top:calc(var(--spacing) * 10)}.right-3{right:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.z-10{z-index:10}.z-\\[2147483647\\]{z-index:2147483647}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-px{margin-top:1px}.-ml-1{margin-left:calc(var(--spacing) * -1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-1{height:calc(var(--spacing) * 1)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-px{height:1px}.max-h-\\[calc\\(100dvh-1rem\\)\\]{max-height:calc(100dvh - 1rem)}.min-h-\\[104px\\]{min-height:104px}.w-1{width:calc(var(--spacing) * 1)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-full{width:100%}.max-w-\\[18rem\\]{max-width:18rem}.max-w-\\[20rem\\]{max-width:20rem}.max-w-\\[320px\\]{max-width:320px}.max-w-md{max-width:var(--container-md)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\\[pw-fade-in_180ms_ease-out\\]{animation:.18s ease-out pw-fade-in}.animate-\\[pw-scale-in_220ms_cubic-bezier\\(0\\.16\\,1\\,0\\.3\\,1\\)\\]{animation:.22s cubic-bezier(.16,1,.3,1) pw-scale-in}.animate-ping{animation:var(--animate-ping)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-center{align-self:center}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\\[2\\.5px\\]{border-style:var(--tw-border-style);border-width:2.5px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\\[var\\(--pw-accent\\)\\]{border-color:var(--pw-accent)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-400{border-color:var(--color-red-400)}.border-white\\/40{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.border-white\\/40{border-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.border-t-\\[var\\(--pw-accent\\)\\]{border-top-color:var(--pw-accent)}.border-t-gray-700{border-top-color:var(--color-gray-700)}.border-t-white{border-top-color:var(--color-white)}.bg-\\[color-mix\\(in_srgb\\,var\\(--pw-accent\\)_6\\%\\,white\\)\\]{background-color:var(--pw-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_srgb\\,var\\(--pw-accent\\)_6\\%\\,white\\)\\]{background-color:color-mix(in srgb,var(--pw-accent) 6%,white)}}.bg-\\[var\\(--pw-accent\\)\\]{background-color:var(--pw-accent)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\\/60{background-color:#f9fafb99}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\\/60{background-color:color-mix(in oklab,var(--color-gray-50) 60%,transparent)}}.bg-gray-300{background-color:var(--color-gray-300)}.bg-red-50{background-color:var(--color-red-50)}.bg-slate-950\\/50{background-color:#02061880}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\\/50{background-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-300{--tw-gradient-from:var(--color-amber-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-200{--tw-gradient-from:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-400{--tw-gradient-to:var(--color-amber-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-gray-200{--tw-gradient-to:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-2{padding:calc(var(--spacing) * 2)}.p-3\\.5{padding:calc(var(--spacing) * 3.5)}.p-7{padding:calc(var(--spacing) * 7)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\\.5{padding-block:calc(var(--spacing) * 3.5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.text-center{text-align:center}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[0\\.9375rem\\]{font-size:.9375rem}.text-\\[1\\.625rem\\]{font-size:1.625rem}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[0\\.14em\\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-\\[var\\(--pw-accent\\)\\]{color:var(--pw-accent)}.text-amber-950{color:var(--color-amber-950)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{--tw-shadow:0 0 0 3px var(--tw-shadow-color,var(--pw-accent))}@supports (color:color-mix(in lab,red,red)){.shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{--tw-shadow:0 0 0 3px var(--tw-shadow-color,color-mix(in srgb,var(--pw-accent) 12%,transparent))}}.shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_12\\%\\,transparent\\)\\]{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_1px_0_rgba\\(15\\,23\\,42\\,0\\.02\\)\\]{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a05);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_1px_0_rgba\\(15\\,23\\,42\\,0\\.04\\)\\]{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-8{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(8px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-black\\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\\/5{--tw-ring-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.\\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.group-hover\\:border-gray-400:is(:where(.group):hover *){border-color:var(--color-gray-400)}}.placeholder\\:text-gray-400::placeholder{color:var(--color-gray-400)}@media(hover:hover){.hover\\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-50\\/60:hover{background-color:#f9fafb99}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-50\\/60:hover{background-color:color-mix(in oklab,var(--color-gray-50) 60%,transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-white:hover{background-color:var(--color-white)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-gray-900:hover{color:var(--color-gray-900)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\:brightness-105:hover{--tw-brightness:brightness(105%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\\:border-\\[var\\(--pw-accent\\)\\]:focus{border-color:var(--pw-accent)}.focus\\:border-red-500:focus{border-color:var(--color-red-500)}.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,var(--pw-accent))}@supports (color:color-mix(in lab,red,red)){.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,transparent\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,color-mix(in srgb,var(--pw-accent) 18%,transparent))}}.focus\\:shadow-\\[0_0_0_3px_color-mix\\(in_srgb\\,var\\(--pw-accent\\)_18\\%\\,transparent\\)\\]:focus{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:shadow-\\[0_0_0_3px_rgba\\(239\\,68\\,68\\,0\\.18\\)\\]:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,#ef44442e);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:underline:focus-visible{text-decoration-line:underline}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-\\[var\\(--pw-accent\\)\\]:focus-visible{--tw-ring-color:var(--pw-accent)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.active\\:translate-y-0:active{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.active\\:brightness-95:active{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-60:disabled{opacity:.6}@media(hover:hover){.disabled\\:hover\\:translate-y-0:disabled:hover{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\\:hover\\:shadow-\\[0_1px_0_rgba\\(15\\,23\\,42\\,0\\.04\\)\\]:disabled:hover{--tw-shadow:0 1px 0 var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.disabled\\:hover\\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(min-width:40rem){.sm\\:max-h-\\[calc\\(100dvh-2rem\\)\\]{max-height:calc(100dvh - 2rem)}.sm\\:p-4{padding:calc(var(--spacing) * 4)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}';let $=!1;function ot(){if($||($=!0,typeof CSS>"u"||typeof CSS.registerProperty!="function"))return;let r;try{const t=new CSSStyleSheet;t.replaceSync(et),r=t.cssRules}catch{return}for(const t of r){if(t.constructor.name!=="CSSPropertyRule")continue;const i=t;try{CSS.registerProperty({name:i.name,syntax:i.syntax,inherits:i.inherits,...i.initialValue!=null?{initialValue:i.initialValue}:{}})}catch{}}}function lt(r,t,i={}){if(typeof document>"u")throw new Error("mountShadow called in non-DOM environment");ot();const n=i.host??document.createElement("div");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);const a=n.attachShadow({mode:i.shadowMode??"closed"}),s=`
|
|
2
|
-
:host {
|
|
3
|
-
all: initial !important;
|
|
4
|
-
display: block !important;
|
|
5
|
-
color: #111827 !important;
|
|
6
|
-
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
|
|
7
|
-
font-size: 16px !important;
|
|
8
|
-
font-weight: 400 !important;
|
|
9
|
-
font-style: normal !important;
|
|
10
|
-
line-height: 1.5 !important;
|
|
11
|
-
letter-spacing: normal !important;
|
|
12
|
-
text-transform: none !important;
|
|
13
|
-
text-decoration: none !important;
|
|
14
|
-
text-align: left !important;
|
|
15
|
-
direction: ltr !important;
|
|
16
|
-
cursor: auto !important;
|
|
17
|
-
visibility: visible !important;
|
|
18
|
-
}
|
|
19
|
-
`,o=document.createElement("style");o.textContent=s+et+(i.injectCss??""),a.appendChild(o);const l=document.createElement("div");l.style.pointerEvents="auto",a.appendChild(l);let c=t;return P.render(P.h(r,c),l),{shadowRoot:a,update(p){c={...c,...p},P.render(P.h(r,c),l)},unmount(){P.render(null,l),n.remove()}}}const q='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function ct({open:r,onClose:t,labelledBy:i,brandColor:n,testMode:a,allowClose:s=!0,children:o}){const l=u.useRef(null),c=u.useRef(null);if(u.useEffect(()=>{if(!r)return;c.current=document.activeElement??null;const b=l.current;b&&(b.querySelector(q)??b).focus({preventScroll:!0});const g=x=>{if(x.key==="Escape"){if(!s)return;x.stopPropagation(),t();return}if(x.key!=="Tab"||!l.current)return;const k=Array.from(l.current.querySelectorAll(q)).filter(m=>!m.hasAttribute("disabled")&&m.tabIndex!==-1);if(k.length===0){x.preventDefault();return}const I=k[0],y=k[k.length-1],_=document.activeElement;x.shiftKey&&_===I?(x.preventDefault(),y.focus()):!x.shiftKey&&_===y&&(x.preventDefault(),I.focus())};document.addEventListener("keydown",g,!0);const w=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g,!0),document.body.style.overflow=w,c.current?.focus?.({preventScroll:!0})}},[r,t,s]),!r)return null;const p=b=>{s&&b.target===b.currentTarget&&t()},f=n??"#3b82f6";return e.jsxs("div",{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]",onClick:p,"data-pw-root":!0,children:[e.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,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)]",style:{"--pw-accent":f,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)"},children:[a&&e.jsxs("div",{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",role:"status",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M8 1L15 14H1L8 1Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"}),e.jsx("path",{d:"M8 6v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]}),"Test mode — no real charge"]}),e.jsx("div",{class:"flex-1 overflow-y-auto p-7",children:o}),s?e.jsx("button",{type:"button",onClick:t,"aria-label":"Close",class:`absolute right-3 ${a?"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)]`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})})}):null]}),e.jsx("style",{children:`
|
|
20
|
-
@keyframes pw-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
21
|
-
@keyframes pw-scale-in {
|
|
22
|
-
from { opacity: 0; transform: translateY(12px) scale(0.96) }
|
|
23
|
-
to { opacity: 1; transform: none }
|
|
24
|
-
}
|
|
25
|
-
`})]})}const dt={google:"Continue with Google",apple:"Continue with Apple",github:"Continue with GitHub",facebook:"Continue with Facebook"};function rt({block:r,ctx:t}){const i=t.auth,n=t.authSession,a=r.allow_signup!==!1,s=r.allow_password_reset!==!1,o=r.hide_when_authenticated!==!1;if(!i)return typeof console<"u"&&console.warn("[paywall] auth_panel rendered without AuthClient — pass `auth: true` to PaywallUI"),null;const l=n&&!n.user.is_anonymous?n:null;return l&&o?null:l?e.jsx(ut,{email:l.user.email??"",onSignOut:()=>i.signOut().catch(()=>{})}):e.jsx(ht,{block:r,allowSignup:a,allowReset:s,ctx:t})}function ut({email:r,onSignOut:t}){return e.jsxs("div",{class:"flex items-center justify-between gap-3 rounded-2xl border border-gray-200 bg-gray-50/60 px-4 py-3",children:[e.jsxs("div",{class:"flex flex-col",children:[e.jsx("span",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-500",children:"Signed in"}),e.jsx("span",{class:"text-sm font-medium text-gray-900",children:r})]}),e.jsx("button",{type:"button",onClick:t,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)]",children:"Sign out"})]})}function ht({block:r,allowSignup:t,allowReset:i,ctx:n}){const a=n.auth,s=r.providers??[],[o,l]=u.useState("signin"),[c,p]=u.useState(""),[f,b]=u.useState(""),[g,w]=u.useState(""),[x,k]=u.useState(null),[I,y]=u.useState(null),[_,m]=u.useState(null),M=async j=>{if(j.preventDefault(),!x){k("email"),y(null),m(null);try{o==="signin"?await a.signInWithEmail({email:c,password:f}):o==="signup"?(await a.signUp({email:c,password:f})).kind==="confirmation_required"&&(l("reset_verify"),m("Check your email for a confirmation code.")):o==="forgot"?(await a.requestPasswordReset({email:c}),l("reset_sent"),m("If that email exists, a reset code has been sent.")):o==="reset_verify"&&(await a.verifyOtp({email:c,token:g,type:f?"recovery":"email"}),f&&await a.updatePassword({password:f}))}catch(S){const h=S instanceof C.PaywallError?S.message:"Something went wrong";y(h)}finally{k(null)}}},T=async j=>{if(!x){k(j),y(null),m(null);try{await a.signInWithOAuth({provider:j,onPopupOpened:()=>k(null)})}catch(S){if(S instanceof C.PaywallError){if(S.code==="oauth_cancelled"||S.code==="oauth_timeout")return;y(S.message)}else y("Sign-in failed")}finally{k(null)}}};return e.jsxs("div",{class:"flex flex-col gap-3",children:[r.heading?e.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:r.heading}):null,s.length>0&&(o==="signin"||o==="signup")?e.jsxs("div",{class:"flex flex-col gap-2",children:[s.map(j=>e.jsxs("button",{type:"button",onClick:()=>T(j),disabled:x!==null,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)]",children:[x===j?e.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700"}):e.jsx(ft,{provider:j}),e.jsx("span",{children:dt[j]})]},j)),e.jsx(gt,{})]}):null,e.jsxs("form",{onSubmit:M,class:"flex flex-col gap-2",children:[(o==="signin"||o==="signup"||o==="forgot")&&e.jsx(L,{type:"email",label:"Email",value:c,onInput:p,autocomplete:"email",required:!0}),(o==="signin"||o==="signup")&&e.jsx(L,{type:"password",label:"Password",value:f,onInput:b,autocomplete:o==="signin"?"current-password":"new-password",required:!0}),o==="reset_verify"&&e.jsxs(e.Fragment,{children:[e.jsx(L,{type:"text",label:"Confirmation code",value:g,onInput:w,autocomplete:"one-time-code",inputMode:"numeric",required:!0}),e.jsx(L,{type:"password",label:"New password (optional — only for password reset)",value:f,onInput:b,autocomplete:"new-password"})]}),o==="reset_sent"&&_&&e.jsx("p",{class:"rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600",children:_}),I&&e.jsx("p",{class:"text-xs text-red-600",children:I}),_&&o!=="reset_sent"&&e.jsx("p",{class:"text-xs text-gray-500",children:_}),o!=="reset_sent"&&e.jsx("button",{type:"submit",disabled:x!==null,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:x==="email"?e.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):pt(o)})]}),e.jsxs("div",{class:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-gray-500",children:[o==="signin"&&t&&e.jsx("button",{type:"button",onClick:()=>z(l,y,m,"signup"),class:"font-medium text-gray-700 hover:underline",children:"Create account"}),o==="signup"&&e.jsx("button",{type:"button",onClick:()=>z(l,y,m,"signin"),class:"font-medium text-gray-700 hover:underline",children:"I already have an account"}),o==="signin"&&i&&e.jsx("button",{type:"button",onClick:()=>z(l,y,m,"forgot"),class:"hover:underline",children:"Forgot password?"}),(o==="forgot"||o==="reset_sent"||o==="reset_verify")&&e.jsx("button",{type:"button",onClick:()=>z(l,y,m,"signin"),class:"hover:underline",children:"Back to sign in"}),o==="reset_sent"&&e.jsx("button",{type:"button",onClick:()=>z(l,y,m,"reset_verify"),class:"font-medium text-gray-700 hover:underline",children:"I have a code"})]})]})}function pt(r){switch(r){case"signin":return"Sign in";case"signup":return"Create account";case"forgot":return"Send reset code";case"reset_verify":return"Verify";default:return"Continue"}}function z(r,t,i,n){r(n),t(null),i(null)}function L({type:r,label:t,value:i,onInput:n,autocomplete:a,inputMode:s,required:o}){return e.jsxs("label",{class:"flex flex-col gap-1.5",children:[e.jsx("span",{class:"text-xs font-medium text-gray-700",children:t}),e.jsx("input",{type:r,value:i,onInput:l=>n(l.target.value),autocomplete:a,inputMode:s,required:o,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)]"})]})}function gt(){return e.jsxs("div",{class:"flex items-center gap-2 py-1 text-[10px] uppercase tracking-[0.14em] text-gray-400",children:[e.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-gray-200 to-transparent"}),e.jsx("span",{children:"or"}),e.jsx("div",{class:"h-px flex-1 bg-gradient-to-r from-transparent to-gray-200"})]})}function ft({provider:r}){return r==="google"?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 18 18","aria-hidden":"true",children:[e.jsx("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"}),e.jsx("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"}),e.jsx("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"}),e.jsx("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"})]}):r==="apple"?e.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("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"?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("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"})}):e.jsx("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("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"})})}function wt({block:r,bootstrap:t,auth:i,authSession:n,onBack:a,showBack:s=!0}){const o={bootstrap:t,selectedPriceId:null,setSelectedPriceId:()=>{},onAction:()=>{},auth:i,authSession:n};return e.jsxs("div",{class:"flex flex-col gap-3",children:[s?e.jsx("button",{type:"button",onClick:a,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)]",children:"← Back"}):null,e.jsx(rt,{block:r,ctx:o})]})}function xt({auth:r,onSuccess:t,onBack:i,heading:n="Continue as guest",description:a="Setting up your guest session…"}){const[s,o]=u.useState({kind:"signing-in"}),l=u.useRef(!0);u.useEffect(()=>()=>{l.current=!1},[]);const c=()=>{o({kind:"signing-in"}),(async()=>{try{const p=await r.signInAnonymously();if(!l.current)return;t(p)}catch(p){if(!l.current)return;o({kind:"error",message:p instanceof Error?p.message:"Anonymous sign-in failed"})}})()};return u.useEffect(()=>{c()},[]),e.jsxs("div",{class:"flex flex-col gap-3",children:[i?e.jsx("button",{type:"button",onClick:i,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)]",children:"← Back"}):null,e.jsxs("div",{class:"flex flex-col gap-1",children:[e.jsx("h2",{class:"text-xl font-semibold text-gray-900",children:n}),e.jsx("p",{class:"text-sm text-gray-500",children:a})]}),s.kind==="signing-in"?e.jsx("div",{class:"flex items-center justify-center py-6",children:e.jsx(bt,{})}):null,s.kind==="error"?e.jsxs("div",{class:"flex flex-col gap-3",children:[e.jsx("div",{class:"rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700",children:s.message}),e.jsx("button",{type:"button",onClick:c,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",children:"Try again"})]}):null]})}function bt(){return e.jsxs("svg",{class:"h-5 w-5 animate-spin text-[var(--pw-accent)]",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"3","stroke-opacity":"0.2"}),e.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"})]})}const O=3,U=200,F=5e3,N=5,vt=10*1024*1024,G=["image/jpeg","image/png","image/webp"],W=/.+@.+\..+/;function mt({client:r,authSession:t,origin:i,onBack:n}){const a=t?.user.email??"",s=a||null,[o,l]=u.useState(a),[c,p]=u.useState(""),[f,b]=u.useState(""),[g,w]=u.useState([]),[x,k]=u.useState(!1),[I,y]=u.useState(null),[_,m]=u.useState({}),M=u.useMemo(()=>{const h=(s??o).trim().toLowerCase(),d=c.trim(),v=f.trim();return W.test(h)&&d.length>=O&&d.length<=U&&v.length>=1&&v.length<=F},[s,o,c,f]),T=()=>{const h={},d=(s??o).trim(),v=c.trim(),E=f.trim();return d?W.test(d.toLowerCase())||(h.email="Invalid email"):h.email="Required",(v.length<O||v.length>U)&&(h.subject=`${O}–${U} characters`),(E.length<1||E.length>F)&&(h.message=`1–${F} characters`),m(h),Object.keys(h).length===0},j=async h=>{if(h.preventDefault(),!x&&T()){k(!0),m(d=>({...d,submit:void 0}));try{const d=(s??o).trim();await r.createSupportTicket({subject:c.trim(),content:f.trim(),email:d||void 0,files:g.length>0?g:void 0}),y(d)}catch(d){const v=d instanceof C.PaywallError&&d.message||"Failed to send. Please try again.";m(E=>({...E,submit:v}))}finally{k(!1)}}},S=()=>{p(""),b(""),w([]),m({}),y(null)};return I?e.jsxs("div",{class:"flex flex-col items-center gap-4 py-2 text-center",children:[e.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full",style:{background:"linear-gradient(135deg, color-mix(in srgb, var(--pw-accent) 85%, white), var(--pw-accent))",color:"#fff",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)"},"aria-hidden":"true",children:e.jsx("svg",{viewBox:"0 0 24 24",class:"h-7 w-7",children:e.jsx("path",{fill:"currentColor",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"})})}),e.jsx("div",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Request submitted"}),e.jsxs("div",{class:"max-w-[320px] text-sm leading-relaxed text-gray-500",children:["We've received your message and will respond to"," ",e.jsx("b",{class:"text-gray-700",children:I}),"."]}),e.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3",children:[e.jsx("button",{type:"button",onClick:n,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)]",children:i==="standalone"?"Done":"Back"}),e.jsx("button",{type:"button",onClick:S,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Send another request"})]})]}):e.jsxs("div",{class:"flex flex-col gap-3",children:[e.jsx("div",{class:"flex items-center justify-between",children:e.jsxs("button",{type:"button",onClick:n,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)]",children:["← ",i==="standalone"?"Close":"Back"]})}),e.jsx("h2",{class:"text-lg font-semibold tracking-tight text-gray-900",children:"Contact Support"}),e.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Fill out the form below and we'll get back to you."}),e.jsxs("form",{onSubmit:j,class:"flex flex-col gap-3",children:[s?e.jsxs("div",{class:"rounded-xl border border-gray-200 bg-gray-50/60 px-3 py-2 text-xs text-gray-500",children:["Sending as ",e.jsx("b",{class:"font-medium text-gray-700",children:s})]}):e.jsx(Z,{type:"email",label:"Your email",value:o,onInput:l,error:_.email,autocomplete:"email",required:!0}),e.jsx(Z,{type:"text",label:"Subject",value:c,onInput:p,error:_.subject,required:!0}),e.jsx(yt,{label:"Message",value:f,onInput:b,error:_.message,required:!0}),e.jsx(kt,{files:g,onChange:w,disabled:x}),_.submit&&e.jsx("p",{class:"text-xs text-red-600",children:_.submit}),e.jsxs("div",{class:"mt-1 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:n,disabled:x,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)]",children:i==="standalone"?"Close":"Back"}),e.jsx("button",{type:"submit",disabled:!M||x,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:x?e.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):"Send"})]})]})]})}function Z({type:r,label:t,value:i,onInput:n,error:a,autocomplete:s,required:o}){return e.jsxs("label",{class:"flex flex-col gap-1.5",children:[e.jsx("span",{class:"text-xs font-medium text-gray-700",children:t}),e.jsx("input",{type:r,value:i,onInput:l=>n(l.target.value),autocomplete:s,required:o,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 ${a?"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)]"}`}),a&&e.jsx("span",{class:"text-xs text-red-600",children:a})]})}function yt({label:r,value:t,onInput:i,error:n,required:a}){return e.jsxs("label",{class:"flex flex-col gap-1.5",children:[e.jsx("span",{class:"text-xs font-medium text-gray-700",children:r}),e.jsx("textarea",{value:t,onInput:s=>i(s.target.value),required:a,rows:4,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)]"}`}),n&&e.jsx("span",{class:"text-xs text-red-600",children:n})]})}function kt({files:r,onChange:t,disabled:i}){const n=u.useRef(null),[a,s]=u.useState(!1),[o,l]=u.useState(null),c=p=>{if(!p||i)return;l(null);const f=Array.from(p);if(r.length+f.length>N){l(`Up to ${N} files`);return}const b=f.filter(g=>G.includes(g.type)&&g.size<=vt);if(b.length!==f.length){l("Only JPEG/PNG/WebP, ≤ 10MB each");return}t([...r,...b])};return e.jsxs("div",{children:[e.jsx("span",{class:"text-xs font-medium text-gray-700",children:"Attachments (optional)"}),e.jsxs("div",{role:"button",tabIndex:0,"aria-label":"Attachments upload",onClick:()=>!i&&n.current?.click(),onDragOver:p=>{p.preventDefault(),i||s(!0)},onDragLeave:()=>s(!1),onDrop:p=>{p.preventDefault(),s(!1),c(p.dataTransfer?.files??null)},class:`mt-1.5 cursor-pointer rounded-2xl border border-dashed p-3.5 text-center transition-all ${a?"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"} ${i?"cursor-not-allowed opacity-60":""}`,children:[e.jsx("div",{class:"text-xs text-gray-500",children:"Drop images here or click to select"}),e.jsxs("div",{class:"mt-0.5 text-[11px] text-gray-400",children:["JPEG/PNG/WebP, up to ",N," files, ≤ 10MB each"]})]}),e.jsx("input",{ref:n,type:"file",multiple:!0,accept:G.join(","),class:"hidden",onChange:p=>{c(p.target.files),p.currentTarget.value=""}}),o&&e.jsx("p",{class:"mt-1 text-xs text-red-600",children:o}),r.length>0&&e.jsx("ul",{class:"mt-2 flex flex-col gap-1",children:r.map((p,f)=>e.jsxs("li",{class:"flex items-center justify-between gap-2 rounded bg-gray-50 px-2 py-1 text-xs",children:[e.jsx("span",{class:"truncate text-gray-700",children:p.name}),e.jsx("button",{type:"button",onClick:()=>{const b=[...r];b.splice(f,1),t(b)},disabled:i,class:"text-gray-500 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-60","aria-label":`Remove ${p.name}`,children:"✕"})]},`${p.name}-${p.size}-${f}`))})]})}function _t({block:r,ctx:t}){const[i,n]=u.useState(!1),a=r.priceId??t.selectedPriceId,s=i||r.action==="checkout"&&!a,o=async()=>{if(!s){n(!0);try{await t.onAction(r.action,{priceId:a})}finally{n(!1)}}};return e.jsx("button",{type:"button",disabled:s,onClick:o,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",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)"},children:i?e.jsx("span",{class:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):r.label})}function jt({ctx:r}){const t=r.authSession,i=r.auth,[n,a]=u.useState(!1),s=()=>r.onAction("support");if(t&&!t.user.is_anonymous){const o=async()=>{if(!(!i||n)){a(!0);try{await i.signOut()}catch{}finally{a(!1)}}};return e.jsxs("div",{class:"mt-2 text-center text-xs text-gray-500",children:[e.jsx("span",{children:"Signed in as "}),e.jsx("b",{class:"font-medium text-gray-700",children:t.user.email}),e.jsxs("div",{class:"mt-1 flex items-center justify-center gap-3",children:[e.jsx("button",{type:"button",onClick:o,disabled:!i||n,class:"font-medium text-gray-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-60 focus:outline-none focus-visible:underline",children:n?"Signing out…":"Sign out"}),e.jsx(K,{}),e.jsx(X,{onClick:s})]})]})}return e.jsxs("div",{class:"mt-2 flex items-center justify-center gap-3 text-center text-xs text-gray-500",children:[e.jsx("button",{type:"button",onClick:()=>r.onAction("restore"),class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Restore purchases"}),e.jsx(K,{}),e.jsx(X,{onClick:s})]})}function X({onClick:r}){return e.jsx("button",{type:"button",onClick:r,class:"font-medium text-gray-600 underline-offset-2 hover:underline focus:outline-none focus-visible:underline",children:"Contact Support"})}function K(){return e.jsx("span",{class:"h-1 w-1 rounded-full bg-gray-300","aria-hidden":"true"})}function St({block:r}){return r.items.length?e.jsx("ul",{class:"flex flex-col gap-2.5",role:"list",children:r.items.map(t=>e.jsxs("li",{class:"flex items-start gap-3 text-sm text-gray-700",children:[e.jsx("span",{class:"mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),e.jsxs("div",{class:"flex flex-col gap-0.5",children:[e.jsx("span",{class:"font-medium leading-snug text-gray-900",children:t.name}),t.desc?e.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:t.desc}):null]})]},t.id))}):null}const it=26,Ct=14,It=2;function At(r,t){const i=t*It;let n=it;for(r.style.fontSize=`${n}px`;r.scrollHeight>i&&n>Ct;)n-=1,r.style.fontSize=`${n}px`}function Mt({block:r,ctx:t}){const i=r.level??1,n=`h${i}`,a=i===1?"text-[1.625rem] font-semibold leading-tight text-gray-900 tracking-[-0.02em]":i===2?"text-xl font-semibold leading-snug text-gray-900 tracking-tight":"text-base font-medium text-gray-900",s=u.useRef(null),o=i===1&&!!t.bootstrap.settings.title_auto_fit;return u.useEffect(()=>{if(!o||!s.current)return;const l=getComputedStyle(s.current),c=parseFloat(l.lineHeight)||it*1.5;At(s.current,c)},[o,r.text]),e.jsx(n,{ref:s,class:a,children:r.text})}function Tt(r){const t=r.local??{currency:r.currency,amount:r.amount};try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t.currency,maximumFractionDigits:t.amount%1===0?0:2}).format(t.amount)}catch{return`${t.amount} ${t.currency}`}}function J(r){if(!r.interval||r.interval==="lifetime")return"one-time";const t=r.interval_count??1;return t===1?`per ${r.interval}`:`every ${t} ${r.interval}s`}function Et({block:r,ctx:t}){const i=r.priceIds&&r.priceIds.length>0?new Set(r.priceIds):null,n=t.bootstrap.prices.filter(l=>!i||i.has(l.id));if(n.length===0)return e.jsx("p",{class:"text-sm text-gray-500",children:"No prices available."});const a=r.view==="horizontal",s=r.popular_label??"Most popular",o=a?Math.min(n.length,3):1;return e.jsx("div",{class:a?"grid gap-2.5":"flex flex-col gap-2.5",style:a?{gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`}:void 0,role:"radiogroup","aria-label":"Plans",children:n.map(l=>{const c=t.selectedPriceId===l.id,p=r.popular_price_id===l.id;return e.jsxs("button",{type:"button",role:"radio","aria-checked":c,onClick:()=>{t.setSelectedPriceId(l.id),t.onAction("price_selected",{priceId:l.id,price:l})},class:["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)]",a?"flex w-full flex-col items-start gap-1":"flex w-full items-center justify-between gap-3",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",p?"mt-2.5":""].join(" "),children:[p?e.jsx("span",{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",style:{background:"linear-gradient(135deg, var(--pw-accent), color-mix(in srgb, var(--pw-accent) 70%, black))"},children:s}):null,e.jsxs("div",{class:a?"flex w-full items-start gap-2.5":"flex flex-1 items-start gap-2.5",children:[e.jsx("span",{class:["mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border transition-colors",c?"border-[var(--pw-accent)] bg-[var(--pw-accent)]":"border-gray-300 bg-white group-hover:border-gray-400"].join(" "),"aria-hidden":"true",children:c?e.jsx("span",{class:"h-1.5 w-1.5 rounded-full bg-white"}):null}),e.jsxs("div",{class:"flex flex-col",children:[e.jsx("span",{class:"text-sm font-semibold text-gray-900",children:l.label??J(l)}),l.description?e.jsx("span",{class:"text-xs leading-relaxed text-gray-500",children:l.description}):null,l.trial_days?e.jsxs("span",{class:"text-xs font-medium text-[var(--pw-accent)]",children:[l.trial_days,"-day free trial"]}):null]})]}),e.jsxs("div",{class:a?"mt-1 flex flex-col items-start":"flex flex-col items-end",children:[e.jsx("span",{class:"text-base font-semibold tracking-tight text-gray-900",children:Tt(l)}),e.jsx("span",{class:"text-[11px] text-gray-500",children:J(l)})]})]},l.id)})})}function Pt({block:r}){return e.jsx("p",{class:"text-[0.9375rem] leading-relaxed text-gray-600",children:r.text})}const zt={week:.25,month:1,year:12};function Lt(r){return r||"period"}function Bt({block:r,ctx:t}){if(!r.queries.length)return null;const n=t.bootstrap.prices.find(s=>s.id===t.selectedPriceId)?.interval??null,a=n?zt[n]:void 0;return e.jsxs("div",{class:"flex flex-col gap-2",children:[e.jsxs("div",{class:"text-sm font-semibold text-gray-800",children:["Included per ",e.jsx("span",{children:Lt(n)}),":"]}),e.jsx("ul",{class:"flex flex-col gap-2",role:"list",children:r.queries.map(s=>{const o=Number.isFinite(s.count)?s.count:0,l=a!==void 0?Math.round(o*a):o;return e.jsxs("li",{class:`flex gap-2 ${s.desc?"":"items-center"}`,children:[e.jsx("span",{class:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full ${s.desc?"mt-0.5":""}`,style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M5 10l3 3 7-7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),e.jsxs("div",{children:[e.jsx("span",{class:"font-semibold text-gray-900 text-sm",children:l})," ",e.jsx("span",{class:"text-sm text-gray-800",children:s.name}),s.desc?e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx("span",{class:"text-xs text-gray-500",children:s.desc})]}):null]})]},s.id)})})]})}const at={heading:Mt,text:Pt,price_grid:Et,cta_button:_t,auth_panel:rt,current_session:jt,features_list:St,tokenization_gate:Bt};function Rt({layout:r,bootstrap:t,onAction:i,auth:n,authSession:a}){const s=u.useMemo(()=>t.prices[0]?.id??null,[t.prices]),[o,l]=u.useState(s),c={bootstrap:t,selectedPriceId:o,setSelectedPriceId:l,onAction:i,auth:n,authSession:a};return e.jsx("div",{class:"flex flex-col gap-4",children:r.blocks.map((p,f)=>{const b=at[p.type];return b?e.jsx(b,{block:p,ctx:c},f):(typeof console<"u"&&console.warn(`[paywall] unknown block type: ${p.type}`),null)})})}function Ot(r,t,i,n){return r?n?{open:!0,view:"purchased",error:null}:t.status==="idle"||t.status==="loading"?{open:!0,view:"loading",error:null}:t.status==="error"?{open:!0,view:"error",error:t.error}:i.kind==="support"?{open:!0,view:"support",error:null}:i.kind==="auth_gate"?{open:!0,view:"auth",error:null}:i.kind==="anon_gate"?{open:!0,view:"anon",error:null}:i.kind==="awaiting_payment"?{open:!0,view:"awaiting_payment",error:null}:i.kind==="popup_blocked"?{open:!0,view:"popup_blocked",error:null}:i.kind==="purchase_success"?{open:!0,view:"purchased",error:null}:i.kind==="verifying"?{open:!0,view:"loading",error:null}:{open:!0,view:"layout",error:null}:{open:!1,view:null,error:null}}function Ut(r,t){return r.open===t.open&&r.view===t.view&&r.error===t.error}function Ft({client:r,open:t,onClose:i,onEvent:n,initialView:a,purchased:s,renew:o,onState:l}){const[c,p]=u.useState({status:"idle"}),[f,b]=u.useState(()=>r.auth?.getCachedSession()??null),[g,w]=u.useState(()=>a==="support"?{kind:"support",origin:"standalone"}:a==="auth"?{kind:"auth_gate",origin:"standalone"}:a==="anon"?{kind:"anon_gate",origin:"standalone"}:{kind:"layout"}),x=u.useRef(!1),k=u.useRef(null);u.useEffect(()=>{if(!l)return;const h=Ot(t,c,g,s),d=k.current;d&&Ut(d,h)||(k.current=h,l(h))},[t,c,g,s,l]),u.useEffect(()=>{if(r.auth)return r.auth.onAuthChange(h=>b(h))},[r.auth]),u.useEffect(()=>{if(typeof r.onBootstrapChange=="function")return r.onBootstrapChange(h=>{p(d=>d.status==="ready"?{status:"ready",data:h}:d)})},[r]),u.useEffect(()=>{if(!t||c.status==="ready"||c.status==="loading")return;let h=!1;return p({status:"loading"}),r.bootstrap().then(d=>{h||(p({status:"ready",data:d}),n("ready",d),d.user?.has_active_subscription&&!o&&(n("purchase_completed",{priceId:null,sessionId:null,restored:!0}),w({kind:"purchase_success",restored:!0})))}).catch(d=>{if(h)return;const v=d instanceof C.PaywallError?d:new C.PaywallError("unknown","Failed to load paywall",{cause:d});p({status:"error",error:v}),n("error",v)}),()=>{h=!0}},[t,r]),u.useEffect(()=>{if(!t){w({kind:"layout"}),x.current=!1;return}a==="support"?w({kind:"support",origin:"standalone"}):a==="auth"?w({kind:"auth_gate",origin:"standalone"}):a==="anon"&&w({kind:"anon_gate",origin:"standalone"})},[t,a]);const I=async h=>{try{const d=await r.createCheckout({priceId:h,ignoreActivePurchase:o===!0});if(n("checkout_started",{priceId:h,url:d.url,acquiring:d.acquiring}),typeof window>"u"||!d.url)return;const v=window.open(d.url,"_blank");if(v){try{v.opener=null}catch{}w({kind:"awaiting_payment",priceId:h,url:d.url})}else w({kind:"popup_blocked",priceId:h,url:d.url})}catch(d){if(d instanceof C.PaywallError&&d.code==="already_purchased"){try{await r.getUser({force:!0})}catch{}n("purchase_completed",{priceId:h,sessionId:null,restored:!0}),w({kind:"purchase_success",restored:!0});return}const v=d instanceof C.PaywallError?d:new C.PaywallError("checkout_failed","Checkout failed",{cause:d});n("error",v),w({kind:"layout"})}},y=(h,d)=>{if(typeof window>"u")return;const v=window.open(d,"_blank");if(v){try{v.opener=null}catch{}w({kind:"awaiting_payment",priceId:h,url:d})}};u.useEffect(()=>{if(g.kind!=="auth_gate"||!f||f.user.is_anonymous||x.current)return;x.current=!0;const h=g.pendingCheckout,d=g.origin;w({kind:"verifying"}),(async()=>{if(!o)try{if((await r.getUser({force:!0})).has_active_subscription){n("purchase_completed",{priceId:h?.priceId??null,sessionId:null,restored:!0}),w({kind:"purchase_success",restored:!0});return}}catch{}if(!h){d==="standalone"?i():w({kind:"layout"});return}await I(h.priceId)})().finally(()=>{x.current=!1})},[f,g]);const _=async(h,d)=>{if(h==="close"){i();return}if(h==="price_selected"){n("price_selected",d);return}if(h==="restore"){if(!r.auth||r.auth.getCachedSession())return;w({kind:"auth_gate"});return}if(h==="support"){w({kind:"support",origin:"layout"});return}if(h==="checkout"&&c.status==="ready"){const v=d?.priceId;if(!v){n("error",new C.PaywallError("no_price","No price selected"));return}if((c.data.settings.checkout_mode??"guest")==="preauth"&&!!r.auth&&!r.auth.getCachedSession()){w({kind:"auth_gate",pendingCheckout:{priceId:v}});return}await I(v)}},m=c.status==="ready"?c.data.settings.brand_color:null,M=c.status==="ready"?!!c.data.settings.is_test_mode:!1,T=c.status==="ready"?c.data.settings.allow_close!==!1:!0,j={type:"auth_panel",heading:"Sign in to continue",allow_signup:!0,allow_password_reset:!0,hide_when_authenticated:!1,providers:c.status==="ready"?c.data.settings.auth_providers:void 0},S=g.kind==="support"?e.jsx(mt,{client:r,authSession:f,origin:g.origin,onBack:()=>{g.origin==="standalone"?i():w({kind:"layout"})}}):null;return e.jsx(ct,{open:t,onClose:i,brandColor:m,testMode:M,allowClose:T,labelledBy:"pw-title",children:s?e.jsx(Y,{onContinue:i}):g.kind==="purchase_success"?e.jsx(Y,{restored:g.restored,onContinue:i}):S||(c.status==="loading"||c.status==="idle"||g.kind==="verifying"?e.jsxs("div",{class:"flex flex-col items-center justify-center gap-3 py-12",children:[e.jsx("span",{class:"inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"}),e.jsx("span",{class:"text-xs font-medium tracking-wide text-gray-500",children:g.kind==="verifying"?"Checking your subscription…":"Loading…"})]}):c.status==="error"?e.jsxs("div",{class:"flex flex-col items-center gap-2 py-8 text-center",children:[e.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full bg-red-50",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M10 6v5M10 14h.01",stroke:"#dc2626","stroke-width":"2","stroke-linecap":"round"}),e.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"#dc2626","stroke-width":"1.75"})]})}),e.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Something went wrong"}),e.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:c.error.message})]}):g.kind==="auth_gate"&&r.auth?e.jsx(wt,{block:j,bootstrap:c.data,auth:r.auth,authSession:f,showBack:g.origin!=="standalone",onBack:()=>{g.origin==="standalone"?i():w({kind:"layout"})}}):g.kind==="anon_gate"&&r.auth?e.jsx(xt,{auth:r.auth,onSuccess:()=>{g.origin==="standalone"?i():w({kind:"layout"})},onBack:g.origin==="standalone"?void 0:()=>w({kind:"layout"})}):g.kind==="awaiting_payment"?e.jsx(Nt,{client:r,onBack:()=>w({kind:"layout"}),onReopen:()=>{if(typeof window>"u")return;const h=window.open(g.url,"_blank");if(h)try{h.opener=null}catch{}},onRetry:()=>I(g.priceId)}):g.kind==="popup_blocked"?e.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[e.jsx("div",{class:"flex h-11 w-11 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--pw-accent) 12%, white)",color:"var(--pw-accent)"},"aria-hidden":"true",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e.jsx("path",{d:"M4 5h12v10H4z",stroke:"currentColor","stroke-width":"1.75","stroke-linejoin":"round"}),e.jsx("path",{d:"M7 9l3 3 4-5",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"})]})}),e.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Allow popups to continue"}),e.jsx("p",{class:"max-w-[18rem] text-xs leading-relaxed text-gray-500",children:"Your browser blocked the checkout tab. Click below to open it."}),e.jsx("button",{type:"button",onClick:()=>y(g.priceId,g.url),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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Open checkout"})]}):e.jsx(Rt,{layout:c.data.layout,bootstrap:c.data,onAction:_,auth:r.auth,authSession:f}))})}function Nt({client:r,onBack:t,onReopen:i,onRetry:n}){const[a,s]=u.useState(!1),[o,l]=u.useState(!1),c=u.useRef(null);u.useEffect(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);const p=async()=>{if(!a){s(!0),l(!1);try{if((await r.getUser({force:!0})).has_active_subscription){typeof window<"u"&&window.postMessage({type:"paywall_purchase"},"*");return}l(!0),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>{l(!1),c.current=null},5e3)}catch{l(!0)}finally{s(!1)}}};return e.jsxs("div",{class:"flex flex-col gap-3",children:[e.jsx("button",{type:"button",onClick:t,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)]",children:"← Back"}),e.jsxs("div",{class:"flex flex-col items-center gap-3 py-6 text-center",children:[e.jsxs("div",{class:"relative flex h-12 w-12 items-center justify-center",children:[e.jsx("span",{class:"absolute inset-0 animate-ping rounded-full opacity-40",style:{background:"color-mix(in srgb, var(--pw-accent) 30%, transparent)"},"aria-hidden":"true"}),e.jsx("span",{class:"relative inline-block h-7 w-7 animate-spin rounded-full border-[2.5px] border-gray-200 border-t-[var(--pw-accent)]"})]}),e.jsx("p",{class:"text-sm font-semibold tracking-tight text-gray-900",children:"Complete payment in the new tab"}),e.jsx("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."}),e.jsx("button",{type:"button",onClick:p,disabled:a,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 6px 14px -4px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:a?"Checking…":"I've paid"}),o?e.jsx("p",{class:"text-xs leading-relaxed text-gray-500",children:"Payment is still being processed. Please try again in a moment."}):null]}),e.jsxs("div",{class:"rounded-2xl border border-gray-200 bg-gray-50/60 p-3.5",children:[e.jsx("p",{class:"text-xs leading-relaxed text-gray-600",children:"Checkout window didn't open or got blocked? Click here to open it again."}),e.jsx("button",{type:"button",onClick:i,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)]",children:"Open checkout again"})]}),e.jsx("button",{type:"button",onClick:n,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)]",children:"Tab closed? Try again"})]})}function Y({onContinue:r,restored:t=!1}){return e.jsxs("div",{class:"flex flex-col items-center gap-3 py-8 text-center",children:[e.jsx("div",{class:"flex h-14 w-14 items-center justify-center rounded-full ring-8",style:{background:"linear-gradient(135deg, #4ade80, #16a34a)",color:"#fff",boxShadow:"0 0 0 8px rgba(74,222,128,0.12), 0 8px 20px -6px rgba(22,163,74,0.45)"},"aria-hidden":"true",children:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})})}),e.jsx("p",{id:"pw-title",class:"mt-1 text-lg font-semibold tracking-tight text-gray-900",children:t?"Subscription restored":"Payment received"}),e.jsx("p",{class:"text-sm leading-relaxed text-gray-500",children:t?"Welcome back — your subscription is already active.":"Your subscription is now active."}),e.jsx("button",{type:"button",onClick:r,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)]",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--pw-accent) 92%, white), var(--pw-accent))",boxShadow:"0 1px 2px rgba(15,23,42,0.08), 0 8px 20px -6px color-mix(in srgb, var(--pw-accent) 50%, transparent)"},children:"Continue"})]})}const Ht=10*6e4,Vt=5e3,Dt=3e4;class $t{constructor(t){this.timer=null,this.timeoutTimer=null,this.visibilityHandler=null,this.focusHandler=null,this.messageHandler=null,this.stopped=!1,this.checking=!1,this.opts={client:t.client,onActive:t.onActive,onTimeout:t.onTimeout??(()=>{}),timeoutMs:t.timeoutMs??Ht,visibleIntervalMs:t.visibleIntervalMs??Vt,hiddenIntervalMs:t.hiddenIntervalMs??Dt}}start(){this.stopped||typeof document>"u"||typeof window>"u"||(this.check(),this.scheduleNext(),this.visibilityHandler=()=>this.handleVisibilityChange(),document.addEventListener("visibilitychange",this.visibilityHandler),this.focusHandler=()=>void this.check(),window.addEventListener("focus",this.focusHandler),this.messageHandler=t=>this.handleMessage(t),window.addEventListener("message",this.messageHandler),this.timeoutTimer=setTimeout(()=>{this.stopped||(this.stop(),this.opts.onTimeout())},this.opts.timeoutMs))}stop(){this.stopped=!0,this.timer!==null&&clearTimeout(this.timer),this.timer=null,this.timeoutTimer!==null&&clearTimeout(this.timeoutTimer),this.timeoutTimer=null,typeof document<"u"&&this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),typeof window<"u"&&(this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.messageHandler&&window.removeEventListener("message",this.messageHandler)),this.visibilityHandler=null,this.focusHandler=null,this.messageHandler=null}async check(){if(!(this.stopped||this.checking)){this.checking=!0;try{const t=await this.opts.client.getUser({force:!0});if(this.stopped)return;t.has_active_subscription&&(this.stop(),this.opts.onActive(t))}catch{}finally{this.checking=!1}}}scheduleNext(){if(this.stopped)return;const i=typeof document<"u"&&document.visibilityState==="visible"?this.opts.visibleIntervalMs:this.opts.hiddenIntervalMs;this.timer=setTimeout(async()=>{await this.check(),this.scheduleNext()},i)}handleVisibilityChange(){typeof document>"u"||(document.visibilityState==="visible"&&this.check(),this.timer!==null&&(clearTimeout(this.timer),this.timer=null),this.scheduleNext())}handleMessage(t){const i=t.data;!i||typeof i!="object"||i.type==="paywall_purchase"&&this.check()}}function qt(){return!(typeof document>"u"||typeof window>"u"||typeof location<"u"&&location.protocol==="chrome-extension:")}const H={open:!1,view:null,error:null},A={status:"paywall_status",priceId:"paywall_price_id",sessionId:"paywall_session_id"};class Gt{constructor(t){this.handle=null,this.isOpen=!1,this.listeners=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=H,this.stateListeners=new Set;const{auth:i,ownsAuth:n}=Wt(t);this.auth=i,this.ownsAuth=n,this.billing=t.client??new C.BillingClient({...t,auth:this.auth}),this.host=t.host,this.shadowMode=t.shadowMode??"closed",this.mountThenLoad=t.mountThenLoad??!0,this.userUnsub=this.billing.onUserChange(a=>{this.emit("userChange",a)}),this.auth&&(this.authUnsub=this.auth.onAuthChange(a=>{this.emit("authChange",a)})),this.initTracker(t.analytics),t.autoDetectReturn!==!1&&typeof window<"u"&&queueMicrotask(()=>this.checkReturn())}initTracker(t){if(t===!1)return;const i=typeof t=="object"&&t!==null?t:{};if(i.enabled===!1)return;const n=i.endpoint??`${this.billing.apiOrigin}/api/v1/paywall/${this.billing.paywallId}/events`;this.tracker=new C.EventTracker({endpoint:n,paywallId:this.billing.paywallId,capabilities:this.billing.capabilities,getVisitorId:()=>this.billing.getVisitorId(),getCachedVisitorId:()=>this.billing.getCachedVisitorId(),getUserId:()=>this.billing.getIdentity()?.userId??null,flushIntervalMs:i.flushIntervalMs,maxBufferSize:i.maxBufferSize,fetch:i.fetch,sendBeacon:i.sendBeacon}),this.on("open",()=>this.tracker?.track("paywall_opened")),this.on("ready",a=>this.tracker?.track("paywall_viewed",{is_test_mode:a.settings.is_test_mode,prices_count:a.prices.length,offers_count:a.offers.length})),this.on("price_selected",a=>this.tracker?.track("price_selected",{price_id:a.priceId})),this.on("checkout_started",a=>this.tracker?.track("checkout_started",{price_id:a.priceId,acquiring:a.acquiring})),this.on("purchase_completed",a=>this.tracker?.track("purchase_completed",{price_id:a.priceId,session_id:a.sessionId})),this.on("purchase_failed",a=>this.tracker?.track("purchase_failed",{reason:a.reason})),this.on("close",()=>this.tracker?.track("paywall_closed")),this.on("trial_blocked",a=>this.tracker?.track("trial_blocked",{mode:a.mode,...a.mode==="time"?{remaining_ms:a.remainingMs,total_ms:a.totalMs}:a.mode==="opens"?{remaining_actions:a.remainingActions,total_actions:a.totalActions}:{}})),this.on("trial_expired",()=>this.tracker?.track("trial_expired")),this.on("visibility_blocked",a=>this.tracker?.track("visibility_blocked",{reason:a.reason,country:a.country,tier:a.tier})),this.on("error",a=>this.tracker?.track("error",{code:a.code,message:a.message}))}track(t,i){this.tracker?.track(t,i)}onUserChange(t){return this.on("userChange",t)}setBootstrap(t){this.billing.setBootstrap(t)}on(t,i){let n=this.listeners.get(t);return n||(n=new Set,this.listeners.set(t,n)),n.add(i),()=>n.delete(i)}off(t,i){this.listeners.get(t)?.delete(i)}emit(t,...i){const n=this.listeners.get(t);if(!n)return;const a=i[0];for(const s of n)try{s(a)}catch(o){typeof console<"u"&&console.error("[paywall] listener error",o)}}open(t={}){this.openInternal("layout",t)}async preload(t={}){try{await this.billing.bootstrap({signal:t.signal}),this.billing.auth&&await this.billing.getBalances({signal:t.signal})}catch{}}openSupport(t={}){this.openInternal("support",t)}openAuth(t={}){this.auth&&this.openInternal("auth",{...t,skipTrial:!0})}openAnonGate(t={}){this.auth&&this.openInternal("anon",{...t,skipTrial:!0,skipVisibility:!0})}openInternal(t,i){i.identity&&this.billing.setIdentity(i.identity),this.purchased=!1;const n=i.skipTrial===!0||t==="support",a=i.skipVisibility===!0||t==="support"||t==="auth"||t==="anon",s=i.renew===!0;if(n&&a){this.mountAndShow(t,{renew:s});return}const o=this.billing.getCachedBootstrap();if(o){this.runOpenGates(t,o,{skipTrial:n,skipVisibility:a,renew:s});return}if(this.mountThenLoad){this.mountAndShow(t,{renew:s}),this.billing.bootstrap().then(l=>this.runDelayedGates(l,{skipTrial:n,skipVisibility:a})).catch(()=>{});return}this.billing.bootstrap().then(l=>this.runOpenGates(t,l,{skipTrial:n,skipVisibility:a,renew:s})).catch(()=>{this.mountAndShow(t,{renew:s})})}runDelayedGates(t,i){if(!this.isOpen)return;if(!i.skipVisibility){const s=t.settings.visibility;if(s&&(this.lastVisibility=s,!s.visible)){this.close(),this.emit("visibility_blocked",s);return}}if(i.skipTrial)return;const n=t.settings.trial;if(!n)return;const a=this.ensureTrialStore(n);a.check().then(async s=>{if(this.isOpen&&(this.lastTrialStatus=s,s.mode!=="none")){if(s.blocked){const o=await a.recordBlock();if(this.lastTrialStatus=o,!this.isOpen)return;this.close(),this.emit("trial_blocked",o);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired"))}}).catch(s=>{typeof console<"u"&&console.warn("[paywall] trial check failed",s)})}runOpenGates(t,i,n){if(!n.skipVisibility){const a=i.settings.visibility;if(a&&(this.lastVisibility=a,!a.visible)){this.emit("visibility_blocked",a);return}}if(n.skipTrial){this.mountAndShow(t,{renew:n.renew});return}this.gateThroughTrial(t,i,n.renew)}gateThroughTrial(t,i,n){const a=i.settings.trial;if(!a){this.mountAndShow(t,{renew:n});return}const s=this.ensureTrialStore(a);s.check().then(async o=>{if(this.lastTrialStatus=o,o.mode==="none"){this.mountAndShow(t,{renew:n});return}if(o.blocked){const l=await s.recordBlock();this.lastTrialStatus=l,this.emit("trial_blocked",l);return}this.trialExpiredFired||(this.trialExpiredFired=!0,this.emit("trial_expired")),this.mountAndShow(t,{renew:n})}).catch(o=>{typeof console<"u"&&console.warn("[paywall] trial check failed",o),this.mountAndShow(t,{renew:n})})}ensureTrialStore(t){if(this.trialStore&&this.trialStoreConfig&&Kt(this.trialStoreConfig,t))return this.trialStore;this.trialStoreConfig=t;const i=this.billing.createTrialStore;return this.trialStore=typeof i=="function"?i.call(this.billing,t):st(this.billing.getStorage(),this.billing.paywallId,t),this.trialStore}mountAndShow(t,i={}){const n=i.renew===!0;if(this.handle){this.isOpen=!0,this.handle.update({open:!0,initialView:t,purchased:!1,renew:n}),this.emit("open");return}this.isOpen=!0,this.handle=lt(Ft,{client:this.billing,open:!0,initialView:t,purchased:!1,renew:n,onClose:()=>this.close(),onEvent:(a,s)=>{this.emit(a,s),a==="checkout_started"&&this.startUserWatcher()},onState:a=>this.applyState(a)},{host:this.host,shadowMode:this.shadowMode}),this.emit("open")}applyState(t){if(!Xt(this.currentState,t)){this.currentState=t;for(const i of this.stateListeners)try{i(t)}catch(n){console.warn("[paywall] onStateChange listener threw",n)}}}getState(){return this.currentState}onStateChange(t,i={}){this.stateListeners.add(t);const n=i.immediate??"microtask";if(n!=="none"){const a=this.currentState;if(n==="sync")try{t(a)}catch(s){console.warn("[paywall] onStateChange initial sync threw",s)}else queueMicrotask(()=>{this.stateListeners.has(t)&&t(a)})}return()=>{this.stateListeners.delete(t)}}getTrialStatus(){return this.lastTrialStatus}getVisibility(){return this.lastVisibility}getPrices(t={}){return this.billing.getPrices(t)}getCachedPrices(){return this.billing.getCachedPrices()}getUserLanguage(){return this.billing.getUserLanguage()}async getAccess(t={}){let i=this.billing.getCachedBootstrap();if(!i)try{i=await this.billing.bootstrap({signal:t.signal})}catch{const o=this.billing.getCachedUser();return o?.has_active_subscription?{access:"granted",reason:"has_subscription",visibility:null,trial:null,user:o}:{access:"blocked",reason:"no_subscription",visibility:null,trial:null,user:o}}const n=i.user??null;if(n?.has_active_subscription)return{access:"granted",reason:"has_subscription",visibility:i.settings.visibility??null,trial:null,user:n};let a=null;if(!t.skipVisibility){const o=i.settings.visibility;if(o&&(a=o,this.lastVisibility=o,!o.visible))return{access:"granted",reason:"visibility_blocked",visibility:a,trial:null,user:n}}let s=null;if(!t.skipTrial){const o=i.settings.trial;if(o)try{if(s=await this.ensureTrialStore(o).check(),this.lastTrialStatus=s,s.blocked)return{access:"granted",reason:"trial_blocked",visibility:a,trial:s,user:n}}catch(l){typeof console<"u"&&console.warn("[paywall] getAccess: trial check failed",l)}}return{access:"blocked",reason:"no_subscription",visibility:a,trial:s,user:n}}async resetTrial(){this.trialStore&&(await this.trialStore.reset(),this.lastTrialStatus=null,this.trialExpiredFired=!1)}startUserWatcher(){this.watcher||qt()&&(this.watcher=new $t({client:this.billing,onActive:t=>{this.watcher=null,this.emit("purchase_completed",{priceId:null,sessionId:null});const i=this.billing.getCachedBootstrap()?.settings.success_redirect_url;if(i&&typeof window<"u")try{window.location.assign(i);return}catch{}this.isOpen&&this.handle&&(this.purchased=!0,this.handle.update({purchased:!0}))},onTimeout:()=>{this.watcher=null}}),this.watcher.start())}close(){!this.isOpen||!this.handle||(this.isOpen=!1,this.purchased=!1,this.handle.update({open:!1,purchased:!1}),this.applyState(H),this.emit("close"))}checkReturn(){if(typeof window>"u")return;const t=new URL(window.location.href),i=Q(t.hash.replace(/^#/,"")),n=Q(t.search.replace(/^\?/,"")),a=i??n;a&&(a.status==="paid"?(this.emit("purchase_completed",{priceId:a.priceId,sessionId:a.sessionId}),Jt(a)):(a.status==="failed"||a.status==="cancelled")&&this.emit("purchase_failed",{reason:a.status}),Yt(t))}destroy(){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=H}}function Wt(r){if(!r.auth)return{auth:void 0,ownsAuth:!1};if(r.auth instanceof C.AuthClient||Zt(r.auth))return{auth:r.auth,ownsAuth:!1};const t=r.auth===!0?{}:r.auth;return{auth:new C.AuthClient({paywallId:r.paywallId,apiOrigin:t.apiOrigin??r.apiOrigin,storage:t.storage??r.storage,fetch:t.fetch??r.fetch,openPopup:t.openPopup}),ownsAuth:!0}}function Zt(r){if(typeof r!="object"||r===null)return!1;const t=r;return typeof t.onAuthChange=="function"&&typeof t.getCachedSession=="function"&&typeof t.signOut=="function"}function Xt(r,t){return r.open===t.open&&r.view===t.view&&r.error===t.error}function Kt(r,t){return r.mode===t.mode&&r.payload===t.payload&&r.storage===t.storage}function Q(r){if(!r)return null;const t=new URLSearchParams(r),i=t.get(A.status);return i?{status:i,priceId:t.get(A.priceId),sessionId:t.get(A.sessionId)}:null}function Jt(r){if(!(typeof window>"u"||!window.opener))try{window.opener.postMessage({type:"paywall_purchase",status:r.status,priceId:r.priceId,sessionId:r.sessionId},"*")}catch{}}function Yt(r){const t=(n,a)=>{if(!n)return"";const s=new URLSearchParams(n.replace(/^[?#]/,""));s.delete(A.status),s.delete(A.priceId),s.delete(A.sessionId);const o=s.toString();return o?a+o:""},i=r.pathname+t(r.search,"?")+t(r.hash,"#");window.history.replaceState(null,"",i)}exports.PaywallUI=Gt;exports.blockRegistry=at;
|
|
26
|
-
//# sourceMappingURL=PaywallUI-CbbcfXXZ.js.map
|