@mrrocket/sdk 0.23.1 → 0.25.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this package. It follows semantic versioning; before 1.0 a minor version may change an API.
4
4
 
5
+ ## 0.25.0 (not published yet)
6
+
7
+ - **Tests your server decides:** `trackVariant(key, { config, distinctId })` in `@mrrocket/sdk/next/server` returns the version like `getVariant` and records `$exposure {experiment, variant}` for that person with the server key (`MRROCKET_SERVER_KEY` or `serverKey`), so a checkout, a price or an email your server chooses is counted like a page test. It sends nothing while the test is not running or its winner is kept for everyone, for an unknown person, for a version a preview forces, or without the server key (one console warning), and waits at most 2.5 s (`timeoutMs`). Pairs with MRRocket's new test type "In your code".
8
+ - Version reported in event batches: `0.25.0`.
9
+
10
+ ## 0.24.0 (includes 0.23.1)
11
+
12
+ - **A/B tests keep a cookieless visitor in one version all day (web, script tag, Next.js server and React Native).** The config now carries `unit`, the daily visitor hash MRRocket's event ingest gives that visitor. Without a signed-in id or a `ck_id` cookie, tests assign by it, so a reload no longer reshuffles the version. Nothing is stored on the visitor's device: the unit lives in memory, and React Native leaves it out of the cached config. Cookieless events carry it as their id, so exposures and conversions are counted under the id that chose the version. An `identify()` id or the provider's `distinctId` still comes first, then `ck_id`.
13
+ - **Until the unit is there, a running test shows control and records nothing**, so no visitor is counted in a version they then leave. A shipped winner shows at once.
14
+ - **Server rendering:** `getCockpitConfig({ headers })` forwards the visitor's address and browser with the server key (`MRROCKET_SERVER_KEY`), and `getVariant`, `getTexts` and `experimentRedirect` assign by the unit the same way the browser will. Without the server key the server assigns nobody by unit and renders control; the browser takes over after hydration. `getVariant` and `getTexts` no longer fall back to the id `"anonymous"`.
15
+ - **A version stays for the page load** (for the app session on React Native) when the weights change meanwhile. A version with weight 0 is never picked.
16
+ - **Feature flags that measure a test record its exposure:** a flag served with `experiment` records `$exposure` once per page when read, with the flag's variant by position (`control`, `a`, `b` …; on/off: on is `a`).
17
+ - **Onboarding items with a running test record its exposure** before they show. The SDK does not draw onboarding versions; use `useVariant(key)` in the app.
18
+ - **Overlapping tests:** when two running tests change the same text, the first in the config wins and is the only one recorded; a development build warns once with both keys. `overlaps(config)` lists them.
19
+ - Version reported in event batches: `0.24.0`.
20
+
5
21
  ## 0.23.1 (not published yet)
6
22
 
7
23
  - **Withdrawing consent now reaches MRRocket from the React provider.** In 0.23.0 `$consent_off` waited in the queue, and the provider's consent effect emptied the queue before anything was sent, so it never went out. It now goes at once, by beacon or `fetch` with `keepalive`, signed with `userHash`, and arrives even if the page closes right after. Everything else in the queue is still dropped. Nothing goes out for an anonymous visitor, a page that starts with consent off, or a browser's privacy signal. The script tag and React Native sent it correctly already.
