@mrrocket/sdk 0.10.0 → 0.12.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.12.0 (not published yet)
6
+
7
+ - **Form leads:** a submitted form marked `data-mrrocket-form="<name>"` becomes a contact in MRRocket (`POST /api/sdk/forms`, sent with `sendBeacon`). It sends the email, the name and the other fields a person typed, plus the form's name, page, referrer, UTM and the state of a checkbox marked `data-mrrocket-consent`; never passwords, card, hidden or file fields, fields whose name looks sensitive (`SENSITIVE`) or anything inside `data-mrrocket-ignore`. With analytics consent the lead carries the visitor id and the SDK calls `identify(email)` when your code has not identified the person yet, so their history carries over. Opt-in auto-detection captures any form with an email field and no password field.
8
+ - **Next.js:** new `forms` prop on `<CockpitProvider>`: `true` (default, marked forms), `"auto"` or `false`; the capture code is a dynamic import.
9
+ - **Script tag:** marked forms are captured with no new attribute; `data-forms="auto"` turns on auto-detection. The capture code is a seventh file, `sdk-forms.js` (`dist/browser/mrrocket-forms.js`, about 2 KB gzip), loaded only on pages with a form to capture; `sdk.js` stays within its 14.5 KB budget.
10
+ - New module `forms` with `fieldsOf`, `sendable`, `captures`, `watchForms` and `SENSITIVE`.
11
+ - Version reported in event batches: `0.12.0`.
12
+
13
+ ## 0.11.0
14
+
15
+ - **Onboarding with waits and conditions:** a flow from MRRocket › Conversion › Onboarding may hold a **wait** ("1 day": the next step shows that long after the one before was done; a short wait comes back on its own, a long one at the next visit) and a **condition** that forks it into a Yes and a No path: "Did <event> happen?" (the person's events from MRRocket, plus what they did on this device) or "Is on <page>?" (the path when they reach it; `*` at the end for everything below). Decided once per person and kept with their progress; like a journey's branch it ends its line. New `$onboarding` actions: a wait records `shown` and `completed`, a condition `answered` with `answer: "yes" | "no"`. The config's `onboarding[].nodes` carries the whole flow; `steps` still holds what older versions may show (the steps before the first wait or condition). Apps have no page path, so "Is on <page>?" answers no there.
16
+ - **Tour steps point at any element:** a step's target may be a CSS selector (`#new-project`, `.toolbar > button:nth-of-type(2)`) as well as a `data-ck-target` name.
17
+ - **Pick on your site:** opened by MRRocket's editor in a frame (`?ck_embed=1&ck_pick=1&ck_origin=…`), the page outlines the element under the pointer and sends the clicked one's selector back to the editor (postMessage to that origin only). Nothing happens on a normal visit.
18
+ - New exports in `flows`: `nodesOf`, `waitMs`, `pageMatches`, the types `OnboardingNode`, `OnboardingWait`, `OnboardingCondition`, `FlowProgress`; `FlowsEnv` takes `path()` and `now()`.
19
+ - Version reported in event batches: `0.11.0`.
20
+
5
21
  ## 0.10.0
6
22
 
7
23
  - **Messenger, new look (web and apps):** Home opens under a head in your color with the greeting large on it, then cards: the recent chat with the team's mark, "Send us a message" with how soon you reply, and help search with the top articles. The chat has a round send button in one rounded field, softer bubbles and the reply time in its head; the launcher is larger, turns into a cross when open and takes a dark text on a light color. React Native draws the same: line icons with the optional `react-native-svg` (text glyphs without it).
package/README.md CHANGED
@@ -499,6 +499,26 @@ Also `data-messenger-greeting`, `-label`, `-position="bottom-left"`, and "false"
499
499
 
500
500
  In React Native, `<MRRocketProvider messenger={{ launcher: true }}>` adds the bubble, `useMessenger().open()` opens it from your own button; a new answer shows as a banner at the top, with a light haptic when `expo-haptics` is installed. The provider also shows your live in-app survey (`surveys={false}` to switch off) and the feedback sheet (`useFeedback().open()`). With the person's consent (`replay`) and `react-native-view-shot` installed, the app also records sessions as screen pictures for Sessions: none while the keyboard is open, and `<MRRocketMask>` areas are painted black on the server before storing. Taps go to Heatmaps as clicks on the current screen; the provider then wraps the app in one `View` with `flex: 1` (`heatmaps={false}` to switch off).
501
501
 
502
+ ## 19. Form leads (0.12.0)
503
+
504
+ A form on your site becomes a contact in MRRocket when someone submits it. Mark the form with its name, and (optional) the checkbox that asks for permission to email:
505
+
506
+ ```html
507
+ <form data-mrrocket-form="Demo request">
508
+ <input type="email" name="email" required>
509
+ <input type="text" name="name">
510
+ <label><input type="checkbox" name="newsletter" data-mrrocket-consent> Email me product news</label>
511
+ <button type="submit">Request a demo</button>
512
+ </form>
513
+ ```
514
+
515
+ - **What is sent** to `POST {host}/api/sdk/forms` (`sendBeacon`, so it survives the page leaving): the email (required), the name (a full-name field, or first and last), the other fields a person typed, the form's name, the page, the referrer and UTM, and whether the `data-mrrocket-consent` box was ticked. **Never** passwords, card fields, hidden fields, files, fields whose name looks sensitive (password, token, card, iban, ssn …) or anything inside `data-mrrocket-ignore`. At most 30 fields, 1,000 characters each.
516
+ - **In MRRocket** the contact gets the source "Form: Demo request", the fields on its timeline and the product as a lead. Consent is recorded as the contact's legal basis to email only when the box was ticked; without it the contact has no basis until you set one.
517
+ - **Linked to the visitor:** with analytics consent the lead carries the visitor id, and the SDK calls `identify(email)` if your code has not identified the person, so their visits before the form count for the contact.
518
+ - **Next.js:** on by default for marked forms (`forms={false}` switches it off). `forms="auto"` also captures any form with an email field, never one with a password field.
519
+ - **Script tag:** marked forms work as they are; the capture code (`sdk-forms.js`, about 2 KB gzip) loads only on pages with one. `data-forms="auto"` on the script tag captures any email form.
520
+ - **Not your form?** Typeform, Tally, Cal.com, Calendly, Webflow and Framer post to the product's lead webhook instead (MRRocket › Settings › Integrations › Leads and API).
521
+
502
522
  ## Privacy and consent
503
523
 
504
524
  ```tsx
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var E=(n,a)=>Math.round(n*(1-a/100)*100)/100,v=(n,a)=>{try{return new Intl.NumberFormat(void 0,{style:"currency",currency:a}).format(n)}catch(p){return `${n.toFixed(2)} ${a}`}},S=n=>n.kind==="contact"?"Send to the team":n.kind==="pause"?"Pause instead":n.kind==="downgrade"?"Switch plan":"Accept offer";var O="ckf-styles",_=`
1
+ (function(){'use strict';var $=(o,a)=>Math.round(o*(1-a/100)*100)/100,v=(o,a)=>{try{return new Intl.NumberFormat(void 0,{style:"currency",currency:a}).format(o)}catch(u){return `${o.toFixed(2)} ${a}`}},E=o=>o.kind==="contact"?"Send to the team":o.kind==="pause"?"Pause instead":o.kind==="downgrade"?"Switch plan":"Accept offer";var S="ckf-styles",j=`
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)}}
@@ -61,4 +61,4 @@
61
61
  .ckf-banner{animation-name:ckf-fade}
62
62
  @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}}
63
63
  @media (prefers-reduced-motion:reduce){.ckf-root *{animation:none!important;transition:none!important}}
64
- `,e=(n,a={},...p)=>{let d=document.createElement(n);for(let[f,c]of Object.entries(a))c===void 0||c===false||(typeof c=="function"?d.addEventListener(f.slice(2).toLowerCase(),c):f==="className"?d.className=String(c):d.setAttribute(f,c===true?"":c));for(let f of p)(f||f==="")&&d.append(typeof f=="string"?document.createTextNode(f):f);return d},b=(n,a,p,d={})=>e("button",{type:"button",className:`ckf-btn${a==="secondary"?"":` ckf-${a}`}`,disabled:!!d.disabled,"data-ckf-id":d.id,onClick:()=>p()},n),w=(n,a)=>e("button",{type:"button",className:"ckf-x","aria-label":n,"data-ckf-id":"x",onClick:()=>a()},"\xD7"),H=(n,a)=>a>1?e("span",{className:"ckf-dots",role:"img","aria-label":`Step ${n} of ${a}`},...Array.from({length:a},(p,d)=>e("span",{className:"ckf-dot","data-on":d<n}))):e("span"),P=n=>n.type==="cancel"?`c:${n.screen}`:n.type==="step"?`s:${n.step.id}`:n.type==="checklist"?`l:${n.flow.id}`:`m:${n.message.id}`,L=(n,a={})=>{var $;if(typeof document=="undefined")return ()=>{};if(!document.getElementById(O)){let t=document.createElement("style");t.id=O,t.textContent=_,document.head.appendChild(t);}let p=e("div",{className:`ckf-root${a.className?` ${a.className}`:""}`,"data-theme":($=a.theme)!=null?$:"auto"});a.accent&&p.style.setProperty("--ckf-accent",a.accent),document.body.appendChild(p);let d="",f=null,c="",h=null,T=t=>{var l,u;let o="ckf-title",r=t.busy,i=[];if(t.screen==="survey")i.push(e("h2",{className:"ckf-h",id:o},t.flow.question||"Why are you leaving?"),e("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":o},...t.flow.reasons.map(s=>e("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(t.reason===s.id),"data-ckf-id":`r:${s.id}`,onClick:()=>n.cancel.pick(s.id)},e("span",{className:"ckf-radio"}),s.label))),e("div",{className:"ckf-btns"},b("Continue","primary",n.cancel.next,{disabled:!t.reason,id:"go"}),b("Never mind, keep my plan","quiet",n.cancel.close)));else if(t.screen==="offer"&&t.offer){let s=t.offer,m=(l=t.flow.reasons.find(y=>y.id===t.reason))==null?void 0:l.label,g=false;s.kind==="discount"&&s.percent&&(g=t.price?e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},v(E(t.price.amount,s.percent),t.price.currency)),e("span",{className:"ckf-strike"},v(t.price.amount,t.price.currency)),e("span",{className:"ckf-small"},`/${(u=t.price.interval)!=null?u:"month"}${s.months?` for ${s.months} ${s.months===1?"month":"months"}`:""}`)):e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},`${s.percent}% off`),s.months?e("span",{className:"ckf-small"},`for ${s.months} ${s.months===1?"month":"months"}`):false)),s.kind==="pause"&&s.months&&(g=e("div",{className:"ckf-box"},e("span",{},`Pause for up to ${s.months} ${s.months===1?"month":"months"}. Your data stays.`))),s.kind==="downgrade"&&s.planName&&(g=e("div",{className:"ckf-box"},e("b",{},s.planName)));let k=s.kind==="contact"?e("textarea",{className:"ckf-text",placeholder:"What would make you stay?","aria-label":"Your message",maxlength:"500","data-ckf-id":"comment",onInput:y=>c=y.target.value}):null;k&&(k.value=c),i.push(m?e("p",{className:"ckf-small"},`You said: ${m}`):false,e("h2",{className:"ckf-h",id:o},s.headline),g,k!=null?k:false,e("div",{className:"ckf-btns"},b(r?"One moment\u2026":S(s),"primary",()=>n.cancel.accept(c),{disabled:r,id:"go"}),b("No thanks, continue cancelling","quiet",n.cancel.decline,{disabled:r})));}else {let m=t.steps===1?null:e("textarea",{className:"ckf-text",placeholder:"Anything else we should know? (optional)","aria-label":"Anything else we should know? (optional)",maxlength:"500","data-ckf-id":"comment",onInput:g=>c=g.target.value});m&&(m.value=c),i.push(e("h2",{className:"ckf-h",id:o},t.flow.confirm.title),t.flow.confirm.body?e("p",{className:"ckf-p"},t.flow.confirm.body):false,m!=null?m:false,e("div",{className:"ckf-btns"},b(r?"One moment\u2026":t.flow.confirm.button,"danger",()=>n.cancel.confirm(c),{disabled:r,id:"go"}),b("Keep my plan","secondary",n.cancel.close,{disabled:r})));}return e("div",{className:"ckf-scrim",onClick:s=>s.target===s.currentTarget&&!r&&n.cancel.close()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":o},e("div",{className:"ckf-top"},H(t.step,t.steps),w("Close",n.cancel.close)),...i,t.error?e("p",{className:"ckf-err",role:"alert"},t.error):false))},I=t=>{let o=t.step,r=e("div",{className:"ckf-card",role:"dialog","aria-modal":o.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},t.total>1?e("p",{className:"ckf-small"},`Step ${t.index+1} of ${t.total}`):e("span"),w("Close the tour",n.onboarding.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},o.title),o.body?e("p",{className:"ckf-p"},o.body):false,e("div",{className:"ckf-row"},b(o.button||(t.last?"Done":"Next"),"primary",n.onboarding.next,{id:"go"})));if(o.kind==="modal")return e("div",{className:"ckf-scrim"},r);let i=o.target?document.querySelector(`[data-ck-target="${CSS.escape(o.target)}"]`):null,l=e("div",{className:"ckf-float"},r);if(i){let u=e("div",{className:"ckf-ring","aria-hidden":"true"});return h={float:l,ring:u,target:i},N(l,u,i),e("div",{},u,l)}return l},N=(t,o,r)=>{let i=r.getBoundingClientRect();Object.assign(o.style,{left:`${i.left-4}px`,top:`${i.top-4}px`,width:`${i.width+8}px`,height:`${i.height+8}px`});let l=Math.min(340,window.innerWidth-24),u=Math.max(12,Math.min(i.left,window.innerWidth-l-12)),s=i.bottom+12;Object.assign(t.style,{left:`${u}px`,right:"auto",width:`${l}px`}),s+200<window.innerHeight?Object.assign(t.style,{top:`${s}px`,bottom:"auto"}):Object.assign(t.style,{top:"auto",bottom:`${Math.max(12,window.innerHeight-i.top+12)}px`});},A=t=>{let o=t.items.filter(r=>r.done).length;return e("div",{className:"ckf-float"},e("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("h2",{className:"ckf-h",id:"ckf-title"},t.flow.name),w("Hide the checklist",n.onboarding.dismiss)),e("p",{className:"ckf-small"},`${o} of ${t.items.length} done`),e("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(t.items.length),"aria-valuenow":String(o)},e("i",{style:`width:${o/t.items.length*100}%`})),e("div",{className:"ckf-opts"},...t.items.map(({step:r,done:i})=>{let l=[e("span",{className:"ckf-tick","aria-hidden":"true"},i?"\u2713":""),e("span",{},e("b",{},r.title),r.body?e("span",{className:"ckf-small"},r.body):false)];return i||r.event?e("div",{className:"ckf-check","data-done":i,role:"listitem"},...l):e("button",{type:"button",className:"ckf-check","aria-label":`Mark \u201C${r.title}\u201D done`,"data-ckf-id":`i:${r.id}`,onClick:()=>n.onboarding.check(r.id)},...l)}))))},M=t=>{let o=t.message,r=o.button?b(o.button,"primary",n.message.click,{id:"go"}):false;return o.style==="banner"?e("div",{className:"ckf-banner",role:"status"},e("span",{},e("b",{},o.title),o.body?e("span",{className:"ckf-small"},o.body):false),r,w("Dismiss",n.message.dismiss)):e("div",{className:"ckf-scrim",onClick:i=>i.target===i.currentTarget&&n.message.dismiss()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("span"),w("Dismiss",n.message.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},o.title),o.body?e("p",{className:"ckf-p"},o.body):false,r?e("div",{className:"ckf-row"},r):false))},C=()=>{var i,l,u,s,m;let t=n.view(),o=t?P(t):"",r=(l=(i=document.activeElement)==null?void 0:i.closest)!=null&&l.call(i,".ckf-root")?(u=document.activeElement)==null?void 0:u.getAttribute("data-ckf-id"):null;if(o&&!d&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(f=document.activeElement),o!==d&&!o.startsWith("c:")&&(c=""),o||(c=""),h=null,p.replaceChildren(...t?[t.type==="cancel"?T(t):t.type==="step"?I(t):t.type==="checklist"?A(t):M(t)]:[]),o!==d){let g=p.querySelector("[aria-modal=true]"),k=(s=g==null?void 0:g.querySelector("[role=radio], [data-ckf-id=go], textarea"))!=null?s:null;k==null||k.focus(),!o&&f&&(f.focus(),f=null);}else r&&((m=p.querySelector(`[data-ckf-id="${CSS.escape(r)}"]`))==null||m.focus());d=o;},F=t=>{if(t.key!=="Escape")return;let o=n.view();(o==null?void 0:o.type)==="cancel"?n.cancel.close():(o==null?void 0:o.type)==="message"?n.message.dismiss():(o==null?void 0:o.type)==="step"&&o.step.kind==="modal"&&n.onboarding.dismiss();},x=()=>{h&&N(h.float,h.ring,h.target);};document.addEventListener("keydown",F),window.addEventListener("resize",x),window.addEventListener("scroll",x,{passive:true,capture:true});let R=n.subscribe(C);return C(),()=>{R(),document.removeEventListener("keydown",F),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,{capture:true}),p.remove();}};window.__mrrocketFlows={mountFlows:L};})();
64
+ `,e=(o,a={},...u)=>{let d=document.createElement(o);for(let[f,c]of Object.entries(a))c===void 0||c===false||(typeof c=="function"?d.addEventListener(f.slice(2).toLowerCase(),c):f==="className"?d.className=String(c):d.setAttribute(f,c===true?"":c));for(let f of u)(f||f==="")&&d.append(typeof f=="string"?document.createTextNode(f):f);return d},b=(o,a,u,d={})=>e("button",{type:"button",className:`ckf-btn${a==="secondary"?"":` ckf-${a}`}`,disabled:!!d.disabled,"data-ckf-id":d.id,onClick:()=>u()},o),w=(o,a)=>e("button",{type:"button",className:"ckf-x","aria-label":o,"data-ckf-id":"x",onClick:()=>a()},"\xD7"),H=(o,a)=>a>1?e("span",{className:"ckf-dots",role:"img","aria-label":`Step ${o} of ${a}`},...Array.from({length:a},(u,d)=>e("span",{className:"ckf-dot","data-on":d<o}))):e("span"),z=o=>o.type==="cancel"?`c:${o.screen}`:o.type==="step"?`s:${o.step.id}`:o.type==="checklist"?`l:${o.flow.id}`:`m:${o.message.id}`,M=(o,a={})=>{var F;if(typeof document=="undefined")return ()=>{};if(!document.getElementById(S)){let n=document.createElement("style");n.id=S,n.textContent=j,document.head.appendChild(n);}let u=e("div",{className:`ckf-root${a.className?` ${a.className}`:""}`,"data-theme":(F=a.theme)!=null?F:"auto"});a.accent&&u.style.setProperty("--ckf-accent",a.accent),document.body.appendChild(u);let d="",f=null,c="",h=null,L=n=>{var l,p;let t="ckf-title",s=n.busy,i=[];if(n.screen==="survey")i.push(e("h2",{className:"ckf-h",id:t},n.flow.question||"Why are you leaving?"),e("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":t},...n.flow.reasons.map(r=>e("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(n.reason===r.id),"data-ckf-id":`r:${r.id}`,onClick:()=>o.cancel.pick(r.id)},e("span",{className:"ckf-radio"}),r.label))),e("div",{className:"ckf-btns"},b("Continue","primary",o.cancel.next,{disabled:!n.reason,id:"go"}),b("Never mind, keep my plan","quiet",o.cancel.close)));else if(n.screen==="offer"&&n.offer){let r=n.offer,g=(l=n.flow.reasons.find(y=>y.id===n.reason))==null?void 0:l.label,m=false;r.kind==="discount"&&r.percent&&(m=n.price?e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},v($(n.price.amount,r.percent),n.price.currency)),e("span",{className:"ckf-strike"},v(n.price.amount,n.price.currency)),e("span",{className:"ckf-small"},`/${(p=n.price.interval)!=null?p:"month"}${r.months?` for ${r.months} ${r.months===1?"month":"months"}`:""}`)):e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},`${r.percent}% off`),r.months?e("span",{className:"ckf-small"},`for ${r.months} ${r.months===1?"month":"months"}`):false)),r.kind==="pause"&&r.months&&(m=e("div",{className:"ckf-box"},e("span",{},`Pause for up to ${r.months} ${r.months===1?"month":"months"}. Your data stays.`))),r.kind==="downgrade"&&r.planName&&(m=e("div",{className:"ckf-box"},e("b",{},r.planName)));let k=r.kind==="contact"?e("textarea",{className:"ckf-text",placeholder:"What would make you stay?","aria-label":"Your message",maxlength:"500","data-ckf-id":"comment",onInput:y=>c=y.target.value}):null;k&&(k.value=c),i.push(g?e("p",{className:"ckf-small"},`You said: ${g}`):false,e("h2",{className:"ckf-h",id:t},r.headline),m,k!=null?k:false,e("div",{className:"ckf-btns"},b(s?"One moment\u2026":E(r),"primary",()=>o.cancel.accept(c),{disabled:s,id:"go"}),b("No thanks, continue cancelling","quiet",o.cancel.decline,{disabled:s})));}else {let g=n.steps===1?null:e("textarea",{className:"ckf-text",placeholder:"Anything else we should know? (optional)","aria-label":"Anything else we should know? (optional)",maxlength:"500","data-ckf-id":"comment",onInput:m=>c=m.target.value});g&&(g.value=c),i.push(e("h2",{className:"ckf-h",id:t},n.flow.confirm.title),n.flow.confirm.body?e("p",{className:"ckf-p"},n.flow.confirm.body):false,g!=null?g:false,e("div",{className:"ckf-btns"},b(s?"One moment\u2026":n.flow.confirm.button,"danger",()=>o.cancel.confirm(c),{disabled:s,id:"go"}),b("Keep my plan","secondary",o.cancel.close,{disabled:s})));}return e("div",{className:"ckf-scrim",onClick:r=>r.target===r.currentTarget&&!s&&o.cancel.close()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":t},e("div",{className:"ckf-top"},H(n.step,n.steps),w("Close",o.cancel.close)),...i,n.error?e("p",{className:"ckf-err",role:"alert"},n.error):false))},T=n=>{let t=n.step,s=e("div",{className:"ckf-card",role:"dialog","aria-modal":t.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},n.total>1?e("p",{className:"ckf-small"},`Step ${n.index+1} of ${n.total}`):e("span"),w("Close the tour",o.onboarding.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},t.title),t.body?e("p",{className:"ckf-p"},t.body):false,e("div",{className:"ckf-row"},b(t.button||(n.last?"Done":"Next"),"primary",o.onboarding.next,{id:"go"})));if(t.kind==="modal")return e("div",{className:"ckf-scrim"},s);let i=t.target?I(t.target):null,l=e("div",{className:"ckf-float"},s);if(i){let p=e("div",{className:"ckf-ring","aria-hidden":"true"});return h={float:l,ring:p,target:i},N(l,p,i),e("div",{},p,l)}return l},I=n=>{var s;let t=()=>document.querySelector(`[data-ck-target="${CSS.escape(n)}"]`);return /^[#.[]|[\s>:=]/.test(n)&&(s=R(n))!=null?s:t()},R=n=>{try{return document.querySelector(n)}catch(t){return null}},N=(n,t,s)=>{let i=s.getBoundingClientRect();Object.assign(t.style,{left:`${i.left-4}px`,top:`${i.top-4}px`,width:`${i.width+8}px`,height:`${i.height+8}px`});let l=Math.min(340,window.innerWidth-24),p=Math.max(12,Math.min(i.left,window.innerWidth-l-12)),r=i.bottom+12;Object.assign(n.style,{left:`${p}px`,right:"auto",width:`${l}px`}),r+200<window.innerHeight?Object.assign(n.style,{top:`${r}px`,bottom:"auto"}):Object.assign(n.style,{top:"auto",bottom:`${Math.max(12,window.innerHeight-i.top+12)}px`});},A=n=>{let t=n.items.filter(s=>s.done).length;return e("div",{className:"ckf-float"},e("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("h2",{className:"ckf-h",id:"ckf-title"},n.flow.name),w("Hide the checklist",o.onboarding.dismiss)),e("p",{className:"ckf-small"},`${t} of ${n.items.length} done`),e("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(n.items.length),"aria-valuenow":String(t)},e("i",{style:`width:${t/n.items.length*100}%`})),e("div",{className:"ckf-opts"},...n.items.map(({step:s,done:i})=>{let l=[e("span",{className:"ckf-tick","aria-hidden":"true"},i?"\u2713":""),e("span",{},e("b",{},s.title),s.body?e("span",{className:"ckf-small"},s.body):false)];return i||s.event?e("div",{className:"ckf-check","data-done":i,role:"listitem"},...l):e("button",{type:"button",className:"ckf-check","aria-label":`Mark \u201C${s.title}\u201D done`,"data-ckf-id":`i:${s.id}`,onClick:()=>o.onboarding.check(s.id)},...l)}))))},_=n=>{let t=n.message,s=t.button?b(t.button,"primary",o.message.click,{id:"go"}):false;return t.style==="banner"?e("div",{className:"ckf-banner",role:"status"},e("span",{},e("b",{},t.title),t.body?e("span",{className:"ckf-small"},t.body):false),s,w("Dismiss",o.message.dismiss)):e("div",{className:"ckf-scrim",onClick:i=>i.target===i.currentTarget&&o.message.dismiss()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("span"),w("Dismiss",o.message.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},t.title),t.body?e("p",{className:"ckf-p"},t.body):false,s?e("div",{className:"ckf-row"},s):false))},C=()=>{var i,l,p,r,g;let n=o.view(),t=n?z(n):"",s=(l=(i=document.activeElement)==null?void 0:i.closest)!=null&&l.call(i,".ckf-root")?(p=document.activeElement)==null?void 0:p.getAttribute("data-ckf-id"):null;if(t&&!d&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(f=document.activeElement),t!==d&&!t.startsWith("c:")&&(c=""),t||(c=""),h=null,u.replaceChildren(...n?[n.type==="cancel"?L(n):n.type==="step"?T(n):n.type==="checklist"?A(n):_(n)]:[]),t!==d){let m=u.querySelector("[aria-modal=true]"),k=(r=m==null?void 0:m.querySelector("[role=radio], [data-ckf-id=go], textarea"))!=null?r:null;k==null||k.focus(),!t&&f&&(f.focus(),f=null);}else s&&((g=u.querySelector(`[data-ckf-id="${CSS.escape(s)}"]`))==null||g.focus());d=t;},O=n=>{if(n.key!=="Escape")return;let t=o.view();(t==null?void 0:t.type)==="cancel"?o.cancel.close():(t==null?void 0:t.type)==="message"?o.message.dismiss():(t==null?void 0:t.type)==="step"&&t.step.kind==="modal"&&o.onboarding.dismiss();},x=()=>{h&&N(h.float,h.ring,h.target);};document.addEventListener("keydown",O),window.addEventListener("resize",x),window.addEventListener("scroll",x,{passive:true,capture:true});let P=o.subscribe(C);return C(),()=>{P(),document.removeEventListener("keydown",O),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,{capture:true}),u.remove();}};window.__mrrocketFlows={mountFlows:M};})();
@@ -0,0 +1 @@
1
+ (function(){'use strict';var k=/pass(word|wd|code)?|pwd|secret|token|csrf|xsrf|nonce|captcha|honeypot|card|^cc([-_ ]|num|exp|$)|cvv|cvc|csc|expir|iban|(^|[^a-z])bic([^a-z]|$)|swift|routing|account[-_ ]?(no|num)|sort[-_ ]?code|(^|[^a-z])ssn([^a-z]|$)|social[-_ ]?sec|tax[-_ ]?id|vat[-_ ]?id|steuer|passport|(^|[^a-z])(pin|otp|pw)([^a-z]|$)|one[-_ ]?time|auth(?!or)|api[-_ ]?key|session|signature/i,h=new Set(["password","hidden","file","submit","button","reset","image"]),w=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,_=30,F=1e3,v=e=>e.toLowerCase().replace(/[\s_-]+/g,""),x=e=>{var n;if(e.ignored||h.has(e.type))return false;let t=((n=e.autocomplete)!=null?n:"").toLowerCase();return /^cc-|password|one-time-code/.test(t)?false:!k.test(e.name)},E=e=>e.type==="email"||/e-?mail/i.test(e.name)||e.autocomplete==="email",L=e=>{var u;let t=null,n=null,a=null,c=null,o,r={};for(let i of e){if(i.consent){o=(o!=null?o:false)||!i.unchecked;continue}if(!i.name||!x(i)||i.unchecked)continue;let s=i.value.trim().slice(0,F);if(!s)continue;let d=v(i.name),f=((u=i.autocomplete)!=null?u:"").toLowerCase();if(!t&&E(i)&&w.test(s)){t=s.toLowerCase();continue}if(!n&&(f==="name"||["name","fullname","yourname","contactname"].includes(d))){n=s.slice(0,100);continue}if(!a&&(f==="given-name"||["firstname","first","vorname","givenname","fname"].includes(d))){a=s.slice(0,60);continue}if(!c&&(f==="family-name"||["lastname","last","nachname","surname","familyname","lname"].includes(d))){c=s.slice(0,60);continue}let l=i.name.trim().slice(0,60);l in r?r[l]=`${r[l]}, ${s}`.slice(0,F):Object.keys(r).length<_&&(r[l]=s);}let m=n!=null?n:[a,c].filter(Boolean).join(" ")||null;return {email:t,name:m,fields:r,...o===void 0?{}:{consent:o}}},I=e=>(e.getAttribute("data-mrrocket-form")||e.getAttribute("name")||e.id||e.getAttribute("aria-label")||`Form on ${window.location.pathname}`).trim().slice(0,100),O=(e,t)=>e.closest("[data-mrrocket-ignore]")?false:e.hasAttribute("data-mrrocket-form")?true:t&&!!e.querySelector('input[type="email"], input[name*="email" i]')&&!e.querySelector('input[type="password"]'),M=e=>Array.from(e.elements).flatMap(t=>{var o;if(!(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement))return [];if(t.disabled)return [];let n=t instanceof HTMLInputElement?t.type.toLowerCase():t instanceof HTMLSelectElement?"select":"textarea",a=n==="checkbox"||n==="radio",c=t instanceof HTMLSelectElement&&t.multiple?Array.from(t.selectedOptions,r=>r.value).join(", "):a&&t.value==="on"?"yes":t.value;return [{name:t.name||t.id||"",type:n,value:c,autocomplete:(o=t.getAttribute("autocomplete"))!=null?o:void 0,unchecked:a&&!t.checked,ignored:!!t.closest("[data-mrrocket-ignore]"),consent:t.hasAttribute("data-mrrocket-consent")}]}),b=e=>{var c;let t=window;(c=t.__mrrocketFormsOff)==null||c.call(t);let n=o=>{var l,p,g;let r=o.target;if(!(r instanceof HTMLFormElement)||!O(r,!!e.auto))return;let m=L(M(r));if(!m.email)return;let u=Object.fromEntries(Object.entries((p=(l=e.utm)==null?void 0:l.call(e))!=null?p:{}).filter(y=>typeof y[1]=="string"&&!!y[1])),i={key:e.apiKey,form:I(r),url:window.location.href.slice(0,500),title:document.title.slice(0,200)||void 0,referrer:((g=e.referrer)==null?void 0:g.call(e))||document.referrer||void 0,...Object.keys(u).length?{utm:u}:{},distinctId:e.distinctId(),...m},s=JSON.stringify(i),d=`${e.host}/api/sdk/forms`;"sendBeacon"in navigator&&navigator.sendBeacon(d,new Blob([s],{type:"text/plain"}))||fetch(d,{method:"POST",headers:{"content-type":"text/plain"},body:s,keepalive:true}).catch(()=>{}),e.tracking()&&!e.identified()&&e.identify(m.email,{email:m.email,...m.name?{name:m.name}:{}});};document.addEventListener("submit",n,true);let a=()=>{document.removeEventListener("submit",n,true),t.__mrrocketFormsOff===a&&delete t.__mrrocketFormsOff;};return t.__mrrocketFormsOff=a,a};window.__mrrocketForms={watchForms:b};})();
@@ -1,2 +1,2 @@
1
- (function(){'use strict';var Yt=Object.defineProperty;var Xt=(e,t,r)=>t in e?Yt(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var oe=(e,t,r)=>Xt(e,typeof t!="symbol"?t+"":t,r);var pt=e=>{let t=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t+=1:s<2048?t+=2:s>=55296&&s<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(t+=4,r++):t+=3;}return t},Gt=(e,t,r)=>{let s=`{"key":${JSON.stringify(e)},"sdk":${JSON.stringify(r)},"events":[`,a=pt(s)+2,c=[],f=[],C=[],v=a,g=()=>{f.length&&c.push({body:`${s}${f.join(",")}]}`,events:C}),f=[],C=[],v=a;};for(let R of t){let b=JSON.stringify(R),k=pt(b)+1;a+k>6e4||((f.length===100||v+k>6e4)&&g(),f.push(b),C.push(R),v+=k);}return g(),c},gt=(e,t,r)=>Gt(e,t,r).map(s=>s.body);var le=class{constructor(t=1e3,r=30,s=3){oe(this,"windowMs",t);oe(this,"radius",r);oe(this,"count",s);oe(this,"clicks",[]);oe(this,"fired",false);}push(t,r,s){let a=this.clicks.filter(c=>s-c.t<=this.windowMs&&Math.hypot(c.x-t,c.y-r)<=this.radius);return a.length!==this.clicks.length&&(this.fired=false),this.clicks=[...a,{x:t,y:r,t:s}],this.clicks.length>=this.count&&!this.fired?(this.fired=true,true):false}};var Jt='a[href],button,input,select,textarea,label,summary,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[onclick],[data-ck-goal]',zt="[data-ck-mask]",Qt="[data-ck-block]",mt=/\d{4,}|^[a-z]{1,3}-[a-z0-9]{5,}$|^_|__|css-|^sc-|^jsx-/i,Zt=e=>{let t=e.tagName.toLowerCase();if(e.id&&!mt.test(e.id)&&e.id.length<=40)return `${t}#${e.id}`;let r=typeof e.className=="string"?e.className.split(/\s+/).filter(c=>c&&!mt.test(c)&&c.length<=30&&!c.includes(":")):[],s=r.length?`${t}.${r.slice(0,2).join(".")}`:t,a=e.parentElement?[...e.parentElement.children].filter(c=>c.tagName===e.tagName):[];return a.length>1?`${s}:nth-of-type(${a.indexOf(e)+1})`:s},en=e=>{let t=[],r=e;for(;r&&t.length<3&&r.tagName&&r.tagName!=="BODY"&&r.tagName!=="HTML";){let s=Zt(r);if(t.unshift(s),s.includes("#"))break;r=r.parentElement;}return t.join(" > ").slice(0,160)},xe=e=>(e!=null?e:"").replace(/\s+/g," ").trim().slice(0,40),tn=e=>{var r,s,a,c,f;if(e.closest(`${zt},${Qt}`))return "";let t=e.tagName.toLowerCase();if(t==="input"){let C=((r=e.getAttribute("type"))!=null?r:"text").toLowerCase();return xe(C==="submit"||C==="button"?(s=e.getAttribute("aria-label"))!=null?s:e.value:e.getAttribute("aria-label"))}return xe(t==="select"||t==="textarea"?e.getAttribute("aria-label"):(f=(c=(a=e.getAttribute("aria-label"))!=null?a:e.getAttribute("title"))!=null?c:e.innerText)!=null?f:e.textContent)},ht=e=>{var c,f;let t=e.target instanceof Element?e.target:null;if(!t)return null;let r=t.closest(Jt),s=r!=null?r:t,a=document.documentElement;return {x:Math.round(e.clientX),y:Math.round(e.clientY+window.scrollY),vw:window.innerWidth,vh:window.innerHeight,docH:Math.max(a.scrollHeight,(f=(c=document.body)==null?void 0:c.scrollHeight)!=null?f:0),selector:en(s),label:r?tn(r):"",interactive:!!r}},wt=()=>{var r,s;let e=document.documentElement,t=Math.max(e.scrollHeight,(s=(r=document.body)==null?void 0:r.scrollHeight)!=null?s:0);return t?Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)):0};var ve="0.10.0",nn=(e,t)=>{let r=t.trim().toLowerCase();for(let[s,a]of Object.entries(e))if(s.toLowerCase()===r)return a},rn=(e,t)=>{let r=e.trim().toLowerCase(),s=t.trim().toLowerCase();return s.startsWith("@")?r.endsWith(s):r===s},on=(e,t)=>{if(e.op==="in cohort")return false;let r=nn(t,e.property),s=r==null?"":String(r);if(e.op==="\u2265"){let c=Number(s),f=Number(e.values[0]);return s!==""&&Number.isFinite(c)&&Number.isFinite(f)&&c>=f}let a=s!==""&&e.values.some(c=>rn(s,c));return e.op==="is"||e.op==="in"?a:!a},sn=(e,t,r={})=>{var C;if(!e.on)return false;let s={id:t,...r},a=e.sets.length?e.sets.find(v=>v.conditions.every(g=>on(g,s))):{rollout:100};if(!a||kt(`${e.key}:rollout:${t}`)*100>=a.rollout)return false;if(!((C=e.variants)!=null&&C.length))return true;let c=kt(`${e.key}:variant:${t}`)*100,f=0;for(let v of e.variants)if(f+=v.split,c<f)return v.key;return e.variants[e.variants.length-1].key},Ke=(e,t,r,s={})=>{var c;let a=(c=t==null?void 0:t.flags)==null?void 0:c.find(f=>f.key===e);return a?sn(a,r,s):false},an=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],yt="ck_preview",bt="ck_embed",Q="ck_id",se="ck_sid";var cn=e=>{var r;let t={};for(let s of an){let a=(r=e(s))==null?void 0:r.trim();a&&(t[s]=a.slice(0,150));}return t},Ct=e=>{let t=new URLSearchParams(e);return cn(r=>t.get(r))};var ln=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},kt=e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,(t>>>0)/4294967296},dn=(e,t)=>{var c,f,C,v;let r=(f=(c=e.variants[0])==null?void 0:c.id)!=null?f:"control";if(e.winner)return e.winner;if(e.status!=="running")return r;let s=ln(`${e.key}:${t}`),a=0;for(let g of e.variants)if(a+=g.weight,s<a)return g.id;return (v=(C=e.variants[e.variants.length-1])==null?void 0:C.id)!=null?v:r},xt=e=>{let t=Array.isArray(e)?e[0]:e;if(!t)return {};let r={};for(let s of t.split(",")){let[a,c]=s.split(":");a&&c&&(r[a.trim()]=c.trim());}return r};var ue=(e,t,r,s)=>{if(s[e])return s[e];let a=t==null?void 0:t.experiments.find(c=>c.key===e);return a?dn(a,r):"control"},Rt=(e,t,r)=>{var a,c,f,C,v,g;let s={...(a=e==null?void 0:e.texts)!=null?a:{}};for(let R of (c=e==null?void 0:e.experiments)!=null?c:[]){let b=ue(R.key,e,t,r);b!==((C=(f=R.variants[0])==null?void 0:f.id)!=null?C:"control")&&Object.assign(s,(g=(v=R.variants.find(k=>k.id===b))==null?void 0:v.changes)!=null?g:{});}return s},de="ck_x",Re=e=>e.replace(/\/+$/,"")||"/",vt=(e,t,r,s={})=>{var C,v;if(!e)return null;let a;try{a=new URL(t);}catch(g){return null}if(a.searchParams.has(de))return null;let c=Re(a.pathname),f=(g,R)=>{let b;try{b=new URL(g,a);}catch(k){return}if(!(!/^https?:$/.test(b.protocol)||b.origin===a.origin&&Re(b.pathname)===c))return a.searchParams.forEach((k,x)=>{b.searchParams.has(x)||b.searchParams.set(x,k);}),R&&b.searchParams.set(de,R),b.hash||(b.hash=a.hash),b.href};for(let g of (C=e.redirects)!=null?C:[]){let R=g.from&&Re(g.from)===c?f(g.to):void 0;if(R)return {to:R}}for(let g of e.experiments){if(!g.path||Re(g.path)!==c)continue;let R=g.status==="running"&&!g.winner;if(R&&r===null&&!s[g.key])return null;let b=ue(g.key,e,r!=null?r:"",s),k=(v=g.variants.find(P=>P.id===b))==null?void 0:v.url,x=k?f(k,R?`${g.key}:${b}`:void 0):void 0;return R?{to:x,experiment:g.key,variant:b}:x?{to:x}:null}return null},Et=(e,t)=>{let[r,s]=(t!=null?t:"").split(":"),a=e==null?void 0:e.experiments.find(c=>c.key===r);return a&&a.variants.some(c=>c.id===s)?{experiment:r,variant:s}:null};var We=()=>typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`ck_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;var fe=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,un=e=>{var t;if(e instanceof Error)return {type:e.name||"Error",message:fe(e.message||String(e),1e3),stack:e.stack?fe(e.stack,8192):void 0};if(typeof e=="string")return {type:"Error",message:fe(e,1e3)};try{return {type:"Error",message:fe((t=JSON.stringify(e))!=null?t:String(e),1e3)}}catch(r){return {type:"Error",message:String(e)}}},_t=e=>{let t=[],r=[],s=new Set,a=0,c=`${e.host}/api/sdk/errors`,f=(k=false)=>{for(;t.length;){let x=JSON.stringify({key:e.apiKey,errors:t.splice(0,4)});k&&typeof navigator!="undefined"&&"sendBeacon"in navigator&&navigator.sendBeacon(c,x)||fetch(c,{method:"POST",headers:{"content-type":"application/json"},body:x,keepalive:true}).then(I=>{!I.ok&&I.status!==429&&e.warn(`Error reports were rejected with ${I.status}. Check the public key and NEXT_PUBLIC_MRROCKET_HOST.`);}).catch(()=>{});}},C=(k,x="manual")=>{let P=e.context();if(!P.send||a>=20)return;let I=un(k);if(/\/api\/sdk\/errors/.test(I.message))return;let A=`${I.type}:${I.message}`;s.has(A)||(s.add(A),a++,t.push({...I,mechanism:x,handled:x==="manual",url:window.location.href,ts:Date.now(),crumbs:r.slice(),...e.release?{release:e.release}:{},...P.distinctId?{distinctId:P.distinctId}:{},...P.sessionId?{sessionId:P.sessionId}:{}}));},v=k=>{var x;!k.error&&(!k.message||k.message==="Script error.")||C((x=k.error)!=null?x:new Error(k.message),"onerror");},g=k=>{var x;return C((x=k.reason)!=null?x:new Error("Unhandled promise rejection"),"onunhandledrejection")},R=()=>f(true);window.addEventListener("error",v),window.addEventListener("unhandledrejection",g),window.addEventListener("pagehide",R);let b=window.setInterval(()=>f(),2e3);return {capture:C,crumb:(k,x)=>{r.push({ts:Date.now(),type:k,message:fe(x,120)}),r.length>20&&r.shift();},stop:()=>{window.removeEventListener("error",v),window.removeEventListener("unhandledrejection",g),window.removeEventListener("pagehide",R),window.clearInterval(b),f(true);}}};var pe="$cancel_flow",Z="$onboarding",Be="$inapp",fn={version:0,question:"",reasons:[],offers:{},confirm:{title:"Cancel your subscription?",body:"You keep access until the end of the billing period.",button:"Cancel subscription"},offersFor:"business"},pn="Something went wrong. Please try again.",gn="mrrocket:onboarding",St=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),It=new Set(["signed_up","signup","sign_up","registered","account_created","user_signed_up"]),Ft=(e,t)=>{let r=St(e),s=St(t);return !r||!s?false:r===s||It.has(r)&&It.has(s)},mn=e=>/^(first (launch|visit|open|session|login|sign ?in|app open)|app (opened|launched)|on load|every visit|always)?$/i.test(e.trim()),hn=()=>`cf_${Math.random().toString(36).slice(2,10)}${Date.now().toString(36)}`;var wn=e=>{let t=(e!=null?e:"").trim();return /^https?:\/\//i.test(t)||/^\/(?!\/)/.test(t)?t:void 0},Ot=e=>{let t=null,r=null,s=null,a=[],c=false,f=null,C,v=null,g=new Map,R=new Set,b=new Set,k=new Set,x=e.auto!==false,P=()=>{var n;return (n=t==null?void 0:t.onboarding)!=null?n:[]},I=n=>n?P().find(i=>i.id===n):void 0,A=n=>{let i=g.get(n);return i||g.set(n,i={done:new Set,dismissed:false}),i},W=n=>{let i=g.get(n.id);return !!i&&(i.dismissed||n.steps.every(u=>i.done.has(u.id)))},he=n=>`${gn}:${n!=null?n:"visitor"}`,K=()=>{var u;let n=(u=e.storage)==null?void 0:u.call(e);if(!n)return;let i={};for(let[m,y]of g)i[m]={done:[...y.done],...y.dismissed?{dismissed:true}:{}};try{n.set(he(e.personId()),JSON.stringify(i));}catch(m){}},B=n=>{var i;for(let[u,m]of Object.entries(n!=null?n:{})){let y=A(u);for(let S of (i=m.done)!=null?i:[])y.done.add(S);m.dismissed&&(y.dismissed=true);}},D=()=>{let n=I(s);if(!n)return null;let i=A(n.id),u=n.steps.findIndex(y=>!i.done.has(y.id));if(u<0||i.dismissed)return null;let m=n.steps[u];if(m.kind==="checklist"){let y=u;for(;y>0&&n.steps[y-1].kind==="checklist";)y--;let S=u;for(;S+1<n.steps.length&&n.steps[S+1].kind==="checklist";)S++;return {type:"checklist",flow:n,items:n.steps.slice(y,S+1).map(w=>({step:w,done:i.done.has(w.id)}))}}return {type:"step",flow:n,step:m,index:u,total:n.steps.length,last:u===n.steps.length-1}},z=()=>{if(r){let u=r.reason?r.flow.offers[r.reason]:void 0;return {type:"cancel",screen:r.screen,flow:r.flow,reason:r.reason,offer:r.screen==="offer"?u:void 0,price:r.options.price,busy:r.busy,error:r.error,step:r.plain||r.screen==="survey"?1:r.screen==="offer"?2:3,steps:r.plain?1:3}}let n=D();if(n)return n;s&&(s=null);let i=a.find(u=>!R.has(u.id));return i?{type:"message",message:i}:null},F=()=>{let n=z();if((n==null?void 0:n.type)==="step"&&!b.has(`s:${n.step.id}`))b.add(`s:${n.step.id}`),e.track(Z,{flow:n.flow.id,step:n.step.id,kind:n.step.kind,action:"shown"});else if((n==null?void 0:n.type)==="checklist")for(let i of n.items)!i.done&&!b.has(`s:${i.step.id}`)&&(b.add(`s:${i.step.id}`),e.track(Z,{flow:n.flow.id,step:i.step.id,kind:"checklist",action:"shown"}));else (n==null?void 0:n.type)==="message"&&!b.has(`m:${n.message.id}`)&&(b.add(`m:${n.message.id}`),e.track(Be,{message:n.message.id,journey:n.message.journey,action:"shown"}));for(let i of [...k])try{i();}catch(u){}},ee=n=>s===n.id?true:s&&I(s)&&!W(I(s))?false:(s=n.id,e.track(Z,{flow:n.id,action:"started"}),F(),true),we=()=>{var i;if(!x||s||!c||!e.personId()&&!((i=e.storage)!=null&&i.call(e)))return;let n=P().find(u=>mn(u.trigger)&&u.steps.length&&!W(u));n&&ee(n);},ie=()=>{let n=e.personId();v!==null&&v!==n&&(g.clear(),R.clear(),s=null,C=void 0),v=n;let i=(async()=>{var y,S;let u=(y=e.storage)==null?void 0:y.call(e);if(u)try{let w=await u.get(he(n));w&&B(JSON.parse(w));}catch(w){}let m=P().length>0||!!(t!=null&&t.messages);if(n&&m&&C!==n){C=n;let w=await e.fetchInApp(n).catch(()=>null);w&&e.personId()===n&&(B(w.onboarding),a=((S=w.messages)!=null?S:[]).filter(M=>M&&M.id&&M.title));}n||(a=[]),c=true,we(),F();})();return f=i.finally(()=>{f===i&&(f=null);}),f},T=(n,i,u)=>{var y;let m=n.reason?n.flow.offers[n.reason]:void 0;return {outcome:i,run:n.run,...n.reason?{reason:n.reason,reasonLabel:(y=n.flow.reasons.find(S=>S.id===n.reason))==null?void 0:y.label}:{},...i==="saved"&&m?{offer:m}:{},...u!=null&&u.trim()?{comment:u.trim().slice(0,500)}:{}}},q=(n,i)=>{var u;e.track(pe,{action:"finished",run:n.run,version:n.flow.version,outcome:i.outcome,customer:(u=n.options.customer)!=null?u:"consumer",...i.reason?{reason:i.reason}:{},...i.offer?{offer:i.offer.kind}:{},...i.comment?{comment:i.comment}:{}}),r===n&&(r=null),n.resolve(i),F();},_=(n,i,u)=>{if(n.busy)return;let m=T(n,i,u),y=i==="saved"?n.options.onSave:n.options.onCancel;n.busy=true,n.error=void 0,F(),Promise.resolve().then(()=>y==null?void 0:y(m)).then(()=>q(n,m),()=>{n.busy=false,n.error=pn,F();});};return {setConfig:n=>{t=n,s&&!I(s)&&(s=null),F();},refresh:ie,onEvent:n=>{var y;if(!n||n.startsWith("$"))return;let i=I(s),u=false;if(i){let S=A(i.id);for(let w of i.steps)w.kind==="checklist"&&w.event&&!S.done.has(w.id)&&Ft(w.event,n)&&(S.done.add(w.id),u=true,e.track(Z,{flow:i.id,step:w.id,kind:w.kind,action:"completed"}));}if(u&&(K(),F()),!x||!e.personId()&&!((y=e.storage)!=null&&y.call(e)))return;let m=P().find(S=>S.steps.length&&Ft(S.trigger,n)&&!W(S));m&&ee(m);},openCancelFlow:(n={})=>{var w,M;if(r)return r.promise;let i=(w=t==null?void 0:t.cancelFlow)!=null?w:fn,u=n.customer!=="business"||i.reasons.length<2,m=()=>{},y=new Promise(H=>m=H),S={flow:i,options:n,plain:u,screen:u?"confirm":"survey",run:hn(),busy:false,resolve:m,promise:y};return r=S,e.track(pe,{action:"shown",run:S.run,version:i.version,customer:(M=n.customer)!=null?M:"consumer",plain:u}),F(),y},startOnboarding:n=>{let i=n?I(n):P().find(m=>m.steps.length&&!W(m));if(!i||!i.steps.length)return false;let u=A(i.id);return u.dismissed=false,ee(i)},view:z,subscribe:n=>(k.add(n),()=>k.delete(n)),cancel:{pick:n=>{!r||r.busy||!r.flow.reasons.some(i=>i.id===n)||(r.reason=n,r.error=void 0,F());},next:()=>{let n=r;!n||n.screen!=="survey"||!n.reason||(e.track(pe,{action:"answered",run:n.run,version:n.flow.version,reason:n.reason}),n.screen=n.flow.offers[n.reason]?"offer":"confirm",F());},accept:n=>{let i=r;if(!i||i.screen!=="offer"||!i.reason)return;let u=i.flow.offers[i.reason];i.busy||e.track(pe,{action:"offer",run:i.run,version:i.flow.version,reason:i.reason,offer:u==null?void 0:u.kind,outcome:"accepted"}),_(i,"saved",n);},decline:()=>{var i;let n=r;!n||n.screen!=="offer"||n.busy||(e.track(pe,{action:"offer",run:n.run,version:n.flow.version,reason:n.reason,offer:n.reason?(i=n.flow.offers[n.reason])==null?void 0:i.kind:void 0,outcome:"declined"}),n.screen="confirm",n.error=void 0,F());},confirm:n=>{let i=r;!i||i.screen!=="confirm"||_(i,"cancelled",n);},close:()=>{var u,m;let n=r;if(!n||n.busy)return;let i=T(n,"kept");(m=(u=n.options).onClose)==null||m.call(u,i),q(n,i);}},onboarding:{next:()=>{let n=D();(n==null?void 0:n.type)==="step"&&(A(n.flow.id).done.add(n.step.id),e.track(Z,{flow:n.flow.id,step:n.step.id,kind:n.step.kind,action:"completed"}),K(),F());},check:n=>{let i=D();if((i==null?void 0:i.type)!=="checklist")return;let u=i.items.find(m=>m.step.id===n);!u||u.done||(A(i.flow.id).done.add(n),e.track(Z,{flow:i.flow.id,step:n,kind:"checklist",action:"completed"}),K(),F());},dismiss:()=>{let n=D();!n||n.type!=="step"&&n.type!=="checklist"||(A(n.flow.id).dismissed=true,e.track(Z,{flow:n.flow.id,...n.type==="step"?{step:n.step.id}:{},action:"dismissed"}),s=null,K(),F());}},message:{click:()=>{var u;let n=z();if((n==null?void 0:n.type)!=="message")return;R.add(n.message.id),e.track(Be,{message:n.message.id,journey:n.message.journey,action:"clicked"});let i=wn(n.message.url);F(),i&&((u=e.openUrl)==null||u.call(e,i));},dismiss:()=>{let n=z();(n==null?void 0:n.type)==="message"&&(R.add(n.message.id),e.track(Be,{message:n.message.id,journey:n.message.journey,action:"dismissed"}),F());}}}};var kn={get:e=>{try{return window.localStorage.getItem(e)}catch(t){return null}},set:(e,t)=>{try{window.localStorage.setItem(e,t);}catch(r){}}},Mt=()=>{try{for(let e=window.localStorage.length-1;e>=0;e--){let t=window.localStorage.key(e);t!=null&&t.startsWith("mrrocket:onboarding")&&window.localStorage.removeItem(t);}}catch(e){}},$t=e=>({track:e.track,personId:e.personId,auto:e.auto,storage:()=>e.canStore()?kn:null,openUrl:t=>window.location.assign(t),fetchInApp:async t=>{if(!e.apiKey)return null;let r=await fetch(`${e.host}/api/sdk/inapp?key=${encodeURIComponent(e.apiKey)}&distinctId=${encodeURIComponent(t)}`);return r.ok?await r.json():null}});var Se="mrr_ref",Ie="mrr_ref",yn="mrr_ref",bn="mrr_click";var ge=/^[A-Za-z0-9_-]{1,64}$/;var Cn=(e,t="ref")=>{let r=new URLSearchParams(e);return xn(s=>r.get(s),t)},xn=(e,t="ref")=>{let r=e(yn);if(r&&ge.test(r)){let a=e(bn);return {code:r,clickId:a&&ge.test(a)?a:null,direct:false}}let s=e(t);return s&&ge.test(s)?{code:s,clickId:null,direct:true}:null},Pt=e=>{var t;return `${e.code}.${(t=e.clickId)!=null?t:""}.${e.at}`},Ee=(e,t=60,r=Date.now())=>{if(!e)return null;let[s,a,c]=e.split("."),f=Number(c);return !s||!ge.test(s)||!Number.isFinite(f)||a&&!ge.test(a)||r-f>t*864e5||f>r+864e5?null:{code:s,clickId:a||null,at:f}};var L=null,Fe=()=>typeof document!="undefined",At=e=>{var r;if(!Fe())return;let t=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);try{return t?decodeURIComponent(t):void 0}catch(s){return t}},Oe=()=>{try{return typeof localStorage=="undefined"?null:localStorage}catch(e){return null}},qe=()=>{var e,t;return L||(Fe()?(t=Ee(At(Se),3650))!=null?t:Ee((e=Oe())==null?void 0:e.getItem(Ie),3650):null)};var _e=(e,t)=>{var a;if(!Fe())return;let r=Math.max(1,Math.round(t))*86400,s=typeof location!="undefined"&&location.protocol==="https:"?"; secure":"";document.cookie=`${Se}=${encodeURIComponent(Pt(e))}; path=/; max-age=${r}; samesite=lax${s}`;try{(a=Oe())==null||a.setItem(Ie,Pt(e));}catch(c){}},Me=()=>{var e;if(Fe()){document.cookie=`${Se}=; path=/; max-age=0; samesite=lax`;try{(e=Oe())==null||e.removeItem(Ie);}catch(t){}}},Lt=()=>{L=null;},Tt=async e=>{var s,a,c;let t=Cn(e.search,e.param),r=(s=e.now)!=null?s:Date.now();if(!t)return !L&&e.store&&(L=(c=Ee(At(Se),e.days,r))!=null?c:Ee((a=Oe())==null?void 0:a.getItem(Ie),e.days,r),L||Me()),L;if(L={code:t.code,clickId:t.clickId,at:r},e.store&&_e(L,e.days),e.beacon)try{let f=await e.beacon({code:t.code,clickId:t.clickId});f&&L&&L.code===t.code&&!L.clickId&&(L={...L,clickId:f},e.store&&_e(L,e.days));}catch(f){}return L},Nt=e=>e==="$identify"||!e.startsWith("$");var Ye=3600*24*365,Ht=e=>{var r;if(typeof document=="undefined")return;let t=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);if(t)try{return decodeURIComponent(t)}catch(s){return t}},$e=(e,t,r)=>{let s=window.location.protocol==="https:"?"; secure":"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${r}; samesite=lax${s}`;},me=e=>{document.cookie=`${e}=; path=/; max-age=0; samesite=lax`;},O={utm:{}},Dt=()=>{var e;return (e=O.id)!=null?e:O.id=We()},Xe=(e,t)=>{if(e!=="cookies")return Dt();let r=Ht(Q);if(r)return O.id=r;let s=Dt();return $e(Q,s,Ye),s},Ge=e=>{var a;let t=Date.now(),r=O.session,s=(a=e?Ht(se):void 0)!=null?a:r&&t-r.last<18e5?r.id:We();return O.session={id:s,last:t},e&&$e(se,s,18e5/1e3),s},Je=()=>{var r;let e=window.location.href;if(O.url===e)return;O.referrer=(r=O.url)!=null?r:document.referrer||void 0,O.url=e;let t=Ct(window.location.search);Object.keys(t).length&&(O.utm=t);},jt=()=>{let e=navigator,t=window;return e.doNotTrack==="1"||t.doNotTrack==="1"||e.globalPrivacyControl===true};var Pe=window,vn=()=>{var e,t;return (t=(e=document.currentScript)!=null?e:document.querySelector('script[data-key][src*="sdk"]'))!=null?t:document.querySelector("script[data-key][src*='mrrocket']")},Vt=new Set,V=e=>{Vt.has(e)||(Vt.add(e),console.warn(`[MRRocket] ${e}`));},En=()=>{var ct,lt,dt,ut;let e=vn(),t=o=>{var l;return (l=e==null?void 0:e.getAttribute(`data-${o}`))!=null?l:void 0},r=(o,l)=>{let d=t(o);return d===void 0?l:!["false","0","off","no"].includes(d.trim().toLowerCase())},s=(ct=e==null?void 0:e.src)!=null?ct:"",a="";try{a=s?new URL(s,window.location.href).origin:"";}catch(o){a="";}let c=((lt=t("key"))!=null?lt:"").trim(),f=((dt=t("api-host"))!=null?dt:a).trim().replace(/\/+$/,""),C=t("consent"),v=r("respect-dnt",false),g=r("heatmaps",true),R=r("errors",true),b=t("release"),k=t("attribution"),x=k==="always"||k==="off"?k:"consent",P=t("referral-param")||"ref",I={},A=(o,l)=>{var d;return (d=I[o])!=null?d:I[o]=new Promise((p,h)=>{var ft;let E=()=>Pe[l];if(E())return p(E());let U=(ft=t(`${o}-src`))!=null?ft:s?s.replace(/(\.min)?\.js(\?[^#]*)?(#.*)?$/,`-${o}$1.js?v=${ve}`):"";if(!U)return h(new Error(o));let J=document.createElement("script");J.async=true,J.src=U,J.onload=()=>E()?p(E()):h(new Error(o)),J.onerror=()=>h(new Error(o)),document.head.appendChild(J);}).catch(p=>{throw I[o]=void 0,p})},W=t("theme"),he={theme:W==="light"||W==="dark"?W:"auto",accent:t("accent")},K=new URLSearchParams(window.location.search),B=xt(K.get(yt)),D=K.get(bt)==="1",z=K.get(de);if(z!==null){K.delete(de);let o=K.toString();history.replaceState(history.state,"",`${window.location.pathname}${o?`?${o}`:""}${window.location.hash}`);}let F=jt(),ee=C==="cookies"||C==="off"?C:"cookieless",we=r("replay",false),ie="",T,q,_=null,Y=false,Ae=false,n=null,i=null,u=window.location.pathname,m=[],y=new Set,S=[],w=()=>v&&F?"off":ee,M=()=>!D&&w()!=="off",H=()=>T!=null?T:ie,ke=()=>w()==="cookies"?H():T;c||V('No public key. Add data-key="mrr_pub_\u2026" to the script tag; nothing is tracked until then.');let Le=(o=false)=>{if(!m.length)return;if(!c){m.length=0;return}let l=`${f}/api/sdk/events`;for(let d of gt(c,m.splice(0),{v:ve,errors:R,platform:"web"}))o&&"sendBeacon"in navigator&&navigator.sendBeacon(l,d)||fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:d,keepalive:true}).then(h=>{h.ok||V(`Events were rejected with ${h.status}. Check data-key (MRRocket \u203A Settings \u203A Products).`);}).catch(()=>V(`Could not reach ${f||"this origin"} to send events. Check data-api-host.`));},$=null,j=null,te=(o,l,d=Date.now(),p)=>{if(!M())return;let h=Nt(o)?qe():null;m.push({event:o,props:h?{...l,$referral:{code:h.code,clickId:h.clickId}}:l,distinctId:ke(),sessionId:Ge(w()==="cookies"),ts:d,url:p!=null?p:window.location.href,referrer:O.referrer,...O.utm,screen:{w:window.screen.width,h:window.screen.height}});},ye=(o,l)=>{typeof o!="string"||!o||(te(o,l),M()&&($==null||$.event(o)),N.onEvent(o));},N=Ot($t({host:f,apiKey:c,track:te,personId:()=>M()?T:void 0,canStore:()=>w()==="cookies",auto:r("onboarding",true)})),Te=false;N.subscribe(()=>{Te||!N.view()||D||(Te=true,A("flows","__mrrocketFlows").then(o=>o.mountFlows(N,he)).catch(()=>{Te=false,V("The cancel flow and onboarding dialogs did not load. Check that sdk-flows.js is served next to sdk.js.");}));});let be=(o,l)=>{if(!M())return;let d=`${window.location.pathname}|${o}`;y.has(d)||(y.add(d),ye("$exposure",{experiment:o,variant:l}));},ze=()=>{let o=vt(_,window.location.href,H(),B);return o!=null&&o.to?(Le(true),window.location.replace(o.to),true):(o!=null&&o.experiment&&be(o.experiment,o.variant),false)},ae=()=>{if(!_)return;let o=document.querySelectorAll("[data-ck-text]");if(!o.length)return;let l=Rt(_,H(),B),d=new Set;o.forEach(p=>{var U,J;let h=p.dataset.ckText;if(!h)return;d.add(h),p.dataset.ckDefault===void 0&&(p.dataset.ckDefault=(U=p.textContent)!=null?U:"");let E=(J=l[h])!=null?J:p.dataset.ckDefault;p.textContent!==E&&(p.textContent=E);});for(let p of _.experiments)p.variants.some(h=>{var E;return Object.keys((E=h.changes)!=null?E:{}).some(U=>d.has(U))})&&be(p.key,ue(p.key,_,H(),B));},Qe=()=>{var o,l;return (l=(o=_==null?void 0:_.referral)==null?void 0:o.cookieDays)!=null?l:60},Ze=()=>x==="always"?w()!=="off":x==="consent"&&w()==="cookies",et=null,Ne=false,Ue=()=>{if(!Y||D)return;if(x==="off"||w()==="off"){Lt(),(x==="off"||Ne)&&Me();return}let o=window.location.href;et!==o&&(et=o,Tt({search:window.location.search,param:P,store:Ze(),days:Qe(),beacon:c?({code:l,clickId:d})=>fetch(`${f}/api/sdk/affiliate/click`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:c,code:l,clickId:d,url:o,referrer:document.referrer||void 0}),keepalive:true}).then(p=>p.ok?p.json():null).then(p=>{var h;return (h=p==null?void 0:p.clickId)!=null?h:null}):void 0}));},Wt=()=>{let o=Ze(),l=qe();o&&l?_e(l,Qe()):!o&&Ne&&Me(),Ne=o;},tt=0,nt=false,rt=()=>{var p,h;let o=M()&&we&&!!(_!=null&&_.replay)&&!!c;if(o===nt)return;nt=o;let l=++tt;if(!o){$==null||$.stop(true),$=null;return}let d=(h=(p=_==null?void 0:_.replay)==null?void 0:p.sampleRate)!=null?h:.1;A("replay","__mrrocketReplay").then(E=>E.startReplay({host:f,apiKey:c,sessionId:Ge(w()==="cookies"),distinctId:ke(),identified:!!T,sampleRate:d,warn:V})).then(E=>{l!==tt?E==null||E.stop(true):$=E;}).catch(()=>V("Session recording could not start (the recorder did not load)."));},ot=r("messenger",false),X=null,ne=o=>{D||c&&(X!=null||(X=A("messenger","__mrrocketMessenger").then(l=>{var E;let d=U=>t(`messenger-${U}`)===void 0?void 0:r(`messenger-${U}`,true),p=t("messenger-position"),h=(E=t("messenger-theme"))!=null?E:W;return l.mountMessenger({host:f,apiKey:c,distinctId:H,user:()=>q,launcher:ot,position:p==="bottom-left"||p==="bottom-right"?p:void 0,title:t("messenger-title"),greeting:t("messenger-greeting"),label:t("messenger-label"),askEmail:d("ask-email"),help:d("help"),sound:d("sound"),preview:d("preview"),theme:h==="light"||h==="dark"||h==="auto"?h:void 0,accent:t("accent")})})),X.then(o).catch(()=>{X=null,V("sdk-messenger.js did not load.");}));},De=()=>{!Ae||!M()||i===window.location.pathname||(i=window.location.pathname,ye("$pageview",{path:window.location.pathname}));},G=null,st=()=>{let o=G;g&&o&&o.max>0&&te("$scroll",{depth:o.max,docH:o.docH,vw:window.innerWidth,vh:window.innerHeight},Date.now(),o.url),G=null;},ce=()=>{var h,E;if(!g||!M()||D)return;let o=document.documentElement,l=Math.max(o.scrollHeight,(E=(h=document.body)==null?void 0:h.scrollHeight)!=null?E:0),d=wt(),p=window.location.href;(G==null?void 0:G.url)!==p?G={url:p,max:d,docH:l}:d>G.max&&(G={url:p,max:d,docH:l});},it=()=>{let o=window.location.pathname;o!==u&&(u=o,!(Y&&ze())&&(st(),Je(),$==null||$.page(o),j==null||j.crumb("navigation",o),De(),Ue(),window.setTimeout(()=>{ce(),ae();},0)));},at=()=>{let o=w(),l=n;n=o,l==="cookies"&&o!=="cookies"&&(me(Q),me(se)),o==="off"&&(m.length=0,O.session=void 0),l==="cookies"&&o!=="cookies"&&Mt(),ie=Xe(o),Wt(),Ue(),rt(),De(),ce();},Ce={track:ye,identify:(o,l)=>{if(typeof o!="string"||!o)return;let d=ke();T=o,te("$identify",{...l,id:o,...d&&d!==o?{previousId:d}:{}}),$==null||$.identify(o),w()==="cookies"&&$e(Q,o,Ye),q={...l,id:o},ae(),Y&&N.refresh();},reset:()=>{T=void 0,q=void 0,y.clear(),w()==="cookies"&&(me(Q),me(se)),O.id=void 0,O.session=void 0,ie=Xe(w()),ae(),Y&&N.refresh();},captureError:o=>j==null?void 0:j.capture(o,"manual"),setConsent:o=>{let{analytics:l,replay:d}=typeof o=="string"?{analytics:o,replay:void 0}:o!=null?o:{};if(l!==void 0&&l!=="cookieless"&&l!=="cookies"&&l!=="off"){V(`setConsent: "${String(l)}" is not a consent mode. Use "cookieless", "cookies" or "off".`);return}l==="off"&&(m.length=0),l&&(ee=l),typeof d=="boolean"&&(we=d),at(),Y&&N.refresh();},getFlag:o=>Ke(o,_,H(),{...q})!==false,getFlagVariant:o=>{let l=Ke(o,_,H(),{...q});return typeof l=="string"?l:null},getVariant:o=>{let l=ue(o,_,H(),B);return (_||B[o])&&be(o,l),l},ready:o=>{typeof o=="function"&&(Y?window.setTimeout(()=>o(Ce),0):S.push(o));},getDistinctId:H,cancelFlow:{open:o=>N.openCancelFlow(o)},onboarding:{start:o=>N.startOnboarding(o)},openCancelFlow:o=>N.openCancelFlow(o),startOnboarding:o=>N.startOnboarding(o),push:{subscribe:o=>{let l=M()?T:void 0;if(!l)return Promise.resolve({status:"not-signed-in"});let d=window.Notification,p=Promise.resolve(d&&d.permission==="default"&&(o==null?void 0:o.ask)!==false?d.requestPermission():d==null?void 0:d.permission);return A("push","__mrrocketPush").then(h=>h.subscribeWebPush({host:f,apiKey:c,distinctId:l,permission:p},o))},unsubscribe:()=>A("push","__mrrocketPush").then(o=>o.unsubscribeWebPush({host:f,apiKey:c,distinctId:T}))},messenger:{open:o=>ne(l=>l.open(o)),close:()=>{X==null?void 0:X.then(o=>o.close()).catch(()=>{});},toggle:()=>ne(o=>o.toggle())},openMessenger:()=>ne(o=>o.open()),version:ve};Je(),at();let re=Pe.mrrocket,Bt=(ut=re==null?void 0:re.q)!=null?ut:[],He=re&&typeof re=="object"?re:{};Object.assign(He,Ce,{__loaded:true}),delete He.q,Pe.mrrocket=He;for(let[o,l]of Bt){let d=Ce[o];if(typeof d=="function")try{d(...Array.from(l!=null?l:[]));}catch(p){console.error(p);}}Ae=true,De(),R&&c&&!D&&(j=_t({host:f,apiKey:c,release:b,context:()=>{var o;return {send:M(),distinctId:ke(),sessionId:(o=O.session)==null?void 0:o.id}},warn:V}),j.crumb("navigation",window.location.pathname));for(let o of ["pushState","replaceState"]){let l=history[o];history[o]=function(...d){let p=l.apply(this,d);return it(),p};}window.addEventListener("popstate",it);let qt=new le;document.addEventListener("click",o=>{var E;o.target instanceof Element&&o.target.closest("[data-ck-messenger]")&&(o.preventDefault(),ne(U=>U.open()));let l=o.target instanceof Element?o.target.closest("[data-ck-goal]"):null;if(l!=null&&l.dataset.ckGoal&&ye(l.dataset.ckGoal,{text:(E=l.textContent)==null?void 0:E.trim().slice(0,80)}),!M())return;let d=ht(o);if(!d)return;let p=qt.push(d.x,d.y,Date.now());if((d.label||d.selector)&&(j==null||j.crumb("click",d.label||d.selector)),$==null||$.click(d,p),!g)return;let h={x:d.x,y:d.y,vw:d.vw,vh:d.vh,docH:d.docH,selector:d.selector,label:d.label,dead:!d.interactive};te("$click",h),p&&te("$rageclick",h);});let je=0;window.addEventListener("scroll",()=>{je||(je=window.requestAnimationFrame(()=>{je=0,ce();}));},{passive:true}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>ce()):ce(),window.setInterval(()=>Le(),2e3),window.addEventListener("pagehide",()=>{st(),Le(true);});let Ve=()=>{if(Y=true,ze())return;let o=Et(_,z);o&&be(o.experiment,o.variant),document.documentElement.classList.remove("ck-hide"),Ue(),rt(),N.setConfig(_),N.refresh(),ot&&(document.body?ne():document.addEventListener("DOMContentLoaded",()=>ne())),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ae):ae();for(let l of S.splice(0))try{l(Ce);}catch(d){console.error(d);}};c?fetch(`${f}/api/sdk/config?key=${encodeURIComponent(c)}`).then(o=>(o.ok||V(`Config request to ${f||"this origin"} answered ${o.status}. Check data-key and data-api-host.`),o.ok?o.json():null)).then(o=>{o&&Array.isArray(o.experiments)&&(_=o),Ve();}).catch(()=>{V(`Could not reach ${f||"this origin"}. Check data-api-host. The page keeps its own texts and flags stay off.`),Ve();}):Ve();},Kt;typeof window!="undefined"&&typeof document!="undefined"&&!((Kt=Pe.mrrocket)!=null&&Kt.__loaded)&&En();
1
+ (function(){'use strict';var on=Object.defineProperty;var sn=(e,t,r)=>t in e?on(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var we=(e,t,r)=>sn(e,typeof t!="symbol"?t+"":t,r);var Ct=e=>{let t=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t+=1:s<2048?t+=2:s>=55296&&s<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(t+=4,r++):t+=3;}return t},an=(e,t,r)=>{let s=`{"key":${JSON.stringify(e)},"sdk":${JSON.stringify(r)},"events":[`,c=Ct(s)+2,a=[],f=[],C=[],v=c,k=()=>{f.length&&a.push({body:`${s}${f.join(",")}]}`,events:C}),f=[],C=[],v=c;};for(let E of t){let g=JSON.stringify(E),w=Ct(g)+1;c+w>6e4||((f.length===100||v+w>6e4)&&k(),f.push(g),C.push(E),v+=w);}return k(),a},Rt=(e,t,r)=>an(e,t,r).map(s=>s.body);var xe=class{constructor(t=1e3,r=30,s=3){we(this,"windowMs",t);we(this,"radius",r);we(this,"count",s);we(this,"clicks",[]);we(this,"fired",false);}push(t,r,s){let c=this.clicks.filter(a=>s-a.t<=this.windowMs&&Math.hypot(a.x-t,a.y-r)<=this.radius);return c.length!==this.clicks.length&&(this.fired=false),this.clicks=[...c,{x:t,y:r,t:s}],this.clicks.length>=this.count&&!this.fired?(this.fired=true,true):false}};var cn='a[href],button,input,select,textarea,label,summary,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[onclick],[data-ck-goal]',ln="[data-ck-mask]",dn="[data-ck-block]",vt=/\d{4,}|^[a-z]{1,3}-[a-z0-9]{5,}$|^_|__|css-|^sc-|^jsx-/i,un=e=>{let t=e.tagName.toLowerCase();if(e.id&&!vt.test(e.id)&&e.id.length<=40)return `${t}#${e.id}`;let r=typeof e.className=="string"?e.className.split(/\s+/).filter(a=>a&&!vt.test(a)&&a.length<=30&&!a.includes(":")):[],s=r.length?`${t}.${r.slice(0,2).join(".")}`:t,c=e.parentElement?[...e.parentElement.children].filter(a=>a.tagName===e.tagName):[];return c.length>1?`${s}:nth-of-type(${c.indexOf(e)+1})`:s},fn=e=>{let t=[],r=e;for(;r&&t.length<3&&r.tagName&&r.tagName!=="BODY"&&r.tagName!=="HTML";){let s=un(r);if(t.unshift(s),s.includes("#"))break;r=r.parentElement;}return t.join(" > ").slice(0,160)},$e=e=>(e!=null?e:"").replace(/\s+/g," ").trim().slice(0,40),pn=e=>{var r,s,c,a,f;if(e.closest(`${ln},${dn}`))return "";let t=e.tagName.toLowerCase();if(t==="input"){let C=((r=e.getAttribute("type"))!=null?r:"text").toLowerCase();return $e(C==="submit"||C==="button"?(s=e.getAttribute("aria-label"))!=null?s:e.value:e.getAttribute("aria-label"))}return $e(t==="select"||t==="textarea"?e.getAttribute("aria-label"):(f=(a=(c=e.getAttribute("aria-label"))!=null?c:e.getAttribute("title"))!=null?a:e.innerText)!=null?f:e.textContent)},Et=e=>{var a,f;let t=e.target instanceof Element?e.target:null;if(!t)return null;let r=t.closest(cn),s=r!=null?r:t,c=document.documentElement;return {x:Math.round(e.clientX),y:Math.round(e.clientY+window.scrollY),vw:window.innerWidth,vh:window.innerHeight,docH:Math.max(c.scrollHeight,(f=(a=document.body)==null?void 0:a.scrollHeight)!=null?f:0),selector:fn(s),label:r?pn(r):"",interactive:!!r}},_t=()=>{var r,s;let e=document.documentElement,t=Math.max(e.scrollHeight,(s=(r=document.body)==null?void 0:r.scrollHeight)!=null?s:0);return t?Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)):0};var Pe="0.12.0",gn=(e,t)=>{let r=t.trim().toLowerCase();for(let[s,c]of Object.entries(e))if(s.toLowerCase()===r)return c},mn=(e,t)=>{let r=e.trim().toLowerCase(),s=t.trim().toLowerCase();return s.startsWith("@")?r.endsWith(s):r===s},hn=(e,t)=>{if(e.op==="in cohort")return false;let r=gn(t,e.property),s=r==null?"":String(r);if(e.op==="\u2265"){let a=Number(s),f=Number(e.values[0]);return s!==""&&Number.isFinite(a)&&Number.isFinite(f)&&a>=f}let c=s!==""&&e.values.some(a=>mn(s,a));return e.op==="is"||e.op==="in"?c:!c},wn=(e,t,r={})=>{var C;if(!e.on)return false;let s={id:t,...r},c=e.sets.length?e.sets.find(v=>v.conditions.every(k=>hn(k,s))):{rollout:100};if(!c||St(`${e.key}:rollout:${t}`)*100>=c.rollout)return false;if(!((C=e.variants)!=null&&C.length))return true;let a=St(`${e.key}:variant:${t}`)*100,f=0;for(let v of e.variants)if(f+=v.split,a<f)return v.key;return e.variants[e.variants.length-1].key},Qe=(e,t,r,s={})=>{var a;let c=(a=t==null?void 0:t.flags)==null?void 0:a.find(f=>f.key===e);return c?wn(c,r,s):false},kn=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],It="ck_preview",Ot="ck_embed",ce="ck_id",ke="ck_sid";var yn=e=>{var r;let t={};for(let s of kn){let c=(r=e(s))==null?void 0:r.trim();c&&(t[s]=c.slice(0,150));}return t},Ft=e=>{let t=new URLSearchParams(e);return yn(r=>t.get(r))};var bn=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},St=e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,(t>>>0)/4294967296},xn=(e,t)=>{var a,f,C,v;let r=(f=(a=e.variants[0])==null?void 0:a.id)!=null?f:"control";if(e.winner)return e.winner;if(e.status!=="running")return r;let s=bn(`${e.key}:${t}`),c=0;for(let k of e.variants)if(c+=k.weight,s<c)return k.id;return (v=(C=e.variants[e.variants.length-1])==null?void 0:C.id)!=null?v:r},$t=e=>{let t=Array.isArray(e)?e[0]:e;if(!t)return {};let r={};for(let s of t.split(",")){let[c,a]=s.split(":");c&&a&&(r[c.trim()]=a.trim());}return r};var Re=(e,t,r,s)=>{if(s[e])return s[e];let c=t==null?void 0:t.experiments.find(a=>a.key===e);return c?xn(c,r):"control"},Mt=(e,t,r)=>{var c,a,f,C,v,k;let s={...(c=e==null?void 0:e.texts)!=null?c:{}};for(let E of (a=e==null?void 0:e.experiments)!=null?a:[]){let g=Re(E.key,e,t,r);g!==((C=(f=E.variants[0])==null?void 0:f.id)!=null?C:"control")&&Object.assign(s,(k=(v=E.variants.find(w=>w.id===g))==null?void 0:v.changes)!=null?k:{});}return s},Ce="ck_x",Me=e=>e.replace(/\/+$/,"")||"/",Pt=(e,t,r,s={})=>{var C,v;if(!e)return null;let c;try{c=new URL(t);}catch(k){return null}if(c.searchParams.has(Ce))return null;let a=Me(c.pathname),f=(k,E)=>{let g;try{g=new URL(k,c);}catch(w){return}if(!(!/^https?:$/.test(g.protocol)||g.origin===c.origin&&Me(g.pathname)===a))return c.searchParams.forEach((w,S)=>{g.searchParams.has(S)||g.searchParams.set(S,w);}),E&&g.searchParams.set(Ce,E),g.hash||(g.hash=c.hash),g.href};for(let k of (C=e.redirects)!=null?C:[]){let E=k.from&&Me(k.from)===a?f(k.to):void 0;if(E)return {to:E}}for(let k of e.experiments){if(!k.path||Me(k.path)!==a)continue;let E=k.status==="running"&&!k.winner;if(E&&r===null&&!s[k.key])return null;let g=Re(k.key,e,r!=null?r:"",s),w=(v=k.variants.find(M=>M.id===g))==null?void 0:v.url,S=w?f(w,E?`${k.key}:${g}`:void 0):void 0;return E?{to:S,experiment:k.key,variant:g}:S?{to:S}:null}return null},At=(e,t)=>{let[r,s]=(t!=null?t:"").split(":"),c=e==null?void 0:e.experiments.find(a=>a.key===r);return c&&c.variants.some(a=>a.id===s)?{experiment:r,variant:s}:null};var Ze=()=>typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`ck_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;var ve=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,Cn=e=>{var t;if(e instanceof Error)return {type:e.name||"Error",message:ve(e.message||String(e),1e3),stack:e.stack?ve(e.stack,8192):void 0};if(typeof e=="string")return {type:"Error",message:ve(e,1e3)};try{return {type:"Error",message:ve((t=JSON.stringify(e))!=null?t:String(e),1e3)}}catch(r){return {type:"Error",message:String(e)}}},Lt=e=>{let t=[],r=[],s=new Set,c=0,a=`${e.host}/api/sdk/errors`,f=(w=false)=>{for(;t.length;){let S=JSON.stringify({key:e.apiKey,errors:t.splice(0,4)});w&&typeof navigator!="undefined"&&"sendBeacon"in navigator&&navigator.sendBeacon(a,S)||fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:S,keepalive:true}).then(L=>{!L.ok&&L.status!==429&&e.warn(`Error reports were rejected with ${L.status}. Check the public key and NEXT_PUBLIC_MRROCKET_HOST.`);}).catch(()=>{});}},C=(w,S="manual")=>{let M=e.context();if(!M.send||c>=20)return;let L=Cn(w);if(/\/api\/sdk\/errors/.test(L.message))return;let N=`${L.type}:${L.message}`;s.has(N)||(s.add(N),c++,t.push({...L,mechanism:S,handled:S==="manual",url:window.location.href,ts:Date.now(),crumbs:r.slice(),...e.release?{release:e.release}:{},...M.distinctId?{distinctId:M.distinctId}:{},...M.sessionId?{sessionId:M.sessionId}:{}}));},v=w=>{var S;!w.error&&(!w.message||w.message==="Script error.")||C((S=w.error)!=null?S:new Error(w.message),"onerror");},k=w=>{var S;return C((S=w.reason)!=null?S:new Error("Unhandled promise rejection"),"onunhandledrejection")},E=()=>f(true);window.addEventListener("error",v),window.addEventListener("unhandledrejection",k),window.addEventListener("pagehide",E);let g=window.setInterval(()=>f(),2e3);return {capture:C,crumb:(w,S)=>{r.push({ts:Date.now(),type:w,message:ve(S,120)}),r.length>20&&r.shift();},stop:()=>{window.removeEventListener("error",v),window.removeEventListener("unhandledrejection",k),window.removeEventListener("pagehide",E),window.clearInterval(g),f(true);}}};var Ee="$cancel_flow",re="$onboarding",et="$inapp",Rn={version:0,question:"",reasons:[],offers:{},confirm:{title:"Cancel your subscription?",body:"You keep access until the end of the billing period.",button:"Cancel subscription"},offersFor:"business"},vn="Something went wrong. Please try again.",Nt="mrrocket:onboarding",Ae=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),Tt=new Set(["signed_up","signup","sign_up","registered","account_created","user_signed_up"]),tt=(e,t)=>{let r=Ae(e),s=Ae(t);return !r||!s?false:r===s||Tt.has(r)&&Tt.has(s)},En=e=>/^(first (launch|visit|open|session|login|sign ?in|app open)|app (opened|launched)|on load|every visit|always)?$/i.test(e.trim()),_n=()=>`cf_${Math.random().toString(36).slice(2,10)}${Date.now().toString(36)}`;var Sn=e=>{let t=(e!=null?e:"").trim();return /^https?:\/\//i.test(t)||/^\/(?!\/)/.test(t)?t:void 0},le=e=>{var t;return (t=e.nodes)!=null?t:e.steps},In=e=>Math.max(0,e.amount)*(e.unit==="hours"?36e5:864e5),On=(e,t)=>{let r=e.trim(),s=(t.split(/[?#]/)[0]||"/").replace(/\/+$/,"")||"/";if(!r)return false;if(r.endsWith("*")){let c=r.slice(0,-1).replace(/\/+$/,"");return !c||s===c||s.startsWith(`${c}/`)}return s===(r.replace(/\/+$/,"")||"/")},nt=e=>e.flatMap(t=>t.kind==="condition"?[...nt(t.yes),...nt(t.no)]:t.kind==="wait"?[]:[t]),Dt=e=>{let t=null,r=null,s=null,c=[],a=false,f=null,C,v=null,k=new Map,E=new Set,g=new Set,w=new Set,S=e.auto!==false,M=new Set,L=()=>{var n,i;return (i=(n=e.now)==null?void 0:n.call(e))!=null?i:Date.now()},N=null,z=()=>{var n;return (n=t==null?void 0:t.onboarding)!=null?n:[]},Z=n=>n?z().find(i=>i.id===n):void 0,H=n=>{let i=k.get(n);return i||k.set(n,i={done:new Set,dismissed:false,answers:new Map,at:new Map,reached:new Map}),i},G=false,K=n=>{e.track(re,n),G=true;},oe=(n,i)=>{n.done.add(i),n.at.set(i,L());},Be=n=>{var i,l,m;if((i=n.page)!=null&&i.trim()){let p=(l=e.path)==null?void 0:l.call(e);return p===void 0?false:On(n.page,p)}if((m=n.event)!=null&&m.trim()){if(!a)return;for(let p of M)if(tt(n.event,p))return true;return false}return false},de=(n,i,l,m,p=0,_)=>{var I,b;for(let y=0;y<i.length;y++){let x=i[y];if(x.kind==="wait"){if(l.done.has(x.id)){_=(I=l.at.get(x.id))!=null?I:_;continue}let O=l.reached.get(x.id);if(O===void 0){if(!m)return {at:"pending"};O=_!=null?_:L(),l.reached.set(x.id,O),K({flow:n.id,step:x.id,kind:"wait",action:"shown"});}let B=O+In(x);if(L()<B)return {at:"wait",until:B};if(!m)return {at:"pending"};oe(l,x.id),K({flow:n.id,step:x.id,kind:"wait",action:"completed"}),_=B;continue}if(x.kind==="condition"){let O=l.answers.get(x.id);if(O===void 0){if(!m)return {at:"pending"};if(O=Be(x),O===void 0)return {at:"pending"};l.answers.set(x.id,O),K({flow:n.id,step:x.id,kind:"condition",action:"answered",answer:O?"yes":"no"});}return de(n,O?x.yes:x.no,l,m,p,_)}if(!l.done.has(x.id))return {at:"step",step:x,line:i,index:y,before:p};_=(b=l.at.get(x.id))!=null?b:_,p++;}return {at:"end"}},se=n=>{let i=k.get(n.id);return !!i&&(i.dismissed||de(n,le(n),i,false).at==="end")},ue=n=>`${Nt}:${n!=null?n:"visitor"}`,j=n=>`${Nt}:events:${n!=null?n:"visitor"}`,W=()=>{var l;G=false;let n=(l=e.storage)==null?void 0:l.call(e);if(!n)return;let i={};for(let[m,p]of k)i[m]={done:[...p.done],...p.dismissed?{dismissed:true}:{},...p.answers.size?{answers:Object.fromEntries([...p.answers].map(([_,I])=>[_,I?"yes":"no"]))}:{},...p.at.size?{at:Object.fromEntries(p.at)}:{},...p.reached.size?{reached:Object.fromEntries(p.reached)}:{}};try{n.set(ue(e.personId()),JSON.stringify(i)),M.size&&n.set(j(e.personId()),JSON.stringify([...M].slice(-200)));}catch(m){}},$=n=>{var i,l,m,p;for(let[_,I]of Object.entries(n!=null?n:{})){let b=H(_);for(let y of (i=I.done)!=null?i:[])b.done.add(y);I.dismissed&&(b.dismissed=true);for(let[y,x]of Object.entries((l=I.answers)!=null?l:{}))b.answers.has(y)||b.answers.set(y,x==="yes");for(let[y,x]of Object.entries((m=I.at)!=null?m:{}))typeof x=="number"&&!b.at.has(y)&&b.at.set(y,x);for(let[y,x]of Object.entries((p=I.reached)!=null?p:{}))typeof x=="number"&&(!b.reached.has(y)||x<b.reached.get(y))&&b.reached.set(y,x);}},Q=n=>{var l;N&&clearTimeout(N),N=null;let i=n-L();i>0&&i<=864e5&&(N=setTimeout(()=>(N=null,P()),i+50),(l=N.unref)==null||l.call(N));},fe=false,ie=()=>{fe=false;let n=Z(s);if(!n)return null;let i=H(n.id);if(i.dismissed)return null;let l=de(n,le(n),i,true);if(G&&W(),l.at==="wait"&&Q(l.until),fe=l.at==="wait"||l.at==="pending",l.at!=="step")return null;let{step:m,line:p,index:_}=l,I=O=>!!O&&O.kind!=="wait"&&O.kind!=="condition";if(m.kind==="checklist"){let O=_;for(;O>0&&I(p[O-1])&&p[O-1].kind==="checklist";)O--;let B=_;for(;B+1<p.length&&I(p[B+1])&&p[B+1].kind==="checklist";)B++;let ge=p.slice(O,B+1).filter(I);for(let Y of ge)!i.done.has(Y.id)&&!g.has(`s:${Y.id}`)&&(g.add(`s:${Y.id}`),e.track(re,{flow:n.id,step:Y.id,kind:"checklist",action:"shown"}));return {type:"checklist",flow:n,items:ge.map(Y=>({step:Y,done:i.done.has(Y.id)}))}}g.has(`s:${m.id}`)||(g.add(`s:${m.id}`),e.track(re,{flow:n.id,step:m.id,kind:m.kind,action:"shown"}));let b=p.slice(_+1),y=b.findIndex(O=>O.kind==="condition"),x=(y<0?b:b.slice(0,y)).filter(I).length;return {type:"step",flow:n,step:m,index:l.before,total:l.before+1+x,last:!x&&y<0}},ae=()=>{if(r){let l=r.reason?r.flow.offers[r.reason]:void 0;return {type:"cancel",screen:r.screen,flow:r.flow,reason:r.reason,offer:r.screen==="offer"?l:void 0,price:r.options.price,busy:r.busy,error:r.error,step:r.plain||r.screen==="survey"?1:r.screen==="offer"?2:3,steps:r.plain?1:3}}let n=ie();if(n)return n;s&&!fe&&(s=null);let i=c.find(l=>!E.has(l.id));return i?{type:"message",message:i}:null},P=()=>{let n=ae();(n==null?void 0:n.type)==="message"&&!g.has(`m:${n.message.id}`)&&(g.add(`m:${n.message.id}`),e.track(et,{message:n.message.id,journey:n.message.journey,action:"shown"}));for(let i of [...w])try{i();}catch(l){}},J=n=>s===n.id?true:s&&Z(s)&&!se(Z(s))?false:(s=n.id,e.track(re,{flow:n.id,action:"started"}),P(),true),ye=()=>{var i;if(!S||s||!a||!e.personId()&&!((i=e.storage)!=null&&i.call(e)))return;let n=z().find(l=>En(l.trigger)&&le(l).length&&!se(l));n&&J(n);},Ie=()=>{let n=e.personId();v!==null&&v!==n&&(k.clear(),M.clear(),E.clear(),s=null,C=void 0),v=n;let i=(async()=>{var p,_,I;let l=(p=e.storage)==null?void 0:p.call(e);if(l)try{let b=await l.get(ue(n));b&&$(JSON.parse(b));let y=await l.get(j(n));if(y)for(let x of JSON.parse(y))typeof x=="string"&&M.add(x);}catch(b){}let m=z().length>0||!!(t!=null&&t.messages);if(n&&m&&C!==n){C=n;let b=await e.fetchInApp(n).catch(()=>null);if(b&&e.personId()===n){$(b.onboarding);for(let y of (_=b.events)!=null?_:[])typeof y=="string"&&M.add(Ae(y));c=((I=b.messages)!=null?I:[]).filter(y=>y&&y.id&&y.title);}}n||(c=[]),a=true,ye(),P();})();return f=i.finally(()=>{f===i&&(f=null);}),f},D=(n,i,l)=>{var p;let m=n.reason?n.flow.offers[n.reason]:void 0;return {outcome:i,run:n.run,...n.reason?{reason:n.reason,reasonLabel:(p=n.flow.reasons.find(_=>_.id===n.reason))==null?void 0:p.label}:{},...i==="saved"&&m?{offer:m}:{},...l!=null&&l.trim()?{comment:l.trim().slice(0,500)}:{}}},U=(n,i)=>{var l;e.track(Ee,{action:"finished",run:n.run,version:n.flow.version,outcome:i.outcome,customer:(l=n.options.customer)!=null?l:"consumer",...i.reason?{reason:i.reason}:{},...i.offer?{offer:i.offer.kind}:{},...i.comment?{comment:i.comment}:{}}),r===n&&(r=null),n.resolve(i),P();},V=(n,i,l)=>{if(n.busy)return;let m=D(n,i,l),p=i==="saved"?n.options.onSave:n.options.onCancel;n.busy=true,n.error=void 0,P(),Promise.resolve().then(()=>p==null?void 0:p(m)).then(()=>U(n,m),()=>{n.busy=false,n.error=vn,P();});};return {setConfig:n=>{t=n,s&&!Z(s)&&(s=null),P();},refresh:Ie,onEvent:n=>{var I;if(!n||n.startsWith("$"))return;let i=Ae(n),l=!!i&&!M.has(i);l&&M.add(i);let m=Z(s),p=false;if(m){let b=H(m.id);for(let y of nt(le(m)))y.kind==="checklist"&&y.event&&!b.done.has(y.id)&&tt(y.event,n)&&(oe(b,y.id),p=true,e.track(re,{flow:m.id,step:y.id,kind:y.kind,action:"completed"}));}if(p||l&&m?(W(),P()):l&&W(),!S||!e.personId()&&!((I=e.storage)!=null&&I.call(e)))return;let _=z().find(b=>le(b).length&&tt(b.trigger,n)&&!se(b));_&&J(_);},openCancelFlow:(n={})=>{var I,b;if(r)return r.promise;let i=(I=t==null?void 0:t.cancelFlow)!=null?I:Rn,l=n.customer!=="business"||i.reasons.length<2,m=()=>{},p=new Promise(y=>m=y),_={flow:i,options:n,plain:l,screen:l?"confirm":"survey",run:_n(),busy:false,resolve:m,promise:p};return r=_,e.track(Ee,{action:"shown",run:_.run,version:i.version,customer:(b=n.customer)!=null?b:"consumer",plain:l}),P(),p},startOnboarding:n=>{let i=n?Z(n):z().find(m=>le(m).length&&!se(m));if(!i||!le(i).length)return false;let l=H(i.id);return l.dismissed=false,J(i)},view:ae,subscribe:n=>(w.add(n),()=>w.delete(n)),cancel:{pick:n=>{!r||r.busy||!r.flow.reasons.some(i=>i.id===n)||(r.reason=n,r.error=void 0,P());},next:()=>{let n=r;!n||n.screen!=="survey"||!n.reason||(e.track(Ee,{action:"answered",run:n.run,version:n.flow.version,reason:n.reason}),n.screen=n.flow.offers[n.reason]?"offer":"confirm",P());},accept:n=>{let i=r;if(!i||i.screen!=="offer"||!i.reason)return;let l=i.flow.offers[i.reason];i.busy||e.track(Ee,{action:"offer",run:i.run,version:i.flow.version,reason:i.reason,offer:l==null?void 0:l.kind,outcome:"accepted"}),V(i,"saved",n);},decline:()=>{var i;let n=r;!n||n.screen!=="offer"||n.busy||(e.track(Ee,{action:"offer",run:n.run,version:n.flow.version,reason:n.reason,offer:n.reason?(i=n.flow.offers[n.reason])==null?void 0:i.kind:void 0,outcome:"declined"}),n.screen="confirm",n.error=void 0,P());},confirm:n=>{let i=r;!i||i.screen!=="confirm"||V(i,"cancelled",n);},close:()=>{var l,m;let n=r;if(!n||n.busy)return;let i=D(n,"kept");(m=(l=n.options).onClose)==null||m.call(l,i),U(n,i);}},onboarding:{next:()=>{let n=ie();(n==null?void 0:n.type)==="step"&&(oe(H(n.flow.id),n.step.id),e.track(re,{flow:n.flow.id,step:n.step.id,kind:n.step.kind,action:"completed"}),W(),P());},check:n=>{let i=ie();if((i==null?void 0:i.type)!=="checklist")return;let l=i.items.find(m=>m.step.id===n);!l||l.done||(oe(H(i.flow.id),n),e.track(re,{flow:i.flow.id,step:n,kind:"checklist",action:"completed"}),W(),P());},dismiss:()=>{let n=ie();!n||n.type!=="step"&&n.type!=="checklist"||(H(n.flow.id).dismissed=true,e.track(re,{flow:n.flow.id,...n.type==="step"?{step:n.step.id}:{},action:"dismissed"}),s=null,W(),P());}},message:{click:()=>{var l;let n=ae();if((n==null?void 0:n.type)!=="message")return;E.add(n.message.id),e.track(et,{message:n.message.id,journey:n.message.journey,action:"clicked"});let i=Sn(n.message.url);P(),i&&((l=e.openUrl)==null||l.call(e,i));},dismiss:()=>{let n=ae();(n==null?void 0:n.type)==="message"&&(E.add(n.message.id),e.track(et,{message:n.message.id,journey:n.message.journey,action:"dismissed"}),P());}}}};var Fn="ck_pick",$n="ck_origin",Le=e=>typeof CSS!="undefined"&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,t=>`\\${t}`),Mn=e=>[...e.classList].filter(t=>t.length<30&&!/\d{2,}|[_-][a-z0-9]{5,}$|^(is|has)-|hover|active|focus|open|selected|:|\[/.test(t)).slice(0,2),Ut=e=>{let t=e.ownerDocument,r=f=>{try{return t.querySelectorAll(f).length===1}catch(C){return false}},s=e.getAttribute("data-ck-target");if(s)return `[data-ck-target="${s.replace(/"/g,'\\"')}"]`;if(e.id&&!/\d{3,}/.test(e.id)&&r(`#${Le(e.id)}`))return `#${Le(e.id)}`;let c=[],a=e;for(;a&&a!==t.documentElement&&c.length<6;){if(a!==e&&a.id&&!/\d{3,}/.test(a.id)){c.unshift(`#${Le(a.id)}`);break}let f=a.tagName.toLowerCase(),C=Mn(a).map(w=>`.${Le(w)}`).join(""),v=a.parentElement,k=v?[...v.children].filter(w=>w.tagName===a.tagName):[],E=k.length>1?`:nth-of-type(${k.indexOf(a)+1})`:"";c.unshift(`${f}${C}${E}`);let g=c.join(" > ");if(r(g))return g;a=v;}return c.join(" > ")},jt=()=>{var E;if(typeof window=="undefined"||window.top===window)return null;let e=new URLSearchParams(window.location.search);if(e.get(Fn)!=="1")return null;let t;try{t=new URL((E=e.get($n))!=null?E:"").origin;}catch(g){return null}if(!/^https?:\/\//.test(t))return null;let r=g=>window.parent.postMessage(g,t),s=document.createElement("div");s.setAttribute("aria-hidden","true"),Object.assign(s.style,{position:"fixed",zIndex:"2147483647",pointerEvents:"none",border:"2px solid #0ea5e9",background:"rgba(14,165,233,.12)",borderRadius:"6px",transition:"all 60ms linear",display:"none"});let c=document.createElement("div");Object.assign(c.style,{position:"absolute",left:"-2px",bottom:"calc(100% + 4px)",font:"600 11px/1.4 system-ui, sans-serif",color:"#fff",background:"#0c4a6e",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap",maxWidth:"360px",overflow:"hidden",textOverflow:"ellipsis"}),s.appendChild(c),document.body.appendChild(s);let a=null,f=g=>{if(a=g&&g!==s&&!s.contains(g)?g:null,!a){s.style.display="none";return}let w=a.getBoundingClientRect();Object.assign(s.style,{display:"block",left:`${w.left-2}px`,top:`${w.top-2}px`,width:`${w.width+4}px`,height:`${w.height+4}px`}),c.textContent=Ut(a);},C=g=>f(document.elementFromPoint(g.clientX,g.clientY)),v=g=>{var S,M;g.preventDefault(),g.stopPropagation();let w=(S=document.elementFromPoint(g.clientX,g.clientY))!=null?S:a;!w||w===s||r({type:"mrrocket:picked",selector:Ut(w),text:((M=w.textContent)!=null?M:"").trim().replace(/\s+/g," ").slice(0,80)});},k=g=>{g.key==="Escape"&&r({type:"mrrocket:pick-cancel"});};return window.addEventListener("mousemove",C,true),window.addEventListener("click",v,true),window.addEventListener("keydown",k,true),r({type:"mrrocket:pick-ready"}),()=>{window.removeEventListener("mousemove",C,true),window.removeEventListener("click",v,true),window.removeEventListener("keydown",k,true),s.remove();}};var Pn={get:e=>{try{return window.localStorage.getItem(e)}catch(t){return null}},set:(e,t)=>{try{window.localStorage.setItem(e,t);}catch(r){}}},Ht=()=>{try{for(let e=window.localStorage.length-1;e>=0;e--){let t=window.localStorage.key(e);t!=null&&t.startsWith("mrrocket:onboarding")&&window.localStorage.removeItem(t);}}catch(e){}},Kt=e=>({track:e.track,personId:e.personId,auto:e.auto,storage:()=>e.canStore()?Pn:null,openUrl:t=>window.location.assign(t),path:()=>window.location.pathname,fetchInApp:async t=>{if(!e.apiKey)return null;let r=await fetch(`${e.host}/api/sdk/inapp?key=${encodeURIComponent(e.apiKey)}&distinctId=${encodeURIComponent(t)}`);return r.ok?await r.json():null}});var De="mrr_ref",Ue="mrr_ref",An="mrr_ref",Ln="mrr_click";var _e=/^[A-Za-z0-9_-]{1,64}$/;var Nn=(e,t="ref")=>{let r=new URLSearchParams(e);return Tn(s=>r.get(s),t)},Tn=(e,t="ref")=>{let r=e(An);if(r&&_e.test(r)){let c=e(Ln);return {code:r,clickId:c&&_e.test(c)?c:null,direct:false}}let s=e(t);return s&&_e.test(s)?{code:s,clickId:null,direct:true}:null},Wt=e=>{var t;return `${e.code}.${(t=e.clickId)!=null?t:""}.${e.at}`},Ne=(e,t=60,r=Date.now())=>{if(!e)return null;let[s,c,a]=e.split("."),f=Number(a);return !s||!_e.test(s)||!Number.isFinite(f)||c&&!_e.test(c)||r-f>t*864e5||f>r+864e5?null:{code:s,clickId:c||null,at:f}};var T=null,je=()=>typeof document!="undefined",Vt=e=>{var r;if(!je())return;let t=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);try{return t?decodeURIComponent(t):void 0}catch(s){return t}},He=()=>{try{return typeof localStorage=="undefined"?null:localStorage}catch(e){return null}},rt=()=>{var e,t;return T||(je()?(t=Ne(Vt(De),3650))!=null?t:Ne((e=He())==null?void 0:e.getItem(Ue),3650):null)};var Te=(e,t)=>{var c;if(!je())return;let r=Math.max(1,Math.round(t))*86400,s=typeof location!="undefined"&&location.protocol==="https:"?"; secure":"";document.cookie=`${De}=${encodeURIComponent(Wt(e))}; path=/; max-age=${r}; samesite=lax${s}`;try{(c=He())==null||c.setItem(Ue,Wt(e));}catch(a){}},Ke=()=>{var e;if(je()){document.cookie=`${De}=; path=/; max-age=0; samesite=lax`;try{(e=He())==null||e.removeItem(Ue);}catch(t){}}},Bt=()=>{T=null;},qt=async e=>{var s,c,a;let t=Nn(e.search,e.param),r=(s=e.now)!=null?s:Date.now();if(!t)return !T&&e.store&&(T=(a=Ne(Vt(De),e.days,r))!=null?a:Ne((c=He())==null?void 0:c.getItem(Ue),e.days,r),T||Ke()),T;if(T={code:t.code,clickId:t.clickId,at:r},e.store&&Te(T,e.days),e.beacon)try{let f=await e.beacon({code:t.code,clickId:t.clickId});f&&T&&T.code===t.code&&!T.clickId&&(T={...T,clickId:f},e.store&&Te(T,e.days));}catch(f){}return T},Yt=e=>e==="$identify"||!e.startsWith("$");var ot=3600*24*365,Jt=e=>{var r;if(typeof document=="undefined")return;let t=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);if(t)try{return decodeURIComponent(t)}catch(s){return t}},We=(e,t,r)=>{let s=window.location.protocol==="https:"?"; secure":"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${r}; samesite=lax${s}`;},Se=e=>{document.cookie=`${e}=; path=/; max-age=0; samesite=lax`;},A={utm:{}},zt=()=>{var e;return (e=A.id)!=null?e:A.id=Ze()},st=(e,t)=>{if(e!=="cookies")return zt();let r=Jt(ce);if(r)return A.id=r;let s=zt();return We(ce,s,ot),s},it=e=>{var c;let t=Date.now(),r=A.session,s=(c=e?Jt(ke):void 0)!=null?c:r&&t-r.last<18e5?r.id:Ze();return A.session={id:s,last:t},e&&We(ke,s,18e5/1e3),s},at=()=>{var r;let e=window.location.href;if(A.url===e)return;A.referrer=(r=A.url)!=null?r:document.referrer||void 0,A.url=e;let t=Ft(window.location.search);Object.keys(t).length&&(A.utm=t);},Gt=()=>{let e=navigator,t=window;return e.doNotTrack==="1"||t.doNotTrack==="1"||e.globalPrivacyControl===true};var Ve=window,Un=()=>{var e,t;return (t=(e=document.currentScript)!=null?e:document.querySelector('script[data-key][src*="sdk"]'))!=null?t:document.querySelector("script[data-key][src*='mrrocket']")},Qt=new Set,X=e=>{Qt.has(e)||(Qt.add(e),console.warn(`[MRRocket] ${e}`));},jn=()=>{var wt,kt,yt,bt;let e=Un(),t=o=>{var d;return (d=e==null?void 0:e.getAttribute(`data-${o}`))!=null?d:void 0},r=(o,d)=>{let u=t(o);return u===void 0?d:!["false","0","off","no"].includes(u.trim().toLowerCase())},s=(wt=e==null?void 0:e.src)!=null?wt:"",c="";try{c=s?new URL(s,window.location.href).origin:"";}catch(o){c="";}let a=((kt=t("key"))!=null?kt:"").trim(),f=((yt=t("api-host"))!=null?yt:c).trim().replace(/\/+$/,""),C=t("consent"),v=r("respect-dnt",false),k=r("heatmaps",true),E=r("errors",true),g=t("release"),w=t("attribution"),S=w==="always"||w==="off"?w:"consent",M=t("referral-param")||"ref",L={},N=(o,d)=>{var u;return (u=L[o])!=null?u:L[o]=new Promise((h,R)=>{var xt;let F=()=>Ve[d];if(F())return h(F());let q=(xt=t(`${o}-src`))!=null?xt:s?s.replace(/(\.min)?\.js(\?[^#]*)?(#.*)?$/,`-${o}$1.js?v=${Pe}`):"";if(!q)return R(new Error(o));let ne=document.createElement("script");ne.async=true,ne.src=q,ne.onload=()=>F()?h(F()):R(new Error(o)),ne.onerror=()=>R(new Error(o)),document.head.appendChild(ne);}).catch(h=>{throw L[o]=void 0,h})},z=t("theme"),Z={theme:z==="light"||z==="dark"?z:"auto",accent:t("accent")},H=new URLSearchParams(window.location.search),G=$t(H.get(It)),K=H.get(Ot)==="1";K&&jt();let oe=H.get(Ce);if(oe!==null){H.delete(Ce);let o=H.toString();history.replaceState(history.state,"",`${window.location.pathname}${o?`?${o}`:""}${window.location.hash}`);}let Be=Gt(),de=C==="cookies"||C==="off"?C:"cookieless",se=r("replay",false),ue="",j,W,$=null,Q=false,fe=false,ie=null,ae=null,P=window.location.pathname,J=[],ye=new Set,Ie=[],D=()=>v&&Be?"off":de,U=()=>!K&&D()!=="off",V=()=>j!=null?j:ue,pe=()=>D()==="cookies"?V():j;a||X('No public key. Add data-key="mrr_pub_\u2026" to the script tag; nothing is tracked until then.');let Oe=(o=false)=>{if(!J.length)return;if(!a){J.length=0;return}let d=`${f}/api/sdk/events`;for(let u of Rt(a,J.splice(0),{v:Pe,errors:E,platform:"web"}))o&&"sendBeacon"in navigator&&navigator.sendBeacon(d,u)||fetch(d,{method:"POST",headers:{"content-type":"application/json"},body:u,keepalive:true}).then(R=>{R.ok||X(`Events were rejected with ${R.status}. Check data-key (MRRocket \u203A Settings \u203A Products).`);}).catch(()=>X(`Could not reach ${f||"this origin"} to send events. Check data-api-host.`));},n=null,i=null,l=(o,d,u=Date.now(),h)=>{if(!U())return;let R=Yt(o)?rt():null;J.push({event:o,props:R?{...d,$referral:{code:R.code,clickId:R.clickId}}:d,distinctId:pe(),sessionId:it(D()==="cookies"),ts:u,url:h!=null?h:window.location.href,referrer:A.referrer,...A.utm,screen:{w:window.screen.width,h:window.screen.height}});},m=(o,d)=>{typeof o!="string"||!o||(l(o,d),U()&&(n==null||n.event(o)),p.onEvent(o));},p=Dt(Kt({host:f,apiKey:a,track:l,personId:()=>U()?j:void 0,canStore:()=>D()==="cookies",auto:r("onboarding",true)})),_=false;p.subscribe(()=>{_||!p.view()||K||(_=true,N("flows","__mrrocketFlows").then(o=>o.mountFlows(p,Z)).catch(()=>{_=false,X("The cancel flow and onboarding dialogs did not load. Check that sdk-flows.js is served next to sdk.js.");}));});let I=(o,d)=>{if(!U())return;let u=`${window.location.pathname}|${o}`;ye.has(u)||(ye.add(u),m("$exposure",{experiment:o,variant:d}));},b=()=>{let o=Pt($,window.location.href,V(),G);return o!=null&&o.to?(Oe(true),window.location.replace(o.to),true):(o!=null&&o.experiment&&I(o.experiment,o.variant),false)},y=()=>{if(!$)return;let o=document.querySelectorAll("[data-ck-text]");if(!o.length)return;let d=Mt($,V(),G),u=new Set;o.forEach(h=>{var q,ne;let R=h.dataset.ckText;if(!R)return;u.add(R),h.dataset.ckDefault===void 0&&(h.dataset.ckDefault=(q=h.textContent)!=null?q:"");let F=(ne=d[R])!=null?ne:h.dataset.ckDefault;h.textContent!==F&&(h.textContent=F);});for(let h of $.experiments)h.variants.some(R=>{var F;return Object.keys((F=R.changes)!=null?F:{}).some(q=>u.has(q))})&&I(h.key,Re(h.key,$,V(),G));},x=()=>{var o,d;return (d=(o=$==null?void 0:$.referral)==null?void 0:o.cookieDays)!=null?d:60},O=()=>S==="always"?D()!=="off":S==="consent"&&D()==="cookies",B=null,ge=false,Y=()=>{if(!Q||K)return;if(S==="off"||D()==="off"){Bt(),(S==="off"||ge)&&Ke();return}let o=window.location.href;B!==o&&(B=o,qt({search:window.location.search,param:M,store:O(),days:x(),beacon:a?({code:d,clickId:u})=>fetch(`${f}/api/sdk/affiliate/click`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:a,code:d,clickId:u,url:o,referrer:document.referrer||void 0}),keepalive:true}).then(h=>h.ok?h.json():null).then(h=>{var R;return (R=h==null?void 0:h.clickId)!=null?R:null}):void 0}));},en=()=>{let o=O(),d=rt();o&&d?Te(d,x()):!o&&ge&&Ke(),ge=o;},ct=0,lt=false,dt=()=>{var h,R;let o=U()&&se&&!!($!=null&&$.replay)&&!!a;if(o===lt)return;lt=o;let d=++ct;if(!o){n==null||n.stop(true),n=null;return}let u=(R=(h=$==null?void 0:$.replay)==null?void 0:h.sampleRate)!=null?R:.1;N("replay","__mrrocketReplay").then(F=>F.startReplay({host:f,apiKey:a,sessionId:it(D()==="cookies"),distinctId:pe(),identified:!!j,sampleRate:u,warn:X})).then(F=>{d!==ct?F==null||F.stop(true):n=F;}).catch(()=>X("Session recording could not start (the recorder did not load)."));},ut=r("messenger",false),ee=null,me=o=>{K||a&&(ee!=null||(ee=N("messenger","__mrrocketMessenger").then(d=>{var F;let u=q=>t(`messenger-${q}`)===void 0?void 0:r(`messenger-${q}`,true),h=t("messenger-position"),R=(F=t("messenger-theme"))!=null?F:z;return d.mountMessenger({host:f,apiKey:a,distinctId:V,user:()=>W,launcher:ut,position:h==="bottom-left"||h==="bottom-right"?h:void 0,title:t("messenger-title"),greeting:t("messenger-greeting"),label:t("messenger-label"),askEmail:u("ask-email"),help:u("help"),sound:u("sound"),preview:u("preview"),theme:R==="light"||R==="dark"||R==="auto"?R:void 0,accent:t("accent")})})),ee.then(o).catch(()=>{ee=null,X("sdk-messenger.js did not load.");}));},ft=t("forms")==="auto",qe=false,Ye=()=>{qe||!a||K||!document.querySelector(ft?"form":"form[data-mrrocket-form]")||(qe=true,N("forms","__mrrocketForms").then(o=>o.watchForms({host:f,apiKey:a,auto:ft,distinctId:()=>U()?pe():void 0,identified:()=>!!j,identify:ht,tracking:U,referrer:()=>A.referrer,utm:()=>A.utm})).catch(()=>qe=false));},Xe=()=>{!fe||!U()||ae===window.location.pathname||(ae=window.location.pathname,m("$pageview",{path:window.location.pathname}));},te=null,pt=()=>{let o=te;k&&o&&o.max>0&&l("$scroll",{depth:o.max,docH:o.docH,vw:window.innerWidth,vh:window.innerHeight},Date.now(),o.url),te=null;},be=()=>{var R,F;if(!k||!U()||K)return;let o=document.documentElement,d=Math.max(o.scrollHeight,(F=(R=document.body)==null?void 0:R.scrollHeight)!=null?F:0),u=_t(),h=window.location.href;(te==null?void 0:te.url)!==h?te={url:h,max:u,docH:d}:u>te.max&&(te={url:h,max:u,docH:d});},gt=()=>{let o=window.location.pathname;o!==P&&(P=o,!(Q&&b())&&(pt(),at(),n==null||n.page(o),i==null||i.crumb("navigation",o),Xe(),Y(),window.setTimeout(()=>{be(),y(),Ye();},0)));},mt=()=>{let o=D(),d=ie;ie=o,d==="cookies"&&o!=="cookies"&&(Se(ce),Se(ke)),o==="off"&&(J.length=0,A.session=void 0),d==="cookies"&&o!=="cookies"&&Ht(),ue=st(o),en(),Y(),dt(),Xe(),be();},tn=o=>{let{analytics:d,replay:u}=typeof o=="string"?{analytics:o,replay:void 0}:o!=null?o:{};if(d!==void 0&&d!=="cookieless"&&d!=="cookies"&&d!=="off"){X(`setConsent: "${String(d)}" is not a consent mode. Use "cookieless", "cookies" or "off".`);return}d==="off"&&(J.length=0),d&&(de=d),typeof u=="boolean"&&(se=u),mt(),Q&&p.refresh();},ht=(o,d)=>{if(typeof o!="string"||!o)return;let u=pe();j=o,l("$identify",{...d,id:o,...u&&u!==o?{previousId:u}:{}}),n==null||n.identify(o),D()==="cookies"&&We(ce,o,ot),W={...d,id:o},y(),Q&&p.refresh();},Fe={track:m,identify:ht,reset:()=>{j=void 0,W=void 0,ye.clear(),D()==="cookies"&&(Se(ce),Se(ke)),A.id=void 0,A.session=void 0,ue=st(D()),y(),Q&&p.refresh();},captureError:o=>i==null?void 0:i.capture(o,"manual"),setConsent:tn,getFlag:o=>Qe(o,$,V(),{...W})!==false,getFlagVariant:o=>{let d=Qe(o,$,V(),{...W});return typeof d=="string"?d:null},getVariant:o=>{let d=Re(o,$,V(),G);return ($||G[o])&&I(o,d),d},ready:o=>{typeof o=="function"&&(Q?window.setTimeout(()=>o(Fe),0):Ie.push(o));},getDistinctId:V,cancelFlow:{open:o=>p.openCancelFlow(o)},onboarding:{start:o=>p.startOnboarding(o)},openCancelFlow:o=>p.openCancelFlow(o),startOnboarding:o=>p.startOnboarding(o),push:{subscribe:o=>{let d=U()?j:void 0;if(!d)return Promise.resolve({status:"not-signed-in"});let u=window.Notification,h=Promise.resolve(u&&u.permission==="default"&&(o==null?void 0:o.ask)!==false?u.requestPermission():u==null?void 0:u.permission);return N("push","__mrrocketPush").then(R=>R.subscribeWebPush({host:f,apiKey:a,distinctId:d,permission:h},o))},unsubscribe:()=>N("push","__mrrocketPush").then(o=>o.unsubscribeWebPush({host:f,apiKey:a,distinctId:j}))},messenger:{open:o=>me(d=>d.open(o)),close:()=>{ee==null?void 0:ee.then(o=>o.close()).catch(()=>{});},toggle:()=>me(o=>o.toggle())},openMessenger:()=>me(o=>o.open()),version:Pe};at(),mt();let he=Ve.mrrocket,nn=(bt=he==null?void 0:he.q)!=null?bt:[],ze=he&&typeof he=="object"?he:{};Object.assign(ze,Fe,{__loaded:true}),delete ze.q,Ve.mrrocket=ze;for(let[o,d]of nn){let u=Fe[o];if(typeof u=="function")try{u(...Array.from(d!=null?d:[]));}catch(h){console.error(h);}}fe=true,Xe(),E&&a&&!K&&(i=Lt({host:f,apiKey:a,release:g,context:()=>{var o;return {send:U(),distinctId:pe(),sessionId:(o=A.session)==null?void 0:o.id}},warn:X}),i.crumb("navigation",window.location.pathname));for(let o of ["pushState","replaceState"]){let d=history[o];history[o]=function(...u){let h=d.apply(this,u);return gt(),h};}window.addEventListener("popstate",gt);let rn=new xe;document.addEventListener("click",o=>{var F;o.target instanceof Element&&o.target.closest("[data-ck-messenger]")&&(o.preventDefault(),me(q=>q.open()));let d=o.target instanceof Element?o.target.closest("[data-ck-goal]"):null;if(d!=null&&d.dataset.ckGoal&&m(d.dataset.ckGoal,{text:(F=d.textContent)==null?void 0:F.trim().slice(0,80)}),!U())return;let u=Et(o);if(!u)return;let h=rn.push(u.x,u.y,Date.now());if((u.label||u.selector)&&(i==null||i.crumb("click",u.label||u.selector)),n==null||n.click(u,h),!k)return;let R={x:u.x,y:u.y,vw:u.vw,vh:u.vh,docH:u.docH,selector:u.selector,label:u.label,dead:!u.interactive};l("$click",R),h&&l("$rageclick",R);});let Je=0;window.addEventListener("scroll",()=>{Je||(Je=window.requestAnimationFrame(()=>{Je=0,be();}));},{passive:true}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>be()):be(),window.setInterval(()=>Oe(),2e3),window.addEventListener("pagehide",()=>{pt(),Oe(true);});let Ge=()=>{if(Q=true,b())return;let o=At($,oe);o&&I(o.experiment,o.variant),document.documentElement.classList.remove("ck-hide"),Y(),dt(),p.setConfig($),p.refresh(),ut&&(document.body?me():document.addEventListener("DOMContentLoaded",()=>me())),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{y(),Ye();}):(y(),Ye());for(let d of Ie.splice(0))try{d(Fe);}catch(u){console.error(u);}};a?fetch(`${f}/api/sdk/config?key=${encodeURIComponent(a)}`).then(o=>(o.ok||X(`Config request to ${f||"this origin"} answered ${o.status}. Check data-key and data-api-host.`),o.ok?o.json():null)).then(o=>{o&&Array.isArray(o.experiments)&&($=o),Ge();}).catch(()=>{X(`Could not reach ${f||"this origin"}. Check data-api-host. The page keeps its own texts and flags stay off.`),Ge();}):Ge();},Zt;typeof window!="undefined"&&typeof document!="undefined"&&!((Zt=Ve.mrrocket)!=null&&Zt.__loaded)&&jn();
2
2
  })();
