@mrrocket/sdk 0.3.0 → 0.8.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +240 -5
  3. package/dist/api.d.ts +23 -3
  4. package/dist/api.js +7 -3
  5. package/dist/api.js.map +1 -1
  6. package/dist/batch.d.ts +33 -0
  7. package/dist/batch.js +50 -0
  8. package/dist/batch.js.map +1 -0
  9. package/dist/browser/mrrocket-flows.js +64 -0
  10. package/dist/browser/mrrocket-push.js +1 -0
  11. package/dist/browser/mrrocket-replay.js +78 -0
  12. package/dist/browser/mrrocket-sw.js +1 -0
  13. package/dist/browser/mrrocket.js +2 -0
  14. package/dist/browser.d.ts +1 -1
  15. package/dist/browser.js +3 -1
  16. package/dist/browser.js.map +1 -1
  17. package/dist/client.d.ts +36 -1
  18. package/dist/client.js +163 -83
  19. package/dist/client.js.map +1 -1
  20. package/dist/context.d.ts +10 -0
  21. package/dist/context.js.map +1 -1
  22. package/dist/core.d.ts +91 -4
  23. package/dist/core.js +83 -6
  24. package/dist/core.js.map +1 -1
  25. package/dist/feedback.d.ts +19 -4
  26. package/dist/feedback.js +652 -190
  27. package/dist/feedback.js.map +1 -1
  28. package/dist/flows-ui.d.ts +23 -0
  29. package/dist/flows-ui.js +384 -0
  30. package/dist/flows-ui.js.map +1 -0
  31. package/dist/flows-web.d.ts +19 -0
  32. package/dist/flows-web.js +42 -0
  33. package/dist/flows-web.js.map +1 -0
  34. package/dist/flows.d.ts +222 -0
  35. package/dist/flows.js +409 -0
  36. package/dist/flows.js.map +1 -0
  37. package/dist/index.d.ts +5 -2
  38. package/dist/index.js +9 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/proxy.d.ts +34 -1
  41. package/dist/proxy.js +14 -1
  42. package/dist/proxy.js.map +1 -1
  43. package/dist/push-web.d.ts +43 -0
  44. package/dist/push-web.js +81 -0
  45. package/dist/push-web.js.map +1 -0
  46. package/dist/react-native/index.d.cts +561 -0
  47. package/dist/react-native/index.d.ts +561 -0
  48. package/dist/react-native/index.js +1743 -0
  49. package/dist/react-native/index.js.map +1 -0
  50. package/dist/react-native/package.json +3 -0
  51. package/dist/referral.d.ts +6 -0
  52. package/dist/referral.js +7 -3
  53. package/dist/referral.js.map +1 -1
  54. package/dist/styles.d.ts +1 -1
  55. package/dist/styles.js +127 -24
  56. package/dist/styles.js.map +1 -1
  57. package/dist/ui.d.ts +3 -0
  58. package/dist/ui.js +12 -0
  59. package/dist/ui.js.map +1 -1
  60. package/dist/web-state.d.ts +36 -0
  61. package/dist/web-state.js +64 -0
  62. package/dist/web-state.js.map +1 -0
  63. package/package.json +64 -6
  64. package/react-native/package.json +7 -0