package/README.md CHANGED
@@ -118,6 +118,21 @@ export default async function Page({ searchParams }: { searchParams: Promise<Rec
118
118
 
119
119
  The server needs an id it can read. Cookieless (the default) there is none, so pass your own, for example the signed-in user's id, to both sides: `getVariant(key, { config, searchParams: sp, distinctId: user.id })` and `<CockpitProvider distinctId={user.id}>`.
120
120
 
121
+ ### Tests your server decides (0.25.0)
122
+
123
+ Some tests have no page: a checkout, a price, an email, anything your server chooses. Create them in MRRocket with **Runs on: In your code**; the test's page shows its key. Ask for the version where the person meets it, with `trackVariant`: it returns the same version as `getVariant` and records who saw which one, so MRRocket can count the goal they reach later.
124
+
125
+ ```ts
126
+ // app/api/checkout/route.ts
127
+ import { getCockpitConfig, trackVariant } from "@mrrocket/sdk/next/server";
128
+
129
+ const config = await getCockpitConfig();
130
+ const version = await trackVariant("checkout-game-picture", { config, distinctId: user.id }); // "control" or "a"
131
+ const session = await stripe.checkout.sessions.create({ ...(version === "a" ? { line_items: withPicture } : { line_items }) });
132
+ ```
133
+
134
+ It needs the server key (`MRROCKET_SERVER_KEY`) next to the public key, sends nothing while the test is not running, and never holds the request longer than 2.5 seconds. Pass the same `distinctId` your app gives `identify()`, so the purchase or signup that follows counts for that person. Call it only for people your product may count, as for its other MRRocket events.
135
+
121
136
  With `consent="cookies"`, give first-time visitors their `ck_id` before the page renders. This writes a cookie, so only do it once the visitor agreed:
122
137
 
123
138
  ```ts
@@ -134,7 +149,7 @@ export function proxy(request: NextRequest) {
134
149
 
135
150
  ## 5. Cloudflare Workers (OpenNext)
136
151
 
137
- The server helpers (`getCockpitConfig`, `getVariant`, `getTexts`, `previewFrom`) and the proxy helper use only `fetch`, `AbortController` and plain objects, so they run on Node, the Edge runtime and Workers via `@opennextjs/cloudflare`. Put the two variables where `next build` reads them (`.env`, `.env.production`, or your CI environment), because Next.js inlines `NEXT_PUBLIC_*` during the build, not at request time.
152
+ The server helpers (`getCockpitConfig`, `getVariant`, `trackVariant`, `getTexts`, `previewFrom`) and the proxy helper use only `fetch`, `AbortController` and plain objects, so they run on Node, the Edge runtime and Workers via `@opennextjs/cloudflare`. Put the two variables where `next build` reads them (`.env`, `.env.production`, or your CI environment), because Next.js inlines `NEXT_PUBLIC_*` during the build, not at request time.
138
153
 
139
154
  ## 6. Previews in MRRocket
140
155
 
@@ -217,12 +217,15 @@ export interface ChatSummary {
217
217
  subject: string;
218
218
  /** The newest message, its body cut to a preview. */
219
219
  last: ChatMessage | null;
220
+ /** Up to when the visitor read it, on any device (servers from 0.24.0). */
221
+ seenAt?: string;
220
222
  }
221
223
  /** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */
222
224
  export interface ChatThread {
223
225
  conversation: {
224
226
  id: string;
225
227
  status: "open" | "solved";
228
+ seenAt?: string;
226
229
  } | null;
227
230
  messages: ChatMessage[];
228
231
  /** All the visitor's conversations, the latest activity first (0.19). */
@@ -309,6 +312,10 @@ export declare const createApi: (c: Conn) => {
309
312
  attachments?: string[];
310
313
  context?: ChatContext;
311
314
  }) => Promise<ChatThread>;
315
+ /** The visitor read a chat up to `at` (the newest message they saw): MRRocket counts it read on every device and shows "Seen" to the team (0.24.0). */
316
+ seenChat: (conversation: string, at: string) => Promise<{
317
+ seenAt: string | null;
318
+ }>;
312
319
  /** Uploads one picked file for the next message (pictures and PDFs, at most 10 MB); answers its upload id. */
313
320
  uploadChatFile: (file: ChatUpload, signal?: AbortSignal) => Promise<ChatFile>;
314
321
  /** Where a sent file of this visitor's chat is read (an image's src, a PDF's link). */
@@ -102,6 +102,8 @@ var createApi = (c) => {
102
102
  * the chat it answers, or "new" to start one; without it, the running chat or else a new one.
103
103
  */
104
104
  sendChat: (m) => post("/messages", { ...m, aiLabel: true }),
105
+ /** The visitor read a chat up to `at` (the newest message they saw): MRRocket counts it read on every device and shows "Seen" to the team (0.24.0). */
106
+ seenChat: (conversation, at) => post("/messages/seen", { conversation, at, user: void 0 }),
105
107
  /** Uploads one picked file for the next message (pictures and PDFs, at most 10 MB); answers its upload id. */
106
108
  uploadChatFile: (file, signal) => {
107
109
  const form = new FormData();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api-client.ts"],"sourcesContent":["/**\n * The SDK's fetch client and the shapes it reads, without React, so the script tag's widgets (src/script) use it too.\n * `./api` re-exports all of it with the `useApi` hook.\n */\nimport { warnUnsigned } from \"./identity\";\nimport { currentLocale, t } from \"./i18n\";\n\nexport type PostStatus = \"review\" | \"planned\" | \"progress\" | \"shipped\";\n\n/** Read at the moment it is shown, so it follows the visitor's language. */\nexport const STATUS_LABEL: Record<PostStatus, string> = {\n get review() {\n return t(\"Under review\");\n },\n get planned() {\n return t(\"Planned\");\n },\n get progress() {\n return t(\"In progress\");\n },\n get shipped() {\n return t(\"Shipped\");\n },\n};\n\nexport interface FeedbackBoardInfo {\n id: string;\n label: string;\n}\n\nexport interface FeedbackPost {\n id: string;\n title: string;\n body: string;\n board: string;\n status: PostStatus;\n votes: number;\n comments: number;\n voted: boolean;\n createdAt: string;\n /** \"Lena K.\", \"Anonymous\" or \"Team\". Missing from servers before SDK 0.6. */\n author?: string;\n}\n\n/** The product's public face for the board's header. */\nexport interface FeedbackProduct {\n name: string;\n logo: string | null;\n /** The domain's favicon, tried when `logo` does not load. Older servers leave it out. */\n logoFallback?: string | null;\n}\n\nexport interface FeedbackList {\n boards: FeedbackBoardInfo[];\n posts: FeedbackPost[];\n product?: FeedbackProduct;\n}\n\nexport interface FeedbackRoadmap {\n /** `review` (Backlog) comes from servers of SDK 0.6 on. */\n columns: { review?: FeedbackPost[]; planned: FeedbackPost[]; progress: FeedbackPost[]; shipped: FeedbackPost[] };\n}\n\nexport interface ChangelogEntry {\n id: string;\n title: string;\n body: string;\n publishedAt: string;\n}\n\nexport interface FeedbackComment {\n id: string;\n body: string;\n author: string;\n isTeam: boolean;\n postedAt: string;\n}\n\nexport type SurveyQuestionKind = \"nps\" | \"rating\" | \"single\" | \"multi\" | \"text\";\n\nexport interface SurveyQuestion {\n key: string;\n kind: SurveyQuestionKind;\n title: string;\n description?: string;\n required: boolean;\n options?: string[];\n /**\n * 0.21.0: what each option says in the visitor's language, parallel to `options`. An answer is still recorded as the\n * `options` value, so rules and numbers do not split by language.\n */\n labels?: string[];\n scale?: number;\n low?: string;\n high?: string;\n placeholder?: string;\n}\n\nexport interface SurveyDefinition {\n id: string;\n name: string;\n type: string;\n thanks: string;\n questions: SurveyQuestion[];\n}\n\nexport type SurveyAnswer = number | string | string[];\n\n/** A file in the messenger's chat: a screenshot, a photo or a PDF the visitor sent (servers from SDK 0.15 on). */\nexport interface ChatFile {\n /** From an upload: the signed id a message sends. In a message: the file's own id (`attachmentUrl` reads it). */\n id: string;\n name: string;\n type: \"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/gif\" | \"application/pdf\";\n /** Bytes. */\n size: number;\n}\n\n/** What the messenger can send: pictures and PDFs, at most 10 MB each, 4 per message. */\nexport const CHAT_FILE_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\", \"application/pdf\"] as const;\nexport const CHAT_FILE_MAX_BYTES = 10 * 1024 * 1024;\nexport const CHAT_FILES_PER_MESSAGE = 4;\n\n/** A file to upload: a Blob or File on the web, the image picker's `{ uri, name, type }` in React Native. */\nexport type ChatUpload = Blob | { uri: string; name: string; type: string };\n\n/** The bug context a visitor message carries; the server fills browser and system from the user agent when left out. */\nexport interface ChatContext {\n browser?: string;\n os?: string;\n /** \"1440×900\". */\n viewport?: string;\n}\n\n/** One message of the messenger's chat. \"visitor\" is the person on the site; the rest come from the product's team. */\nexport interface ChatMessage {\n id: string;\n from: \"visitor\" | \"team\" | \"ai\" | \"auto\";\n body: string;\n at: string;\n /** Help articles an answer drew on (servers from SDK 0.9 on). */\n articles?: { id: string; title: string }[];\n /** Files sent with it (servers from SDK 0.15 on). */\n attachments?: ChatFile[];\n}\n\n/** A published help article in a list (the messenger's Help tab). */\nexport interface ArticleSummary {\n id: string;\n title: string;\n collection: string;\n excerpt: string;\n updatedAt: string;\n}\n\n/** A run of text inside an article block. Links are http(s), mailto or tel only. */\nexport interface ArticleSpan {\n text: string;\n href?: string;\n bold?: boolean;\n italic?: boolean;\n code?: boolean;\n}\n\n/** An article's content as blocks, written with textContent (never parsed as HTML). */\nexport type ArticleBlock =\n | { type: \"h2\" | \"h3\" | \"p\" | \"quote\"; spans: ArticleSpan[] }\n | { type: \"ul\" | \"ol\"; items: ArticleSpan[][] }\n | { type: \"code\"; text: string }\n | { type: \"hr\" };\n\nexport interface Article {\n id: string;\n title: string;\n collection: string;\n updatedAt: string;\n blocks: ArticleBlock[];\n}\n\n/** Where the chat button sits: a corner, the middle of the top or bottom edge, or the middle of a side. */\nexport type MessengerPosition = \"top-left\" | \"top-center\" | \"top-right\" | \"middle-left\" | \"middle-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\";\n\n/** How round the messenger is. */\nexport type MessengerCorners = \"round\" | \"soft\" | \"square\";\n\n/** The radii per corner style, in px: the panel or sheet, message bubbles (and their tail), cards, fields and buttons. */\nexport const CORNERS: Record<MessengerCorners, { panel: number; bubble: number; tail: number; card: number; field: number }> = {\n round: { panel: 22, bubble: 18, tail: 6, card: 16, field: 20 },\n soft: { panel: 14, bubble: 12, tail: 4, card: 10, field: 10 },\n square: { panel: 6, bubble: 6, tail: 2, card: 4, field: 4 },\n};\n\n/** The messenger's look and texts as set in MRRocket › Support › Messenger (servers from SDK 0.9 on). */\nexport interface MessengerLook {\n accent: string;\n /** Up to two more colors blended into Home's background glow (MRRocket from 0.16; older servers leave it out). */\n glow?: string[];\n theme: \"light\" | \"dark\" | \"auto\";\n position: MessengerPosition;\n title: string;\n greeting: string;\n label: string;\n /** How soon the team usually answers (MRRocket from 0.10; older servers leave it out). */\n replyTime?: \"minutes\" | \"hours\" | \"day\";\n /** A round chat button in the app (React Native) too. */\n appLauncher?: boolean;\n help: boolean;\n /** The Updates tab with the published changelog (MRRocket from 0.22; older servers leave it out). */\n updates?: boolean;\n sound: boolean;\n preview: boolean;\n askEmail: boolean;\n /** How round panel, bubbles, cards and fields are (MRRocket from 0.15; older servers leave it out: round). */\n corners?: MessengerCorners;\n /** The site's own font (the default) or the system's (web only; from 0.15). */\n font?: \"site\" | \"system\";\n /** Home's top: plain like the rest, or in the accent color (from 0.15; older servers leave it out: plain). */\n header?: \"plain\" | \"color\";\n /** \"Powered by MRRocket\" at the bottom; the server sends false only on plans that may hide it (from 0.15). */\n branding?: boolean;\n /** The logo at the top left of Home: the one uploaded in MRRocket, else the product's favicon; without it the title's first letter. */\n logo?: string;\n /** The product's favicon, the round mark in the chat's head (from 0.17; without it the title's first letter). */\n icon?: string;\n /** The AI agent's name on its answers (from 0.17; empty or left out: \"AI agent\"). */\n agentName?: string;\n /** The AI agent's picture beside its answers (from 0.17). */\n agentPhoto?: string;\n}\n\n/** The link behind \"Powered by MRRocket\". */\nexport const BRAND_URL = \"https://mrrocket.dev/?utm_source=messenger&utm_medium=powered-by\";\n\n/** The line under \"Send us a message\" and in the chat's head. */\nexport const replyLine = (time: MessengerLook[\"replyTime\"]) =>\n time === \"minutes\" ? t(\"We usually reply in a few minutes\") : time === \"day\" ? t(\"We usually reply within a day\") : t(\"We usually reply in a few hours\");\n\n/** Black or white, whichever reads better on the accent (a light custom color gets dark text). */\nexport const inkOn = (hex: string) => {\n const m = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);\n if (!m) return \"#ffffff\";\n const [r, g, b] = [m[1], m[2], m[3]].map((x) => {\n const c = parseInt(x, 16) / 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.45 ? \"#111214\" : \"#ffffff\";\n};\n\n/** One of the visitor's conversations in their list (0.19). */\nexport interface ChatSummary {\n id: string;\n status: \"open\" | \"solved\";\n /** The visitor's first words. */\n subject: string;\n /** The newest message, its body cut to a preview. */\n last: ChatMessage | null;\n}\n\n/** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */\nexport interface ChatThread {\n conversation: { id: string; status: \"open\" | \"solved\" } | null;\n messages: ChatMessage[];\n /** All the visitor's conversations, the latest activity first (0.19). */\n conversations?: ChatSummary[];\n /** The visitor gave an email already: the messenger stops asking. */\n hasEmail: boolean;\n}\n\n/**\n * For the count and the preview of unread answers, after a read: an answer the team took back and a conversation it\n * archived leave them. Of a conversation that is not on screen the list brings only the newest message, so an answer\n * newer than that one is gone.\n */\nexport const stillThere = (t: ChatThread, chats: ChatSummary[]) => (m: { id: string; at: string; chat: string }) => {\n if (m.chat === t.conversation?.id) return t.messages.some((x) => x.id === m.id);\n const last = chats.find((c) => c.id === m.chat)?.last;\n return !!last && m.at <= last.at;\n};\n\nexport class ApiError extends Error {\n status: number;\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n }\n}\n\ninterface Conn {\n host: string;\n apiKey: string;\n distinctId: string;\n user?: { id?: string; [key: string]: unknown };\n /**\n * The identity hash of `distinctId` (0.16.0, see identity.ts), sent with every request that names the visitor: a\n * JSON field next to `distinctId`, a query parameter, a form field. Leave it out for any other id.\n */\n userHash?: string;\n}\n\n// Not URLSearchParams: React Native's lacks `set` in older versions, and the apps use this client too.\n// `lang` goes along so the answer's words can be in the visitor's language; \"\" leaves it out.\nconst qs = (params: Record<string, string | undefined>, lang = currentLocale()) =>\n Object.entries({ ...params, lang })\n .filter((e): e is [string, string] => !!e[1])\n .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)\n .join(\"&\");\n\n/** A POST's address: its body names the visitor, the query only the language of the words in its answer. */\nconst withLang = (url: string) => {\n const q = qs({});\n return q ? `${url}?${q}` : url;\n};\n\nconst call = async <T>(url: string, init: RequestInit | undefined, signal?: AbortSignal): Promise<T> => {\n let res: Response;\n try {\n res = await fetch(url, {\n ...init,\n signal,\n // A form (a file upload) sets its own multipart type with the boundary.\n headers: typeof init?.body === \"string\" ? { \"content-type\": \"application/json\" } : undefined,\n });\n } catch (e) {\n if ((e as Error).name === \"AbortError\") throw e;\n throw new ApiError(t(\"Could not reach the server. Check your connection and try again.\"), 0);\n }\n if (!res.ok) {\n // A missing or wrong identity hash: the console says once how to sign the user id.\n warnUnsigned(res.status);\n let detail = \"\";\n try {\n detail = ((await res.json()) as { error?: string }).error ?? \"\";\n } catch {\n // Not JSON; the status is enough.\n }\n throw new ApiError(detail || (res.status === 429 ? t(\"Too many requests. Try again in a minute.\") : t(\"Something went wrong. Please try again.\")), res.status);\n }\n return (await res.json()) as T;\n};\n\n/** The small fetch client behind the widgets. Every read takes an AbortSignal so unmounting cancels it. */\nexport const createApi = (c: Conn) => {\n const base = `${c.host}/api/sdk`;\n const who = { key: c.apiKey, distinctId: c.distinctId, user: c.user, userHash: c.userHash };\n // Every query that names the visitor names its hash too.\n const me = { key: c.apiKey, distinctId: c.distinctId, userHash: c.userHash };\n const post = <T>(path: string, body: Record<string, unknown>, signal?: AbortSignal) =>\n call<T>(withLang(`${base}${path}`), { method: \"POST\", body: JSON.stringify({ ...who, ...body }) }, signal);\n return {\n list: (o: { board?: string; sort?: \"top\" | \"new\"; q?: string }, signal?: AbortSignal) =>\n call<FeedbackList>(`${base}/feedback?${qs({ ...me, board: o.board, sort: o.sort, q: o.q })}`, undefined, signal),\n post: (id: string, signal?: AbortSignal) =>\n call<FeedbackPost>(`${base}/feedback/${encodeURIComponent(id)}?${qs(me)}`, undefined, signal),\n roadmap: (signal?: AbortSignal) => call<FeedbackRoadmap>(`${base}/feedback/roadmap?${qs(me)}`, undefined, signal),\n changelog: (signal?: AbortSignal) => call<{ entries: ChangelogEntry[] }>(`${base}/feedback/changelog?${qs({ key: c.apiKey })}`, undefined, signal),\n submit: (p: { title: string; body?: string; board: string }) => post<FeedbackPost>(\"/feedback\", p),\n vote: (id: string) => post<{ voted: boolean; votes: number }>(`/feedback/${encodeURIComponent(id)}/vote`, {}),\n comments: (id: string, signal?: AbortSignal) =>\n call<{ comments: FeedbackComment[] }>(`${base}/feedback/${encodeURIComponent(id)}/comments?${qs({ key: c.apiKey })}`, undefined, signal),\n comment: (id: string, body: string) => post<FeedbackComment>(`/feedback/${encodeURIComponent(id)}/comments`, { body }),\n survey: (url: string, signal?: AbortSignal) =>\n call<{ survey: SurveyDefinition | null }>(`${base}/surveys?${qs({ ...me, url })}`, undefined, signal),\n seen: (id: string) => post<unknown>(`/surveys/${encodeURIComponent(id)}/seen`, { user: undefined }),\n respond: (id: string, r: { answers: Record<string, SurveyAnswer>; completed: boolean; seconds: number }) =>\n post<unknown>(`/surveys/${encodeURIComponent(id)}/respond`, r),\n /**\n * One chat by id, else the visitor's newest; `conversations` lists them all. `aiLabel`: the messenger says \"AI agent\"\n * beside an answer's name, so the answer comes without its AI notice line (from 0.22.0).\n */\n chat: (signal?: AbortSignal, conversation?: string) => call<ChatThread>(`${base}/messages?${qs({ ...me, conversation, aiLabel: \"1\" })}`, undefined, signal),\n /**\n * A message; `attachments` are upload ids from `uploadChatFile` (then the body may be empty). `conversation` is\n * the chat it answers, or \"new\" to start one; without it, the running chat or else a new one.\n */\n sendChat: (m: { body: string; conversation?: string; email?: string; url?: string; attachments?: string[]; context?: ChatContext }) => post<ChatThread>(\"/messages\", { ...m, aiLabel: true }),\n /** Uploads one picked file for the next message (pictures and PDFs, at most 10 MB); answers its upload id. */\n uploadChatFile: (file: ChatUpload, signal?: AbortSignal) => {\n const form = new FormData();\n form.append(\"key\", c.apiKey);\n form.append(\"distinctId\", c.distinctId);\n if (c.userHash) form.append(\"userHash\", c.userHash);\n if (\"uri\" in file) form.append(\"file\", file as unknown as Blob);\n else form.append(\"file\", file, (file as Blob & { name?: string }).name || \"file\");\n return call<ChatFile>(withLang(`${base}/messages/attachments`), { method: \"POST\", body: form }, signal);\n },\n /** Where a sent file of this visitor's chat is read (an image's src, a PDF's link). */\n attachmentUrl: (id: string) => `${base}/messages/attachments/${encodeURIComponent(id)}?${qs(me, \"\")}`,\n articles: (q?: string, signal?: AbortSignal) => call<{ articles: ArticleSummary[] }>(`${base}/articles?${qs({ key: c.apiKey, q })}`, undefined, signal),\n article: (id: string, signal?: AbortSignal) =>\n call<Article>(`${base}/articles/${encodeURIComponent(id)}?${qs(me)}`, undefined, signal),\n messengerLook: (signal?: AbortSignal) => call<MessengerLook>(`${base}/messenger?${qs({ key: c.apiKey })}`, undefined, signal),\n rateArticle: (id: string, helpful: boolean) => post<{ counted: boolean }>(`/articles/${encodeURIComponent(id)}/rate`, { helpful }),\n };\n};\n\nexport type Api = ReturnType<typeof createApi>;\n"],"mappings":";AAIA,SAAS,oBAAoB;AAC7B,SAAS,eAAe,SAAS;AAK1B,IAAM,eAA2C;AAAA,EACpD,IAAI,SAAS;AACT,WAAO,EAAE,cAAc;AAAA,EAC3B;AAAA,EACA,IAAI,UAAU;AACV,WAAO,EAAE,SAAS;AAAA,EACtB;AAAA,EACA,IAAI,WAAW;AACX,WAAO,EAAE,aAAa;AAAA,EAC1B;AAAA,EACA,IAAI,UAAU;AACV,WAAO,EAAE,SAAS;AAAA,EACtB;AACJ;AAgGO,IAAM,kBAAkB,CAAC,aAAa,cAAc,cAAc,aAAa,iBAAiB;AAChG,IAAM,sBAAsB,KAAK,OAAO;AACxC,IAAM,yBAAyB;AAiE/B,IAAM,UAAkH;AAAA,EAC3H,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W,MAAM;AAAA,IAC3F,eAAe,CAAC,WAAyB,KAAoB,GAAG,IAAI,cAAc,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,QAAW,MAAM;AAAA,IAC5H,aAAa,CAAC,IAAY,YAAqB,KAA2B,aAAa,mBAAmB,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;AAAA,EACrI;AACJ;","names":["t"]}
1
+ {"version":3,"sources":["../src/api-client.ts"],"sourcesContent":["/**\n * The SDK's fetch client and the shapes it reads, without React, so the script tag's widgets (src/script) use it too.\n * `./api` re-exports all of it with the `useApi` hook.\n */\nimport { warnUnsigned } from \"./identity\";\nimport { currentLocale, t } from \"./i18n\";\n\nexport type PostStatus = \"review\" | \"planned\" | \"progress\" | \"shipped\";\n\n/** Read at the moment it is shown, so it follows the visitor's language. */\nexport const STATUS_LABEL: Record<PostStatus, string> = {\n get review() {\n return t(\"Under review\");\n },\n get planned() {\n return t(\"Planned\");\n },\n get progress() {\n return t(\"In progress\");\n },\n get shipped() {\n return t(\"Shipped\");\n },\n};\n\nexport interface FeedbackBoardInfo {\n id: string;\n label: string;\n}\n\nexport interface FeedbackPost {\n id: string;\n title: string;\n body: string;\n board: string;\n status: PostStatus;\n votes: number;\n comments: number;\n voted: boolean;\n createdAt: string;\n /** \"Lena K.\", \"Anonymous\" or \"Team\". Missing from servers before SDK 0.6. */\n author?: string;\n}\n\n/** The product's public face for the board's header. */\nexport interface FeedbackProduct {\n name: string;\n logo: string | null;\n /** The domain's favicon, tried when `logo` does not load. Older servers leave it out. */\n logoFallback?: string | null;\n}\n\nexport interface FeedbackList {\n boards: FeedbackBoardInfo[];\n posts: FeedbackPost[];\n product?: FeedbackProduct;\n}\n\nexport interface FeedbackRoadmap {\n /** `review` (Backlog) comes from servers of SDK 0.6 on. */\n columns: { review?: FeedbackPost[]; planned: FeedbackPost[]; progress: FeedbackPost[]; shipped: FeedbackPost[] };\n}\n\nexport interface ChangelogEntry {\n id: string;\n title: string;\n body: string;\n publishedAt: string;\n}\n\nexport interface FeedbackComment {\n id: string;\n body: string;\n author: string;\n isTeam: boolean;\n postedAt: string;\n}\n\nexport type SurveyQuestionKind = \"nps\" | \"rating\" | \"single\" | \"multi\" | \"text\";\n\nexport interface SurveyQuestion {\n key: string;\n kind: SurveyQuestionKind;\n title: string;\n description?: string;\n required: boolean;\n options?: string[];\n /**\n * 0.21.0: what each option says in the visitor's language, parallel to `options`. An answer is still recorded as the\n * `options` value, so rules and numbers do not split by language.\n */\n labels?: string[];\n scale?: number;\n low?: string;\n high?: string;\n placeholder?: string;\n}\n\nexport interface SurveyDefinition {\n id: string;\n name: string;\n type: string;\n thanks: string;\n questions: SurveyQuestion[];\n}\n\nexport type SurveyAnswer = number | string | string[];\n\n/** A file in the messenger's chat: a screenshot, a photo or a PDF the visitor sent (servers from SDK 0.15 on). */\nexport interface ChatFile {\n /** From an upload: the signed id a message sends. In a message: the file's own id (`attachmentUrl` reads it). */\n id: string;\n name: string;\n type: \"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/gif\" | \"application/pdf\";\n /** Bytes. */\n size: number;\n}\n\n/** What the messenger can send: pictures and PDFs, at most 10 MB each, 4 per message. */\nexport const CHAT_FILE_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\", \"application/pdf\"] as const;\nexport const CHAT_FILE_MAX_BYTES = 10 * 1024 * 1024;\nexport const CHAT_FILES_PER_MESSAGE = 4;\n\n/** A file to upload: a Blob or File on the web, the image picker's `{ uri, name, type }` in React Native. */\nexport type ChatUpload = Blob | { uri: string; name: string; type: string };\n\n/** The bug context a visitor message carries; the server fills browser and system from the user agent when left out. */\nexport interface ChatContext {\n browser?: string;\n os?: string;\n /** \"1440×900\". */\n viewport?: string;\n}\n\n/** One message of the messenger's chat. \"visitor\" is the person on the site; the rest come from the product's team. */\nexport interface ChatMessage {\n id: string;\n from: \"visitor\" | \"team\" | \"ai\" | \"auto\";\n body: string;\n at: string;\n /** Help articles an answer drew on (servers from SDK 0.9 on). */\n articles?: { id: string; title: string }[];\n /** Files sent with it (servers from SDK 0.15 on). */\n attachments?: ChatFile[];\n}\n\n/** A published help article in a list (the messenger's Help tab). */\nexport interface ArticleSummary {\n id: string;\n title: string;\n collection: string;\n excerpt: string;\n updatedAt: string;\n}\n\n/** A run of text inside an article block. Links are http(s), mailto or tel only. */\nexport interface ArticleSpan {\n text: string;\n href?: string;\n bold?: boolean;\n italic?: boolean;\n code?: boolean;\n}\n\n/** An article's content as blocks, written with textContent (never parsed as HTML). */\nexport type ArticleBlock =\n | { type: \"h2\" | \"h3\" | \"p\" | \"quote\"; spans: ArticleSpan[] }\n | { type: \"ul\" | \"ol\"; items: ArticleSpan[][] }\n | { type: \"code\"; text: string }\n | { type: \"hr\" };\n\nexport interface Article {\n id: string;\n title: string;\n collection: string;\n updatedAt: string;\n blocks: ArticleBlock[];\n}\n\n/** Where the chat button sits: a corner, the middle of the top or bottom edge, or the middle of a side. */\nexport type MessengerPosition = \"top-left\" | \"top-center\" | \"top-right\" | \"middle-left\" | \"middle-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\";\n\n/** How round the messenger is. */\nexport type MessengerCorners = \"round\" | \"soft\" | \"square\";\n\n/** The radii per corner style, in px: the panel or sheet, message bubbles (and their tail), cards, fields and buttons. */\nexport const CORNERS: Record<MessengerCorners, { panel: number; bubble: number; tail: number; card: number; field: number }> = {\n round: { panel: 22, bubble: 18, tail: 6, card: 16, field: 20 },\n soft: { panel: 14, bubble: 12, tail: 4, card: 10, field: 10 },\n square: { panel: 6, bubble: 6, tail: 2, card: 4, field: 4 },\n};\n\n/** The messenger's look and texts as set in MRRocket › Support › Messenger (servers from SDK 0.9 on). */\nexport interface MessengerLook {\n accent: string;\n /** Up to two more colors blended into Home's background glow (MRRocket from 0.16; older servers leave it out). */\n glow?: string[];\n theme: \"light\" | \"dark\" | \"auto\";\n position: MessengerPosition;\n title: string;\n greeting: string;\n label: string;\n /** How soon the team usually answers (MRRocket from 0.10; older servers leave it out). */\n replyTime?: \"minutes\" | \"hours\" | \"day\";\n /** A round chat button in the app (React Native) too. */\n appLauncher?: boolean;\n help: boolean;\n /** The Updates tab with the published changelog (MRRocket from 0.22; older servers leave it out). */\n updates?: boolean;\n sound: boolean;\n preview: boolean;\n askEmail: boolean;\n /** How round panel, bubbles, cards and fields are (MRRocket from 0.15; older servers leave it out: round). */\n corners?: MessengerCorners;\n /** The site's own font (the default) or the system's (web only; from 0.15). */\n font?: \"site\" | \"system\";\n /** Home's top: plain like the rest, or in the accent color (from 0.15; older servers leave it out: plain). */\n header?: \"plain\" | \"color\";\n /** \"Powered by MRRocket\" at the bottom; the server sends false only on plans that may hide it (from 0.15). */\n branding?: boolean;\n /** The logo at the top left of Home: the one uploaded in MRRocket, else the product's favicon; without it the title's first letter. */\n logo?: string;\n /** The product's favicon, the round mark in the chat's head (from 0.17; without it the title's first letter). */\n icon?: string;\n /** The AI agent's name on its answers (from 0.17; empty or left out: \"AI agent\"). */\n agentName?: string;\n /** The AI agent's picture beside its answers (from 0.17). */\n agentPhoto?: string;\n}\n\n/** The link behind \"Powered by MRRocket\". */\nexport const BRAND_URL = \"https://mrrocket.dev/?utm_source=messenger&utm_medium=powered-by\";\n\n/** The line under \"Send us a message\" and in the chat's head. */\nexport const replyLine = (time: MessengerLook[\"replyTime\"]) =>\n time === \"minutes\" ? t(\"We usually reply in a few minutes\") : time === \"day\" ? t(\"We usually reply within a day\") : t(\"We usually reply in a few hours\");\n\n/** Black or white, whichever reads better on the accent (a light custom color gets dark text). */\nexport const inkOn = (hex: string) => {\n const m = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);\n if (!m) return \"#ffffff\";\n const [r, g, b] = [m[1], m[2], m[3]].map((x) => {\n const c = parseInt(x, 16) / 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.45 ? \"#111214\" : \"#ffffff\";\n};\n\n/** One of the visitor's conversations in their list (0.19). */\nexport interface ChatSummary {\n id: string;\n status: \"open\" | \"solved\";\n /** The visitor's first words. */\n subject: string;\n /** The newest message, its body cut to a preview. */\n last: ChatMessage | null;\n /** Up to when the visitor read it, on any device (servers from 0.24.0). */\n seenAt?: string;\n}\n\n/** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */\nexport interface ChatThread {\n conversation: { id: string; status: \"open\" | \"solved\"; seenAt?: string } | null;\n messages: ChatMessage[];\n /** All the visitor's conversations, the latest activity first (0.19). */\n conversations?: ChatSummary[];\n /** The visitor gave an email already: the messenger stops asking. */\n hasEmail: boolean;\n}\n\n/**\n * For the count and the preview of unread answers, after a read: an answer the team took back and a conversation it\n * archived leave them. Of a conversation that is not on screen the list brings only the newest message, so an answer\n * newer than that one is gone.\n */\nexport const stillThere = (t: ChatThread, chats: ChatSummary[]) => (m: { id: string; at: string; chat: string }) => {\n if (m.chat === t.conversation?.id) return t.messages.some((x) => x.id === m.id);\n const last = chats.find((c) => c.id === m.chat)?.last;\n return !!last && m.at <= last.at;\n};\n\nexport class ApiError extends Error {\n status: number;\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n }\n}\n\ninterface Conn {\n host: string;\n apiKey: string;\n distinctId: string;\n user?: { id?: string; [key: string]: unknown };\n /**\n * The identity hash of `distinctId` (0.16.0, see identity.ts), sent with every request that names the visitor: a\n * JSON field next to `distinctId`, a query parameter, a form field. Leave it out for any other id.\n */\n userHash?: string;\n}\n\n// Not URLSearchParams: React Native's lacks `set` in older versions, and the apps use this client too.\n// `lang` goes along so the answer's words can be in the visitor's language; \"\" leaves it out.\nconst qs = (params: Record<string, string | undefined>, lang = currentLocale()) =>\n Object.entries({ ...params, lang })\n .filter((e): e is [string, string] => !!e[1])\n .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)\n .join(\"&\");\n\n/** A POST's address: its body names the visitor, the query only the language of the words in its answer. */\nconst withLang = (url: string) => {\n const q = qs({});\n return q ? `${url}?${q}` : url;\n};\n\nconst call = async <T>(url: string, init: RequestInit | undefined, signal?: AbortSignal): Promise<T> => {\n let res: Response;\n try {\n res = await fetch(url, {\n ...init,\n signal,\n // A form (a file upload) sets its own multipart type with the boundary.\n headers: typeof init?.body === \"string\" ? { \"content-type\": \"application/json\" } : undefined,\n });\n } catch (e) {\n if ((e as Error).name === \"AbortError\") throw e;\n throw new ApiError(t(\"Could not reach the server. Check your connection and try again.\"), 0);\n }\n if (!res.ok) {\n // A missing or wrong identity hash: the console says once how to sign the user id.\n warnUnsigned(res.status);\n let detail = \"\";\n try {\n detail = ((await res.json()) as { error?: string }).error ?? \"\";\n } catch {\n // Not JSON; the status is enough.\n }\n throw new ApiError(detail || (res.status === 429 ? t(\"Too many requests. Try again in a minute.\") : t(\"Something went wrong. Please try again.\")), res.status);\n }\n return (await res.json()) as T;\n};\n\n/** The small fetch client behind the widgets. Every read takes an AbortSignal so unmounting cancels it. */\nexport const createApi = (c: Conn) => {\n const base = `${c.host}/api/sdk`;\n const who = { key: c.apiKey, distinctId: c.distinctId, user: c.user, userHash: c.userHash };\n // Every query that names the visitor names its hash too.\n const me = { key: c.apiKey, distinctId: c.distinctId, userHash: c.userHash };\n const post = <T>(path: string, body: Record<string, unknown>, signal?: AbortSignal) =>\n call<T>(withLang(`${base}${path}`), { method: \"POST\", body: JSON.stringify({ ...who, ...body }) }, signal);\n return {\n list: (o: { board?: string; sort?: \"top\" | \"new\"; q?: string }, signal?: AbortSignal) =>\n call<FeedbackList>(`${base}/feedback?${qs({ ...me, board: o.board, sort: o.sort, q: o.q })}`, undefined, signal),\n post: (id: string, signal?: AbortSignal) =>\n call<FeedbackPost>(`${base}/feedback/${encodeURIComponent(id)}?${qs(me)}`, undefined, signal),\n roadmap: (signal?: AbortSignal) => call<FeedbackRoadmap>(`${base}/feedback/roadmap?${qs(me)}`, undefined, signal),\n changelog: (signal?: AbortSignal) => call<{ entries: ChangelogEntry[] }>(`${base}/feedback/changelog?${qs({ key: c.apiKey })}`, undefined, signal),\n submit: (p: { title: string; body?: string; board: string }) => post<FeedbackPost>(\"/feedback\", p),\n vote: (id: string) => post<{ voted: boolean; votes: number }>(`/feedback/${encodeURIComponent(id)}/vote`, {}),\n comments: (id: string, signal?: AbortSignal) =>\n call<{ comments: FeedbackComment[] }>(`${base}/feedback/${encodeURIComponent(id)}/comments?${qs({ key: c.apiKey })}`, undefined, signal),\n comment: (id: string, body: string) => post<FeedbackComment>(`/feedback/${encodeURIComponent(id)}/comments`, { body }),\n survey: (url: string, signal?: AbortSignal) =>\n call<{ survey: SurveyDefinition | null }>(`${base}/surveys?${qs({ ...me, url })}`, undefined, signal),\n seen: (id: string) => post<unknown>(`/surveys/${encodeURIComponent(id)}/seen`, { user: undefined }),\n respond: (id: string, r: { answers: Record<string, SurveyAnswer>; completed: boolean; seconds: number }) =>\n post<unknown>(`/surveys/${encodeURIComponent(id)}/respond`, r),\n /**\n * One chat by id, else the visitor's newest; `conversations` lists them all. `aiLabel`: the messenger says \"AI agent\"\n * beside an answer's name, so the answer comes without its AI notice line (from 0.22.0).\n */\n chat: (signal?: AbortSignal, conversation?: string) => call<ChatThread>(`${base}/messages?${qs({ ...me, conversation, aiLabel: \"1\" })}`, undefined, signal),\n /**\n * A message; `attachments` are upload ids from `uploadChatFile` (then the body may be empty). `conversation` is\n * the chat it answers, or \"new\" to start one; without it, the running chat or else a new one.\n */\n sendChat: (m: { body: string; conversation?: string; email?: string; url?: string; attachments?: string[]; context?: ChatContext }) => post<ChatThread>(\"/messages\", { ...m, aiLabel: true }),\n /** The visitor read a chat up to `at` (the newest message they saw): MRRocket counts it read on every device and shows \"Seen\" to the team (0.24.0). */\n seenChat: (conversation: string, at: string) => post<{ seenAt: string | null }>(\"/messages/seen\", { conversation, at, user: undefined }),\n /** Uploads one picked file for the next message (pictures and PDFs, at most 10 MB); answers its upload id. */\n uploadChatFile: (file: ChatUpload, signal?: AbortSignal) => {\n const form = new FormData();\n form.append(\"key\", c.apiKey);\n form.append(\"distinctId\", c.distinctId);\n if (c.userHash) form.append(\"userHash\", c.userHash);\n if (\"uri\" in file) form.append(\"file\", file as unknown as Blob);\n else form.append(\"file\", file, (file as Blob & { name?: string }).name || \"file\");\n return call<ChatFile>(withLang(`${base}/messages/attachments`), { method: \"POST\", body: form }, signal);\n },\n /** Where a sent file of this visitor's chat is read (an image's src, a PDF's link). */\n attachmentUrl: (id: string) => `${base}/messages/attachments/${encodeURIComponent(id)}?${qs(me, \"\")}`,\n articles: (q?: string, signal?: AbortSignal) => call<{ articles: ArticleSummary[] }>(`${base}/articles?${qs({ key: c.apiKey, q })}`, undefined, signal),\n article: (id: string, signal?: AbortSignal) =>\n call<Article>(`${base}/articles/${encodeURIComponent(id)}?${qs(me)}`, undefined, signal),\n messengerLook: (signal?: AbortSignal) => call<MessengerLook>(`${base}/messenger?${qs({ key: c.apiKey })}`, undefined, signal),\n rateArticle: (id: string, helpful: boolean) => post<{ counted: boolean }>(`/articles/${encodeURIComponent(id)}/rate`, { helpful }),\n };\n};\n\nexport type Api = ReturnType<typeof createApi>;\n"],"mappings":";AAIA,SAAS,oBAAoB;AAC7B,SAAS,eAAe,SAAS;AAK1B,IAAM,eAA2C;AAAA,EACpD,IAAI,SAAS;AACT,WAAO,EAAE,cAAc;AAAA,EAC3B;AAAA,EACA,IAAI,UAAU;AACV,WAAO,EAAE,SAAS;AAAA,EACtB;AAAA,EACA,IAAI,WAAW;AACX,WAAO,EAAE,aAAa;AAAA,EAC1B;AAAA,EACA,IAAI,UAAU;AACV,WAAO,EAAE,SAAS;AAAA,EACtB;AACJ;AAgGO,IAAM,kBAAkB,CAAC,aAAa,cAAc,cAAc,aAAa,iBAAiB;AAChG,IAAM,sBAAsB,KAAK,OAAO;AACxC,IAAM,yBAAyB;AAiE/B,IAAM,UAAkH;AAAA,EAC3H,OAAO,EAAE,OAAO,IAAI,QAAQ,IAAI,MAAM,GAAG,MAAM,IAAI,OAAO,GAAG;AAAA,EAC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AC,IAAI,QAAW,MAAM;AAAA,IAC3F,eAAe,CAAC,WAAyB,KAAoB,GAAG,IAAI,cAAc,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,QAAW,MAAM;AAAA,IAC5H,aAAa,CAAC,IAAY,YAAqB,KAA2B,aAAa,mBAAmB,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;AAAA,EACrI;AACJ;","names":["t"]}
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var Fe=()=>{try{return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return false}},ae=["#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899"],Pe=(e,t)=>{e.beginPath();for(let o=0;o<10;o++){let s=Math.PI/5*o-Math.PI/2,c=o%2?t*.45:t;e[o?"lineTo":"moveTo"](Math.cos(s)*c,Math.sin(s)*c);}e.closePath(),e.fill();},Ee=(e,t,o,s)=>{let c=(d,w)=>d+Math.random()*(w-d),m=()=>s[Math.floor(Math.random()*s.length)],h=[];if(e==="confetti")for(let d=0;d<110;d++){let w=d%2===0;h.push({x:w?t*.15:t*.85,y:o*.95,vx:(w?1:-1)*c(.12,.42)*(t/900+.4),vy:-c(.75,1.25)*(o/900+.35),r:c(4,7),spin:c(-0.02,.02),angle:c(0,Math.PI),color:m(),born:c(0,180),life:c(1500,2100),shape:"rect"});}else if(e==="fireworks")for(let d=0;d<4;d++){let w=c(t*.2,t*.8),l=c(o*.18,o*.5),x=m();for(let k=0;k<46;k++){let M=Math.PI*2*k/46+c(-0.05,.05),E=c(.12,.3)*(Math.min(t,o)/600+.5);h.push({x:w,y:l,vx:Math.cos(M)*E,vy:Math.sin(M)*E,r:c(1.6,2.6),spin:0,angle:0,color:x,born:d*320,life:c(900,1300),shape:"dot"});}}else for(let d=0;d<34;d++)h.push({x:c(t*.08,t*.92),y:c(o*.2,o*.85),vx:0,vy:-c(.02,.06),r:c(6,13),spin:c(-4e-3,.004),angle:c(0,Math.PI),color:m(),born:c(0,700),life:c(900,1300),shape:"star"});return h},ce=(e,t={})=>{if(!e||e==="none"||typeof document=="undefined"||!t.force&&Fe())return ()=>{};let o=document.createElement("canvas");o.setAttribute("aria-hidden","true");let s=t.host;o.style.cssText=s?"position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5":"position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:2147483003",(s!=null?s:document.body).appendChild(o);let c=s?s.clientWidth:window.innerWidth,m=s?s.clientHeight:window.innerHeight,h=Math.min(2,window.devicePixelRatio||1);o.width=Math.max(1,Math.round(c*h)),o.height=Math.max(1,Math.round(m*h));let d=o.getContext("2d");if(!d)return o.remove(),()=>{};let w=t.accent?[t.accent,t.accent,...ae]:ae,l=Ee(e,c,m,w),x=Math.max(...l.map(z=>z.born+z.life)),k=e==="confetti"?.0016:e==="fireworks"?35e-5:0,M=0,E=0,H=false,I=()=>{H||(H=true,cancelAnimationFrame(M),o.remove());},N=z=>{if(H)return;E||(E=z);let V=z-E;d.setTransform(h,0,0,h,0,0),d.clearRect(0,0,c,m);for(let y of l){let P=V-y.born;if(P<0||P>y.life)continue;let q=y.x+y.vx*P,R=y.y+y.vy*P+.5*k*P*P,r=Math.min(1,(y.life-P)/350);if(d.save(),d.globalAlpha=Math.max(0,r),d.translate(q,R),d.rotate(y.angle+y.spin*P),d.fillStyle=y.color,y.shape==="rect")d.fillRect(-y.r,-y.r/2.2,y.r*2,y.r/1.1);else if(y.shape==="dot")d.beginPath(),d.arc(0,0,y.r,0,Math.PI*2),d.fill();else {let i=Math.min(1,P/220);Pe(d,y.r*(i<1?i:1-Math.max(0,(P-y.life*.6)/(y.life*.4))*.6));}d.restore();}V<x?M=requestAnimationFrame(N):I();};return M=requestAnimationFrame(N),I};var Y=globalThis,le,K=(le=Y.__mrrocketI18n)!=null?le:Y.__mrrocketI18n={version:0,onWords:new Set,onLocale:new Set};var f=e=>{var t;return ((t=K.words)==null?void 0:t[e])||e},T=(e,t)=>f(e).replace(/\{(\w+)\}/g,(o,s)=>s in t?String(t[s]):o);var de=()=>{var e,t;return (t=(e=K.locale)!=null?e:K.device)!=null?t:typeof navigator!="undefined"&&navigator.language||void 0};var fe=()=>K.lang;var J=e=>(K.onWords.add(e),()=>{K.onWords.delete(e);});var U="other:",Q=e=>{var s,c;let t=(s=e==null?void 0:e.min)!=null?s:0,o=(c=e==null?void 0:e.max)!=null?c:10;return Array.from({length:Math.max(0,Math.min(o-t,20)+1)},(m,h)=>t+h)},pe=(e,t)=>{var o;return !e||t==null?false:e.type==="choice"?e.other&&t.startsWith(U)?t.slice(U.length).trim().length>0:((o=e.options)!=null?o:[]).some(s=>s.id===t):e.type==="scale"?Q(e).some(s=>String(s)===t):t.trim().length>0&&t.length<=500};var X=e=>{let t=(e!=null?e:"").trim();if(!/^https?:\/\//i.test(t))return null;let o=t.match(/^https?:\/\/(?:www\.|m\.)?(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/|youtube-nocookie\.com\/embed\/)([\w-]{6,20})/i);return o?{kind:"iframe",src:`https://www.youtube-nocookie.com/embed/${o[1]}?rel=0`}:(o=t.match(/^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{4,12})/i),o?{kind:"iframe",src:`https://player.vimeo.com/video/${o[1]}?dnt=1`}:(o=t.match(/^https?:\/\/(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]{8,64})/i),o?{kind:"iframe",src:`https://www.loom.com/embed/${o[1]}`}:/\.(mp4|webm|mov|m4v)(\?|#|$)/i.test(t)||/\/media\/uploads\//.test(t)?{kind:"file",src:t}:null))},ue=e=>{var o;let t=e.media;if(!(!t||t.kind!=="image"&&t.kind!=="video"||!/^https?:\/\//i.test((o=t.url)!=null?o:"")))return t.kind==="video"&&!X(t.url)?void 0:t};var ge=(e,t)=>Math.round(e*(1-t/100)*100)/100,G=(e,t)=>{try{return new Intl.NumberFormat(de(),{style:"currency",currency:t}).format(e)}catch(o){return `${e.toFixed(2)} ${t}`}},me=e=>e.kind==="contact"?f("Send to the team"):e.kind==="pause"?f("Pause instead"):e.kind==="downgrade"?f("Switch plan"):f("Accept offer"),Z=e=>e===1?f("1 month"):T("{n} months",{n:e}),ee=e=>T("for {months}",{months:Z(e)});var B={check:{label:"Check",paths:["M5 12.5l4.5 4.5L19 7.5"],emoji:"\u2705"},star:{label:"Star",paths:["M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z"],emoji:"\u2B50"},rocket:{label:"Rocket",paths:["M12 3c3 2 4.5 5.5 4 10l-2 3h-4l-2-3c-.5-4.5 1-8 4-10z","M8 13.5l-3 3 3.5.5","M16 13.5l3 3-3.5.5","M13.5 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z","M11 19.5v1.5M13 19.5v1.5"],emoji:"\u{1F680}"},user:{label:"Person",paths:["M15.5 8a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z","M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5"],emoji:"\u{1F464}"},users:{label:"Team",paths:["M13 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z","M3.5 19c.6-3 3-4.8 6.5-4.8s5.9 1.8 6.5 4.8","M16 5.2a3 3 0 0 1 0 5.6","M18 14.6c1.5.6 2.4 2 2.7 4.4"],emoji:"\u{1F465}"},settings:{label:"Settings",paths:["M12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7","M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0z","M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"],emoji:"\u2699\uFE0F"},bell:{label:"Bell",paths:["M6 16v-5a6 6 0 0 1 12 0v5l1.5 2h-15z","M10 20.5a2 2 0 0 0 4 0"],emoji:"\u{1F514}"},mail:{label:"Mail",paths:["M4 6h16v12H4z","M4 7l8 6 8-6"],emoji:"\u2709\uFE0F"},chat:{label:"Chat",paths:["M4 5h16v11H9l-5 4z"],emoji:"\u{1F4AC}"},heart:{label:"Heart",paths:["M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"],emoji:"\u2764\uFE0F"},flag:{label:"Flag",paths:["M5 21V4","M5 4h11l-2 4 2 4H5"],emoji:"\u{1F6A9}"},bolt:{label:"Bolt",paths:["M13 3L5 13.5h6L10 21l8-10.5h-6z"],emoji:"\u26A1"},book:{label:"Book",paths:["M4 5.5C6.5 4 9.5 4 12 6c2.5-2 5.5-2 8-.5V19c-2.5-1.5-5.5-1.5-8 .5-2.5-2-5.5-2-8-.5z","M12 6v13.5"],emoji:"\u{1F4D6}"},calendar:{label:"Calendar",paths:["M4 6h16v14H4z","M4 10h16","M8 3.5v4M16 3.5v4"],emoji:"\u{1F4C5}"},camera:{label:"Camera",paths:["M4 8h3.5L9 5.5h6L16.5 8H20v11H4z","M15.5 13a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z"],emoji:"\u{1F4F7}"},cart:{label:"Cart",paths:["M3.5 4.5H6l2 10h10l2-7H7","M9.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z","M18.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"],emoji:"\u{1F6D2}"},chart:{label:"Chart",paths:["M4 20h16","M7 16v-4M12 16V8M17 16V9"],emoji:"\u{1F4CA}"},gift:{label:"Gift",paths:["M4 10h16v10H4z","M3 7h18v3H3z","M12 7v13","M12 7c-1.5-3-5-3-5-1s3.5 1 5 1z","M12 7c1.5-3 5-3 5-1s-3.5 1-5 1z"],emoji:"\u{1F381}"},home:{label:"Home",paths:["M4 11l8-7 8 7","M6 9.5V20h12V9.5","M10 20v-6h4v6"],emoji:"\u{1F3E0}"},link:{label:"Link",paths:["M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1","M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"],emoji:"\u{1F517}"},lock:{label:"Lock",paths:["M6 11h12v9H6z","M8.5 11V8a3.5 3.5 0 0 1 7 0v3"],emoji:"\u{1F512}"},pencil:{label:"Pencil",paths:["M4 20l1-4L16 5l3 3L8 19z","M14 7l3 3"],emoji:"\u270F\uFE0F"},plus:{label:"Plus",paths:["M12 5v14M5 12h14"],emoji:"\u2795"},search:{label:"Search",paths:["M16 10.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z","M14.5 14.5L20 20"],emoji:"\u{1F50D}"},upload:{label:"Upload",paths:["M12 15V4","M7.5 8.5L12 4l4.5 4.5","M4 15v5h16v-5"],emoji:"\u2B06\uFE0F"},play:{label:"Play",paths:["M8 5l11 7-11 7z"],emoji:"\u25B6\uFE0F"},sparkle:{label:"Sparkle",paths:["M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z","M19 16l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7z"],emoji:"\u2728"},globe:{label:"Globe",paths:["M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0z","M4 12h16","M12 4c2.2 2.2 3.3 4.9 3.3 8s-1.1 5.8-3.3 8c-2.2-2.2-3.3-4.9-3.3-8S9.8 6.2 12 4z"],emoji:"\u{1F310}"}},ke=e=>{if(e){if(e.kind==="builtin")return e.name&&B[e.name]?e:void 0;if(e.kind==="emoji")return e.value&&e.value.trim()&&[...e.value.trim()].length<=8?e:void 0;if(e.kind==="image")return e.url&&/^https?:\/\//i.test(e.url)?e:void 0}};var he="ckf-styles",Se=`
1
+ (function(){'use strict';var Ee=()=>{try{return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){return false}},ae=["#f59e0b","#10b981","#ef4444","#8b5cf6","#06b6d4","#ec4899"],Pe=(e,t)=>{e.beginPath();for(let r=0;r<10;r++){let a=Math.PI/5*r-Math.PI/2,i=r%2?t*.45:t;e[r?"lineTo":"moveTo"](Math.cos(a)*i,Math.sin(a)*i);}e.closePath(),e.fill();},Se=(e,t,r,a)=>{let i=(d,w)=>d+Math.random()*(w-d),u=()=>a[Math.floor(Math.random()*a.length)],m=[];if(e==="confetti")for(let d=0;d<110;d++){let w=d%2===0;m.push({x:w?t*.15:t*.85,y:r*.95,vx:(w?1:-1)*i(.12,.42)*(t/900+.4),vy:-i(.75,1.25)*(r/900+.35),r:i(4,7),spin:i(-0.02,.02),angle:i(0,Math.PI),color:u(),born:i(0,180),life:i(1500,2100),shape:"rect"});}else if(e==="fireworks")for(let d=0;d<4;d++){let w=i(t*.2,t*.8),c=i(r*.18,r*.5),x=u();for(let h=0;h<46;h++){let M=Math.PI*2*h/46+i(-0.05,.05),P=i(.12,.3)*(Math.min(t,r)/600+.5);m.push({x:w,y:c,vx:Math.cos(M)*P,vy:Math.sin(M)*P,r:i(1.6,2.6),spin:0,angle:0,color:x,born:d*320,life:i(900,1300),shape:"dot"});}}else for(let d=0;d<34;d++)m.push({x:i(t*.08,t*.92),y:i(r*.2,r*.85),vx:0,vy:-i(.02,.06),r:i(6,13),spin:i(-4e-3,.004),angle:i(0,Math.PI),color:u(),born:i(0,700),life:i(900,1300),shape:"star"});return m},ce=(e,t={})=>{if(!e||e==="none"||typeof document=="undefined"||!t.force&&Ee())return ()=>{};let r=document.createElement("canvas");r.setAttribute("aria-hidden","true");let a=t.host;r.style.cssText=a?"position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5":"position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:2147483003",(a!=null?a:document.body).appendChild(r);let i=a?a.clientWidth:window.innerWidth,u=a?a.clientHeight:window.innerHeight,m=Math.min(2,window.devicePixelRatio||1);r.width=Math.max(1,Math.round(i*m)),r.height=Math.max(1,Math.round(u*m));let d=r.getContext("2d");if(!d)return r.remove(),()=>{};let w=t.accent?[t.accent,t.accent,...ae]:ae,c=Se(e,i,u,w),x=Math.max(...c.map(H=>H.born+H.life)),h=e==="confetti"?.0016:e==="fireworks"?35e-5:0,M=0,P=0,V=false,T=()=>{V||(V=true,cancelAnimationFrame(M),r.remove());},O=H=>{if(V)return;P||(P=H);let z=H-P;d.setTransform(m,0,0,m,0,0),d.clearRect(0,0,i,u);for(let y of c){let E=z-y.born;if(E<0||E>y.life)continue;let K=y.x+y.vx*E,R=y.y+y.vy*E+.5*h*E*E,o=Math.min(1,(y.life-E)/350);if(d.save(),d.globalAlpha=Math.max(0,o),d.translate(K,R),d.rotate(y.angle+y.spin*E),d.fillStyle=y.color,y.shape==="rect")d.fillRect(-y.r,-y.r/2.2,y.r*2,y.r/1.1);else if(y.shape==="dot")d.beginPath(),d.arc(0,0,y.r,0,Math.PI*2),d.fill();else {let s=Math.min(1,E/220);Pe(d,y.r*(s<1?s:1-Math.max(0,(E-y.life*.6)/(y.life*.4))*.6));}d.restore();}z<x?M=requestAnimationFrame(O):T();};return M=requestAnimationFrame(O),T};var Y=globalThis,le,q=(le=Y.__mrrocketI18n)!=null?le:Y.__mrrocketI18n={version:0,onWords:new Set,onLocale:new Set};var f=e=>{var t;return ((t=q.words)==null?void 0:t[e])||e},I=(e,t)=>f(e).replace(/\{(\w+)\}/g,(r,a)=>a in t?String(t[a]):r);var de=()=>{var e,t;return (t=(e=q.locale)!=null?e:q.device)!=null?t:typeof navigator!="undefined"&&navigator.language||void 0};var fe=()=>q.lang;var J=e=>(q.onWords.add(e),()=>{q.onWords.delete(e);});var U="other:",Q=e=>{var a,i;let t=(a=e==null?void 0:e.min)!=null?a:0,r=(i=e==null?void 0:e.max)!=null?i:10;return Array.from({length:Math.max(0,Math.min(r-t,20)+1)},(u,m)=>t+m)},ue=(e,t)=>{var r;return !e||t==null?false:e.type==="choice"?e.other&&t.startsWith(U)?t.slice(U.length).trim().length>0:((r=e.options)!=null?r:[]).some(a=>a.id===t):e.type==="scale"?Q(e).some(a=>String(a)===t):t.trim().length>0&&t.length<=500};var X=e=>{let t=(e!=null?e:"").trim();if(!/^https?:\/\//i.test(t))return null;let r=t.match(/^https?:\/\/(?:www\.|m\.)?(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/|youtube-nocookie\.com\/embed\/)([\w-]{6,20})/i);return r?{kind:"iframe",src:`https://www.youtube-nocookie.com/embed/${r[1]}?rel=0`}:(r=t.match(/^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{4,12})/i),r?{kind:"iframe",src:`https://player.vimeo.com/video/${r[1]}?dnt=1`}:(r=t.match(/^https?:\/\/(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]{8,64})/i),r?{kind:"iframe",src:`https://www.loom.com/embed/${r[1]}`}:/\.(mp4|webm|mov|m4v)(\?|#|$)/i.test(t)||/\/media\/uploads\//.test(t)?{kind:"file",src:t}:null))},pe=e=>{var r;let t=e.media;if(!(!t||t.kind!=="image"&&t.kind!=="video"||!/^https?:\/\//i.test((r=t.url)!=null?r:"")))return t.kind==="video"&&!X(t.url)?void 0:t};var ge=(e,t)=>Math.round(e*(1-t/100)*100)/100,G=(e,t)=>{try{return new Intl.NumberFormat(de(),{style:"currency",currency:t}).format(e)}catch(r){return `${e.toFixed(2)} ${t}`}},me=e=>e.kind==="contact"?f("Send to the team"):e.kind==="pause"?f("Pause instead"):e.kind==="downgrade"?f("Switch plan"):f("Accept offer"),Z=e=>e===1?f("1 month"):I("{n} months",{n:e}),ee=e=>I("for {months}",{months:Z(e)});var B={check:{label:"Check",paths:["M5 12.5l4.5 4.5L19 7.5"],emoji:"\u2705"},star:{label:"Star",paths:["M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z"],emoji:"\u2B50"},rocket:{label:"Rocket",paths:["M12 3c3 2 4.5 5.5 4 10l-2 3h-4l-2-3c-.5-4.5 1-8 4-10z","M8 13.5l-3 3 3.5.5","M16 13.5l3 3-3.5.5","M13.5 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z","M11 19.5v1.5M13 19.5v1.5"],emoji:"\u{1F680}"},user:{label:"Person",paths:["M15.5 8a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z","M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5"],emoji:"\u{1F464}"},users:{label:"Team",paths:["M13 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z","M3.5 19c.6-3 3-4.8 6.5-4.8s5.9 1.8 6.5 4.8","M16 5.2a3 3 0 0 1 0 5.6","M18 14.6c1.5.6 2.4 2 2.7 4.4"],emoji:"\u{1F465}"},settings:{label:"Settings",paths:["M12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7","M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0z","M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"],emoji:"\u2699\uFE0F"},bell:{label:"Bell",paths:["M6 16v-5a6 6 0 0 1 12 0v5l1.5 2h-15z","M10 20.5a2 2 0 0 0 4 0"],emoji:"\u{1F514}"},mail:{label:"Mail",paths:["M4 6h16v12H4z","M4 7l8 6 8-6"],emoji:"\u2709\uFE0F"},chat:{label:"Chat",paths:["M4 5h16v11H9l-5 4z"],emoji:"\u{1F4AC}"},heart:{label:"Heart",paths:["M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"],emoji:"\u2764\uFE0F"},flag:{label:"Flag",paths:["M5 21V4","M5 4h11l-2 4 2 4H5"],emoji:"\u{1F6A9}"},bolt:{label:"Bolt",paths:["M13 3L5 13.5h6L10 21l8-10.5h-6z"],emoji:"\u26A1"},book:{label:"Book",paths:["M4 5.5C6.5 4 9.5 4 12 6c2.5-2 5.5-2 8-.5V19c-2.5-1.5-5.5-1.5-8 .5-2.5-2-5.5-2-8-.5z","M12 6v13.5"],emoji:"\u{1F4D6}"},calendar:{label:"Calendar",paths:["M4 6h16v14H4z","M4 10h16","M8 3.5v4M16 3.5v4"],emoji:"\u{1F4C5}"},camera:{label:"Camera",paths:["M4 8h3.5L9 5.5h6L16.5 8H20v11H4z","M15.5 13a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z"],emoji:"\u{1F4F7}"},cart:{label:"Cart",paths:["M3.5 4.5H6l2 10h10l2-7H7","M9.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z","M18.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"],emoji:"\u{1F6D2}"},chart:{label:"Chart",paths:["M4 20h16","M7 16v-4M12 16V8M17 16V9"],emoji:"\u{1F4CA}"},gift:{label:"Gift",paths:["M4 10h16v10H4z","M3 7h18v3H3z","M12 7v13","M12 7c-1.5-3-5-3-5-1s3.5 1 5 1z","M12 7c1.5-3 5-3 5-1s-3.5 1-5 1z"],emoji:"\u{1F381}"},home:{label:"Home",paths:["M4 11l8-7 8 7","M6 9.5V20h12V9.5","M10 20v-6h4v6"],emoji:"\u{1F3E0}"},link:{label:"Link",paths:["M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1","M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"],emoji:"\u{1F517}"},lock:{label:"Lock",paths:["M6 11h12v9H6z","M8.5 11V8a3.5 3.5 0 0 1 7 0v3"],emoji:"\u{1F512}"},pencil:{label:"Pencil",paths:["M4 20l1-4L16 5l3 3L8 19z","M14 7l3 3"],emoji:"\u270F\uFE0F"},plus:{label:"Plus",paths:["M12 5v14M5 12h14"],emoji:"\u2795"},search:{label:"Search",paths:["M16 10.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z","M14.5 14.5L20 20"],emoji:"\u{1F50D}"},upload:{label:"Upload",paths:["M12 15V4","M7.5 8.5L12 4l4.5 4.5","M4 15v5h16v-5"],emoji:"\u2B06\uFE0F"},play:{label:"Play",paths:["M8 5l11 7-11 7z"],emoji:"\u25B6\uFE0F"},sparkle:{label:"Sparkle",paths:["M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z","M19 16l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7z"],emoji:"\u2728"},globe:{label:"Globe",paths:["M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0z","M4 12h16","M12 4c2.2 2.2 3.3 4.9 3.3 8s-1.1 5.8-3.3 8c-2.2-2.2-3.3-4.9-3.3-8S9.8 6.2 12 4z"],emoji:"\u{1F310}"}},ke=e=>{if(e){if(e.kind==="builtin")return e.name&&B[e.name]?e:void 0;if(e.kind==="emoji")return e.value&&e.value.trim()&&[...e.value.trim()].length<=8?e:void 0;if(e.kind==="image")return e.url&&/^https?:\/\//i.test(e.url)?e:void 0}};var he="ckf-styles",Re=`
2
2
  .ckf-root{--ckf-accent:#3f76ff;--ckf-accent-ink:#fff;--ckf-bg:#fff;--ckf-fg:#1c1d20;--ckf-muted:#5d6068;--ckf-soft:#f4f5f7;--ckf-line:#e4e5e8;--ckf-danger:#d92d20;--ckf-radius:14px;--ckf-font:inherit;--ckf-shadow:0 16px 40px -12px rgba(16,18,24,.28),0 0 0 1px rgba(16,18,24,.07)}
3
3
  .ckf-root[data-theme=dark]{--ckf-bg:#17181b;--ckf-fg:#f1f2f4;--ckf-muted:#a9acb3;--ckf-soft:#232428;--ckf-line:#2e2f35;--ckf-shadow:0 16px 40px -12px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.08)}
4
4
  @media (prefers-color-scheme:dark){.ckf-root[data-theme=auto]{--ckf-bg:#17181b;--ckf-fg:#f1f2f4;--ckf-muted:#a9acb3;--ckf-soft:#232428;--ckf-line:#2e2f35;--ckf-shadow:0 16px 40px -12px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.08)}}
@@ -88,5 +88,5 @@
88
88
  .ckf-banner{animation-name:ckf-fade}
89
89
  @media (max-width:520px){.ckf-scrim{align-items:flex-end;padding:0}.ckf-scrim .ckf-card{max-width:none;border-radius:var(--ckf-radius) var(--ckf-radius) 0 0;max-height:92dvh}.ckf-float{right:12px;bottom:12px}}
90
90
  @media (prefers-reduced-motion:reduce){.ckf-root *{animation:none!important;transition:none!important}}
91
- `,n=(e,t={},...o)=>{let s=document.createElement(e);for(let[c,m]of Object.entries(t))m===void 0||m===false||(typeof m=="function"?s.addEventListener(c.slice(2).toLowerCase(),m):c==="className"?s.className=String(m):s.setAttribute(c,m===true?"":m));for(let c of o)(c||c==="")&&s.append(typeof c=="string"?document.createTextNode(c):c);return s},L=(e,t,o,s={})=>n("button",{type:"button",className:`ckf-btn${t==="secondary"?"":` ckf-${t}`}`,disabled:!!s.disabled,"data-ckf-id":s.id,onClick:()=>o()},e),W=(e,t)=>n("button",{type:"button",className:"ckf-x","aria-label":e,"data-ckf-id":"x",onClick:()=>t()},"\xD7"),ne=(e,t)=>t>1?n("span",{className:"ckf-dots",role:"img","aria-label":T("Step {n} of {total}",{n:e,total:t})},...Array.from({length:t},(o,s)=>n("span",{className:"ckf-dot","data-on":s<e}))):n("span"),be=e=>{var t;return e.type==="cancel"?`c:${e.screen}:${(t=e.round)!=null?t:1}`:e.type==="step"?`s:${e.step.id}`:e.type==="checklist"?`l:${e.flow.id}`:`m:${e.message.id}`},Re=e=>e.type==="cancel"?"c":e.type==="step"&&(e.step.kind==="question"||e.step.kind==="modal")?`d:${e.flow.id}`:be(e),we=e=>{var o;if(!document.getElementById(he)){let s=document.createElement("style");s.id=he,s.textContent=Se,document.head.appendChild(s);}let t=n("div",{className:`ckf-root${e.className?` ${e.className}`:""}`,"data-theme":(o=e.theme)!=null?o:"auto"});return e.accent&&t.style.setProperty("--ckf-accent",e.accent),document.body.appendChild(t),t},xe=e=>{let t=fe();t?e.setAttribute("lang",t):e.removeAttribute("lang");},te=(e,t)=>{let o=ke(e);if(!o)return false;let s=n("span",{className:t,"aria-hidden":"true"});if(o.kind==="emoji")s.textContent=o.value;else if(o.kind==="image")s.append(n("img",{src:o.url,alt:""}));else {let c="http://www.w3.org/2000/svg",m=document.createElementNS(c,"svg");for(let[h,d]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))m.setAttribute(h,d);for(let h of B[o.name].paths){let d=document.createElementNS(c,"path");d.setAttribute("d",h),m.append(d);}s.append(m);}return s},ye=(e,t={})=>{if(typeof document=="undefined")return ()=>{};let o=we(t),s="",c="",m="",h=null,d="",w=null,l=r=>{var g,O,$;let i="ckf-title",a=r.busy,u=[];if(r.screen==="survey")u.push(n("h2",{className:"ckf-h",id:i},r.flow.question||f("Why are you leaving?")),n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":i},...r.flow.reasons.map(p=>n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(r.reason===p.id),"data-ckf-id":`r:${p.id}`,onClick:()=>e.cancel.pick(p.id)},n("span",{className:"ckf-radio"}),p.label))),n("div",{className:"ckf-btns"},L(f("Continue"),"primary",e.cancel.next,{disabled:!r.reason,id:"go"}),L(f("Never mind, keep my plan"),"quiet",e.cancel.close)));else if(r.screen==="followup"&&r.followUp){let p=r.followUp,C;if(p.answers.length)C=n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":i},...p.answers.map((F,b)=>{var S;return n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(r.answer===F),"data-ckf-id":`a:${b}`,onClick:()=>e.cancel.answer(F)},n("span",{className:"ckf-radio"}),((S=p.answerLabels)==null?void 0:S[b])||F)}));else {let F=n("textarea",{className:"ckf-text",placeholder:f("Your answer (optional)"),"aria-labelledby":i,maxlength:"500","data-ckf-id":"answer",onInput:b=>e.cancel.answer(b.target.value)});F.value=(g=r.answer)!=null?g:"",C=F;}let v=(O=r.flow.reasons.find(F=>F.id===r.reason))==null?void 0:O.label;u.push(v?n("p",{className:"ckf-small"},T("You said: {label}",{label:v})):false,n("h2",{className:"ckf-h",id:i},p.question),C,n("div",{className:"ckf-btns"},L(f("Continue"),"primary",e.cancel.next,{id:"go"}),L(f("Never mind, keep my plan"),"quiet",e.cancel.close)));}else if(r.screen==="offer"&&r.offer){let p=r.offer,C=($=r.flow.reasons.find(b=>b.id===r.reason))==null?void 0:$.label,v=false;p.kind==="discount"&&p.percent&&(v=r.price?n("div",{className:"ckf-box"},n("span",{className:"ckf-big"},G(ge(r.price.amount,p.percent),r.price.currency)),n("span",{className:"ckf-strike"},G(r.price.amount,r.price.currency)),n("span",{className:"ckf-small"},`/${r.price.interval==="year"?f("year"):f("month")}${p.months?` ${ee(p.months)}`:""}`)):n("div",{className:"ckf-box"},n("span",{className:"ckf-big"},T("{percent}% off",{percent:p.percent})),p.months?n("span",{className:"ckf-small"},ee(p.months)):false)),p.kind==="pause"&&p.months&&(v=n("div",{className:"ckf-box"},n("span",{},T("Pause for up to {months}. Your data stays.",{months:Z(p.months)})))),p.kind==="downgrade"&&p.planName&&(v=n("div",{className:"ckf-box"},n("b",{},p.planName)));let F=p.kind==="contact"?n("textarea",{className:"ckf-text",placeholder:f("What would make you stay?"),"aria-label":f("Your message"),maxlength:"500","data-ckf-id":"comment",onInput:b=>d=b.target.value}):null;F&&(F.value=d),u.push(C?n("p",{className:"ckf-small"},T("You said: {label}",{label:C})):false,n("h2",{className:"ckf-h",id:i},p.headline),v,F!=null?F:false,n("div",{className:"ckf-btns"},L(a?f("One moment\u2026"):me(p),"primary",()=>e.cancel.accept(d),{disabled:a,id:"go"}),L(f("No thanks, continue cancelling"),"quiet",e.cancel.decline,{disabled:a})));}else {let C=r.steps===1?null:n("textarea",{className:"ckf-text",placeholder:f("Anything else we should know? (optional)"),"aria-label":f("Anything else we should know? (optional)"),maxlength:"500","data-ckf-id":"comment",onInput:v=>d=v.target.value});C&&(C.value=d),u.push(n("h2",{className:"ckf-h",id:i},r.flow.confirm.title),r.flow.confirm.body?n("p",{className:"ckf-p"},r.flow.confirm.body):false,C!=null?C:false,n("div",{className:"ckf-btns"},L(a?f("One moment\u2026"):r.flow.confirm.button,"danger",()=>e.cancel.confirm(d),{disabled:a,id:"go"}),L(f("Keep my plan"),"secondary",e.cancel.close,{disabled:a})));}return n("div",{className:"ckf-scrim",onClick:p=>p.target===p.currentTarget&&!a&&e.cancel.close()},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":i},n("div",{className:"ckf-top"},ne(r.step,r.steps),W(f("Close"),e.cancel.close)),...u,r.error?n("p",{className:"ckf-err",role:"alert"},r.error):false))},x=r=>{var u;let i=ue(r);if(!i)return false;if(i.kind==="image")return n("img",{className:"ckf-media",src:i.url,alt:(u=i.alt)!=null?u:"",onLoad:()=>P()});let a=X(i.url);return a.kind==="iframe"?n("div",{className:"ckf-video"},n("iframe",{src:a.src,title:i.alt||f("Video"),allow:"fullscreen; picture-in-picture",allowfullscreen:true,loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"})):n("video",{className:"ckf-media",src:a.src,controls:true,playsinline:true,preload:"metadata","aria-label":i.alt||void 0,onLoadedmetadata:()=>P()})},k=r=>{var C,v,F;let i=r.step,a=i.question,u="ckf-title",g=pe(a,r.answer),O=false,$=(b,S,_)=>{let A=n("input",{type:"text",className:"ckf-input",placeholder:b,"aria-labelledby":u,maxlength:"500","data-ckf-id":"answer",onInput:j=>_(j.target.value),onKeydown:j=>j.key==="Enter"&&e.onboarding.next()});return A.value=S,A},p=(b,S,_,A)=>n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(b),"data-ckf-id":`q:${S}`,onClick:A},n("span",{className:"ckf-radio"}),_);if((a==null?void 0:a.type)==="choice"){let b=!!a.other&&!!((C=r.answer)!=null&&C.startsWith(U));O=n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":u},...((v=a.options)!=null?v:[]).map(S=>p(r.answer===S.id,S.id,S.label,()=>e.onboarding.answer(S.id))),a.other?p(b,"other",a.otherLabel||f("Other"),()=>b||e.onboarding.answer(U)):false,b?$(f("Your answer"),r.answer.slice(U.length),S=>e.onboarding.answer(U+S)):false);}else (a==null?void 0:a.type)==="scale"?O=n("div",{},n("div",{className:"ckf-scale",role:"radiogroup","aria-labelledby":u},...Q(a).map(b=>n("button",{type:"button",role:"radio",className:"ckf-num","aria-checked":String(r.answer===String(b)),"data-ckf-id":`q:${b}`,onClick:()=>e.onboarding.answer(String(b))},String(b)))),a.lowLabel||a.highLabel?n("div",{className:"ckf-ends ckf-small"},n("span",{},a.lowLabel||""),n("span",{},a.highLabel||"")):false):a&&(O=$(a.placeholder||f("Your answer"),(F=r.answer)!=null?F:"",b=>e.onboarding.answer(b)));return n("div",{className:"ckf-scrim"},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":u},n("div",{className:"ckf-top"},ne(r.index+1,r.total),W(f("Close"),e.onboarding.dismiss)),r.index===0?te(r.flow.icon,"ckf-hic"):false,n("h2",{className:"ckf-h",id:u},i.title),i.body?n("p",{className:"ckf-p"},i.body):false,O,n("div",{className:"ckf-row"},r.back?L(f("Back"),"quiet",e.onboarding.back):false,a!=null&&a.optional?L(a.skipLabel||f("Skip"),"quiet",e.onboarding.skip):false,L(i.button||(r.last?f("Done"):f("Continue")),"primary",e.onboarding.next,{disabled:!g,id:"go"}))))},M=r=>{let i=r.step;if(i.kind==="question")return k(r);let a=n("div",{className:"ckf-card",role:"dialog","aria-modal":i.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},r.total>1?n("p",{className:"ckf-small"},T("Step {n} of {total}",{n:r.index+1,total:r.total})):n("span"),W(f("Close the tour"),e.onboarding.dismiss)),i.kind==="modal"?te(r.flow.icon,"ckf-hic"):false,x(i),n("h2",{className:"ckf-h",id:"ckf-title"},i.title),i.body?n("p",{className:"ckf-p"},i.body):false,n("div",{className:"ckf-row"},L(i.button||(r.last?f("Done"):f("Next")),"primary",e.onboarding.next,{id:"go"})));if(i.kind==="modal")return n("div",{className:"ckf-scrim"},a);let u=i.target?E(i.target):null,g=n("div",{className:"ckf-float"},a);if(u){let O=n("div",{className:"ckf-ring","aria-hidden":"true"});return g.append(n("span",{className:"ckf-arrow","aria-hidden":"true"})),w={float:g,ring:O,target:u,side:i.placement},I(g,O,u,i.placement),n("div",{},O,g)}return g},E=r=>{var a;let i=()=>document.querySelector(`[data-ck-target="${CSS.escape(r)}"]`);return /^[#.[]|[\s>:=]/.test(r)&&(a=H(r))!=null?a:i()},H=r=>{try{return document.querySelector(r)}catch(i){return null}},I=(r,i,a,u="auto")=>{var se;let g=a.getBoundingClientRect();Object.assign(i.style,{left:`${g.left-4}px`,top:`${g.top-4}px`,width:`${g.width+8}px`,height:`${g.height+8}px`});let O=window.innerWidth,$=window.innerHeight,p=Math.min(340,O-24),C=r.offsetHeight||200,v=14,F={bottom:$-g.bottom-v-12>=C,top:g.top-v-12>=C,right:O-g.right-v-12>=p,left:g.left-v-12>=p},b={top:"bottom",bottom:"top",left:"right",right:"left"},_=(se=(u==="auto"||!b[u]?["bottom","top"]:[u,b[u],"bottom","top","right","left"]).find(D=>F[D]))!=null?se:u!=="auto"&&b[u]?u:g.top>$-g.bottom?"top":"bottom",A=(D,Oe)=>Math.max(12,Math.min(D,Oe-12)),j=_==="top"||_==="bottom",oe=j?A(u==="auto"?g.left:g.left+g.width/2-p/2,O-p):_==="right"?g.right+v:g.left-v-p,ie=j?_==="bottom"?g.bottom+v:g.top-v-C:A(g.top+g.height/2-C/2,$-C);Object.assign(r.style,{left:`${oe}px`,top:`${ie}px`,right:"auto",bottom:"auto",width:`${p}px`}),r.setAttribute("data-side",_);let Ne=j?g.left+g.width/2-oe:g.top+g.height/2-ie;r.style.setProperty("--ckf-ap",`${Math.max(18,Math.min(Ne,(j?p:C)-18))}px`);},N=r=>{let i=r.items.filter(a=>a.done).length;return n("div",{className:"ckf-float"},n("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},n("h2",{className:"ckf-h",id:"ckf-title"},r.flow.name),W(f("Hide the checklist"),e.onboarding.dismiss)),n("p",{className:"ckf-small"},T("{done} of {total} done",{done:i,total:r.items.length})),n("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(r.items.length),"aria-valuenow":String(i)},n("i",{style:`width:${i/r.items.length*100}%`})),n("div",{className:"ckf-opts"},...r.items.map(({step:a,done:u,opens:g})=>{let O=[n("span",{className:"ckf-tick","aria-hidden":"true"},u?"\u2713":""),te(a.icon,"ckf-ic"),n("span",{},n("b",{},a.title),a.body?n("span",{className:"ckf-small"},a.body):false)];return !u&&g?n("button",{type:"button",className:"ckf-check","aria-label":T("Start \u201C{title}\u201D",{title:a.title}),"data-ckf-id":`t:${a.id}`,onClick:()=>e.onboarding.open(a.id)},...O,n("span",{className:"ckf-go","aria-hidden":"true"},"\u203A")):u||a.event?n("div",{className:"ckf-check","data-done":u,role:"listitem"},...O):n("button",{type:"button",className:"ckf-check","aria-label":T("Mark \u201C{title}\u201D done",{title:a.title}),"data-ckf-id":`i:${a.id}`,onClick:()=>e.onboarding.check(a.id)},...O)}))))},z=r=>{let i=r.message,a=i.button?L(i.button,"primary",e.message.click,{id:"go"}):false;return i.style==="banner"?n("div",{className:"ckf-banner",role:"status"},n("span",{},n("b",{},i.title),i.body?n("span",{className:"ckf-small"},i.body):false),a,W(f("Dismiss"),e.message.dismiss)):n("div",{className:"ckf-scrim",onClick:u=>u.target===u.currentTarget&&e.message.dismiss()},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},n("span"),W(f("Dismiss"),e.message.dismiss)),n("h2",{className:"ckf-h",id:"ckf-title"},i.title),i.body?n("p",{className:"ckf-p"},i.body):false,a?n("div",{className:"ckf-row"},a):false))},V=()=>{var $,p,C,v,F,b,S,_;let r=e.view();xe(o);let i=(p=t.accent)!=null?p:($=e.accent)==null?void 0:$.call(e);i&&o.style.setProperty("--ckf-accent",i);let a=(C=e.finale)==null?void 0:C.call(e);a&&a.key!==s&&(s=a.key,ce(a.kind,{accent:i}));let u=r?be(r):"",g=(F=(v=document.activeElement)==null?void 0:v.closest)!=null&&F.call(v,".ckf-root")?(b=document.activeElement)==null?void 0:b.getAttribute("data-ckf-id"):null;u&&!c&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(h=document.activeElement),u!==c&&!u.startsWith("c:")&&(d=""),u||(d=""),w=null;let O=r?Re(r):"";if(o.toggleAttribute("data-still",!!O&&O===m),m=O,o.replaceChildren(...r?[r.type==="cancel"?l(r):r.type==="step"?M(r):r.type==="checklist"?N(r):z(r)]:[]),P(),u!==c){let A=o.querySelector("[aria-modal=true]"),j=(S=A==null?void 0:A.querySelector("[role=radio], input, [data-ckf-id=go], textarea"))!=null?S:null;j==null||j.focus(),!u&&h&&(h.focus(),h=null);}else g&&((_=o.querySelector(`[data-ckf-id="${CSS.escape(g)}"]`))==null||_.focus());c=u;},y=r=>{if(r.key!=="Escape")return;let i=e.view();(i==null?void 0:i.type)==="cancel"?e.cancel.close():(i==null?void 0:i.type)==="message"?e.message.dismiss():(i==null?void 0:i.type)==="step"&&(i.step.kind==="modal"||i.step.kind==="question")&&e.onboarding.dismiss();};function P(){w&&I(w.float,w.ring,w.target,w.side);}document.addEventListener("keydown",y),window.addEventListener("resize",P),window.addEventListener("scroll",P,{passive:true,capture:true});let q=e.subscribe(V),R=J(V);return V(),()=>{q(),R(),document.removeEventListener("keydown",y),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,{capture:true}),o.remove();}},ve=(e,t={})=>{if(typeof document=="undefined")return ()=>{};let o=we(t),s="",c=null,m=()=>{var E,H,I;let l=e.view();xe(o);let x=l?`${l.paywall.id}:${l.index}`:"";if(x&&!s&&document.activeElement instanceof HTMLElement&&(c=document.activeElement),!l){o.replaceChildren(),o.removeAttribute("data-still"),s&&(c==null||c.focus()),s="";return}s&&o.setAttribute("data-still","");let k=l.page,M=k.kind==="plans"?n("div",{className:"ckf-opts",role:"radiogroup","aria-label":f("Plans")},...l.plans.map(N=>n("button",{type:"button",role:"radio",className:"ckf-opt ckf-plan","aria-checked":String(l.plan===N.id),"data-ckf-id":`p:${N.id}`,onClick:()=>e.pick(N.id)},n("span",{className:"ckf-radio"}),n("span",{},N.name,N.note?n("span",{className:"ckf-small"},N.note):false),n("b",{},N.price)))):false;o.replaceChildren(n("div",{className:"ckf-scrim",onClick:N=>N.target===N.currentTarget&&e.close()},n("div",{className:"ckf-card ckf-pw",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},ne(l.index+1,l.total),W(f("Close"),e.close)),n("h2",{className:"ckf-h",id:"ckf-title"},k.title),k.body?n("p",{className:"ckf-p"},k.body):false,k.kind==="benefits"&&((E=k.items)!=null&&E.length)?n("div",{className:"ckf-opts"},...k.items.map(N=>n("p",{className:"ckf-li"},N))):false,k.kind==="proof"&&((H=k.quotes)!=null&&H.length)?n("div",{className:"ckf-opts"},...k.quotes.map(N=>n("blockquote",{className:"ckf-quote"},N.text,N.by?n("cite",{},N.by):false))):false,M,l.error?n("p",{className:"ckf-err",role:"alert"},l.error):false,n("div",{className:"ckf-btns"},L(l.busy?f("One moment\u2026"):k.button||f("Continue"),"primary",e.next,{disabled:l.busy||k.kind==="plans"&&!l.plan,id:"go"}),l.index?L(f("Back"),"quiet",e.back,{disabled:l.busy}):false)))),x!==s&&((I=o.querySelector("[data-ckf-id=go]"))==null||I.focus()),s=x;},h=l=>{e.view()&&l.key==="Escape"&&e.close();};document.addEventListener("keydown",h);let d=e.subscribe(m),w=J(m);return m(),()=>{d(),w(),document.removeEventListener("keydown",h),o.remove();}};var Le=e=>{let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=Math.imul(t,16777619);return (t>>>0)/4294967296};var Ce=(e,t)=>{var m,h,d,w;let o=(h=(m=e.variants[0])==null?void 0:m.id)!=null?h:"control";if(e.winner)return e.winner;if(e.status!=="running")return o;let s=Le(`${e.key}:${t}`),c=0;for(let l of e.variants)if(c+=l.weight,s<c)return l.id;return (w=(d=e.variants[e.variants.length-1])==null?void 0:d.id)!=null?w:o};var re="$paywall",Te=(e,t,o)=>{var h,d;let s=t.experiment?e==null?void 0:e.experiments.find(w=>w.key===t.experiment):void 0,c=s?Ce(s,o):(h=t.variants[0])==null?void 0:h.id,m=(d=t.variants.find(w=>w.id===c))!=null?d:t.variants[0];return m?{variant:m.id,pages:m.pages,test:(s==null?void 0:s.status)==="running"&&!s.winner?s.key:void 0}:null},Me=e=>{let t=null,o=new Set,s=()=>{for(let l of [...o])try{l();}catch(x){}},c=()=>t?{paywall:t.w.id,placement:t.w.placement,variant:t.variant}:{},m=()=>{t&&!t.seen.has(t.index)&&(t.seen.add(t.index),e.track(re,{...c(),page:t.pages[t.index].id,index:t.index,action:"page"})),s();},h=l=>{var k,M;let x=t;x&&(t=null,l.outcome==="closed"&&((M=(k=x.options).onClose)==null||M.call(k,l)),x.resolve(l),s());},d=l=>{var x;return {outcome:l,index:(x=t==null?void 0:t.index)!=null?x:0,...t?{paywall:t.w.id,variant:t.variant}:{},...l!=="closed"&&t?{plan:t.plans.find(k=>k.id===t.plan)}:{}}},w=()=>{let l=t,x=l==null?void 0:l.plans.find(k=>k.id===l.plan);if(!(!l||!x||l.busy)){if(!l.options.onPurchase)return h(d("chosen"));l.busy=true,l.error=void 0,s(),Promise.resolve().then(()=>{var k,M;return (M=(k=l.options).onPurchase)==null?void 0:M.call(k,x)}).then(k=>{if(l.busy=false,t===l){if(k===false)return s();e.track(re,{...c(),page:l.pages[l.index].id,index:l.index,plan:x.id,action:"purchased"}),h(d("purchased"));}},()=>{l.busy=false,l.error=f("The purchase did not go through. Please try again."),s();});}};return {open:(l,x={})=>{var y,P,q;if(t)return t.promise;let k=e.config(),M=(y=k==null?void 0:k.paywalls)==null?void 0:y.find(R=>R.placement===l),E=M?Te(k,M,e.distinctId()):null;if(!M||!(E!=null&&E.pages.length))return Promise.resolve({outcome:"closed",index:0});let H=new Map(((P=x.plans)!=null?P:[]).map(R=>[R.id,R])),I=M.plans.map(R=>{var r;return (r=H.get(R.id))!=null?r:R}),N=()=>{},z=new Promise(R=>N=R),V=I.some(R=>R.id===M.highlight)?M.highlight:(q=I[0])==null?void 0:q.id;return t={w:M,variant:E.variant,pages:E.pages,plans:I,index:0,plan:V,busy:false,seen:new Set,options:x,resolve:N,promise:z},E.test&&e.track("$exposure",{experiment:E.test,variant:E.variant}),m(),z},view:()=>t?{paywall:t.w,variant:t.variant,page:t.pages[t.index],index:t.index,total:t.pages.length,last:t.index===t.pages.length-1,plans:t.plans,plan:t.plan,busy:t.busy,error:t.error}:null,subscribe:l=>(o.add(l),()=>o.delete(l)),next:()=>{if(!(!t||t.busy)){if(t.pages[t.index].kind==="plans"||t.index===t.pages.length-1)return w();t.index++,t.error=void 0,m();}},back:()=>{!t||t.busy||!t.index||(t.index--,t.error=void 0,s());},pick:l=>{!t||t.busy||!t.plans.some(x=>x.id===l)||(t.plan=l,t.error=void 0,s());},close:()=>{!t||t.busy||(e.track(re,{...c(),index:t.index,action:"closed"}),h(d("closed")));}}};var Ie=(e,t)=>{let o=Me(e);return ve(o,t),o};window.__mrrocketFlows={mountFlows:ye,paywallHost:Ie};
92
- })();
91
+ `,n=(e,t={},...r)=>{let a=document.createElement(e);for(let[i,u]of Object.entries(t))u===void 0||u===false||(typeof u=="function"?a.addEventListener(i.slice(2).toLowerCase(),u):i==="className"?a.className=String(u):a.setAttribute(i,u===true?"":u));for(let i of r)(i||i==="")&&a.append(typeof i=="string"?document.createTextNode(i):i);return a},L=(e,t,r,a={})=>n("button",{type:"button",className:`ckf-btn${t==="secondary"?"":` ckf-${t}`}`,disabled:!!a.disabled,"data-ckf-id":a.id,onClick:()=>r()},e),W=(e,t)=>n("button",{type:"button",className:"ckf-x","aria-label":e,"data-ckf-id":"x",onClick:()=>t()},"\xD7"),ne=(e,t)=>t>1?n("span",{className:"ckf-dots",role:"img","aria-label":I("Step {n} of {total}",{n:e,total:t})},...Array.from({length:t},(r,a)=>n("span",{className:"ckf-dot","data-on":a<e}))):n("span"),be=e=>{var t;return e.type==="cancel"?`c:${e.screen}:${(t=e.round)!=null?t:1}`:e.type==="step"?`s:${e.step.id}`:e.type==="checklist"?`l:${e.flow.id}`:`m:${e.message.id}`},Le=e=>e.type==="cancel"?"c":e.type==="step"&&(e.step.kind==="question"||e.step.kind==="modal")?`d:${e.flow.id}`:be(e),we=e=>{var r;if(!document.getElementById(he)){let a=document.createElement("style");a.id=he,a.textContent=Re,document.head.appendChild(a);}let t=n("div",{className:`ckf-root${e.className?` ${e.className}`:""}`,"data-theme":(r=e.theme)!=null?r:"auto"});return e.accent&&t.style.setProperty("--ckf-accent",e.accent),document.body.appendChild(t),t},xe=e=>{let t=fe();t?e.setAttribute("lang",t):e.removeAttribute("lang");},te=(e,t)=>{let r=ke(e);if(!r)return false;let a=n("span",{className:t,"aria-hidden":"true"});if(r.kind==="emoji")a.textContent=r.value;else if(r.kind==="image")a.append(n("img",{src:r.url,alt:""}));else {let i="http://www.w3.org/2000/svg",u=document.createElementNS(i,"svg");for(let[m,d]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))u.setAttribute(m,d);for(let m of B[r.name].paths){let d=document.createElementNS(i,"path");d.setAttribute("d",m),u.append(d);}a.append(u);}return a},ye=(e,t={})=>{if(typeof document=="undefined")return ()=>{};let r=we(t),a="",i="",u="",m=null,d="",w=null,c=o=>{var k,N,$;let s="ckf-title",l=o.busy,g=[];if(o.screen==="survey")g.push(n("h2",{className:"ckf-h",id:s},o.flow.question||f("Why are you leaving?")),n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":s},...o.flow.reasons.map(p=>n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(o.reason===p.id),"data-ckf-id":`r:${p.id}`,onClick:()=>e.cancel.pick(p.id)},n("span",{className:"ckf-radio"}),p.label))),n("div",{className:"ckf-btns"},L(f("Continue"),"primary",e.cancel.next,{disabled:!o.reason,id:"go"}),L(f("Never mind, keep my plan"),"quiet",e.cancel.close)));else if(o.screen==="followup"&&o.followUp){let p=o.followUp,C;if(p.answers.length)C=n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":s},...p.answers.map((F,b)=>{var S;return n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(o.answer===F),"data-ckf-id":`a:${b}`,onClick:()=>e.cancel.answer(F)},n("span",{className:"ckf-radio"}),((S=p.answerLabels)==null?void 0:S[b])||F)}));else {let F=n("textarea",{className:"ckf-text",placeholder:f("Your answer (optional)"),"aria-labelledby":s,maxlength:"500","data-ckf-id":"answer",onInput:b=>e.cancel.answer(b.target.value)});F.value=(k=o.answer)!=null?k:"",C=F;}let v=(N=o.flow.reasons.find(F=>F.id===o.reason))==null?void 0:N.label;g.push(v?n("p",{className:"ckf-small"},I("You said: {label}",{label:v})):false,n("h2",{className:"ckf-h",id:s},p.question),C,n("div",{className:"ckf-btns"},L(f("Continue"),"primary",e.cancel.next,{id:"go"}),L(f("Never mind, keep my plan"),"quiet",e.cancel.close)));}else if(o.screen==="offer"&&o.offer){let p=o.offer,C=($=o.flow.reasons.find(b=>b.id===o.reason))==null?void 0:$.label,v=false;p.kind==="discount"&&p.percent&&(v=o.price?n("div",{className:"ckf-box"},n("span",{className:"ckf-big"},G(ge(o.price.amount,p.percent),o.price.currency)),n("span",{className:"ckf-strike"},G(o.price.amount,o.price.currency)),n("span",{className:"ckf-small"},`/${o.price.interval==="year"?f("year"):f("month")}${p.months?` ${ee(p.months)}`:""}`)):n("div",{className:"ckf-box"},n("span",{className:"ckf-big"},I("{percent}% off",{percent:p.percent})),p.months?n("span",{className:"ckf-small"},ee(p.months)):false)),p.kind==="pause"&&p.months&&(v=n("div",{className:"ckf-box"},n("span",{},I("Pause for up to {months}. Your data stays.",{months:Z(p.months)})))),p.kind==="downgrade"&&p.planName&&(v=n("div",{className:"ckf-box"},n("b",{},p.planName)));let F=p.kind==="contact"?n("textarea",{className:"ckf-text",placeholder:f("What would make you stay?"),"aria-label":f("Your message"),maxlength:"500","data-ckf-id":"comment",onInput:b=>d=b.target.value}):null;F&&(F.value=d),g.push(C?n("p",{className:"ckf-small"},I("You said: {label}",{label:C})):false,n("h2",{className:"ckf-h",id:s},p.headline),v,F!=null?F:false,n("div",{className:"ckf-btns"},L(l?f("One moment\u2026"):me(p),"primary",()=>e.cancel.accept(d),{disabled:l,id:"go"}),L(f("No thanks, continue cancelling"),"quiet",e.cancel.decline,{disabled:l})));}else {let C=o.steps===1?null:n("textarea",{className:"ckf-text",placeholder:f("Anything else we should know? (optional)"),"aria-label":f("Anything else we should know? (optional)"),maxlength:"500","data-ckf-id":"comment",onInput:v=>d=v.target.value});C&&(C.value=d),g.push(n("h2",{className:"ckf-h",id:s},o.flow.confirm.title),o.flow.confirm.body?n("p",{className:"ckf-p"},o.flow.confirm.body):false,C!=null?C:false,n("div",{className:"ckf-btns"},L(l?f("One moment\u2026"):o.flow.confirm.button,"danger",()=>e.cancel.confirm(d),{disabled:l,id:"go"}),L(f("Keep my plan"),"secondary",e.cancel.close,{disabled:l})));}return n("div",{className:"ckf-scrim",onClick:p=>p.target===p.currentTarget&&!l&&e.cancel.close()},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":s},n("div",{className:"ckf-top"},ne(o.step,o.steps),W(f("Close"),e.cancel.close)),...g,o.error?n("p",{className:"ckf-err",role:"alert"},o.error):false))},x=o=>{var g;let s=pe(o);if(!s)return false;if(s.kind==="image")return n("img",{className:"ckf-media",src:s.url,alt:(g=s.alt)!=null?g:"",onLoad:()=>E()});let l=X(s.url);return l.kind==="iframe"?n("div",{className:"ckf-video"},n("iframe",{src:l.src,title:s.alt||f("Video"),allow:"fullscreen; picture-in-picture",allowfullscreen:true,loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"})):n("video",{className:"ckf-media",src:l.src,controls:true,playsinline:true,preload:"metadata","aria-label":s.alt||void 0,onLoadedmetadata:()=>E()})},h=o=>{var C,v,F;let s=o.step,l=s.question,g="ckf-title",k=ue(l,o.answer),N=false,$=(b,S,_)=>{let A=n("input",{type:"text",className:"ckf-input",placeholder:b,"aria-labelledby":g,maxlength:"500","data-ckf-id":"answer",onInput:j=>_(j.target.value),onKeydown:j=>j.key==="Enter"&&e.onboarding.next()});return A.value=S,A},p=(b,S,_,A)=>n("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(b),"data-ckf-id":`q:${S}`,onClick:A},n("span",{className:"ckf-radio"}),_);if((l==null?void 0:l.type)==="choice"){let b=!!l.other&&!!((C=o.answer)!=null&&C.startsWith(U));N=n("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":g},...((v=l.options)!=null?v:[]).map(S=>p(o.answer===S.id,S.id,S.label,()=>e.onboarding.answer(S.id))),l.other?p(b,"other",l.otherLabel||f("Other"),()=>b||e.onboarding.answer(U)):false,b?$(f("Your answer"),o.answer.slice(U.length),S=>e.onboarding.answer(U+S)):false);}else (l==null?void 0:l.type)==="scale"?N=n("div",{},n("div",{className:"ckf-scale",role:"radiogroup","aria-labelledby":g},...Q(l).map(b=>n("button",{type:"button",role:"radio",className:"ckf-num","aria-checked":String(o.answer===String(b)),"data-ckf-id":`q:${b}`,onClick:()=>e.onboarding.answer(String(b))},String(b)))),l.lowLabel||l.highLabel?n("div",{className:"ckf-ends ckf-small"},n("span",{},l.lowLabel||""),n("span",{},l.highLabel||"")):false):l&&(N=$(l.placeholder||f("Your answer"),(F=o.answer)!=null?F:"",b=>e.onboarding.answer(b)));return n("div",{className:"ckf-scrim"},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":g},n("div",{className:"ckf-top"},ne(o.index+1,o.total),W(f("Close"),e.onboarding.dismiss)),o.index===0?te(o.flow.icon,"ckf-hic"):false,n("h2",{className:"ckf-h",id:g},s.title),s.body?n("p",{className:"ckf-p"},s.body):false,N,n("div",{className:"ckf-row"},o.back?L(f("Back"),"quiet",e.onboarding.back):false,l!=null&&l.optional?L(l.skipLabel||f("Skip"),"quiet",e.onboarding.skip):false,L(s.button||(o.last?f("Done"):f("Continue")),"primary",e.onboarding.next,{disabled:!k,id:"go"}))))},M=o=>{let s=o.step;if(s.kind==="question")return h(o);let l=n("div",{className:"ckf-card",role:"dialog","aria-modal":s.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},o.total>1?n("p",{className:"ckf-small"},I("Step {n} of {total}",{n:o.index+1,total:o.total})):n("span"),W(f("Close the tour"),e.onboarding.dismiss)),s.kind==="modal"?te(o.flow.icon,"ckf-hic"):false,x(s),n("h2",{className:"ckf-h",id:"ckf-title"},s.title),s.body?n("p",{className:"ckf-p"},s.body):false,n("div",{className:"ckf-row"},L(s.button||(o.last?f("Done"):f("Next")),"primary",e.onboarding.next,{id:"go"})));if(s.kind==="modal")return n("div",{className:"ckf-scrim"},l);let g=s.target?P(s.target):null,k=n("div",{className:"ckf-float"},l);if(g){let N=n("div",{className:"ckf-ring","aria-hidden":"true"});return k.append(n("span",{className:"ckf-arrow","aria-hidden":"true"})),w={float:k,ring:N,target:g,side:s.placement},T(k,N,g,s.placement),n("div",{},N,k)}return k},P=o=>{var l;let s=()=>document.querySelector(`[data-ck-target="${CSS.escape(o)}"]`);return /^[#.[]|[\s>:=]/.test(o)&&(l=V(o))!=null?l:s()},V=o=>{try{return document.querySelector(o)}catch(s){return null}},T=(o,s,l,g="auto")=>{var se;let k=l.getBoundingClientRect();Object.assign(s.style,{left:`${k.left-4}px`,top:`${k.top-4}px`,width:`${k.width+8}px`,height:`${k.height+8}px`});let N=window.innerWidth,$=window.innerHeight,p=Math.min(340,N-24),C=o.offsetHeight||200,v=14,F={bottom:$-k.bottom-v-12>=C,top:k.top-v-12>=C,right:N-k.right-v-12>=p,left:k.left-v-12>=p},b={top:"bottom",bottom:"top",left:"right",right:"left"},_=(se=(g==="auto"||!b[g]?["bottom","top"]:[g,b[g],"bottom","top","right","left"]).find(D=>F[D]))!=null?se:g!=="auto"&&b[g]?g:k.top>$-k.bottom?"top":"bottom",A=(D,Fe)=>Math.max(12,Math.min(D,Fe-12)),j=_==="top"||_==="bottom",oe=j?A(g==="auto"?k.left:k.left+k.width/2-p/2,N-p):_==="right"?k.right+v:k.left-v-p,ie=j?_==="bottom"?k.bottom+v:k.top-v-C:A(k.top+k.height/2-C/2,$-C);Object.assign(o.style,{left:`${oe}px`,top:`${ie}px`,right:"auto",bottom:"auto",width:`${p}px`}),o.setAttribute("data-side",_);let Ne=j?k.left+k.width/2-oe:k.top+k.height/2-ie;o.style.setProperty("--ckf-ap",`${Math.max(18,Math.min(Ne,(j?p:C)-18))}px`);},O=o=>{let s=o.items.filter(l=>l.done).length;return n("div",{className:"ckf-float"},n("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},n("h2",{className:"ckf-h",id:"ckf-title"},o.flow.name),W(f("Hide the checklist"),e.onboarding.dismiss)),n("p",{className:"ckf-small"},I("{done} of {total} done",{done:s,total:o.items.length})),n("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(o.items.length),"aria-valuenow":String(s)},n("i",{style:`width:${s/o.items.length*100}%`})),n("div",{className:"ckf-opts"},...o.items.map(({step:l,done:g,opens:k})=>{let N=[n("span",{className:"ckf-tick","aria-hidden":"true"},g?"\u2713":""),te(l.icon,"ckf-ic"),n("span",{},n("b",{},l.title),l.body?n("span",{className:"ckf-small"},l.body):false)];return !g&&k?n("button",{type:"button",className:"ckf-check","aria-label":I("Start \u201C{title}\u201D",{title:l.title}),"data-ckf-id":`t:${l.id}`,onClick:()=>e.onboarding.open(l.id)},...N,n("span",{className:"ckf-go","aria-hidden":"true"},"\u203A")):g||l.event?n("div",{className:"ckf-check","data-done":g,role:"listitem"},...N):n("button",{type:"button",className:"ckf-check","aria-label":I("Mark \u201C{title}\u201D done",{title:l.title}),"data-ckf-id":`i:${l.id}`,onClick:()=>e.onboarding.check(l.id)},...N)}))))},H=o=>{let s=o.message,l=s.button?L(s.button,"primary",e.message.click,{id:"go"}):false;return s.style==="banner"?n("div",{className:"ckf-banner",role:"status"},n("span",{},n("b",{},s.title),s.body?n("span",{className:"ckf-small"},s.body):false),l,W(f("Dismiss"),e.message.dismiss)):n("div",{className:"ckf-scrim",onClick:g=>g.target===g.currentTarget&&e.message.dismiss()},n("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},n("span"),W(f("Dismiss"),e.message.dismiss)),n("h2",{className:"ckf-h",id:"ckf-title"},s.title),s.body?n("p",{className:"ckf-p"},s.body):false,l?n("div",{className:"ckf-row"},l):false))},z=()=>{var $,p,C,v,F,b,S,_;let o=e.view();xe(r);let s=(p=t.accent)!=null?p:($=e.accent)==null?void 0:$.call(e);s&&r.style.setProperty("--ckf-accent",s);let l=(C=e.finale)==null?void 0:C.call(e);l&&l.key!==a&&(a=l.key,ce(l.kind,{accent:s}));let g=o?be(o):"",k=(F=(v=document.activeElement)==null?void 0:v.closest)!=null&&F.call(v,".ckf-root")?(b=document.activeElement)==null?void 0:b.getAttribute("data-ckf-id"):null;g&&!i&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(m=document.activeElement),g!==i&&!g.startsWith("c:")&&(d=""),g||(d=""),w=null;let N=o?Le(o):"";if(r.toggleAttribute("data-still",!!N&&N===u),u=N,r.replaceChildren(...o?[o.type==="cancel"?c(o):o.type==="step"?M(o):o.type==="checklist"?O(o):H(o)]:[]),E(),g!==i){let A=r.querySelector("[aria-modal=true]"),j=(S=A==null?void 0:A.querySelector("[role=radio], input, [data-ckf-id=go], textarea"))!=null?S:null;j==null||j.focus(),!g&&m&&(m.focus(),m=null);}else k&&((_=r.querySelector(`[data-ckf-id="${CSS.escape(k)}"]`))==null||_.focus());i=g;},y=o=>{if(o.key!=="Escape")return;let s=e.view();(s==null?void 0:s.type)==="cancel"?e.cancel.close():(s==null?void 0:s.type)==="message"?e.message.dismiss():(s==null?void 0:s.type)==="step"&&(s.step.kind==="modal"||s.step.kind==="question")&&e.onboarding.dismiss();};function E(){w&&T(w.float,w.ring,w.target,w.side);}document.addEventListener("keydown",y),window.addEventListener("resize",E),window.addEventListener("scroll",E,{passive:true,capture:true});let K=e.subscribe(z),R=J(z);return z(),()=>{K(),R(),document.removeEventListener("keydown",y),window.removeEventListener("resize",E),window.removeEventListener("scroll",E,{capture:true}),r.remove();}},ve=(e,t={})=>{if(typeof document=="undefined")return ()=>{};let r=we(t),a="",i=null,u=()=>{var P,V,T;let c=e.view();xe(r);let x=c?`${c.paywall.id}:${c.index}`:"";if(x&&!a&&document.activeElement instanceof HTMLElement&&(i=document.activeElement),!c){r.replaceChildren(),r.removeAttribute("data-still"),a&&(i==null||i.focus()),a="";return}a&&r.setAttribute("data-still","");let h=c.page,M=h.kind==="plans"?n("div",{className:"ckf-opts",role:"radiogroup","aria-label":f("Plans")},...c.plans.map(O=>n("button",{type:"button",role:"radio",className:"ckf-opt ckf-plan","aria-checked":String(c.plan===O.id),"data-ckf-id":`p:${O.id}`,onClick:()=>e.pick(O.id)},n("span",{className:"ckf-radio"}),n("span",{},O.name,O.note?n("span",{className:"ckf-small"},O.note):false),n("b",{},O.price)))):false;r.replaceChildren(n("div",{className:"ckf-scrim",onClick:O=>O.target===O.currentTarget&&e.close()},n("div",{className:"ckf-card ckf-pw",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},n("div",{className:"ckf-top"},ne(c.index+1,c.total),W(f("Close"),e.close)),n("h2",{className:"ckf-h",id:"ckf-title"},h.title),h.body?n("p",{className:"ckf-p"},h.body):false,h.kind==="benefits"&&((P=h.items)!=null&&P.length)?n("div",{className:"ckf-opts"},...h.items.map(O=>n("p",{className:"ckf-li"},O))):false,h.kind==="proof"&&((V=h.quotes)!=null&&V.length)?n("div",{className:"ckf-opts"},...h.quotes.map(O=>n("blockquote",{className:"ckf-quote"},O.text,O.by?n("cite",{},O.by):false))):false,M,c.error?n("p",{className:"ckf-err",role:"alert"},c.error):false,n("div",{className:"ckf-btns"},L(c.busy?f("One moment\u2026"):h.button||f("Continue"),"primary",e.next,{disabled:c.busy||h.kind==="plans"&&!c.plan,id:"go"}),c.index?L(f("Back"),"quiet",e.back,{disabled:c.busy}):false)))),x!==a&&((T=r.querySelector("[data-ckf-id=go]"))==null||T.focus()),a=x;},m=c=>{e.view()&&c.key==="Escape"&&e.close();};document.addEventListener("keydown",m);let d=e.subscribe(u),w=J(u);return u(),()=>{d(),w(),document.removeEventListener("keydown",m),r.remove();}};var Ie=e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return (t>>>0)/4294967296};var Te=e=>typeof e.weight=="number"&&e.weight>0?e.weight:0,Ce=(e,t)=>{var m,d;let r=(d=(m=e.variants[0])==null?void 0:m.id)!=null?d:"control";if(e.winner)return e.winner;if(e.status!=="running")return r;let a=Ie(`${e.key}:${t}`),i=0,u;for(let w of e.variants){let c=Te(w);if(c&&(i+=c,u=w.id,a<i))return w.id}return u!=null?u:r},$e=(e,t,r)=>{if(!r||e.winner||e.status!=="running")return Ce(e,t);let a=`${e.key}
92
+ ${t}`,i=r.get(a);if(i!==void 0&&e.variants.some(m=>m.id===i))return i;let u=Ce(e,t);return r.set(a,u),u};var _e=e=>e.status==="running"&&!e.winner;var Me=(e,t,r,a,i)=>{var m,d;if(a[e])return a[e];let u=t==null?void 0:t.experiments.find(w=>w.key===e);return u?r===null&&_e(u)?(d=(m=u.variants[0])==null?void 0:m.id)!=null?d:"control":$e(u,r!=null?r:"",i):"control"};var re="$paywall",je=(e,t,r,a)=>{var d,w;let i=t.experiment?e==null?void 0:e.experiments.find(c=>c.key===t.experiment):void 0,u=i?Me(i.key,e,r,{},a):(d=t.variants[0])==null?void 0:d.id,m=(w=t.variants.find(c=>c.id===u))!=null?w:t.variants[0];return m?{variant:m.id,pages:m.pages,test:(i==null?void 0:i.status)==="running"&&!i.winner&&r!==null?i.key:void 0}:null},Oe=e=>{let t=null,r=new Set,a=()=>{for(let c of [...r])try{c();}catch(x){}},i=()=>t?{paywall:t.w.id,placement:t.w.placement,variant:t.variant}:{},u=()=>{t&&!t.seen.has(t.index)&&(t.seen.add(t.index),e.track(re,{...i(),page:t.pages[t.index].id,index:t.index,action:"page"})),a();},m=c=>{var h,M;let x=t;x&&(t=null,c.outcome==="closed"&&((M=(h=x.options).onClose)==null||M.call(h,c)),x.resolve(c),a());},d=c=>{var x;return {outcome:c,index:(x=t==null?void 0:t.index)!=null?x:0,...t?{paywall:t.w.id,variant:t.variant}:{},...c!=="closed"&&t?{plan:t.plans.find(h=>h.id===t.plan)}:{}}},w=()=>{let c=t,x=c==null?void 0:c.plans.find(h=>h.id===c.plan);if(!(!c||!x||c.busy)){if(!c.options.onPurchase)return m(d("chosen"));c.busy=true,c.error=void 0,a(),Promise.resolve().then(()=>{var h,M;return (M=(h=c.options).onPurchase)==null?void 0:M.call(h,x)}).then(h=>{if(c.busy=false,t===c){if(h===false)return a();e.track(re,{...i(),page:c.pages[c.index].id,index:c.index,plan:x.id,action:"purchased"}),m(d("purchased"));}},()=>{c.busy=false,c.error=f("The purchase did not go through. Please try again."),a();});}};return {open:(c,x={})=>{var y,E,K;if(t)return t.promise;let h=e.config(),M=(y=h==null?void 0:h.paywalls)==null?void 0:y.find(R=>R.placement===c),P=M?je(h,M,e.distinctId(),e.kept):null;if(!M||!(P!=null&&P.pages.length))return Promise.resolve({outcome:"closed",index:0});let V=new Map(((E=x.plans)!=null?E:[]).map(R=>[R.id,R])),T=M.plans.map(R=>{var o;return (o=V.get(R.id))!=null?o:R}),O=()=>{},H=new Promise(R=>O=R),z=T.some(R=>R.id===M.highlight)?M.highlight:(K=T[0])==null?void 0:K.id;return t={w:M,variant:P.variant,pages:P.pages,plans:T,index:0,plan:z,busy:false,seen:new Set,options:x,resolve:O,promise:H},P.test&&e.track("$exposure",{experiment:P.test,variant:P.variant}),u(),H},view:()=>t?{paywall:t.w,variant:t.variant,page:t.pages[t.index],index:t.index,total:t.pages.length,last:t.index===t.pages.length-1,plans:t.plans,plan:t.plan,busy:t.busy,error:t.error}:null,subscribe:c=>(r.add(c),()=>r.delete(c)),next:()=>{if(!(!t||t.busy)){if(t.pages[t.index].kind==="plans"||t.index===t.pages.length-1)return w();t.index++,t.error=void 0,u();}},back:()=>{!t||t.busy||!t.index||(t.index--,t.error=void 0,a());},pick:c=>{!t||t.busy||!t.plans.some(x=>x.id===c)||(t.plan=c,t.error=void 0,a());},close:()=>{!t||t.busy||(e.track(re,{...i(),index:t.index,action:"closed"}),m(d("closed")));}}};var Ae=(e,t)=>{let r=Oe(e);return ve(r,t),r};window.__mrrocketFlows={mountFlows:ye,paywallHost:Ae};})();