package/dist/client.d.ts CHANGED
@@ -58,6 +58,12 @@ export interface CockpitProviderProps {
58
58
  onboarding?: boolean;
59
59
  /** The look of the cancel flow, onboarding and message dialogs: `{ theme: "dark", accent: "#0f766e", className }`. */
60
60
  appearance?: FlowsTheme;
61
+ /**
62
+ * Form leads (0.12.0): a submitted form marked `data-mrrocket-form` becomes a contact in MRRocket (default true).
63
+ * "auto" also captures any form with an email field (never one with a password field); false captures none. Only
64
+ * the email, the name and the other fields a person typed go out, never passwords, card or hidden fields (forms.ts).
65
+ */
66
+ forms?: boolean | "auto";
61
67
  children: ReactNode;
62
68
  }
63
69
  /**
@@ -67,7 +73,7 @@ export interface CockpitProviderProps {
67
73
  * `preview` forces variants for this render, for example from the `ck_preview` search param on the server,
68
74
  * so a Cockpit preview never flickers. Without it the provider reads the param itself after the first render.
69
75
  */
70
- export declare const CockpitProvider: ({ apiKey: apiKeyProp, host: hostProp, preview: forced, embedded: embeddedProp, config: bootstrapConfig, distinctId: bootstrapId, consent: consentProp, respectDnt, replay: replayProp, heatmaps, surveys, errors, release, attribution, referralParam, onboarding, appearance, children, }: CockpitProviderProps) => import("react").JSX.Element;
76
+ export declare const CockpitProvider: ({ apiKey: apiKeyProp, host: hostProp, preview: forced, embedded: embeddedProp, config: bootstrapConfig, distinctId: bootstrapId, consent: consentProp, respectDnt, replay: replayProp, heatmaps, surveys, errors, release, attribution, referralParam, onboarding, appearance, forms, children, }: CockpitProviderProps) => import("react").JSX.Element;
71
77
  /**
72
78
  * `track`, `identify`, `captureError`, the consent mode, the replay consent and their setter, the visitor id and whether
73
79
  * the experiments and flags have loaded. `setConsent("cookies")` sets the mode, `setConsent({ replay: true })` the
package/dist/client.js CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  import { bodies } from "./batch.js";
37
37
  import { YEAR_S, deleteCookie, enterPage, page, privacySignal, touchSession, visitorId, writeCookie } from "./web-state.js";
38
38
  import { createFlows } from "./flows.js";
39
+ import { startPicker } from "./pick.js";
39
40
  import { forgetFlowsStorage, webFlowsEnv } from "./flows-web.js";
40
41
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
41
42
  var warned = /* @__PURE__ */ new Set();