@@ -0,0 +1,64 @@
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",_=`
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
+ .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
+ @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)}}
5
+ .ckf-root,.ckf-root *{box-sizing:border-box}
6
+ .ckf-root{font-family:var(--ckf-font);font-size:14px;line-height:1.45;color:var(--ckf-fg);-webkit-font-smoothing:antialiased}
7
+ .ckf-root :where(button,textarea){font:inherit;color:inherit;margin:0}
8
+ .ckf-root :focus-visible{outline:2px solid var(--ckf-accent);outline-offset:2px}
9
+ .ckf-scrim{position:fixed;inset:0;z-index:2147483002;background:rgba(0,0,0,.4);display:flex;align-items:center;justify-content:center;padding:16px;animation:ckf-fade .15s ease-out}
10
+ .ckf-card{position:relative;width:100%;max-width:400px;max-height:calc(100dvh - 32px);overflow-y:auto;background:var(--ckf-bg);color:var(--ckf-fg);border-radius:var(--ckf-radius);box-shadow:var(--ckf-shadow);padding:18px 20px 20px;display:flex;flex-direction:column;gap:12px;animation:ckf-in .18s ease-out}
11
+ .ckf-float{position:fixed;z-index:2147483001;right:20px;bottom:20px;width:340px;max-width:calc(100vw - 24px)}
12
+ .ckf-top{display:flex;align-items:center;gap:8px;min-height:20px}
13
+ .ckf-dots{display:flex;gap:4px}
14
+ .ckf-dot{width:16px;height:4px;border-radius:4px;background:var(--ckf-line)}
15
+ .ckf-dot[data-on]{background:var(--ckf-accent)}
16
+ .ckf-x{margin-left:auto;width:28px;height:28px;border:0;border-radius:8px;background:none;color:var(--ckf-muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:18px;line-height:1}
17
+ .ckf-x:hover{background:var(--ckf-soft);color:var(--ckf-fg)}
18
+ .ckf-h{margin:0;font-size:17px;font-weight:650;letter-spacing:-.01em;text-wrap:balance}
19
+ .ckf-p{margin:0;color:var(--ckf-muted);text-wrap:pretty;white-space:pre-wrap}
20
+ .ckf-small{margin:0;font-size:12px;color:var(--ckf-muted)}
21
+ .ckf-opts{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
22
+ .ckf-opt{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;padding:8px 12px;border:1px solid var(--ckf-line);border-radius:10px;background:var(--ckf-bg);text-align:left;cursor:pointer;font-weight:500}
23
+ .ckf-opt:hover{background:var(--ckf-soft)}
24
+ .ckf-opt[aria-checked=true]{border-color:var(--ckf-accent);background:color-mix(in srgb,var(--ckf-accent) 8%,var(--ckf-bg))}
25
+ .ckf-radio{width:16px;height:16px;flex:none;border-radius:50%;border:1.5px solid var(--ckf-line);display:inline-flex;align-items:center;justify-content:center}
26
+ .ckf-opt[aria-checked=true] .ckf-radio{border-color:var(--ckf-accent)}
27
+ .ckf-opt[aria-checked=true] .ckf-radio::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--ckf-accent)}
28
+ .ckf-box{border-radius:10px;background:var(--ckf-soft);padding:12px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
29
+ .ckf-big{font-size:22px;font-weight:650;font-variant-numeric:tabular-nums}
30
+ .ckf-strike{color:var(--ckf-muted);text-decoration:line-through;font-variant-numeric:tabular-nums}
31
+ .ckf-text{width:100%;min-height:64px;resize:vertical;border:1px solid var(--ckf-line);border-radius:10px;background:var(--ckf-bg);padding:8px 10px}
32
+ .ckf-text::placeholder{color:var(--ckf-muted)}
33
+ .ckf-btns{display:flex;flex-direction:column;gap:6px}
34
+ .ckf-btn{height:38px;padding:0 14px;border-radius:10px;border:1px solid var(--ckf-line);background:var(--ckf-bg);font-weight:600;cursor:pointer;transition:filter .1s linear,background-color .1s linear}
35
+ .ckf-btn:hover{background:var(--ckf-soft)}
36
+ .ckf-btn[disabled]{opacity:.55;cursor:not-allowed}
37
+ .ckf-primary{background:var(--ckf-accent);border-color:var(--ckf-accent);color:var(--ckf-accent-ink)}
38
+ .ckf-primary:hover{background:var(--ckf-accent);filter:brightness(1.07)}
39
+ .ckf-danger{background:var(--ckf-danger);border-color:var(--ckf-danger);color:#fff}
40
+ .ckf-danger:hover{background:var(--ckf-danger);filter:brightness(1.07)}
41
+ .ckf-quiet{border-color:transparent;background:none;color:var(--ckf-muted);height:30px;font-weight:500}
42
+ .ckf-quiet:hover{background:none;color:var(--ckf-fg)}
43
+ .ckf-err{margin:0;color:var(--ckf-danger);font-size:13px;font-weight:500}
44
+ .ckf-row{display:flex;justify-content:flex-end;gap:8px;align-items:center}
45
+ .ckf-row .ckf-small{margin-right:auto}
46
+ .ckf-ring{position:fixed;z-index:2147483000;pointer-events:none;border-radius:10px;box-shadow:0 0 0 2px var(--ckf-accent),0 0 0 6px color-mix(in srgb,var(--ckf-accent) 25%,transparent);transition:all .15s ease-out}
47
+ .ckf-check{display:flex;align-items:flex-start;gap:10px;width:100%;padding:8px 6px;border:0;border-radius:8px;background:none;text-align:left}
48
+ .ckf-check:where(button){cursor:pointer}
49
+ .ckf-check:where(button):hover{background:var(--ckf-soft)}
50
+ .ckf-tick{width:18px;height:18px;flex:none;margin-top:1px;border-radius:50%;border:1.5px solid var(--ckf-line);display:inline-flex;align-items:center;justify-content:center;color:var(--ckf-accent-ink);font-size:11px;font-weight:700}
51
+ .ckf-check[data-done] .ckf-tick{background:var(--ckf-accent);border-color:var(--ckf-accent)}
52
+ .ckf-check[data-done] b{color:var(--ckf-muted);text-decoration:line-through}
53
+ .ckf-check span{display:flex;flex-direction:column;gap:2px;min-width:0}
54
+ .ckf-bar{height:4px;border-radius:4px;background:var(--ckf-soft);overflow:hidden}
55
+ .ckf-bar i{display:block;height:100%;background:var(--ckf-accent)}
56
+ .ckf-banner{position:fixed;z-index:2147483001;left:50%;top:12px;transform:translateX(-50%);width:min(640px,calc(100vw - 24px));background:var(--ckf-bg);border-radius:12px;box-shadow:var(--ckf-shadow);padding:10px 10px 10px 16px;display:flex;align-items:center;gap:12px;animation:ckf-in .18s ease-out}
57
+ .ckf-banner>span{flex:1;min-width:0;display:flex;flex-direction:column}
58
+ .ckf-banner .ckf-btn{height:32px}
59
+ @keyframes ckf-fade{from{opacity:0}}
60
+ @keyframes ckf-in{from{opacity:0;transform:translateY(6px)}}
61
+ .ckf-banner{animation-name:ckf-fade}
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
+ @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};})();
@@ -0,0 +1 @@
1
+ (function(){'use strict';var g=e=>{let s=atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"=")),t=new Uint8Array(s.length);for(let r=0;r<s.length;r++)t[r]=s.charCodeAt(r);return t},P=(e,s)=>{if(!e)return false;let t=new Uint8Array(e);return t.length===s.length&&t.every((r,o)=>r===s[o])},a=()=>typeof window!="undefined"&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window,w=(e=true)=>{if(!a())return Promise.resolve("denied");if(Notification.permission!=="default"||!e)return Promise.resolve(Notification.permission);try{return Promise.resolve(Notification.requestPermission())}catch(s){return Promise.resolve("denied")}},m=async(e,s,t)=>{if(t!==false){let r=`${t}?key=${encodeURIComponent(s)}&host=${encodeURIComponent(e)}`;await navigator.serviceWorker.register(r);}return navigator.serviceWorker.ready},l=async(e,s={})=>{var o,u,c,d;if(!a())return {status:"unsupported",reason:"This browser has no web push."};if(!e.distinctId)return {status:"not-signed-in"};let t=s.ask!==false,r=await((o=e.permission)!=null?o:w(t));if(r==="denied")return {status:"denied"};if(r!=="granted")return {status:t?"denied":"not-asked"};try{let n=await fetch(`${e.host}/api/sdk/push?key=${encodeURIComponent(e.apiKey)}`),p=n.ok?(u=(await n.json()).web)==null?void 0:u.vapidKey:void 0;if(!p)return {status:"error",reason:`MRRocket answered ${n.status} for the push key.`};let h=g(p),b=await m(e.host,e.apiKey,(c=s.serviceWorker)!=null?c:"/mrrocket-sw.js"),i=await b.pushManager.getSubscription();i&&!P((d=i.options)==null?void 0:d.applicationServerKey,h)&&(await i.unsubscribe().catch(()=>!1),i=null),i!=null||(i=await b.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:h}));let f=await fetch(`${e.host}/api/sdk/push`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:e.apiKey,distinctId:e.distinctId,platform:"web",subscription:i.toJSON(),host:e.host})});return f.ok?{status:"subscribed"}:{status:"error",reason:`MRRocket answered ${f.status}.`}}catch(n){return {status:"error",reason:n instanceof Error?n.message:String(n)}}},y=async e=>{if(!a())return false;try{let s=await navigator.serviceWorker.getRegistration(),t=await(s==null?void 0:s.pushManager.getSubscription());return t?(await fetch(`${e.host}/api/sdk/push`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:e.apiKey,distinctId:e.distinctId,platform:"web",remove:!0,endpoint:t.endpoint})}).catch(()=>null),await t.unsubscribe()):!1}catch(s){return false}};window.__mrrocketPush={subscribeWebPush:l,unsubscribeWebPush:y};})();
@@ -0,0 +1,78 @@
1
+ (function(){'use strict';var St=Object.defineProperty;var vr=(e,t,r)=>t in e?St(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var Mr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ir=(e,t)=>{for(var r in t)St(e,r,{get:t[r],enumerable:true});};var ge=(e,t,r)=>vr(e,typeof t!="symbol"?t+"":t,r);var br={};Ir(br,{record:()=>Ie});function ht(e){if(ke[e])return ke[e];let t=globalThis[e],r=t.prototype,n=e in Nt?Nt[e]:void 0,s=!!(n&&n.every(c=>{var i,p;return !!((p=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&p.toString().includes("[native code]"))})),o=e in Lt?Lt[e]:void 0,a=!!(o&&o.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!Lr())return ke[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let p=i[e].prototype;if(!p)return c.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),jt[e]=()=>c.remove()):c.remove(),ke[e]=p}catch(c){return r}}function J(e,t,r){var n,s;let o=(n=Je[e])==null?void 0:n[r];if(o)return o.call(t);let a=ht(e),c=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return c?((Je[e]||(Je[e]={}))[r]=c,c.call(t)):t[r]}function Vt(e,t,r){let n=`${e}.${String(r)}`;if(Qe[n])return Qe[n].bind(t);let o=ht(e)[r];return typeof o!="function"?t[r]:(Qe[n]=o,o.bind(t))}function _r(e){return J("Node",e,"ownerDocument")}function Dr(e){return J("Node",e,"childNodes")}function Ar(e){return J("Node",e,"parentNode")}function Fr(e){return J("Node",e,"parentElement")}function Pr(e){return J("Node",e,"textContent")}function Ur(e){return J("Node",e,"firstChild")}function Wr(e){return J("Node",e,"lastChild")}function Br(e){return J("Node",e,"nextSibling")}function Hr(e){return J("Node",e,"previousSibling")}function $r(e,t){return Vt("Node",e,"contains")(t)}function zr(e){return Vt("Node",e,"getRootNode")()}function jr(e){return !e||!("host"in e)?null:J("ShadowRoot",e,"host")}function Vr(e){return e.styleSheets}function Gr(e){return !e||!("shadowRoot"in e)?null:J("Element",e,"shadowRoot")}function qr(e,t){return J("Element",e,"querySelector")(t)}function Kr(e,t){return J("Element",e,"querySelectorAll")(t)}function Gt(){var e;return [ht("MutationObserver").constructor,(e=jt.MutationObserver)!=null?e:(()=>{})]}function ae(e,t,r){try{if(!(t in e))return ()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n;}}catch(n){return ()=>{}}}function qt(e){return e.nodeType===e.ELEMENT_NODE}function be(e){let t=e&&"host"in e&&"mode"in e&&S.host(e)||null;return !!(t&&"shadowRoot"in t&&S.shadowRoot(t)===e)}function Se(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Yr(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function tt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>Kt(s,r)).join("");return Xr(n)}catch(t){return null}}function Kt(e,t){if(Qr(e)){let r;try{r=tt(e.styleSheet)||Yr(e);}catch(n){r=e.cssText;}return e.styleSheet.href?Pe(r,e.styleSheet.href):r}else {let r=e.cssText;return Zr(e)&&e.selectorText.includes(":")&&(r=Jr(r)),t?Pe(r,t):r}}function Jr(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Qr(e){return "styleSheet"in e}function Zr(e){return "selectorText"in e}function en(){return new De}function Ae({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"",c=n&&ne(n);return (t[r.toLowerCase()]||c&&t[c])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function ne(e){return e.toLowerCase()}function tn(e){let t=e.getContext("2d");if(!t)return true;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let o=t.getImageData,a=_t in o?o[_t]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return false}return true}function Fe(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ne(t):null}function Xt(e,t){var o;let r;try{r=new URL(e,t!=null?t:window.location.href);}catch(a){return null}let n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return (o=s==null?void 0:s[1])!=null?o:null}function rn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}function Pe(e,t){return (e||"").replace(nn,(r,n,s,o,a,c)=>{let i=s||a||c,p=n||o||"";if(!i)return r;if(sn.test(i)||on.test(i))return `url(${p}${i}${p})`;if(an.test(i))return `url(${p}${i}${p})`;if(i[0]==="/")return `url(${p}${rn(t)+i}${p})`;let u=i.split("#")[0],d=i.substring(u.length),h=t.split("#")[0].split("/"),f=u.split("/");h.pop();for(let m of f)m!=="."&&(m===".."?h.pop():h.push(m));return `url(${p}${h.join("/")}${d}${p})`})}function Oe(e,t=false){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function ln(e,t,r=false){let n=Array.from(t.childNodes),s=[],o=0;if(n.length>1&&e&&typeof e=="string"){let a=Oe(e,r),c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let p=Oe(n[i].textContent,r),u=100,d=3;for(;d<p.length&&(p[d].match(/[a-zA-Z0-9]/)||p.indexOf(p.substring(0,d),1)!==-1);d++);for(;d<p.length;d++){let h=p.substring(0,d),f=a.split(h),m=-1;if(f.length===2)m=f[0].length;else if(f.length>2&&f[0]===""&&n[i-1].textContent!=="")m=a.indexOf(h,1);else if(f.length===1){if(h=h.substring(0,h.length-1),f=a.split(h),f.length<=1)return s.push(e),s;d=u+1;}else d===p.length-1&&(m=a.indexOf(h));if(f.length>=2&&d>u){let l=n[i-1].textContent;if(l&&typeof l=="string"){let b=Oe(l).length;m=a.indexOf(h,b);}m===-1&&(m=f[0].length);}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;let b=Oe(e.substring(0,l),r);if(b.length===m){s.push(e.substring(0,l)),e=e.substring(l),a=a.substring(m);break}else b.length<m?l+=Math.max(1,Math.floor((m-b.length)/c)):l-=Math.max(1,Math.floor((b.length-m)*c));}break}}}}return s.push(e),s}function cn(e,t){return ln(e,t).join("/* rr_split */")}function Yt(){return un++}function pn(e){if(e instanceof HTMLFormElement)return "form";let t=ne(e.tagName);return dn.test(t)?"div":t}function mn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a,c=o.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let s=[];for(;n(fn),!(r>=t.length);){let o=n(hn);if(o.slice(-1)===",")o=pe(e,o.substring(0,o.length-1)),s.push(o);else {let a="";o=pe(e,o);let c=false;for(;;){let i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(c)i===")"&&(c=false);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(c=true);a+=i,r+=1;}}}return s.join(", ")}function pe(e,t){return !t||t.trim()===""?t:ft(e,t)}function gn(e){return !!(e.tagName==="svg"||e.ownerSVGElement)}function ft(e,t){let r=At.get(e);if(r||(r=e.createElement("a"),At.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Jt(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?pe(e,n):r==="srcset"?mn(e,n):r==="style"?Pe(n,ft(e)):t==="object"&&r==="data"?pe(e,n):n)}function Qt(e,t,r){return ["video","audio"].includes(e)&&ne(t)==="autoplay"}function yn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return !0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return !0}if(r)return e.matches(r)}catch(n){}return false}function We(e,t,r){if(!e)return false;if(e.nodeType!==e.ELEMENT_NODE)return r?We(S.parentNode(e),t,r):false;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return true}return r?We(S.parentNode(e),t,r):false}function Zt(e,t,r,n){let s;if(qt(e)){if(s=e,!S.childNodes(s).length)return false}else {if(S.parentElement(e)===null)return false;s=S.parentElement(e);}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return !0}else if(s.classList.contains(t))return !0}else if(We(s,t,n))return !0;if(r){if(n){if(s.closest(r))return !0}else if(s.matches(r))return !0}}catch(o){}return false}function bn(e,t,r){let n=e.contentWindow;if(!n)return;let s=false,o;try{o=n.document.readyState;}catch(c){return}if(o!=="complete"){let c=setTimeout(()=>{s||(t(),s=true);},r);e.addEventListener("load",()=>{clearTimeout(c),s=true,t();});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t);}function Sn(e,t,r){let n=false,s;try{s=e.sheet;}catch(a){return}if(s)return;let o=setTimeout(()=>{n||(t(),n=true);},r);e.addEventListener("load",()=>{clearTimeout(o),n=true,t();});}function wn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:p,maskInputFn:u,dataURLOptions:d={},inlineImages:h,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l=false,cssCaptured:b=false}=t,v=Cn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:B.Document,childNodes:[],compatMode:e.compatMode}:{type:B.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return {type:B.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return Mn(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:c,maskInputOptions:i,maskInputFn:u,dataURLOptions:d,inlineImages:h,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l,rootId:v});case e.TEXT_NODE:return vn(e,{doc:r,needsMask:a,maskTextFn:p,rootId:v,cssCaptured:b});case e.CDATA_SECTION_NODE:return {type:B.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return {type:B.Comment,textContent:S.textContent(e)||"",rootId:v};default:return false}}function Cn(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function vn(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=S.parentNode(e),c=a&&a.tagName,i="",p=c==="STYLE"?true:void 0,u=c==="SCRIPT"?true:void 0;return u?i="SCRIPT_PLACEHOLDER":o||(i=S.textContent(e),p&&i&&(i=Pe(i,ft(t.doc)))),!p&&!u&&i&&r&&(i=n?n(i,S.parentElement(e)):i.replace(/[\S]/g,"*")),{type:B.Text,textContent:i||"",rootId:s}}function Mn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:p,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:h=false,rootId:f}=t,m=yn(e,n,s),l=pn(e),b={},v=e.attributes.length;for(let g=0;g<v;g++){let I=e.attributes[g];Qt(l,I.name,I.value)||(b[I.name]=Jt(r,l,ne(I.name),I.value));}if(l==="link"&&o){let g=Array.from(r.styleSheets).find(L=>L.href===e.href),I=null;g&&(I=tt(g)),I&&(delete b.rel,delete b.href,b._cssText=I);}if(l==="style"&&e.sheet){let g=tt(e.sheet);g&&(e.childNodes.length>1&&(g=cn(g,e)),b._cssText=g);}if(["input","textarea","select"].includes(l)){let g=e.value,I=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&g?b.value=Ae({element:e,type:Fe(e),tagName:l,value:g,maskInputOptions:a,maskInputFn:c}):I&&(b.checked=I);}if(l==="option"&&(e.selected&&!a.select?b.selected=true:delete b.selected),l==="dialog"&&e.open&&(b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&u){if(e.__context==="2d")tn(e)||(b.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let g=e.toDataURL(i.type,i.quality),I=r.createElement("canvas");I.width=e.width,I.height=e.height;let L=I.toDataURL(i.type,i.quality);g!==L&&(b.rr_dataURL=g);}}if(l==="img"&&p){ce||(ce=r.createElement("canvas"),Dt=ce.getContext("2d"));let g=e,I=g.currentSrc||g.getAttribute("src")||"<unknown-src>",L=g.crossOrigin,D=()=>{g.removeEventListener("load",D);try{ce.width=g.naturalWidth,ce.height=g.naturalHeight,Dt.drawImage(g,0,0),b.rr_dataURL=ce.toDataURL(i.type,i.quality);}catch(H){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?D():g.addEventListener("load",D);return}else console.warn(`Cannot inline img src=${I}! Error: ${H}`);}g.crossOrigin==="anonymous"&&(L?b.crossOrigin=L:g.removeAttribute("crossorigin"));};g.complete&&g.naturalWidth!==0?D():g.addEventListener("load",D);}if(["audio","video"].includes(l)){let g=b;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume;}if(h||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),m){let{width:g,height:I}=e.getBoundingClientRect();b={class:b.class,rr_width:`${g}px`,rr_height:`${I}px`};}l==="iframe"&&!d(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src);let w;try{customElements.get(l)&&(w=!0);}catch(g){}return {type:B.Element,tagName:l,attributes:b,childNodes:[],isSVG:gn(e)||void 0,needBlock:m,rootId:f,isCustom:w}}function _(e){return e==null?"":e.toLowerCase()}function er(e){return e===true||e==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function In(e,t){if(t.comment&&e.type===B.Comment)return true;if(e.type===B.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Xt(e.attributes.href)==="js"))return true;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(_(e.attributes.name).match(/^msapplication-tile(image|color)$/)||_(e.attributes.name)==="application-name"||_(e.attributes.rel)==="icon"||_(e.attributes.rel)==="apple-touch-icon"||_(e.attributes.rel)==="shortcut icon")))return true;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&_(e.attributes.name).match(/^description|keywords$/))return true;if(t.headMetaSocial&&(_(e.attributes.property).match(/^(og|twitter|fb):/)||_(e.attributes.name).match(/^(og|twitter):/)||_(e.attributes.name)==="pinterest"))return true;if(t.headMetaRobots&&(_(e.attributes.name)==="robots"||_(e.attributes.name)==="googlebot"||_(e.attributes.name)==="bingbot"))return true;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return true;if(t.headMetaAuthorship&&(_(e.attributes.name)==="author"||_(e.attributes.name)==="generator"||_(e.attributes.name)==="framework"||_(e.attributes.name)==="publisher"||_(e.attributes.name)==="progid"||_(e.attributes.property).match(/^article:/)||_(e.attributes.property).match(/^product:/)))return true;if(t.headMetaVerification&&(_(e.attributes.name)==="google-site-verification"||_(e.attributes.name)==="yandex-verification"||_(e.attributes.name)==="csrf-token"||_(e.attributes.name)==="p:domain_verify"||_(e.attributes.name)==="verify-v1"||_(e.attributes.name)==="verification"||_(e.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function he(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:i=false,inlineStylesheet:p=true,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:m={},inlineImages:l=false,recordCanvas:b=false,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:L=5e3,keepIframeSrcFn:D=()=>false,newlyAddedElement:H=false,cssCaptured:X=false}=t,{needsMask:$}=t,{preserveWhiteSpace:q=true}=t;$||($=Zt(e,a,c,$===void 0));let z=wn(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:$,inlineStylesheet:p,maskInputOptions:u,maskTextFn:d,maskInputFn:h,dataURLOptions:m,inlineImages:l,recordCanvas:b,keepIframeSrcFn:D,newlyAddedElement:H,cssCaptured:X});if(!z)return console.warn(e,"not serialized"),null;let j;n.hasNode(e)?j=n.getId(e):In(z,f)||!q&&z.type===B.Text&&!z.textContent.replace(/^\s+|\s+$/gm,"").length?j=Ue:j=Yt();let E=Object.assign(z,{id:j});if(n.add(e,E),j===Ue)return null;v&&v(e);let te=!i;if(E.type===B.Element){te=te&&!E.needBlock,delete E.needBlock;let C=S.shadowRoot(e);C&&Se(C)&&(E.isShadowHost=true);}if((E.type===B.Document||E.type===B.Element)&&te){f.headWhitespace&&E.type===B.Element&&E.tagName==="head"&&(q=false);let C={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:p,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:q,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:D,cssCaptured:false};if(!(E.type===B.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===B.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(C.cssCaptured=true);for(let A of Array.from(S.childNodes(e))){let F=he(A,C);F&&E.childNodes.push(F);}}let O=null;if(qt(e)&&(O=S.shadowRoot(e)))for(let A of Array.from(S.childNodes(O))){let F=he(A,C);F&&(Se(O)&&(F.isShadow=true),E.childNodes.push(F));}}let M=S.parentNode(e);return M&&be(M)&&Se(M)&&(E.isShadow=true),E.type===B.Element&&E.tagName==="iframe"&&bn(e,()=>{let C=e.contentDocument;if(C&&w){let O=he(C,{doc:C,mirror:n,blockClass:s,blockSelector:o,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:false,inlineStylesheet:p,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:q,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:D});O&&w(e,O);}},g),E.type===B.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&Xt(E.attributes.href)==="css")&&Sn(e,()=>{if(I){let C=he(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:false,inlineStylesheet:p,maskInputOptions:u,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:q,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:D});C&&I(e,C);}},L),E}function Rn(e,t){let{mirror:r=new De,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=true,inlineImages:i=false,recordCanvas:p=false,maskAllInputs:u=false,maskTextFn:d,maskInputFn:h,slimDOM:f=false,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:I,keepIframeSrcFn:L=()=>false}=t,D=u===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u===false?{password:true}:u,H=er(f);return he(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:false,inlineStylesheet:c,maskInputOptions:D,maskTextFn:d,maskInputFn:h,slimDOMOptions:H,dataURLOptions:m,inlineImages:i,recordCanvas:p,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:I,keepIframeSrcFn:L,newlyAddedElement:false})}function V(e,t,r=document){let n={capture:true,passive:true};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function ve(e,t,r={}){let n=null,s=0;return function(...o){let a=Date.now();!s&&r.leading===false&&(s=a);let c=t-(a-s),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==false&&(n=setTimeout(()=>{s=r.leading===false?0:Date.now(),n=null,e.apply(i,o);},c));}}function ze(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a);},0),o&&o.set&&o.set.call(this,a);}}),()=>ze(e,t,o||{},true)}function tr(e){var t,r,n,s;let o=e.document;return {left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((t=S.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o==null?void 0:o.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((n=S.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o==null?void 0:o.body)==null?void 0:s.scrollTop)||0}}function rr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function nr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function sr(e){return e?e.nodeType===e.ELEMENT_NODE?e:S.parentElement(e):null}function G(e,t,r,n){if(!e)return false;let s=sr(e);if(!s)return false;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return !0}else if(We(s,t,n))return !0}catch(o){}return !!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function En(e,t){return t.getId(e)!==-1}function Ze(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?true:t.getId(e)===Ue}function or(e,t){if(be(e))return false;let r=t.getId(e);if(!t.has(r))return true;let n=S.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?false:n?or(n,t):true}function nt(e){return !!e.changedTouches}function xn(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach);}function ir(e,t){return !!(e.nodeName==="IFRAME"&&t.getMeta(e))}function ar(e,t){return !!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function st(e){return e?e instanceof rt&&"shadowRoot"in e?!!e.shadowRoot:!!S.shadowRoot(e):false}function lr(e){var t;let r=null;return "getRootNode"in e&&((t=S.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&S.host(S.getRootNode(e))&&(r=S.host(S.getRootNode(e))),r}function kn(e){let t=e,r;for(;r=lr(t);)t=r;return t}function On(e){let t=S.ownerDocument(e);if(!t)return false;let r=kn(e);return S.contains(t,r)}function cr(e){let t=S.ownerDocument(e);return t?S.contains(t,e)||On(e):false}function at(e,t){e.delete(t),S.childNodes(t).forEach(r=>at(e,r));}function Tn(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),S.childNodes(n).forEach(s=>r.push(s)));}}function Ut(e,t){return e.size===0?false:ur(e,t)}function ur(e,t){if(e.has(t))return true;let r=S.parentNode(t);return r?ur(e,r):false}function Nn(e){we=e;}function Ln(){we=void 0;}function Me(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function dr(e,t){let r=new it;ie.push(r),r.init(e);let[n,s]=Gt(),o=new n(x(r.processMutations.bind(r)));return o.observe(t,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),[o,s]}function _n({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===false)return ()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=ve(x(d=>{let h=Date.now()-c;e(a.map(f=>(f.timeOffset-=h,f)),d),a=[],c=null;}),o),p=x(ve(x(d=>{let h=Me(d),{clientX:f,clientY:m}=nt(d)?d.changedTouches[0]:d;c||(c=Ce()),a.push({x:f,y:m,id:n.getId(h),timeOffset:Ce()-c}),i(typeof DragEvent!="undefined"&&d instanceof DragEvent?R.Drag:d instanceof MouseEvent?R.MouseMove:R.TouchMove);}),s,{trailing:!1})),u=[V("mousemove",p,r),V("touchmove",p,r),V("drag",p,r)];return x(()=>{u.forEach(d=>d());})}function Dn({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(o.mouseInteraction===false)return ()=>{};let a=o.mouseInteraction===true||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],i=null,p=u=>d=>{let h=Me(d);if(G(h,n,s,true))return;let f=null,m=u;if("pointerType"in d){switch(d.pointerType){case "mouse":f=ee.Mouse;break;case "touch":f=ee.Touch;break;case "pen":f=ee.Pen;break}f===ee.Touch?K[u]===K.MouseDown?m="TouchStart":K[u]===K.MouseUp&&(m="TouchEnd"):ee.Pen;}else nt(d)&&(f=ee.Touch);f!==null?(i=f,(m.startsWith("Touch")&&f===ee.Touch||m.startsWith("Mouse")&&f===ee.Mouse)&&(f=null)):K[u]===K.Click&&(f=i,i=null);let l=nt(d)?d.changedTouches[0]:d;if(!l)return;let b=r.getId(h),{clientX:v,clientY:w}=l;x(e)({type:K[m],id:b,x:v,y:w,...f!==null&&{pointerType:f}});};return Object.keys(K).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==false).forEach(u=>{let d=ne(u),h=p(u);if(window.PointerEvent)switch(K[u]){case K.MouseDown:case K.MouseUp:d=d.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}c.push(V(d,h,t));}),x(()=>{c.forEach(u=>u());})}function pr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){let a=x(ve(x(c=>{let i=Me(c);if(!i||G(i,n,s,!0))return;let p=r.getId(i);if(i===t&&t.defaultView){let u=tr(t.defaultView);e({id:p,x:u.left,y:u.top});}else e({id:p,x:i.scrollLeft,y:i.scrollTop});}),o.scroll||100));return V("scroll",a,t)}function An({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=x(ve(x(()=>{let o=rr(),a=nr();(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a);}),200));return V("resize",s,t)}function Pn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:p,userTriggeredOnInput:u}){function d(w){let g=Me(w),I=w.isTrusted,L=g&&g.tagName;if(g&&L==="OPTION"&&(g=S.parentElement(g)),!g||!L||Fn.indexOf(L)<0||G(g,n,s,true)||g.classList.contains(o)||a&&g.matches(a))return;let D=g.value,H=false,X=Fe(g)||"";X==="radio"||X==="checkbox"?H=g.checked:(c[L.toLowerCase()]||c[X])&&(D=Ae({element:g,maskInputOptions:c,tagName:L,type:X,value:D,maskInputFn:i})),h(g,u?{text:D,isChecked:H,userTriggered:I}:{text:D,isChecked:H});let $=g.name;X==="radio"&&$&&H&&t.querySelectorAll(`input[type="radio"][name="${$}"]`).forEach(q=>{if(q!==g){let z=q.value;h(q,u?{text:z,isChecked:!H,userTriggered:false}:{text:z,isChecked:!H});}});}function h(w,g){let I=Wt.get(w);if(!I||I.text!==g.text||I.isChecked!==g.isChecked){Wt.set(w,g);let L=r.getId(w);x(e)({...g,id:L});}}let m=(p.input==="last"?["change"]:["input","change"]).map(w=>V(w,x(d),t)),l=t.defaultView;if(!l)return ()=>{m.forEach(w=>w());};let b=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),v=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&m.push(...v.map(w=>ze(w[0],w[1],{set(){x(d)({target:this,isTrusted:false});}},false,l))),x(()=>{m.forEach(w=>w());})}function Be(e){let t=[];function r(n,s){if(Te("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Te("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Te("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Te("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(a),r(n.parentRule,s)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(a);}return s}return r(e,t)}function re(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function Un({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return ()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:x((u,d,h)=>{let[f,m]=h,{id:l,styleId:b}=re(d,t,r.styleMirror);return (l&&l!==-1||b&&b!==-1)&&e({id:l,styleId:b,adds:[{rule:f,index:m}]}),u.apply(d,h)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,h=this.cssRules.length){let f=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[f,h])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:x((u,d,h)=>{let[f]=h,{id:m,styleId:l}=re(d,t,r.styleMirror);return (m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:f}]}),u.apply(d,h)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:x((u,d,h)=>{let[f]=h,{id:m,styleId:l}=re(d,t,r.styleMirror);return (m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:f}),u.apply(d,h)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:x((u,d,h)=>{let[f]=h,{id:m,styleId:l}=re(d,t,r.styleMirror);return (m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:f}),u.apply(d,h)})}));let i={};Ne("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(Ne("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),Ne("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),Ne("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let p={};return Object.entries(i).forEach(([u,d])=>{p[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(p[u].insertRule,{apply:x((h,f,m)=>{let[l,b]=m,{id:v,styleId:w}=re(f.parentStyleSheet,t,r.styleMirror);return (v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,adds:[{rule:l,index:[...Be(f),b||0]}]}),h.apply(f,m)})}),d.prototype.deleteRule=new Proxy(p[u].deleteRule,{apply:x((h,f,m)=>{let[l]=m,{id:b,styleId:v}=re(f.parentStyleSheet,t,r.styleMirror);return (b&&b!==-1||v&&v!==-1)&&e({id:b,styleId:v,removes:[{index:[...Be(f),l]}]}),h.apply(f,m)})});}),x(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([u,d])=>{d.prototype.insertRule=p[u].insertRule,d.prototype.deleteRule=p[u].deleteRule;});})}function hr({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(S.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=c!=null&&c.prototype?Object.getOwnPropertyDescriptor(c==null?void 0:c.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var p;return (p=i.get)==null?void 0:p.call(this)},set(p){var u;let d=(u=i.set)==null?void 0:u.call(this,p);if(a!==null&&a!==-1)try{t.adoptStyleSheets(p,a);}catch(h){}return d}}),x(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set});}))}function Wn({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:x((c,i,p)=>{var u;let[d,h,f]=p;if(r.has(d))return o.apply(i,[d,h,f]);let{id:m,styleId:l}=re((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return (m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:d,value:h,priority:f},index:Be(i.parentRule)}),c.apply(i,p)})});let a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:x((c,i,p)=>{var u;let[d]=p;if(r.has(d))return a.apply(i,[d]);let{id:h,styleId:f}=re((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return (h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,remove:{property:d},index:Be(i.parentRule)}),c.apply(i,p)})}),x(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a;})}function Bn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){let a=x(i=>ve(x(p=>{let u=Me(p);if(!u||G(u,t,r,!0))return;let{currentTime:d,volume:h,muted:f,playbackRate:m,loop:l}=u;e({type:i,id:n.getId(u),currentTime:d,volume:h,muted:f,playbackRate:m,loop:l});}),s.media||500)),c=[V("play",a(ue.Play),o),V("pause",a(ue.Pause),o),V("seeked",a(ue.Seeked),o),V("volumechange",a(ue.VolumeChange),o),V("ratechange",a(ue.RateChange),o)];return x(()=>{c.forEach(i=>i());})}function Hn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return ()=>{};let n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,p,u){let d=new o(i,p,u);return s.set(d,{family:i,buffer:typeof p!="string",descriptors:u,fontSource:typeof p=="string"?p:JSON.stringify(Array.from(new Uint8Array(p)))}),d};let a=ae(t.fonts,"add",function(c){return function(i){return setTimeout(x(()=>{let p=s.get(i);p&&(e(p),s.delete(i));}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=o;}),n.push(a),x(()=>{n.forEach(c=>c());})}function $n(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e,a=true,c=x(()=>{let i=t.getSelection();if(!i||a&&(i!=null&&i.isCollapsed))return;a=i.isCollapsed||false;let p=[],u=i.rangeCount||0;for(let d=0;d<u;d++){let h=i.getRangeAt(d),{startContainer:f,startOffset:m,endContainer:l,endOffset:b}=h;G(f,n,s,!0)||G(l,n,s,!0)||p.push({start:r.getId(f),startOffset:m,end:r.getId(l),endOffset:b});}o({ranges:p});});return c(),V("selectionchange",c)}function zn({doc:e,customElementCb:t}){let r=e.defaultView;return !r||!r.customElements?()=>{}:ae(r.customElements,"define",function(s){return function(o,a,c){try{t({define:{name:o}});}catch(i){console.warn(`Custom element callback failed for ${o}`);}return s.apply(this,[o,a,c])}})}function jn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:p,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:f,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l);},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l);},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l);},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),o(...l);},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l);},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l);},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l);},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),p(...l);},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),u(...l);},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),d(...l);},e.fontCb=(...l)=>{t.font&&t.font(...l),h(...l);},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),f(...l);},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l);};}function Vn(e,t={}){let r=e.doc.defaultView;if(!r)return ()=>{};jn(e,t);let n,s=()=>{};e.recordDOM&&([n,s]=dr(e,e.doc));let o=_n(e),a=Dn(e),c=pr(e),i=An(e,{win:r}),p=Pn(e),u=Bn(e),d=()=>{},h=()=>{},f=()=>{},m=()=>{};e.recordDOM&&(d=Un(e,{win:r}),h=hr(e,e.doc),f=Wn(e,{win:r}),e.collectFonts&&(m=Hn(e)));let l=$n(e),b=zn(e),v=[];for(let w of e.plugins)v.push(w.observer(w.callback,r,w.options));return x(()=>{ie.forEach(w=>w.reset()),n==null||n.disconnect(),s(),o(),a(),c(),i(),p(),u(),d(),h(),f(),m(),l(),b(),v.forEach(w=>w());})}function Te(e){return typeof window[e]!="undefined"}function Ne(e){return !!(typeof window[e]!="undefined"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function Kn(e,t){let r=Bt.get(e);return r||(r=new Map,Bt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function Le(e,t,r){if(e instanceof Array)return e.map(n=>Le(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return {rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=qn(e);return {rr_type:n,base64:s}}else {if(e instanceof DataView)return {rr_type:e.constructor.name,args:[Le(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return {rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return {rr_type:n,src:s}}else {if(e instanceof ImageData)return {rr_type:e.constructor.name,args:[Le(e.data,t,r),e.width,e.height]};if(gr(e,t)||typeof e=="object"){let n=e.constructor.name,s=fr(e,t,r);return {rr_type:n,index:s}}}}return e}function Xn(e,t,r,n){let s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=ae(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...p){return G(this.canvas,r,n,!0)||setTimeout(()=>{let u=mr(p,t,this);e(this.canvas,{type:me["2D"],property:a,args:u});},0),i.apply(this,p)}});s.push(c);}catch(c){let i=ze(t.CanvasRenderingContext2D.prototype,a,{set(p){e(this.canvas,{type:me["2D"],property:a,args:[p],setter:true});}});s.push(i);}return ()=>{s.forEach(a=>a());}}function Yn(e){return e==="experimental-webgl"?"webgl":e}function Ht(e,t,r,n){let s=[];try{let o=ae(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!G(this,t,r,!0)){let p=Yn(c);if("__context"in this||(this.__context=p),n&&["webgl","webgl2"].includes(p))if(i[0]&&typeof i[0]=="object"){let u=i[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0);}else i.splice(0,1,{preserveDrawingBuffer:!0});}return a.apply(this,[c,...i])}});s.push(o);}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{s.forEach(o=>o());}}function $t(e,t,r,n,s,o){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let p=ae(e,i,function(u){return function(...d){let h=u.apply(this,d);if(fr(h,o,this),"tagName"in this.canvas&&!G(this.canvas,n,s,!0)){let f=mr(d,o,this),m={type:t,property:i,args:f};r(this.canvas,m);}return h}});a.push(p);}catch(p){let u=ze(e,i,{set(d){r(this.canvas,{type:t,property:i,args:[d],setter:true});}});a.push(u);}return a}function Jn(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext!="undefined"&&s.push(...$t(t.WebGLRenderingContext.prototype,me.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext!="undefined"&&s.push(...$t(t.WebGL2RenderingContext.prototype,me.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o());}}function Qn(e){let t;try{if(t=zt&&(self.URL||self.webkitURL).createObjectURL(zt),!t)throw "";let r=new Worker(t,{name:e==null?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t);}),r}catch(r){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(yr),{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t);}}function Ie(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:p=null,inlineStylesheet:u=true,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:f,maskInputFn:m,maskTextFn:l,hooks:b,packFn:v,sampling:w={},dataURLOptions:g={},mousemoveWait:I,recordDOM:L=true,recordCanvas:D=false,recordCrossOriginIframes:H=false,recordAfter:X=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:$=false,collectFonts:q=false,inlineImages:z=false,plugins:j,keepIframeSrcFn:E=()=>false,ignoreCSSAttributes:te=new Set([]),errorHandler:M}=e;Nn(M);let C=H?window.parent===window:true,O=false;if(!C)try{window.parent.document&&(O=!1);}catch(T){O=true;}if(C&&!t)throw new Error("emit function is required");if(!C&&!O)return ()=>{};I!==void 0&&w.mousemove===void 0&&(w.mousemove=I),Z.reset();let A=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:h!==void 0?h:{password:true},F=er(f);xn();let le,Ve=0,gt=T=>{for(let Q of j||[])Q.eventProcessor&&(T=Q.eventProcessor(T));return v&&!O&&(T=v(T)),T};W=(T,Q)=>{var P;let U=T;if(U.timestamp=Ce(),(P=ie[0])!=null&&P.isFrozen()&&U.type!==k.FullSnapshot&&!(U.type===k.IncrementalSnapshot&&U.data.source===R.Mutation)&&ie.forEach(Y=>Y.unfreeze()),C)t==null||t(gt(U),Q);else if(O){let Y={type:"rrweb",event:gt(U),origin:window.location.origin,isCheckout:Q};window.parent.postMessage(Y,"*");}if(U.type===k.FullSnapshot)le=U,Ve=0;else if(U.type===k.IncrementalSnapshot){if(U.data.source===R.Mutation&&U.data.isAttachIframe)return;Ve++;let Y=n&&Ve>=n,N=r&&U.timestamp-le.timestamp>r;(Y||N)&&_e(true);}};let Re=T=>{W({type:k.IncrementalSnapshot,data:{source:R.Mutation,...T}});},yt=T=>W({type:k.IncrementalSnapshot,data:{source:R.Scroll,...T}}),bt=T=>W({type:k.IncrementalSnapshot,data:{source:R.CanvasMutation,...T}}),Cr=T=>W({type:k.IncrementalSnapshot,data:{source:R.AdoptedStyleSheet,...T}}),se=new dt({mutationCb:Re,adoptedStyleSheetCb:Cr}),oe=new lt({mirror:Z,mutationCb:Re,stylesheetManager:se,recordCrossOriginIframes:H,wrappedEmit:W});for(let T of j||[])T.getMirror&&T.getMirror({nodeMirror:Z,crossOriginIframeMirror:oe.crossOriginIframeMirror,crossOriginIframeStyleMirror:oe.crossOriginIframeStyleMirror});let Ge=new pt;et=new ut({recordCanvas:D,mutationCb:bt,win:window,blockClass:s,blockSelector:o,mirror:Z,sampling:w.canvas,dataURLOptions:g});let Ee=new ct({mutationCb:Re,scrollCb:yt,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:p,inlineStylesheet:u,maskInputOptions:A,dataURLOptions:g,maskTextFn:l,maskInputFn:m,recordCanvas:D,inlineImages:z,sampling:w,slimDOMOptions:F,iframeManager:oe,stylesheetManager:se,canvasManager:et,keepIframeSrcFn:E,processedNodeManager:Ge},mirror:Z});_e=(T=false)=>{if(!L)return;W({type:k.Meta,data:{href:window.location.href,width:nr(),height:rr()}},T),se.reset(),Ee.init(),ie.forEach(P=>P.lock());let Q=Rn(document,{mirror:Z,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:p,inlineStylesheet:u,maskAllInputs:A,maskTextFn:l,maskInputFn:m,slimDOM:F,dataURLOptions:g,recordCanvas:D,inlineImages:z,onSerialize:P=>{ir(P,Z)&&oe.addIframe(P),ar(P,Z)&&se.trackLinkElement(P),st(P)&&Ee.addShadowRoot(S.shadowRoot(P),document);},onIframeLoad:(P,U)=>{oe.attachIframe(P,U),Ee.observeAttachShadow(P);},onStylesheetLoad:(P,U)=>{se.attachLinkElement(P,U);},keepIframeSrcFn:E});if(!Q)return console.warn("Failed to snapshot the document");W({type:k.FullSnapshot,data:{node:Q,initialOffset:tr(window)}},T),ie.forEach(P=>P.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&se.adoptStyleSheets(document.adoptedStyleSheets,Z.getId(document));};try{let T=[],Q=U=>{var Y;return x(Vn)({mutationCb:Re,mousemoveCb:(N,qe)=>W({type:k.IncrementalSnapshot,data:{source:qe,positions:N}}),mouseInteractionCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.MouseInteraction,...N}}),scrollCb:yt,viewportResizeCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.ViewportResize,...N}}),inputCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.Input,...N}}),mediaInteractionCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.MediaInteraction,...N}}),styleSheetRuleCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.StyleSheetRule,...N}}),styleDeclarationCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.StyleDeclaration,...N}}),canvasMutationCb:bt,fontCb:N=>W({type:k.IncrementalSnapshot,data:{source:R.Font,...N}}),selectionCb:N=>{W({type:k.IncrementalSnapshot,data:{source:R.Selection,...N}});},customElementCb:N=>{W({type:k.IncrementalSnapshot,data:{source:R.CustomElement,...N}});},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:p,maskInputOptions:A,inlineStylesheet:u,sampling:w,recordDOM:L,recordCanvas:D,inlineImages:z,userTriggeredOnInput:$,collectFonts:q,doc:U,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:E,blockSelector:o,slimDOMOptions:F,dataURLOptions:g,mirror:Z,iframeManager:oe,stylesheetManager:se,shadowDomManager:Ee,processedNodeManager:Ge,canvasManager:et,ignoreCSSAttributes:te,plugins:((Y=j==null?void 0:j.filter(N=>N.observer))==null?void 0:Y.map(N=>({observer:N.observer,options:N.options,callback:qe=>W({type:k.Plugin,data:{plugin:N.name,payload:qe}})})))||[]},b)};oe.addLoadListener(U=>{try{T.push(Q(U.contentDocument));}catch(Y){console.warn(Y);}});let P=()=>{_e(),T.push(Q(document)),$e=!0;};return ["interactive","complete"].includes(document.readyState)?P():(T.push(V("DOMContentLoaded",()=>{W({type:k.DomContentLoaded,data:{}}),X==="DOMContentLoaded"&&P();})),T.push(V("load",()=>{W({type:k.Load,data:{}}),X==="load"&&P();},window))),()=>{T.forEach(U=>{try{U();}catch(Y){String(Y).toLowerCase().includes("cross-origin")||console.warn(Y);}}),Ge.destroy(),$e=!1,Ln();}}catch(T){console.warn(T);}}var Tr,Nr,y,Tt,k,R,K,ee,me,ue,B,Nt,Lt,ke,jt,Lr,Je,Qe,Ce,S,De,_t,nn,sn,on,an,un,dn,Ue,ce,Dt,hn,fn,At,rt,de,Ft,ot,Pt,it,we,x,ie,Fn,Wt,He,lt,ct,fe,Gn,ye,qn,Bt,fr,mr,gr,yr,zt,ut,dt,pt,W,_e,et,$e,Z,Sr=Mr(()=>{Tr=Object.defineProperty,Nr=(e,t,r)=>t in e?Tr(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,y=(e,t,r)=>Nr(e,typeof t!="symbol"?t+"":t,r),k=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e))(k||{}),R=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(R||{}),K=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(K||{}),ee=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ee||{}),me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(me||{}),ue=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ue||{}),B=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(B||{}),Nt={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Lt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ke={},jt={},Lr=()=>!!globalThis.Zone;Je={};Qe={};Ce=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ce=()=>new Date().getTime());S={ownerDocument:_r,childNodes:Dr,parentNode:Ar,parentElement:Fr,textContent:Pr,firstChild:Ur,lastChild:Wr,nextSibling:Br,previousSibling:Hr,contains:$r,getRootNode:zr,host:jr,styleSheets:Vr,shadowRoot:Gr,querySelector:qr,querySelectorAll:Kr,nowTimestamp:Ce,mutationObserverCtor:Gt,patch:ae};De=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap);}getId(t){var r;if(!t)return -1;let n=(r=this.getMeta(t))==null?void 0:r.id;return n!=null?n:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n));}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s);}this.idNodeMap.set(t,r);}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}};_t="__rrweb_original__";nn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,sn=/^(?:[a-z+]+:)?\/\//i,on=/^www\..*/i,an=/^(data:)([^,]*),(.*)/i;un=1,dn=new RegExp("[^a-z0-9-_:]"),Ue=-2;hn=/^[^ \t\n\r\u000c]+/,fn=/^[, \t\n\r\u000c]+/;At=new WeakMap;rt=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType");}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return false;if(t===this)return true}else return false;for(;t.parentNode;){if(t.parentNode===this)return true;t=t.parentNode;}return false}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return "RRNode"}};de=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`,Ft={map:{},getId(){return console.error(de),-1},getNode(){return console.error(de),null},removeNodeFromMap(){console.error(de);},has(){return console.error(de),false},reset(){console.error(de);}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Ft=new Proxy(Ft,{get(e,t,r){return t==="map"&&console.error(de),Reflect.get(e,t,r)}}));ot=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map);}getId(t){var r;return (r=this.styleIDMap.get(t))!=null?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};Pt=(e,t)=>`${e}@${t}`,it=class{constructor(){y(this,"frozen",false),y(this,"locked",false),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"canvasManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit();}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let h of this.movedSet){let f=S.parentNode(h);this.removesSubTreeCache.has(f)&&!this.movedSet.has(f)||this.addedSet.add(h);}let n=null,s=null,o=-1,a=null,c=false,i=new Set,p=this.addedSet.values(),u=p.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(S.previousSibling(n)))a=n,n=S.previousSibling(n);else {for(this.addedSet.has(u.value)||(u=p.next()),n=u.value;;){if(s=S.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if(cr(s)?(c=Ut(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&Ut(this.movedSet,n)&&(c=false)):c=true,this.addedSet.has(S.lastChild(s)))n=S.lastChild(s),a=null;else for(;;){if(a=S.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=be(s)?this.mirror.getId(lr(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=S.host(s);o=this.mirror.getId(l);}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let h=false;if(n.nodeType===Node.TEXT_NODE){let l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(o)&&(h=true);}let f=a?this.mirror.getId(a):null;for(;f===Ue;)a=a&&S.nextSibling(a),f=a&&this.mirror.getId(a);if(f===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let m=he(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:l=>{ir(l,this.mirror)&&this.iframeManager.addIframe(l),ar(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),st(n)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(n),this.doc);},onIframeLoad:(l,b)=>{this.iframeManager.attachIframe(l,b),this.shadowDomManager.observeAttachShadow(l);},onStylesheetLoad:(l,b)=>{this.stylesheetManager.attachLinkElement(l,b);},cssCaptured:h});m&&(t.push({parentId:o,nextId:f,node:m}),r.add(m.id));}let d={texts:this.texts.map(h=>{let f=h.node,m=S.parentNode(f);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(f),value:h.value}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),attributes:this.attributes.map(h=>{let{attributes:f}=h;if(typeof f.style=="string"){let m=JSON.stringify(h.styleDiff),l=JSON.stringify(h._unchangedStyles);m.length<f.style.length&&(m+l).split("var(").length===f.style.split("var(").length&&(f.style=h.styleDiff);}return {id:this.mirror.getId(h.node),attributes:f}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(d));}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(S.childNodes(t),s=>S.textContent(s)||"").join("");r.attributes.value=Ae({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Fe(t),value:n,maskInputFn:this.maskInputFn});}),y(this,"processMutation",t=>{if(!Ze(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case "characterData":{let r=S.textContent(t.target);!G(t.target,this.blockClass,this.blockSelector,false)&&r!==t.oldValue&&this.texts.push({value:Zt(t.target,this.maskTextClass,this.maskTextSelector,true)&&r?this.maskTextFn?this.maskTextFn(r,sr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case "attributes":{let r=t.target,n=ne(r.tagName),s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){let c=Fe(r);o=Ae({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn});}if(G(t.target,this.blockClass,this.blockSelector,false)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Qt(n,s))if(a.attributes[s]=Jt(this.doc,n,ne(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument();}catch(i){this.unattachedDoc=this.doc;}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let p=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);p!==c.style.getPropertyValue(i)||u!==c.style.getPropertyPriority(i)?u===""?a.styleDiff[i]=p:a.styleDiff[i]=[p,u]:a._unchangedStyles[i]=[p,u];}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=false);}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case "childList":{if(G(t.target,this.blockClass,this.blockSelector,true))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),s=be(t.target)?this.mirror.getId(S.host(t.target)):this.mirror.getId(t.target);G(t.target,this.blockClass,this.blockSelector,false)||Ze(r,this.mirror,this.slimDOMOptions)||!En(r,this.mirror)||(this.addedSet.has(r)?(at(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||or(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Pt(n,s)]?at(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:be(t.target)&&Se(t.target)?true:void 0}),Tn(r,this.removesSubTreeCache))),this.mapRemoves.push(r));});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ze(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Pt(this.mirror.getId(t),n)]=true);}else this.addedSet.add(t),this.droppedSet.delete(t);G(t,this.blockClass,this.blockSelector,false)||(S.childNodes(t).forEach(n=>this.genAdds(n)),st(t)&&S.childNodes(S.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t);}));}});}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};x=e=>we?(...r)=>{try{return e(...r)}catch(n){if(we&&we(n)===true)return;throw n}}:e,ie=[];Fn=["INPUT","TEXTAREA","SELECT"],Wt=new WeakMap;He=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t;}getId(t,r,n,s){let o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t),c=o.get(r);return c||(c=this.generateIdFn(),o.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=s.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t);}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},lt=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new He(Yt)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new He(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(t){this.iframes.set(t,true),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t);}addLoadListener(t){this.loadListener=t;}attachIframe(t,r){var n,s;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument));}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout);}transformCrossOriginEvent(t,r){var n;switch(r.type){case k.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:k.IncrementalSnapshot,data:{source:R.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}}}case k.Meta:case k.Load:case k.DomContentLoaded:return false;case k.Plugin:return r;case k.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case k.IncrementalSnapshot:switch(r.data.source){case R.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o);}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"]);}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"]);}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"]);}),r;case R.Drag:case R.TouchMove:case R.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"]);}),r;case R.ViewportResize:return false;case R.MediaInteraction:case R.MouseInteraction:case R.Scroll:case R.CanvasMutation:case R.Input:return this.replaceIds(r.data,t,["id"]),r;case R.StyleSheetRule:case R.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case R.Font:return r;case R.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"]);}),r;case R.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"]);}),r}}return false}replace(t,r,n,s){for(let o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}patchRootIdOnNode(t,r){t.type!==B.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r);});}},ct=class{constructor(t){y(this,"shadowDoms",new WeakSet),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init();}init(){this.reset(),this.patchAttachShadow(Element,document);}addShadowRoot(t,r){if(!Se(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=dr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(pr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(S.host(t))),this.restoreHandlers.push(hr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t));},0);}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument);}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(ae(t.prototype,"attachShadow",function(s){return function(o){let a=s.call(this,o),c=S.shadowRoot(this);return c&&cr(this)&&n.addShadowRoot(c,r),a}}));}reset(){this.restoreHandlers.forEach(t=>{try{t();}catch(r){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet;}},fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(ye=0;ye<fe.length;ye++)Gn[fe.charCodeAt(ye)]=ye;qn=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=fe[t[r]>>2],s+=fe[(t[r]&3)<<4|t[r+1]>>4],s+=fe[(t[r+1]&15)<<2|t[r+2]>>6],s+=fe[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},Bt=new Map;fr=(e,t,r)=>{if(!e||!(gr(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=Kn(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};mr=(e,t,r)=>e.map(n=>Le(n,t,r)),gr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);yr=`(function() {
4
+ "use strict";
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
7
+ for (var i = 0; i < chars.length; i++) {
8
+ lookup[chars.charCodeAt(i)] = i;
9
+ }
10
+ var encode = function(arraybuffer) {
11
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
12
+ for (i2 = 0; i2 < len; i2 += 3) {
13
+ base64 += chars[bytes[i2] >> 2];
14
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
15
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
16
+ base64 += chars[bytes[i2 + 2] & 63];
17
+ }
18
+ if (len % 3 === 2) {
19
+ base64 = base64.substring(0, base64.length - 1) + "=";
20
+ } else if (len % 3 === 1) {
21
+ base64 = base64.substring(0, base64.length - 2) + "==";
22
+ }
23
+ return base64;
24
+ };
25
+ const lastBlobMap = /* @__PURE__ */ new Map();
26
+ const transparentBlobMap = /* @__PURE__ */ new Map();
27
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
28
+ const id = \`\${width}-\${height}\`;
29
+ if ("OffscreenCanvas" in globalThis) {
30
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
31
+ const offscreen = new OffscreenCanvas(width, height);
32
+ offscreen.getContext("2d");
33
+ const blob = await offscreen.convertToBlob(dataURLOptions);
34
+ const arrayBuffer = await blob.arrayBuffer();
35
+ const base64 = encode(arrayBuffer);
36
+ transparentBlobMap.set(id, base64);
37
+ return base64;
38
+ } else {
39
+ return "";
40
+ }
41
+ }
42
+ const worker = self;
43
+ worker.onmessage = async function(e) {
44
+ if ("OffscreenCanvas" in globalThis) {
45
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
46
+ const transparentBase64 = getTransparentBlobFor(
47
+ width,
48
+ height,
49
+ dataURLOptions
50
+ );
51
+ const offscreen = new OffscreenCanvas(width, height);
52
+ const ctx = offscreen.getContext("2d");
53
+ ctx.drawImage(bitmap, 0, 0);
54
+ bitmap.close();
55
+ const blob = await offscreen.convertToBlob(dataURLOptions);
56
+ const type = blob.type;
57
+ const arrayBuffer = await blob.arrayBuffer();
58
+ const base64 = encode(arrayBuffer);
59
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
60
+ lastBlobMap.set(id, base64);
61
+ return worker.postMessage({ id });
62
+ }
63
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
64
+ worker.postMessage({
65
+ id,
66
+ type,
67
+ base64,
68
+ width,
69
+ height
70
+ });
71
+ lastBlobMap.set(id, base64);
72
+ } else {
73
+ return worker.postMessage({ id: e.data.id });
74
+ }
75
+ };
76
+ })();
77
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
78
+ `,zt=typeof self!="undefined"&&self.Blob&&new Blob([yr],{type:"text/javascript;charset=utf-8"});ut=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",false),y(this,"locked",false),y(this,"processMutation",(i,p)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(p);});let{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:c});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(t,r,n,s,o){let a=Ht(r,n,s,true),c=new Map,i=new Qn;i.onmessage=m=>{let{id:l}=m.data;if(c.set(l,false),!("base64"in m.data))return;let{base64:b,type:v,width:w,height:g}=m.data;this.mutationCb({id:l,type:me["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:v}]},0,0]}]});};let p=1e3/t,u=0,d,h=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{G(l,n,s,true)||m.push(l);}),m},f=m=>{if(u&&m-u<p){d=requestAnimationFrame(f);return}u=m,h().forEach(async l=>{var b;let v=this.mirror.getId(l);if(c.get(v)||l.width===0||l.height===0)return;if(c.set(v,true),["webgl","webgl2"].includes(l.__context)){let g=l.getContext(l.__context);((b=g==null?void 0:g.getContextAttributes())==null?void 0:b.preserveDrawingBuffer)===false&&g.clear(g.COLOR_BUFFER_BIT);}let w=await createImageBitmap(l);i.postMessage({id:v,bitmap:w,width:l.width,height:l.height,dataURLOptions:o.dataURLOptions},[w]);}),d=requestAnimationFrame(f);};d=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(d);};}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=Ht(t,r,n,false),o=Xn(this.processMutation.bind(this),t,r,n),a=Jn(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t);};requestAnimationFrame(t);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(a=>{let{type:c,...i}=a;return i}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t);}},dt=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new ot),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb;}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t);}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t));}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(c,i)=>({rule:Kt(c,o.href),index:i}))})),n.styleIds.push(a);}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(t){}},pt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",false);}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=true,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=false;})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r));}destroy(){}},$e=false;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Tt=e.contentWindow)==null?void 0:Tt.Array.from)||Array.from,document.body.removeChild(e);}}catch(e){console.debug("Unable to override Array.from",e);}Z=en();Ie.addCustomEvent=(e,t)=>{if(!$e)throw new Error("please add custom event after start recording");W({type:k.Custom,data:{tag:e,payload:t}});};Ie.freezePage=()=>{ie.forEach(e=>e.freeze());};Ie.takeFullSnapshot=e=>{if(!$e)throw new Error("please take full snapshot after start recording");_e(e);};Ie.mirror=Z;});var wt="[data-ck-mask]",Ct="[data-ck-block]";var vt=e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return (t>>>0)/4294967296};var Ke=1800*1e3,Xe=60*1e3,Mt=30*1e3,Rr=5*1e3,Ye=64*1024,Er=4*1024*1024,It=1024*1024,xr=[Ct,'input[type="password"]','input[type="hidden"]','[autocomplete^="cc-"]','input[name*="card" i]','input[name*="cvc" i]','input[name*="cvv" i]','iframe[src*="js.stripe.com"]','iframe[src*="paypal.com"]'].join(","),kr=wt,Rt=(e,t)=>vt(`replay:${e}`)<Math.min(1,Math.max(0,t)),Et=e=>{let t=e.toLowerCase().replace(/^\$/,"");return t.startsWith("purchase")?"purchase":t.startsWith("checkout")?"checkout":null},Or=e=>"*".repeat(Math.min(12,e.length)),xt=e=>({emit:e,maskAllInputs:true,maskInputOptions:{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true},maskInputFn:Or,maskTextSelector:kr,blockSelector:xr,recordCanvas:false,recordCrossOriginIframes:false,collectFonts:false,inlineImages:false,slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"}}),xe=class{constructor(t=Xe,r=Er){ge(this,"windowMs",t);ge(this,"maxBytes",r);ge(this,"segments",[]);}push(t,r){(t.type===4||!this.segments.length)&&this.segments.push({events:[],bytes:0});let n=this.segments[this.segments.length-1];n.events.push(t),n.bytes+=r;let s=t.timestamp-this.windowMs;for(;this.segments.length>1&&(this.segments[1].events[0].timestamp<=s||this.bytes>this.maxBytes);)this.segments.shift();}get bytes(){return this.segments.reduce((t,r)=>t+r.bytes,0)}get size(){return this.segments.reduce((t,r)=>t+r.events.length,0)}get first(){var t,r,n;return (n=(r=(t=this.segments[0])==null?void 0:t.events[0])==null?void 0:r.timestamp)!=null?n:null}drain(){let t=this.segments.flatMap(r=>r.events);return this.segments=[],t}clear(){this.segments=[];}},kt=(e,t)=>e>=Ye||e>0&&t>=Rr,Ot=e=>{let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)};var mt=(e,t)=>String(e!=null?e:"").slice(0,t),je=()=>window.location.pathname.slice(0,300)||"/",Zn=async e=>{let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())},wr=async e=>{if(typeof window=="undefined")return null;let{record:t}=await Promise.resolve().then(()=>(Sr(),br)),r=`${e.host}/api/sdk/replay`,n=Rt(e.sessionId,e.sampleRate)?"upload":"buffer",s=n==="upload"?"sample":null,o=e.distinctId,a=e.identified===true,c=null,i=0,p=false,u=Date.now(),d=new xe,h=[],f=0,m=Date.now(),l=[{t:Date.now(),kind:"pageview",path:je()}],b=Promise.resolve(),v=M=>{p||(!M&&n==="upload"&&g(false),p=true,j==null||j(),window.clearInterval(E),window.clearInterval(te),window.removeEventListener("error",X),window.removeEventListener("unhandledrejection",$),window.removeEventListener("pagehide",q),document.removeEventListener("visibilitychange",z),console.error===H&&(console.error=D),h=[],d.clear(),l=[]);},w=async(M,C,O)=>{let A;if(!O&&typeof CompressionStream!="undefined"?A=JSON.stringify({...M,enc:"gzip",data:Ot(await Zn(C))}):A=JSON.stringify({...M,enc:"json",data:C}),A.length>It){e.warn("A recording chunk was over 1 MB (a very large page). The recording stopped."),v(true);return}if(!(O&&"sendBeacon"in navigator&&navigator.sendBeacon(r,A)))try{let F=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:A,keepalive:O||A.length<6e4});(F.status===403||F.status===409||F.status===413)&&v(!0);}catch(F){e.warn(`Could not reach ${e.host||"this origin"} to upload a recording.`);}};function g(M){if(!h.length)return;let C=h;h=[],f=0,m=Date.now(),c!=null||(c=C[0].timestamp);let O=l;l=[];let A={key:e.apiKey,sessionId:e.sessionId,distinctId:o,identified:a,start:c,seq:i++,consent:{replay:true},trigger:s,final:M,meta:{first:C[0].timestamp,last:C[C.length-1].timestamp,vw:window.innerWidth,vh:window.innerHeight,marks:O}},F=`[${C.map(le=>le.json).join(",")}]`;M?w(A,F,true):b=b.then(()=>w(A,F,false));}let I=M=>{p||n==="upload"||(n="upload",s=M,window.clearInterval(te),h=d.drain(),f=h.reduce((C,O)=>C+O.json.length,0),g(false));},L=M=>{var A;if(p)return;if(Date.now()-(c!=null?c:u)>Ke){v(false);return}let C=JSON.stringify(M),O={type:M.type,timestamp:M.timestamp,json:C};if(n==="buffer"){d.push(O,C.length);let F=(A=d.first)!=null?A:M.timestamp-Xe;l=l.filter(le=>le.t>=F);return}h.push(O),f+=C.length,f>=Ye&&g(false);},D=console.error,H=(...M)=>{try{t.addCustomEvent("$console",{level:"error",text:mt(M.map(C=>C instanceof Error?C.message:typeof C=="string"?C:"[object]").join(" "),300)});}catch(C){}D.apply(console,M);},X=M=>{let C=mt(M.message||"Script error",200);l.push({t:Date.now(),kind:"error",path:je(),label:C});try{t.addCustomEvent("$error",{message:C});}catch(O){}I("error");},$=M=>{let C=M.reason,O=mt(typeof(C==null?void 0:C.message)=="string"?C.message:"Unhandled promise rejection",200);l.push({t:Date.now(),kind:"error",path:je(),label:O});try{t.addCustomEvent("$error",{message:O});}catch(A){}I("error");},q=()=>n==="upload"&&g(true),z=()=>document.visibilityState==="hidden"&&n==="upload"&&g(false),j=t(xt(L));if(!j)return null;console.error=H,window.addEventListener("error",X),window.addEventListener("unhandledrejection",$),window.addEventListener("pagehide",q),document.addEventListener("visibilitychange",z);let E=window.setInterval(()=>{Date.now()-(c!=null?c:u)>Ke?v(false):n==="upload"&&kt(f,Date.now()-m)&&g(false);},1e3),te=n==="buffer"?window.setInterval(()=>t.takeFullSnapshot(true),Mt):0;return {event:M=>{let C=Et(M);C&&I(C);},click:(M,C)=>{if(p)return;let O=Date.now(),A=je(),F=M.label||M.selector.split(" > ").pop()||"";l.push({t:O,kind:"click",path:A,label:F,x:M.x,y:M.y,vw:M.vw,dead:!M.interactive}),C&&(l.push({t:O,kind:"rage",path:A,label:F,x:M.x,y:M.y,vw:M.vw}),I("rage"));},page:M=>!p&&l.push({t:Date.now(),kind:"pageview",path:M.slice(0,300)||"/"}),identify:M=>{o=M,a=true;},stop:(M=false)=>v(M)}};window.__mrrocketReplay={startReplay:wr};})();
@@ -0,0 +1 @@
1
+ (function(){'use strict';var n=self,w=new URLSearchParams(n.location.search);n.addEventListener("install",()=>{n.skipWaiting();});n.addEventListener("activate",i=>i.waitUntil(n.clients.claim()));n.addEventListener("push",i=>{var o;let t={};try{t=i.data?i.data.json():{};}catch(s){t={title:(o=i.data)==null?void 0:o.text()};}t.title&&i.waitUntil(n.registration.showNotification(t.title,{body:t.body,icon:t.icon,data:t,tag:t.id}));});n.addEventListener("notificationclick",i=>{var a,r,c,l,d;let t=(r=(a=i.notification)==null?void 0:a.data)!=null?r:{};(c=i.notification)==null||c.close();let o=t.k||w.get("key"),s=(d=(l=t.h)!=null?l:w.get("host"))!=null?d:"",g=o&&t.id?fetch(`${s}/api/sdk/events`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:o,events:[{event:"$push",props:{action:"opened",message:t.id},ts:Date.now(),url:t.url}]})}).catch(()=>null):null,h=t.url?n.clients.matchAll({type:"window",includeUncontrolled:true}).then(p=>{let u=new URL(t.url,n.location.origin).href,e=p.find(f=>f.url===u);return e!=null&&e.focus?e.focus():n.clients.openWindow(u)}):null;i.waitUntil(Promise.all([g,h]));});})();
@@ -0,0 +1,2 @@
1
+ (function(){'use strict';var Wt=Object.defineProperty;var Bt=(e,n,r)=>n in e?Wt(e,n,{enumerable:true,configurable:true,writable:true,value:r}):e[n]=r;var ne=(e,n,r)=>Bt(e,typeof n!="symbol"?n+"":n,r);var dt=e=>{let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?n+=1:s<2048?n+=2:s>=55296&&s<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3;}return n},qt=(e,n,r)=>{let s=`{"key":${JSON.stringify(e)},"sdk":${JSON.stringify(r)},"events":[`,a=dt(s)+2,c=[],f=[],b=[],v=a,g=()=>{f.length&&c.push({body:`${s}${f.join(",")}]}`,events:b}),f=[],b=[],v=a;};for(let R of n){let y=JSON.stringify(R),w=dt(y)+1;a+w>6e4||((f.length===100||v+w>6e4)&&g(),f.push(y),b.push(R),v+=w);}return g(),c},ut=(e,n,r)=>qt(e,n,r).map(s=>s.body);var Yt='a[href],button,input,select,textarea,label,summary,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[onclick],[data-ck-goal]',Xt="[data-ck-mask]",Gt="[data-ck-block]",ft=/\d{4,}|^[a-z]{1,3}-[a-z0-9]{5,}$|^_|__|css-|^sc-|^jsx-/i,Jt=e=>{let n=e.tagName.toLowerCase();if(e.id&&!ft.test(e.id)&&e.id.length<=40)return `${n}#${e.id}`;let r=typeof e.className=="string"?e.className.split(/\s+/).filter(c=>c&&!ft.test(c)&&c.length<=30&&!c.includes(":")):[],s=r.length?`${n}.${r.slice(0,2).join(".")}`:n,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},zt=e=>{let n=[],r=e;for(;r&&n.length<3&&r.tagName&&r.tagName!=="BODY"&&r.tagName!=="HTML";){let s=Jt(r);if(n.unshift(s),s.includes("#"))break;r=r.parentElement;}return n.join(" > ").slice(0,160)},ye=e=>(e!=null?e:"").replace(/\s+/g," ").trim().slice(0,40),Qt=e=>{var r,s,a,c,f;if(e.closest(`${Xt},${Gt}`))return "";let n=e.tagName.toLowerCase();if(n==="input"){let b=((r=e.getAttribute("type"))!=null?r:"text").toLowerCase();return ye(b==="submit"||b==="button"?(s=e.getAttribute("aria-label"))!=null?s:e.value:e.getAttribute("aria-label"))}return ye(n==="select"||n==="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)},pt=e=>{var c,f;let n=e.target instanceof Element?e.target:null;if(!n)return null;let r=n.closest(Yt),s=r!=null?r:n,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:zt(s),label:r?Qt(r):"",interactive:!!r}},be=class{constructor(n=1e3,r=30,s=3){ne(this,"windowMs",n);ne(this,"radius",r);ne(this,"count",s);ne(this,"clicks",[]);ne(this,"fired",false);}push(n,r,s){let a=this.clicks.filter(c=>s-c.t<=this.windowMs&&Math.hypot(c.x-n,c.y-r)<=this.radius);return a.length!==this.clicks.length&&(this.fired=false),this.clicks=[...a,{x:n,y:r,t:s}],this.clicks.length>=this.count&&!this.fired?(this.fired=true,true):false}},gt=()=>{var r,s;let e=document.documentElement,n=Math.max(e.scrollHeight,(s=(r=document.body)==null?void 0:r.scrollHeight)!=null?s:0);return n?Math.min(100,Math.round((window.scrollY+window.innerHeight)/n*100)):0};var xe="0.8.0",Zt=(e,n)=>{let r=n.trim().toLowerCase();for(let[s,a]of Object.entries(e))if(s.toLowerCase()===r)return a},en=(e,n)=>{let r=e.trim().toLowerCase(),s=n.trim().toLowerCase();return s.startsWith("@")?r.endsWith(s):r===s},tn=(e,n)=>{if(e.op==="in cohort")return false;let r=Zt(n,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=>en(s,c));return e.op==="is"||e.op==="in"?a:!a},nn=(e,n,r={})=>{var b;if(!e.on)return false;let s={id:n,...r},a=e.sets.length?e.sets.find(v=>v.conditions.every(g=>tn(g,s))):{rollout:100};if(!a||mt(`${e.key}:rollout:${n}`)*100>=a.rollout)return false;if(!((b=e.variants)!=null&&b.length))return true;let c=mt(`${e.key}:variant:${n}`)*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},je=(e,n,r,s={})=>{var c;let a=(c=n==null?void 0:n.flags)==null?void 0:c.find(f=>f.key===e);return a?nn(a,r,s):false},rn=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],ht="ck_preview",wt="ck_embed",z="ck_id",re="ck_sid";var on=e=>{var r;let n={};for(let s of rn){let a=(r=e(s))==null?void 0:r.trim();a&&(n[s]=a.slice(0,150));}return n},kt=e=>{let n=new URLSearchParams(e);return on(r=>n.get(r))};var sn=e=>{let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return (n>>>0)/4294967296},mt=e=>{let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return n^=n>>>16,n=Math.imul(n,2246822507),n^=n>>>13,n=Math.imul(n,3266489909),n^=n>>>16,(n>>>0)/4294967296},an=(e,n)=>{var c,f,b,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=sn(`${e.key}:${n}`),a=0;for(let g of e.variants)if(a+=g.weight,s<a)return g.id;return (v=(b=e.variants[e.variants.length-1])==null?void 0:b.id)!=null?v:r},yt=e=>{let n=Array.isArray(e)?e[0]:e;if(!n)return {};let r={};for(let s of n.split(",")){let[a,c]=s.split(":");a&&c&&(r[a.trim()]=c.trim());}return r};var ce=(e,n,r,s)=>{if(s[e])return s[e];let a=n==null?void 0:n.experiments.find(c=>c.key===e);return a?an(a,r):"control"},bt=(e,n,r)=>{var a,c,f,b,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 y=ce(R.key,e,n,r);y!==((b=(f=R.variants[0])==null?void 0:f.id)!=null?b:"control")&&Object.assign(s,(g=(v=R.variants.find(w=>w.id===y))==null?void 0:v.changes)!=null?g:{});}return s},ae="ck_x",Ce=e=>e.replace(/\/+$/,"")||"/",Ct=(e,n,r,s={})=>{var b,v;if(!e)return null;let a;try{a=new URL(n);}catch(g){return null}if(a.searchParams.has(ae))return null;let c=Ce(a.pathname),f=(g,R)=>{let y;try{y=new URL(g,a);}catch(w){return}if(!(!/^https?:$/.test(y.protocol)||y.origin===a.origin&&Ce(y.pathname)===c))return a.searchParams.forEach((w,x)=>{y.searchParams.has(x)||y.searchParams.set(x,w);}),R&&y.searchParams.set(ae,R),y.hash||(y.hash=a.hash),y.href};for(let g of (b=e.redirects)!=null?b:[]){let R=g.from&&Ce(g.from)===c?f(g.to):void 0;if(R)return {to:R}}for(let g of e.experiments){if(!g.path||Ce(g.path)!==c)continue;let R=g.status==="running"&&!g.winner;if(R&&r===null&&!s[g.key])return null;let y=ce(g.key,e,r!=null?r:"",s),w=(v=g.variants.find(A=>A.id===y))==null?void 0:v.url,x=w?f(w,R?`${g.key}:${y}`:void 0):void 0;return R?{to:x,experiment:g.key,variant:y}:x?{to:x}:null}return null},xt=(e,n)=>{let[r,s]=(n!=null?n:"").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 Ke=()=>typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`ck_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;var le=(e,n)=>e.length>n?`${e.slice(0,n-1)}\u2026`:e,cn=e=>{var n;if(e instanceof Error)return {type:e.name||"Error",message:le(e.message||String(e),1e3),stack:e.stack?le(e.stack,8192):void 0};if(typeof e=="string")return {type:"Error",message:le(e,1e3)};try{return {type:"Error",message:le((n=JSON.stringify(e))!=null?n:String(e),1e3)}}catch(r){return {type:"Error",message:String(e)}}},Rt=e=>{let n=[],r=[],s=new Set,a=0,c=`${e.host}/api/sdk/errors`,f=(w=false)=>{for(;n.length;){let x=JSON.stringify({key:e.apiKey,errors:n.splice(0,4)});w&&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(()=>{});}},b=(w,x="manual")=>{let A=e.context();if(!A.send||a>=20)return;let I=cn(w);if(/\/api\/sdk\/errors/.test(I.message))return;let L=`${I.type}:${I.message}`;s.has(L)||(s.add(L),a++,n.push({...I,mechanism:x,handled:x==="manual",url:window.location.href,ts:Date.now(),crumbs:r.slice(),...e.release?{release:e.release}:{},...A.distinctId?{distinctId:A.distinctId}:{},...A.sessionId?{sessionId:A.sessionId}:{}}));},v=w=>{var x;!w.error&&(!w.message||w.message==="Script error.")||b((x=w.error)!=null?x:new Error(w.message),"onerror");},g=w=>{var x;return b((x=w.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 y=window.setInterval(()=>f(),2e3);return {capture:b,crumb:(w,x)=>{r.push({ts:Date.now(),type:w,message:le(x,120)}),r.length>20&&r.shift();},stop:()=>{window.removeEventListener("error",v),window.removeEventListener("unhandledrejection",g),window.removeEventListener("pagehide",R),window.clearInterval(y),f(true);}}};var de="$cancel_flow",Q="$onboarding",Ve="$inapp",ln={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"},dn="Something went wrong. Please try again.",un="mrrocket:onboarding",vt=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),Et=new Set(["signed_up","signup","sign_up","registered","account_created","user_signed_up"]),_t=(e,n)=>{let r=vt(e),s=vt(n);return !r||!s?false:r===s||Et.has(r)&&Et.has(s)},fn=e=>/^(first (launch|visit|open|session|login|sign ?in|app open)|app (opened|launched)|on load|every visit|always)?$/i.test(e.trim()),pn=()=>`cf_${Math.random().toString(36).slice(2,10)}${Date.now().toString(36)}`;var gn=e=>{let n=(e!=null?e:"").trim();return /^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:void 0},St=e=>{let n=null,r=null,s=null,a=[],c=false,f=null,b,v=null,g=new Map,R=new Set,y=new Set,w=new Set,x=e.auto!==false,A=()=>{var t;return (t=n==null?void 0:n.onboarding)!=null?t:[]},I=t=>t?A().find(i=>i.id===t):void 0,L=t=>{let i=g.get(t);return i||g.set(t,i={done:new Set,dismissed:false}),i},V=t=>{let i=g.get(t.id);return !!i&&(i.dismissed||t.steps.every(u=>i.done.has(u.id)))},pe=t=>`${un}:${t!=null?t:"visitor"}`,D=()=>{var u;let t=(u=e.storage)==null?void 0:u.call(e);if(!t)return;let i={};for(let[m,k]of g)i[m]={done:[...k.done],...k.dismissed?{dismissed:true}:{}};try{t.set(pe(e.personId()),JSON.stringify(i));}catch(m){}},W=t=>{var i;for(let[u,m]of Object.entries(t!=null?t:{})){let k=L(u);for(let _ of (i=m.done)!=null?i:[])k.done.add(_);m.dismissed&&(k.dismissed=true);}},H=()=>{let t=I(s);if(!t)return null;let i=L(t.id),u=t.steps.findIndex(k=>!i.done.has(k.id));if(u<0||i.dismissed)return null;let m=t.steps[u];if(m.kind==="checklist"){let k=u;for(;k>0&&t.steps[k-1].kind==="checklist";)k--;let _=u;for(;_+1<t.steps.length&&t.steps[_+1].kind==="checklist";)_++;return {type:"checklist",flow:t,items:t.steps.slice(k,_+1).map(h=>({step:h,done:i.done.has(h.id)}))}}return {type:"step",flow:t,step:m,index:u,total:t.steps.length,last:u===t.steps.length-1}},X=()=>{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 t=H();if(t)return t;s&&(s=null);let i=a.find(u=>!R.has(u.id));return i?{type:"message",message:i}:null},F=()=>{let t=X();if((t==null?void 0:t.type)==="step"&&!y.has(`s:${t.step.id}`))y.add(`s:${t.step.id}`),e.track(Q,{flow:t.flow.id,step:t.step.id,kind:t.step.kind,action:"shown"});else if((t==null?void 0:t.type)==="checklist")for(let i of t.items)!i.done&&!y.has(`s:${i.step.id}`)&&(y.add(`s:${i.step.id}`),e.track(Q,{flow:t.flow.id,step:i.step.id,kind:"checklist",action:"shown"}));else (t==null?void 0:t.type)==="message"&&!y.has(`m:${t.message.id}`)&&(y.add(`m:${t.message.id}`),e.track(Ve,{message:t.message.id,journey:t.message.journey,action:"shown"}));for(let i of [...w])try{i();}catch(u){}},Z=t=>s===t.id?true:s&&I(s)&&!V(I(s))?false:(s=t.id,e.track(Q,{flow:t.id,action:"started"}),F(),true),ge=()=>{var i;if(!x||s||!c||!e.personId()&&!((i=e.storage)!=null&&i.call(e)))return;let t=A().find(u=>fn(u.trigger)&&u.steps.length&&!V(u));t&&Z(t);},oe=()=>{let t=e.personId();v!==null&&v!==t&&(g.clear(),R.clear(),s=null,b=void 0),v=t;let i=(async()=>{var k,_;let u=(k=e.storage)==null?void 0:k.call(e);if(u)try{let h=await u.get(pe(t));h&&W(JSON.parse(h));}catch(h){}let m=A().length>0||!!(n!=null&&n.messages);if(t&&m&&b!==t){b=t;let h=await e.fetchInApp(t).catch(()=>null);h&&e.personId()===t&&(W(h.onboarding),a=((_=h.messages)!=null?_:[]).filter($=>$&&$.id&&$.title));}t||(a=[]),c=true,ge(),F();})();return f=i.finally(()=>{f===i&&(f=null);}),f},T=(t,i,u)=>{var k;let m=t.reason?t.flow.offers[t.reason]:void 0;return {outcome:i,run:t.run,...t.reason?{reason:t.reason,reasonLabel:(k=t.flow.reasons.find(_=>_.id===t.reason))==null?void 0:k.label}:{},...i==="saved"&&m?{offer:m}:{},...u!=null&&u.trim()?{comment:u.trim().slice(0,500)}:{}}},G=(t,i)=>{var u;e.track(de,{action:"finished",run:t.run,version:t.flow.version,outcome:i.outcome,customer:(u=t.options.customer)!=null?u:"consumer",...i.reason?{reason:i.reason}:{},...i.offer?{offer:i.offer.kind}:{},...i.comment?{comment:i.comment}:{}}),r===t&&(r=null),t.resolve(i),F();},E=(t,i,u)=>{if(t.busy)return;let m=T(t,i,u),k=i==="saved"?t.options.onSave:t.options.onCancel;t.busy=true,t.error=void 0,F(),Promise.resolve().then(()=>k==null?void 0:k(m)).then(()=>G(t,m),()=>{t.busy=false,t.error=dn,F();});};return {setConfig:t=>{n=t,s&&!I(s)&&(s=null),F();},refresh:oe,onEvent:t=>{var k;if(!t||t.startsWith("$"))return;let i=I(s),u=false;if(i){let _=L(i.id);for(let h of i.steps)h.kind==="checklist"&&h.event&&!_.done.has(h.id)&&_t(h.event,t)&&(_.done.add(h.id),u=true,e.track(Q,{flow:i.id,step:h.id,kind:h.kind,action:"completed"}));}if(u&&(D(),F()),!x||!e.personId()&&!((k=e.storage)!=null&&k.call(e)))return;let m=A().find(_=>_.steps.length&&_t(_.trigger,t)&&!V(_));m&&Z(m);},openCancelFlow:(t={})=>{var h,$;if(r)return r.promise;let i=(h=n==null?void 0:n.cancelFlow)!=null?h:ln,u=t.customer!=="business"||i.reasons.length<2,m=()=>{},k=new Promise(j=>m=j),_={flow:i,options:t,plain:u,screen:u?"confirm":"survey",run:pn(),busy:false,resolve:m,promise:k};return r=_,e.track(de,{action:"shown",run:_.run,version:i.version,customer:($=t.customer)!=null?$:"consumer",plain:u}),F(),k},startOnboarding:t=>{let i=t?I(t):A().find(m=>m.steps.length&&!V(m));if(!i||!i.steps.length)return false;let u=L(i.id);return u.dismissed=false,Z(i)},view:X,subscribe:t=>(w.add(t),()=>w.delete(t)),cancel:{pick:t=>{!r||r.busy||!r.flow.reasons.some(i=>i.id===t)||(r.reason=t,r.error=void 0,F());},next:()=>{let t=r;!t||t.screen!=="survey"||!t.reason||(e.track(de,{action:"answered",run:t.run,version:t.flow.version,reason:t.reason}),t.screen=t.flow.offers[t.reason]?"offer":"confirm",F());},accept:t=>{let i=r;if(!i||i.screen!=="offer"||!i.reason)return;let u=i.flow.offers[i.reason];i.busy||e.track(de,{action:"offer",run:i.run,version:i.flow.version,reason:i.reason,offer:u==null?void 0:u.kind,outcome:"accepted"}),E(i,"saved",t);},decline:()=>{var i;let t=r;!t||t.screen!=="offer"||t.busy||(e.track(de,{action:"offer",run:t.run,version:t.flow.version,reason:t.reason,offer:t.reason?(i=t.flow.offers[t.reason])==null?void 0:i.kind:void 0,outcome:"declined"}),t.screen="confirm",t.error=void 0,F());},confirm:t=>{let i=r;!i||i.screen!=="confirm"||E(i,"cancelled",t);},close:()=>{var u,m;let t=r;if(!t||t.busy)return;let i=T(t,"kept");(m=(u=t.options).onClose)==null||m.call(u,i),G(t,i);}},onboarding:{next:()=>{let t=H();(t==null?void 0:t.type)==="step"&&(L(t.flow.id).done.add(t.step.id),e.track(Q,{flow:t.flow.id,step:t.step.id,kind:t.step.kind,action:"completed"}),D(),F());},check:t=>{let i=H();if((i==null?void 0:i.type)!=="checklist")return;let u=i.items.find(m=>m.step.id===t);!u||u.done||(L(i.flow.id).done.add(t),e.track(Q,{flow:i.flow.id,step:t,kind:"checklist",action:"completed"}),D(),F());},dismiss:()=>{let t=H();!t||t.type!=="step"&&t.type!=="checklist"||(L(t.flow.id).dismissed=true,e.track(Q,{flow:t.flow.id,...t.type==="step"?{step:t.step.id}:{},action:"dismissed"}),s=null,D(),F());}},message:{click:()=>{var u;let t=X();if((t==null?void 0:t.type)!=="message")return;R.add(t.message.id),e.track(Ve,{message:t.message.id,journey:t.message.journey,action:"clicked"});let i=gn(t.message.url);F(),i&&((u=e.openUrl)==null||u.call(e,i));},dismiss:()=>{let t=X();(t==null?void 0:t.type)==="message"&&(R.add(t.message.id),e.track(Ve,{message:t.message.id,journey:t.message.journey,action:"dismissed"}),F());}}}};var mn={get:e=>{try{return window.localStorage.getItem(e)}catch(n){return null}},set:(e,n)=>{try{window.localStorage.setItem(e,n);}catch(r){}}},It=()=>{try{for(let e=window.localStorage.length-1;e>=0;e--){let n=window.localStorage.key(e);n!=null&&n.startsWith("mrrocket:onboarding")&&window.localStorage.removeItem(n);}}catch(e){}},Ft=e=>({track:e.track,personId:e.personId,auto:e.auto,storage:()=>e.canStore()?mn:null,openUrl:n=>window.location.assign(n),fetchInApp:async n=>{if(!e.apiKey)return null;let r=await fetch(`${e.host}/api/sdk/inapp?key=${encodeURIComponent(e.apiKey)}&distinctId=${encodeURIComponent(n)}`);return r.ok?await r.json():null}});var Ee="mrr_ref",_e="mrr_ref",hn="mrr_ref",wn="mrr_click";var ue=/^[A-Za-z0-9_-]{1,64}$/;var kn=(e,n="ref")=>{let r=new URLSearchParams(e);return yn(s=>r.get(s),n)},yn=(e,n="ref")=>{let r=e(hn);if(r&&ue.test(r)){let a=e(wn);return {code:r,clickId:a&&ue.test(a)?a:null,direct:false}}let s=e(n);return s&&ue.test(s)?{code:s,clickId:null,direct:true}:null},Ot=e=>{var n;return `${e.code}.${(n=e.clickId)!=null?n:""}.${e.at}`},Re=(e,n=60,r=Date.now())=>{if(!e)return null;let[s,a,c]=e.split("."),f=Number(c);return !s||!ue.test(s)||!Number.isFinite(f)||a&&!ue.test(a)||r-f>n*864e5||f>r+864e5?null:{code:s,clickId:a||null,at:f}};var M=null,Se=()=>typeof document!="undefined",$t=e=>{var r;if(!Se())return;let n=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);try{return n?decodeURIComponent(n):void 0}catch(s){return n}},Ie=()=>{try{return typeof localStorage=="undefined"?null:localStorage}catch(e){return null}},We=()=>{var e,n;return M||(Se()?(n=Re($t(Ee),3650))!=null?n:Re((e=Ie())==null?void 0:e.getItem(_e),3650):null)};var ve=(e,n)=>{var a;if(!Se())return;let r=Math.max(1,Math.round(n))*86400,s=typeof location!="undefined"&&location.protocol==="https:"?"; secure":"";document.cookie=`${Ee}=${encodeURIComponent(Ot(e))}; path=/; max-age=${r}; samesite=lax${s}`;try{(a=Ie())==null||a.setItem(_e,Ot(e));}catch(c){}},Fe=()=>{var e;if(Se()){document.cookie=`${Ee}=; path=/; max-age=0; samesite=lax`;try{(e=Ie())==null||e.removeItem(_e);}catch(n){}}},Pt=()=>{M=null;},At=async e=>{var s,a,c;let n=kn(e.search,e.param),r=(s=e.now)!=null?s:Date.now();if(!n)return !M&&e.store&&(M=(c=Re($t(Ee),e.days,r))!=null?c:Re((a=Ie())==null?void 0:a.getItem(_e),e.days,r),M||Fe()),M;if(M={code:n.code,clickId:n.clickId,at:r},e.store&&ve(M,e.days),e.beacon)try{let f=await e.beacon({code:n.code,clickId:n.clickId});f&&M&&M.code===n.code&&!M.clickId&&(M={...M,clickId:f},e.store&&ve(M,e.days));}catch(f){}return M},Mt=e=>e==="$identify"||!e.startsWith("$");var Be=3600*24*365,Nt=e=>{var r;if(typeof document=="undefined")return;let n=(r=document.cookie.split("; ").find(s=>s.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);if(n)try{return decodeURIComponent(n)}catch(s){return n}},Oe=(e,n,r)=>{let s=window.location.protocol==="https:"?"; secure":"";document.cookie=`${e}=${encodeURIComponent(n)}; path=/; max-age=${r}; samesite=lax${s}`;},fe=e=>{document.cookie=`${e}=; path=/; max-age=0; samesite=lax`;},O={utm:{}},Tt=()=>{var e;return (e=O.id)!=null?e:O.id=Ke()},qe=(e,n)=>{if(e!=="cookies")return Tt();let r=Nt(z);if(r)return O.id=r;let s=Tt();return Oe(z,s,Be),s},Ye=e=>{var a;let n=Date.now(),r=O.session,s=(a=e?Nt(re):void 0)!=null?a:r&&n-r.last<18e5?r.id:Ke();return O.session={id:s,last:n},e&&Oe(re,s,18e5/1e3),s},Xe=()=>{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 n=kt(window.location.search);Object.keys(n).length&&(O.utm=n);},Ut=()=>{let e=navigator,n=window;return e.doNotTrack==="1"||n.doNotTrack==="1"||e.globalPrivacyControl===true};var $e=window,Cn=()=>{var e,n;return (n=(e=document.currentScript)!=null?e:document.querySelector('script[data-key][src*="sdk"]'))!=null?n:document.querySelector("script[data-key][src*='mrrocket']")},Dt=new Set,K=e=>{Dt.has(e)||(Dt.add(e),console.warn(`[MRRocket] ${e}`));},xn=()=>{var st,it,at,ct;let e=Cn(),n=o=>{var l;return (l=e==null?void 0:e.getAttribute(`data-${o}`))!=null?l:void 0},r=(o,l)=>{let d=n(o);return d===void 0?l:!["false","0","off","no"].includes(d.trim().toLowerCase())},s=(st=e==null?void 0:e.src)!=null?st:"",a="";try{a=s?new URL(s,window.location.href).origin:"";}catch(o){a="";}let c=((it=n("key"))!=null?it:"").trim(),f=((at=n("api-host"))!=null?at:a).trim().replace(/\/+$/,""),b=n("consent"),v=r("respect-dnt",false),g=r("heatmaps",true),R=r("errors",true),y=n("release"),w=n("attribution"),x=w==="always"||w==="off"?w:"consent",A=n("referral-param")||"ref",I={},L=(o,l)=>{var d;return (d=I[o])!=null?d:I[o]=new Promise((p,C)=>{var lt;let S=()=>$e[l];if(S())return p(S());let J=(lt=n(`${o}-src`))!=null?lt:s?s.replace(/(\.min)?\.js(\?[^#]*)?(#.*)?$/,`-${o}$1.js?v=${xe}`):"";if(!J)return C(new Error(o));let Y=document.createElement("script");Y.async=true,Y.src=J,Y.onload=()=>S()?p(S()):C(new Error(o)),Y.onerror=()=>C(new Error(o)),document.head.appendChild(Y);}).catch(p=>{throw I[o]=void 0,p})},V=n("theme"),pe={theme:V==="light"||V==="dark"?V:"auto",accent:n("accent")},D=new URLSearchParams(window.location.search),W=yt(D.get(ht)),H=D.get(wt)==="1",X=D.get(ae);if(X!==null){D.delete(ae);let o=D.toString();history.replaceState(history.state,"",`${window.location.pathname}${o?`?${o}`:""}${window.location.hash}`);}let F=Ut(),Z=b==="cookies"||b==="off"?b:"cookieless",ge=r("replay",false),oe="",T,G,E=null,B=false,Pe=false,t=null,i=null,u=window.location.pathname,m=[],k=new Set,_=[],h=()=>v&&F?"off":Z,$=()=>!H&&h()!=="off",j=()=>T!=null?T:oe,me=()=>h()==="cookies"?j():T;c||K('No public key. Add data-key="mrr_pub_\u2026" to the script tag; nothing is tracked until then.');let Ae=(o=false)=>{if(!m.length)return;if(!c){m.length=0;return}let l=`${f}/api/sdk/events`;for(let d of ut(c,m.splice(0),{v:xe,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(C=>{C.ok||K(`Events were rejected with ${C.status}. Check data-key (MRRocket \u203A Settings \u203A Products).`);}).catch(()=>K(`Could not reach ${f||"this origin"} to send events. Check data-api-host.`));},P=null,U=null,ee=(o,l,d=Date.now(),p)=>{if(!$())return;let C=Mt(o)?We():null;m.push({event:o,props:C?{...l,$referral:{code:C.code,clickId:C.clickId}}:l,distinctId:me(),sessionId:Ye(h()==="cookies"),ts:d,url:p!=null?p:window.location.href,referrer:O.referrer,...O.utm,screen:{w:window.screen.width,h:window.screen.height}});},he=(o,l)=>{typeof o!="string"||!o||(ee(o,l),$()&&(P==null||P.event(o)),N.onEvent(o));},N=St(Ft({host:f,apiKey:c,track:ee,personId:()=>$()?T:void 0,canStore:()=>h()==="cookies",auto:r("onboarding",true)})),Me=false;N.subscribe(()=>{Me||!N.view()||H||(Me=true,L("flows","__mrrocketFlows").then(o=>o.mountFlows(N,pe)).catch(()=>{Me=false,K("The cancel flow and onboarding dialogs did not load. Check that sdk-flows.js is served next to sdk.js.");}));});let we=(o,l)=>{if(!$())return;let d=`${window.location.pathname}|${o}`;k.has(d)||(k.add(d),he("$exposure",{experiment:o,variant:l}));},Ge=()=>{let o=Ct(E,window.location.href,j(),W);return o!=null&&o.to?(Ae(true),window.location.replace(o.to),true):(o!=null&&o.experiment&&we(o.experiment,o.variant),false)},se=()=>{if(!E)return;let o=document.querySelectorAll("[data-ck-text]");if(!o.length)return;let l=bt(E,j(),W),d=new Set;o.forEach(p=>{var J,Y;let C=p.dataset.ckText;if(!C)return;d.add(C),p.dataset.ckDefault===void 0&&(p.dataset.ckDefault=(J=p.textContent)!=null?J:"");let S=(Y=l[C])!=null?Y:p.dataset.ckDefault;p.textContent!==S&&(p.textContent=S);});for(let p of E.experiments)p.variants.some(C=>{var S;return Object.keys((S=C.changes)!=null?S:{}).some(J=>d.has(J))})&&we(p.key,ce(p.key,E,j(),W));},Je=()=>{var o,l;return (l=(o=E==null?void 0:E.referral)==null?void 0:o.cookieDays)!=null?l:60},ze=()=>x==="always"?h()!=="off":x==="consent"&&h()==="cookies",Qe=null,Le=false,Te=()=>{if(!B||H)return;if(x==="off"||h()==="off"){Pt(),(x==="off"||Le)&&Fe();return}let o=window.location.href;Qe!==o&&(Qe=o,At({search:window.location.search,param:A,store:ze(),days:Je(),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 C;return (C=p==null?void 0:p.clickId)!=null?C:null}):void 0}));},jt=()=>{let o=ze(),l=We();o&&l?ve(l,Je()):!o&&Le&&Fe(),Le=o;},Ze=0,et=false,tt=()=>{var p,C;let o=$()&&ge&&!!(E!=null&&E.replay)&&!!c;if(o===et)return;et=o;let l=++Ze;if(!o){P==null||P.stop(true),P=null;return}let d=(C=(p=E==null?void 0:E.replay)==null?void 0:p.sampleRate)!=null?C:.1;L("replay","__mrrocketReplay").then(S=>S.startReplay({host:f,apiKey:c,sessionId:Ye(h()==="cookies"),distinctId:me(),identified:!!T,sampleRate:d,warn:K})).then(S=>{l!==Ze?S==null||S.stop(true):P=S;}).catch(()=>K("Session recording could not start (the recorder did not load)."));},Ne=()=>{!Pe||!$()||i===window.location.pathname||(i=window.location.pathname,he("$pageview",{path:window.location.pathname}));},q=null,nt=()=>{let o=q;g&&o&&o.max>0&&ee("$scroll",{depth:o.max,docH:o.docH,vw:window.innerWidth,vh:window.innerHeight},Date.now(),o.url),q=null;},ie=()=>{var C,S;if(!g||!$()||H)return;let o=document.documentElement,l=Math.max(o.scrollHeight,(S=(C=document.body)==null?void 0:C.scrollHeight)!=null?S:0),d=gt(),p=window.location.href;(q==null?void 0:q.url)!==p?q={url:p,max:d,docH:l}:d>q.max&&(q={url:p,max:d,docH:l});},rt=()=>{let o=window.location.pathname;o!==u&&(u=o,!(B&&Ge())&&(nt(),Xe(),P==null||P.page(o),U==null||U.crumb("navigation",o),Ne(),Te(),window.setTimeout(()=>{ie(),se();},0)));},ot=()=>{let o=h(),l=t;t=o,l==="cookies"&&o!=="cookies"&&(fe(z),fe(re)),o==="off"&&(m.length=0,O.session=void 0),l==="cookies"&&o!=="cookies"&&It(),oe=qe(o),jt(),Te(),tt(),Ne(),ie();},ke={track:he,identify:(o,l)=>{if(typeof o!="string"||!o)return;let d=me();T=o,ee("$identify",{...l,id:o,...d&&d!==o?{previousId:d}:{}}),P==null||P.identify(o),h()==="cookies"&&Oe(z,o,Be),G={...l,id:o},se(),B&&N.refresh();},reset:()=>{T=void 0,G=void 0,k.clear(),h()==="cookies"&&(fe(z),fe(re)),O.id=void 0,O.session=void 0,oe=qe(h()),se(),B&&N.refresh();},captureError:o=>U==null?void 0:U.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"){K(`setConsent: "${String(l)}" is not a consent mode. Use "cookieless", "cookies" or "off".`);return}l==="off"&&(m.length=0),l&&(Z=l),typeof d=="boolean"&&(ge=d),ot(),B&&N.refresh();},getFlag:o=>je(o,E,j(),{...G})!==false,getFlagVariant:o=>{let l=je(o,E,j(),{...G});return typeof l=="string"?l:null},getVariant:o=>{let l=ce(o,E,j(),W);return (E||W[o])&&we(o,l),l},ready:o=>{typeof o=="function"&&(B?window.setTimeout(()=>o(ke),0):_.push(o));},getDistinctId:j,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=$()?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 L("push","__mrrocketPush").then(C=>C.subscribeWebPush({host:f,apiKey:c,distinctId:l,permission:p},o))},unsubscribe:()=>L("push","__mrrocketPush").then(o=>o.unsubscribeWebPush({host:f,apiKey:c,distinctId:T}))},version:xe};Xe(),ot();let te=$e.mrrocket,Kt=(ct=te==null?void 0:te.q)!=null?ct:[],Ue=te&&typeof te=="object"?te:{};Object.assign(Ue,ke,{__loaded:true}),delete Ue.q,$e.mrrocket=Ue;for(let[o,l]of Kt){let d=ke[o];if(typeof d=="function")try{d(...Array.from(l!=null?l:[]));}catch(p){console.error(p);}}Pe=true,Ne(),R&&c&&!H&&(U=Rt({host:f,apiKey:c,release:y,context:()=>{var o;return {send:$(),distinctId:me(),sessionId:(o=O.session)==null?void 0:o.id}},warn:K}),U.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 rt(),p};}window.addEventListener("popstate",rt);let Vt=new be;document.addEventListener("click",o=>{var S;let l=o.target instanceof Element?o.target.closest("[data-ck-goal]"):null;if(l!=null&&l.dataset.ckGoal&&he(l.dataset.ckGoal,{text:(S=l.textContent)==null?void 0:S.trim().slice(0,80)}),!$())return;let d=pt(o);if(!d)return;let p=Vt.push(d.x,d.y,Date.now());if((d.label||d.selector)&&(U==null||U.crumb("click",d.label||d.selector)),P==null||P.click(d,p),!g)return;let C={x:d.x,y:d.y,vw:d.vw,vh:d.vh,docH:d.docH,selector:d.selector,label:d.label,dead:!d.interactive};ee("$click",C),p&&ee("$rageclick",C);});let De=0;window.addEventListener("scroll",()=>{De||(De=window.requestAnimationFrame(()=>{De=0,ie();}));},{passive:true}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>ie()):ie(),window.setInterval(()=>Ae(),2e3),window.addEventListener("pagehide",()=>{nt(),Ae(true);});let He=()=>{if(B=true,Ge())return;let o=xt(E,X);o&&we(o.experiment,o.variant),document.documentElement.classList.remove("ck-hide"),Te(),tt(),N.setConfig(E),N.refresh(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",se):se();for(let l of _.splice(0))try{l(ke);}catch(d){console.error(d);}};c?fetch(`${f}/api/sdk/config?key=${encodeURIComponent(c)}`).then(o=>(o.ok||K(`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)&&(E=o),He();}).catch(()=>{K(`Could not reach ${f||"this origin"}. Check data-api-host. The page keeps its own texts and flags stay off.`),He();}):He();},Ht;typeof window!="undefined"&&typeof document!="undefined"&&!((Ht=$e.mrrocket)!=null&&Ht.__loaded)&&xn();
2
+ })();
package/dist/browser.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * that the build keeps one client chunk: server components import these as client references, while the plain
4
4
  * helpers (`core`, `server`, `proxy`) stay free of the directive.
5
5
  */
6
- export { CockpitProvider, Experiment, Text, useCockpit, useFlag, useFlagVariant, useVariant, type CockpitProviderProps } from "./client.js";
6
+ export { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, usePush, useVariant, type CockpitProviderProps } from "./client.js";
7
7
  export { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from "./feedback.js";
8
8
  export { Survey } from "./survey.js";
9
9
  export type { CockpitUser } from "./context.js";
package/dist/browser.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/browser.ts
4
- import { CockpitProvider, Experiment, Text, useCockpit, useFlag, useFlagVariant, useVariant } from "./client.js";
4
+ import { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, usePush, useVariant } from "./client.js";
5
5
  import { FeedbackBoard, FeedbackWidget, useFeedback } from "./feedback.js";
6
6
  import { Survey } from "./survey.js";
7
7
  import {
@@ -17,10 +17,12 @@ export {
17
17
  Text,
18
18
  CSS as WIDGET_CSS,
19
19
  createApi,
20
+ useCancelFlow,
20
21
  useCockpit,
21
22
  useFeedback,
22
23
  useFlag,
23
24
  useFlagVariant,
25
+ usePush,
24
26
  useStyles,
25
27
  useVariant
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/browser.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Everything of the SDK that needs the browser or React state. It is its own file with the \"use client\" directive so\n * that the build keeps one client chunk: server components import these as client references, while the plain\n * helpers (`core`, `server`, `proxy`) stay free of the directive.\n */\nexport { CockpitProvider, Experiment, Text, useCockpit, useFlag, useFlagVariant, useVariant, type CockpitProviderProps } from \"./client\";\nexport { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from \"./feedback\";\nexport { Survey } from \"./survey\";\nexport type { CockpitUser } from \"./context\";\nexport {\n type ChangelogEntry,\n type FeedbackBoardInfo,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n createApi,\n} from \"./api\";\nexport { CSS as WIDGET_CSS, useStyles } from \"./styles\";\n"],"mappings":";;;AAOA,SAAS,iBAAiB,YAAY,MAAM,YAAY,SAAS,gBAAgB,kBAA6C;AAC9H,SAAS,eAAe,gBAAgB,mBAAsE;AAC9G,SAAS,cAAc;AAEvB;AAAA,EAYI;AAAA,OACG;AACP,SAAgB,KAAY,iBAAiB;","names":[]}
1
+ {"version":3,"sources":["../src/browser.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Everything of the SDK that needs the browser or React state. It is its own file with the \"use client\" directive so\n * that the build keeps one client chunk: server components import these as client references, while the plain\n * helpers (`core`, `server`, `proxy`) stay free of the directive.\n */\nexport { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, usePush, useVariant, type CockpitProviderProps } from \"./client\";\nexport { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from \"./feedback\";\nexport { Survey } from \"./survey\";\nexport type { CockpitUser } from \"./context\";\nexport {\n type ChangelogEntry,\n type FeedbackBoardInfo,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n createApi,\n} from \"./api\";\nexport { CSS as WIDGET_CSS, useStyles } from \"./styles\";\n"],"mappings":";;;AAOA,SAAS,iBAAiB,YAAY,MAAM,eAAe,YAAY,SAAS,gBAAgB,SAAS,kBAA6C;AACtJ,SAAS,eAAe,gBAAgB,mBAAsE;AAC9G,SAAS,cAAc;AAEvB;AAAA,EAYI;AAAA,OACG;AACP,SAAgB,KAAY,iBAAiB;","names":[]}
package/dist/client.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type AttributionMode } from "./referral.js";
3
3
  import { type CockpitConfig, type ConsentChoice, type ConsentMode, type VariantId } from "./core.js";
4
+ import type { PushResult, WebPushOptions } from "./push-web.js";
5
+ import { type CancelFlowOptions, type CancelFlowResult } from "./flows.js";
6
+ import type { FlowsTheme } from "./flows-ui.js";
4
7
  export interface CockpitProviderProps {
5
8
  /** The product's public key from Cockpit › Settings › SDK. Safe in the browser. Default: `NEXT_PUBLIC_MRROCKET_KEY`. */
6
9
  apiKey?: string;
@@ -48,6 +51,13 @@ export interface CockpitProviderProps {
48
51
  attribution?: AttributionMode;
49
52
  /** The query parameter of direct partner links, default `ref` (`https://your.site/?ref=maya`). */
50
53
  referralParam?: string;
54
+ /**
55
+ * Onboarding flows start on their own when the visitor does their trigger (default true). False: only
56
+ * `useCockpit().startOnboarding()` starts one. In-app messages and `openCancelFlow` work either way.
57
+ */
58
+ onboarding?: boolean;
59
+ /** The look of the cancel flow, onboarding and message dialogs: `{ theme: "dark", accent: "#0f766e", className }`. */
60
+ appearance?: FlowsTheme;
51
61
  children: ReactNode;
52
62
  }
53
63
  /**
@@ -57,7 +67,7 @@ export interface CockpitProviderProps {
57
67
  * `preview` forces variants for this render, for example from the `ck_preview` search param on the server,
58
68
  * so a Cockpit preview never flickers. Without it the provider reads the param itself after the first render.
59
69
  */
60
- 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, children, }: CockpitProviderProps) => import("react").JSX.Element;
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;
61
71
  /**
62
72
  * `track`, `identify`, `captureError`, the consent mode, the replay consent and their setter, the visitor id and whether
63
73
  * the experiments and flags have loaded. `setConsent("cookies")` sets the mode, `setConsent({ replay: true })` the
@@ -73,6 +83,21 @@ export declare const useCockpit: () => {
73
83
  consent: ConsentMode;
74
84
  replay: boolean;
75
85
  setConsent: (choice: ConsentChoice) => void;
86
+ openCancelFlow: (options?: CancelFlowOptions) => Promise<CancelFlowResult>;
87
+ startOnboarding: (id?: string) => boolean;
88
+ };
89
+ /**
90
+ * Push notifications from your Lifecycle journeys for the signed-in person (`identify` first). Call `subscribe()` from
91
+ * a click: it asks the browser's permission and signs this browser up (your site hosts `/mrrocket-sw.js`). Call
92
+ * `unsubscribe()` on sign-out. Resolves with `{ status: "subscribed" | "denied" | "not-asked" | "unsupported" |
93
+ * "not-signed-in" | "error" }`.
94
+ *
95
+ * const push = usePush();
96
+ * <button onClick={() => push.subscribe()}>Turn on notifications</button>
97
+ */
98
+ export declare const usePush: () => {
99
+ subscribe: (options?: WebPushOptions) => Promise<PushResult>;
100
+ unsubscribe: () => Promise<boolean>;
76
101
  };
77
102
  /**
78
103
  * A feature flag from MRRocket › Build › Feature flags: true while it is on for this visitor (its audience and rollout
@@ -101,3 +126,13 @@ export declare const Text: ({ id, children }: {
101
126
  id: string;
102
127
  children: string;
103
128
  }) => import("react").JSX.Element;
129
+ /**
130
+ * The cancel flow you built in MRRocket › Churn › Cancel flow. Call `open` from your Cancel button: it shows the flow
131
+ * and resolves with what the customer did. MRRocket never changes the subscription; your `onCancel` and `onSave` do.
132
+ *
133
+ * const cancelFlow = useCancelFlow();
134
+ * <button onClick={() => cancelFlow.open({ customer: "business", onCancel: cancelSubscription, onSave: applyOffer })}>
135
+ */
136
+ export declare const useCancelFlow: () => {
137
+ open: (options?: CancelFlowOptions) => Promise<CancelFlowResult>;
138
+ };