@@ -62,6 +63,7 @@ var CockpitProvider = ({
62
63
  referralParam = "ref",
63
64
  onboarding = true,
64
65
  appearance,
66
+ forms = true,
65
67
  children
66
68
  }) => {
67
69
  const pathname = usePathname();
@@ -95,6 +97,7 @@ var CockpitProvider = ({
95
97
  setUrlEmbedded(params.get(EMBED_PARAM) === "1");
96
98
  setDnt(privacySignal());
97
99
  setMounted(true);
100
+ return params.get(EMBED_PARAM) === "1" ? startPicker() ?? void 0 : void 0;
98
101
  }, []);
99
102
  const setConsent = useCallback((choice) => {
100
103
  const { analytics: mode, replay } = typeof choice === "string" ? { analytics: choice, replay: void 0 } : choice;
@@ -241,6 +244,31 @@ var CockpitProvider = ({
241
244
  },
242
245
  [record]
243
246
  );
247
+ const identifyRef = useRef(identify);
248
+ identifyRef.current = identify;
249
+ useEffect(() => {
250
+ if (!forms || !apiKey || embedded || typeof window === "undefined") return;
251
+ let off;
252
+ let gone = false;
253
+ void import("./forms.js").then((m) => {
254
+ if (gone) return;
255
+ off = m.watchForms({
256
+ host,
257
+ apiKey,
258
+ auto: forms === "auto",
259
+ distinctId: () => live.current.tracking ? live.current.sendId : void 0,
260
+ identified: () => live.current.identified,
261
+ identify: (id, props) => identifyRef.current(id, props),
262
+ tracking: () => live.current.tracking,
263
+ referrer: () => page.referrer,
264
+ utm: () => page.utm
265
+ });
266
+ }).catch(() => void 0);
267
+ return () => {
268
+ gone = true;
269
+ off?.();
270
+ };
271
+ }, [forms, apiKey, host, embedded]);
244
272
  useEffect(() => {
245
273
  if (!visitor) return;
246
274
  for (const run of early.current.splice(0)) run();