@sheeptrack/web 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ - Consent: `consent.get()` (choice per category, `null` before any choice) and `consent.onChange(cb)`, plus a `pt:consent` event on `window`, so tools loaded from npm or in JS follow the SheepTrack choice.
6
+ - Consent banner: floating "Manage my cookies" button once a choice exists; `data-pt-consent-open` on any element reopens the preferences and hides that button.
7
+ - Consent banner takes the page font, colours and first button; `--pt-primary`, `--pt-primary-text`, `--pt-bg`, `--pt-text`, `--pt-border`, `--pt-font`, `--pt-radius` on `:root` (dashboard colours win).
8
+ - Fixes: consent proof survives navigation and offline, replay waits for it; refused replay chunks kept, contenteditable text masked; `regions: 'eu'` covers EU/EEA time zones outside `Europe/*`; in-memory queue capped, replay paused in a hidden tab; `pt_flags` cache read, no client-side UA parsing.
9
+
10
+ ## 0.1.0
11
+
12
+ - First npm release.
package/README.md CHANGED
@@ -20,11 +20,15 @@ track('plan_selected', { plan: 'pro' });
20
20
  identify('user-42', { plan: 'pro' }); // needs the "personalization" consent
21
21
  flags.isEnabled('new-checkout'); flags.getVariant('pricing'); flags.onChange(() => render());
22
22
  consent.open(); // "Manage my cookies" link
23
+ consent.get(); // { analytics: true, ... } or null before any choice
24
+ consent.onChange((c) => c?.marketing && loadPixel()); // also window event 'pt:consent'
23
25
  ```
24
26
  Mark clickable elements with `data-pt-event="name"`. Mask text with `data-pt-mask`, block an element from replay with `data-pt-block`. Third-party scripts: `<script type="text/plain" data-pt-category="marketing" src="...">` run only after the matching consent.
25
27
 
26
28
  Without consent nothing is written to storage (no cookie, localStorage or sessionStorage); the anonymous id lives in memory.
27
29
 
30
+ Consent banner: once a choice exists, a floating "Manage my cookies" button lets visitors withdraw at any time. Put `data-pt-consent-open` on your own footer link to replace it (`<a href="#" data-pt-consent-open>Manage my cookies</a>`). The banner takes the page font and colours; set `--pt-primary`, `--pt-primary-text`, `--pt-bg`, `--pt-text`, `--pt-border`, `--pt-font`, `--pt-radius` on `:root` to match the brand exactly (dashboard colours win). The floating button, `data-pt-consent-open`, `--pt-*`, `consent.get` and `consent.onChange` need 0.2.0 or later.
31
+
28
32
  ## Astro
29
33
 
30
34
  ```astro
package/dist/consent.js CHANGED
@@ -1,18 +1,21 @@
1
- var T=`
1
+ var j=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box}
4
4
  .w{position:fixed;z-index:2147483647;left:0;right:0;bottom:0;display:flex;justify-content:center;padding:12px;pointer-events:none;
5
- --bg:hsl(210 20% 98%);--fg:hsl(200 18% 20%);--p:#004D40;--pf:#fff;--bd:hsl(200 12% 80%);font-family:var(--f,system-ui,-apple-system,"Segoe UI",sans-serif)}
6
- .w.d{--bg:hsl(200 18% 16%);--fg:hsl(210 20% 94%);--p:hsl(162 65% 42%);--pf:hsl(200 18% 10%);--bd:hsl(200 12% 30%)}
5
+ --bg:var(--pt-bg,var(--abg,hsl(210 20% 98%)));--fg:var(--pt-text,var(--afg,hsl(200 18% 20%)));--p:var(--pt-primary,var(--ap,#004D40));--pf:var(--pt-primary-text,var(--apf,#fff));
6
+ --bd:var(--pt-border,color-mix(in srgb,var(--fg) 22%,var(--bg)));--r:var(--pt-radius,var(--ar,8px));font-family:var(--pt-font,var(--f,system-ui,-apple-system,"Segoe UI",sans-serif))}
7
+ .w.d{--abg:hsl(200 18% 16%);--afg:hsl(210 20% 94%);--ap:hsl(162 65% 42%);--apf:hsl(200 18% 10%)}
7
8
  .w.bl{justify-content:flex-start}
8
9
  .w.c{inset:0;align-items:center;background:rgb(0 0 0/.45);pointer-events:auto}
9
- .b{pointer-events:auto;width:100%;max-width:720px;max-height:90vh;overflow:auto;background:var(--bg);color:var(--fg);border:1px solid var(--bd);border-radius:12px;padding:20px;box-shadow:0 8px 32px rgb(0 0 0/.2);font-size:15px;line-height:1.5}
10
+ .b{pointer-events:auto;width:100%;max-width:720px;max-height:90vh;overflow:auto;background:var(--bg);color:var(--fg);border:1px solid var(--bd);border-radius:min(calc(var(--r) * 1.5),16px);padding:20px;box-shadow:0 8px 32px rgb(0 0 0/.2);font-size:15px;line-height:1.5}
10
11
  .bl .b{max-width:380px}
11
12
  h2{margin:0 0 8px;font-size:17px;font-weight:600}
12
13
  p{margin:0 0 16px}
13
14
  img{height:28px;margin-bottom:8px;display:block}
14
15
  .r{display:flex;gap:8px;flex-wrap:wrap}
15
- button{flex:1 1 140px;min-height:44px;padding:10px 16px;font:inherit;font-weight:600;cursor:pointer;color:var(--pf);background:var(--p);border:2px solid var(--p);border-radius:8px}
16
+ button{flex:1 1 140px;min-height:44px;padding:10px 16px;font:inherit;font-weight:600;cursor:pointer;color:var(--pf);background:var(--p);border:2px solid var(--p);border-radius:var(--r)}
17
+ .m{position:fixed;z-index:2147483646;left:16px;bottom:16px;flex:none;width:44px;height:44px;min-height:0;padding:10px;border-radius:50%;box-shadow:0 2px 10px rgb(0 0 0/.25)}
18
+ .m svg{display:block;width:100%;height:100%}
16
19
  button:hover{filter:brightness(1.1)}
17
20
  button:focus-visible,input:focus-visible,.b:focus-visible{outline:3px solid var(--fg);outline-offset:2px}
18
21
  .l{margin:0 0 16px;padding:0;list-style:none;border-top:1px solid var(--bd)}
@@ -20,4 +23,4 @@ button:focus-visible,input:focus-visible,.b:focus-visible{outline:3px solid var(
20
23
  .l input{width:22px;height:22px;margin:2px 0 0;accent-color:var(--p);flex:none}
21
24
  .l label{display:block;cursor:pointer}.l small{display:block;opacity:.85}
22
25
  .l[hidden]{display:none}
23
- `,j=a=>/^#[0-9a-f]{6}$/i.test(a||""),z=a=>[1,3,5].map(d=>{let p=parseInt(a.slice(d,d+2),16)/255;return p<=.03928?p/12.92:((p+.055)/1.055)**2.4}).reduce((d,p,g)=>d+p*[.2126,.7152,.0722][g],0);function H({cfg:a,current:d,onChoice:p,onClose:g}){let L=(navigator.language||"en").slice(0,2),r=a.texts[L]??a.texts.en??Object.values(a.texts)[0];if(!r)return()=>{};let n=a.style,f=n.position??"bottom",b=document.createElement("div");b.setAttribute("data-pt-consent","");let h=b.attachShadow({mode:"open"}),s=(e,o,t,u)=>{let m=document.createElement(e);return o&&(m.className=o),t!==void 0&&(m.textContent=t),u?.appendChild(m),m},l=s("div","w"+(f==="center"?" c":f==="bottom-left"?" bl":""));!n.primary&&!n.background&&!n.text&&matchMedia("(prefers-color-scheme: dark)").matches&&l.classList.add("d"),n.primary&&(l.style.setProperty("--p",n.primary),l.style.setProperty("--pf",j(n.primary)&&z(n.primary)>.4?"#000":"#fff")),n.background&&l.style.setProperty("--bg",n.background),n.text&&l.style.setProperty("--fg",n.text),n.font&&l.style.setProperty("--f",n.font);let i=s("div","b",void 0,l);if(i.setAttribute("role","dialog"),i.setAttribute("aria-modal",String(f==="center")),i.setAttribute("aria-labelledby","pt-t"),i.setAttribute("aria-describedby","pt-d"),i.tabIndex=-1,n.logo_url&&/^(https:|\/)/.test(n.logo_url)){let e=s("img","",void 0,i);e.src=n.logo_url,e.alt=""}s("h2","",r.title,i).id="pt-t",s("p","",r.body,i).id="pt-d";let w=[],c=s("ul","l",void 0,i);c.hidden=!d;for(let e of a.categories){let o=s("li","",void 0,c),t=s("input","",void 0,o);t.type="checkbox",t.id="pt-"+e.key,t.disabled=e.required||e.key==="necessary",t.checked=t.disabled||!!d?.[e.key];let u=s("label","",void 0,o);u.htmlFor=t.id,s("strong","",r.categories[e.key]?.label??e.key,u),s("small","",r.categories[e.key]?.description??"",u),w.push([e.key,t])}let M=s("div","r",void 0,i),x=(e,o)=>{let t=s("button","",e,M);return t.type="button",t.onclick=o,t},y=e=>k(Object.fromEntries(w.map(([o,t])=>[o,e===null?t.checked:e||t.disabled])));x(r.reject_all,()=>y(!1));let v=x(d?r.save:r.customize,()=>{if(!c.hidden)return y(null);c.hidden=!1,v.textContent=r.save,v.setAttribute("aria-expanded","true")});v.setAttribute("aria-expanded",String(!c.hidden)),x(r.accept_all,()=>y(!0));let S=document.activeElement,E=matchMedia("(prefers-reduced-motion: reduce)").matches,A=!1;function k(e){if(A)return;A=!0,e&&p(e);let o=()=>{b.remove(),S?.focus?.(),g()};if(E||!i.animate)return o();i.animate({opacity:[1,0]},{duration:150,easing:"ease-in"}).onfinish=o}i.addEventListener("keydown",e=>{if(e.key==="Escape")return k();if(e.key!=="Tab"||f!=="center")return;let o=[...h.querySelectorAll("input:not(:disabled),button")],t=o[(o.indexOf(h.activeElement)+(e.shiftKey?-1:1)+o.length)%o.length];e.preventDefault(),t.focus()}),h.append(s("style","",T),l);let C=()=>{document.body.appendChild(b),i.focus({preventScroll:!0}),!E&&i.animate&&i.animate({opacity:[0,1],transform:["translateY(16px)","translateY(0)"]},{duration:250,easing:"ease-out"})};return document.body?C():document.addEventListener("DOMContentLoaded",C,{once:!0}),()=>k()}export{H as show};
26
+ `,b=t=>{let o=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t||"");if(o)return o.slice(1).map(r=>parseInt(r,16));let e=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/.exec(t||"");return!e||e[4]!==void 0&&parseFloat(e[4])/(e[4].endsWith("%")?100:1)<.5?null:e.slice(1,4).map(Number)},H=t=>t.map(o=>{let e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}).reduce((o,e,r)=>o+e*[.2126,.7152,.0722][r],0),E=t=>{let o=b(t);return o&&H(o)>.4?"#000":"#fff"};function z(){let t=s=>s?getComputedStyle(s):null,o=t(document.body),e={};if(!o)return e;o.fontFamily&&(e["--f"]=o.fontFamily);let r=[document.body,document.documentElement].map(s=>t(s).backgroundColor).find(s=>b(s));r&&b(o.color)&&(e["--abg"]=r,e["--afg"]=o.color);let n=[...document.querySelectorAll("button:not([disabled]),[role=button],a[class*=btn],a[class*=button],input[type=submit]")].find(s=>!s.closest("[data-pt-consent],[data-pt-consent-manage]")&&b(t(s).backgroundColor)&&t(s).display!=="none"&&t(s).visibility!=="hidden"),l=n?t(n).backgroundColor:t(document.querySelector("a[href]"))?.color;l&&b(l)&&(e["--ap"]=l,e["--apf"]=n&&b(t(n).color)?t(n).color:E(l));let a=n&&parseFloat(t(n).borderTopLeftRadius);return a!==void 0&&a>=0&&a<40&&(e["--ar"]=a+"px"),e}var c=(t,o,e,r)=>{let n=document.createElement(t);return o&&(n.className=o),e!==void 0&&(n.textContent=e),r?.appendChild(n),n},A=t=>t.texts[(navigator.language||"en").slice(0,2)]??t.texts.en??Object.values(t.texts)[0];function S(t,o,e){let r=t.style,n=document.createElement("div");n.setAttribute(o,"");let l=n.attachShadow({mode:"open"}),a=c("div",e),s=z();for(let[f,p]of Object.entries(s))a.style.setProperty(f,p);return!s["--abg"]&&!r.primary&&!r.background&&!r.text&&matchMedia("(prefers-color-scheme: dark)").matches&&a.classList.add("d"),r.primary&&(a.style.setProperty("--p",r.primary),a.style.setProperty("--pf",E(r.primary))),r.background&&a.style.setProperty("--bg",r.background),r.text&&a.style.setProperty("--fg",r.text),r.font&&a.style.setProperty("--f",r.font),l.append(c("style","",j),a),{host:n,root:l,wrap:a}}var L=(t,o)=>{let e=()=>{document.body.appendChild(t),o?.()};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})};function N(t,o){let e=A(t);if(!e)return()=>{};let{host:r,wrap:n}=S(t,"data-pt-consent-manage","w"),l=c("button","m",void 0,n);l.type="button",l.setAttribute("aria-label",e.manage),l.title=e.manage;let a="http://www.w3.org/2000/svg",s=document.createElementNS(a,"svg"),f=document.createElementNS(a,"path");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),f.setAttribute("d","M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5Zm-3.5 8a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm-5 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"),s.append(f),l.append(s),l.onclick=o,L(r),()=>r.remove()}function P({cfg:t,current:o,onChoice:e,onClose:r}){let n=A(t);if(!n)return()=>{};let l=t.style.position??"bottom",{host:a,root:s,wrap:f}=S(t,"data-pt-consent","w"+(l==="center"?" c":l==="bottom-left"?" bl":"")),p=c("div","b",void 0,f);if(p.setAttribute("role","dialog"),p.setAttribute("aria-modal",String(l==="center")),p.setAttribute("aria-labelledby","pt-t"),p.setAttribute("aria-describedby","pt-d"),p.tabIndex=-1,t.style.logo_url&&/^(https:|\/)/.test(t.style.logo_url)){let i=c("img","",void 0,p);i.src=t.style.logo_url,i.alt=""}c("h2","",n.title,p).id="pt-t",c("p","",n.body,p).id="pt-d";let k=[],m=c("ul","l",void 0,p);m.hidden=!o;for(let i of t.categories){let u=c("li","",void 0,m),d=c("input","",void 0,u);d.type="checkbox",d.id="pt-"+i.key,d.disabled=i.required||i.key==="necessary",d.checked=d.disabled||!!o?.[i.key];let v=c("label","",void 0,u);v.htmlFor=d.id,c("strong","",n.categories[i.key]?.label??i.key,v),c("small","",n.categories[i.key]?.description??"",v),k.push([i.key,d])}let M=c("div","r",void 0,p),g=(i,u)=>{let d=c("button","",i,M);return d.type="button",d.onclick=u,d},x=i=>y(Object.fromEntries(k.map(([u,d])=>[u,i===null?d.checked:i||d.disabled])));g(n.reject_all,()=>x(!1));let h=g(o?n.save:n.customize,()=>{if(!m.hidden)return x(null);m.hidden=!1,h.textContent=n.save,h.setAttribute("aria-expanded","true")});h.setAttribute("aria-expanded",String(!m.hidden)),g(n.accept_all,()=>x(!0));let T=document.activeElement,w=matchMedia("(prefers-reduced-motion: reduce)").matches,C=!1;function y(i){if(C)return;C=!0,i&&e(i);let u=!1,d=()=>{u||(u=!0,a.remove(),T?.focus?.(),r())};if(w||!p.animate)return d();p.animate({opacity:[1,0]},{duration:150,easing:"ease-in"}).onfinish=d,setTimeout(d,300)}return p.addEventListener("keydown",i=>{if(i.key==="Escape")return y();if(i.key!=="Tab"||l!=="center")return;let u=[...s.querySelectorAll("input:not(:disabled),button")],d=u[(u.indexOf(s.activeElement)+(i.shiftKey?-1:1)+u.length)%u.length];i.preventDefault(),d.focus()}),L(a,()=>{p.focus({preventScroll:!0}),!w&&p.animate&&p.animate({opacity:[0,1],transform:["translateY(16px)","translateY(0)"]},{duration:250,easing:"ease-out"})}),()=>y()}export{N as manage,z as pageTheme,b as rgb,P as show};
@@ -1,18 +1,21 @@
1
- var T=`
1
+ var j=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box}
4
4
  .w{position:fixed;z-index:2147483647;left:0;right:0;bottom:0;display:flex;justify-content:center;padding:12px;pointer-events:none;
5
- --bg:hsl(210 20% 98%);--fg:hsl(200 18% 20%);--p:#004D40;--pf:#fff;--bd:hsl(200 12% 80%);font-family:var(--f,system-ui,-apple-system,"Segoe UI",sans-serif)}
6
- .w.d{--bg:hsl(200 18% 16%);--fg:hsl(210 20% 94%);--p:hsl(162 65% 42%);--pf:hsl(200 18% 10%);--bd:hsl(200 12% 30%)}
5
+ --bg:var(--pt-bg,var(--abg,hsl(210 20% 98%)));--fg:var(--pt-text,var(--afg,hsl(200 18% 20%)));--p:var(--pt-primary,var(--ap,#004D40));--pf:var(--pt-primary-text,var(--apf,#fff));
6
+ --bd:var(--pt-border,color-mix(in srgb,var(--fg) 22%,var(--bg)));--r:var(--pt-radius,var(--ar,8px));font-family:var(--pt-font,var(--f,system-ui,-apple-system,"Segoe UI",sans-serif))}
7
+ .w.d{--abg:hsl(200 18% 16%);--afg:hsl(210 20% 94%);--ap:hsl(162 65% 42%);--apf:hsl(200 18% 10%)}
7
8
  .w.bl{justify-content:flex-start}
8
9
  .w.c{inset:0;align-items:center;background:rgb(0 0 0/.45);pointer-events:auto}
9
- .b{pointer-events:auto;width:100%;max-width:720px;max-height:90vh;overflow:auto;background:var(--bg);color:var(--fg);border:1px solid var(--bd);border-radius:12px;padding:20px;box-shadow:0 8px 32px rgb(0 0 0/.2);font-size:15px;line-height:1.5}
10
+ .b{pointer-events:auto;width:100%;max-width:720px;max-height:90vh;overflow:auto;background:var(--bg);color:var(--fg);border:1px solid var(--bd);border-radius:min(calc(var(--r) * 1.5),16px);padding:20px;box-shadow:0 8px 32px rgb(0 0 0/.2);font-size:15px;line-height:1.5}
10
11
  .bl .b{max-width:380px}
11
12
  h2{margin:0 0 8px;font-size:17px;font-weight:600}
12
13
  p{margin:0 0 16px}
13
14
  img{height:28px;margin-bottom:8px;display:block}
14
15
  .r{display:flex;gap:8px;flex-wrap:wrap}
15
- button{flex:1 1 140px;min-height:44px;padding:10px 16px;font:inherit;font-weight:600;cursor:pointer;color:var(--pf);background:var(--p);border:2px solid var(--p);border-radius:8px}
16
+ button{flex:1 1 140px;min-height:44px;padding:10px 16px;font:inherit;font-weight:600;cursor:pointer;color:var(--pf);background:var(--p);border:2px solid var(--p);border-radius:var(--r)}
17
+ .m{position:fixed;z-index:2147483646;left:16px;bottom:16px;flex:none;width:44px;height:44px;min-height:0;padding:10px;border-radius:50%;box-shadow:0 2px 10px rgb(0 0 0/.25)}
18
+ .m svg{display:block;width:100%;height:100%}
16
19
  button:hover{filter:brightness(1.1)}
17
20
  button:focus-visible,input:focus-visible,.b:focus-visible{outline:3px solid var(--fg);outline-offset:2px}
18
21
  .l{margin:0 0 16px;padding:0;list-style:none;border-top:1px solid var(--bd)}
@@ -20,4 +23,4 @@ button:focus-visible,input:focus-visible,.b:focus-visible{outline:3px solid var(
20
23
  .l input{width:22px;height:22px;margin:2px 0 0;accent-color:var(--p);flex:none}
21
24
  .l label{display:block;cursor:pointer}.l small{display:block;opacity:.85}
22
25
  .l[hidden]{display:none}
23
- `,j=a=>/^#[0-9a-f]{6}$/i.test(a||""),z=a=>[1,3,5].map(d=>{let p=parseInt(a.slice(d,d+2),16)/255;return p<=.03928?p/12.92:((p+.055)/1.055)**2.4}).reduce((d,p,g)=>d+p*[.2126,.7152,.0722][g],0);function H({cfg:a,current:d,onChoice:p,onClose:g}){let L=(navigator.language||"en").slice(0,2),r=a.texts[L]??a.texts.en??Object.values(a.texts)[0];if(!r)return()=>{};let n=a.style,f=n.position??"bottom",b=document.createElement("div");b.setAttribute("data-pt-consent","");let h=b.attachShadow({mode:"open"}),s=(e,o,t,u)=>{let m=document.createElement(e);return o&&(m.className=o),t!==void 0&&(m.textContent=t),u?.appendChild(m),m},l=s("div","w"+(f==="center"?" c":f==="bottom-left"?" bl":""));!n.primary&&!n.background&&!n.text&&matchMedia("(prefers-color-scheme: dark)").matches&&l.classList.add("d"),n.primary&&(l.style.setProperty("--p",n.primary),l.style.setProperty("--pf",j(n.primary)&&z(n.primary)>.4?"#000":"#fff")),n.background&&l.style.setProperty("--bg",n.background),n.text&&l.style.setProperty("--fg",n.text),n.font&&l.style.setProperty("--f",n.font);let i=s("div","b",void 0,l);if(i.setAttribute("role","dialog"),i.setAttribute("aria-modal",String(f==="center")),i.setAttribute("aria-labelledby","pt-t"),i.setAttribute("aria-describedby","pt-d"),i.tabIndex=-1,n.logo_url&&/^(https:|\/)/.test(n.logo_url)){let e=s("img","",void 0,i);e.src=n.logo_url,e.alt=""}s("h2","",r.title,i).id="pt-t",s("p","",r.body,i).id="pt-d";let w=[],c=s("ul","l",void 0,i);c.hidden=!d;for(let e of a.categories){let o=s("li","",void 0,c),t=s("input","",void 0,o);t.type="checkbox",t.id="pt-"+e.key,t.disabled=e.required||e.key==="necessary",t.checked=t.disabled||!!d?.[e.key];let u=s("label","",void 0,o);u.htmlFor=t.id,s("strong","",r.categories[e.key]?.label??e.key,u),s("small","",r.categories[e.key]?.description??"",u),w.push([e.key,t])}let M=s("div","r",void 0,i),x=(e,o)=>{let t=s("button","",e,M);return t.type="button",t.onclick=o,t},y=e=>k(Object.fromEntries(w.map(([o,t])=>[o,e===null?t.checked:e||t.disabled])));x(r.reject_all,()=>y(!1));let v=x(d?r.save:r.customize,()=>{if(!c.hidden)return y(null);c.hidden=!1,v.textContent=r.save,v.setAttribute("aria-expanded","true")});v.setAttribute("aria-expanded",String(!c.hidden)),x(r.accept_all,()=>y(!0));let S=document.activeElement,E=matchMedia("(prefers-reduced-motion: reduce)").matches,A=!1;function k(e){if(A)return;A=!0,e&&p(e);let o=()=>{b.remove(),S?.focus?.(),g()};if(E||!i.animate)return o();i.animate({opacity:[1,0]},{duration:150,easing:"ease-in"}).onfinish=o}i.addEventListener("keydown",e=>{if(e.key==="Escape")return k();if(e.key!=="Tab"||f!=="center")return;let o=[...h.querySelectorAll("input:not(:disabled),button")],t=o[(o.indexOf(h.activeElement)+(e.shiftKey?-1:1)+o.length)%o.length];e.preventDefault(),t.focus()}),h.append(s("style","",T),l);let C=()=>{document.body.appendChild(b),i.focus({preventScroll:!0}),!E&&i.animate&&i.animate({opacity:[0,1],transform:["translateY(16px)","translateY(0)"]},{duration:250,easing:"ease-out"})};return document.body?C():document.addEventListener("DOMContentLoaded",C,{once:!0}),()=>k()}export{H as show};
26
+ `,b=t=>{let o=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t||"");if(o)return o.slice(1).map(r=>parseInt(r,16));let e=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/.exec(t||"");return!e||e[4]!==void 0&&parseFloat(e[4])/(e[4].endsWith("%")?100:1)<.5?null:e.slice(1,4).map(Number)},H=t=>t.map(o=>{let e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}).reduce((o,e,r)=>o+e*[.2126,.7152,.0722][r],0),E=t=>{let o=b(t);return o&&H(o)>.4?"#000":"#fff"};function z(){let t=s=>s?getComputedStyle(s):null,o=t(document.body),e={};if(!o)return e;o.fontFamily&&(e["--f"]=o.fontFamily);let r=[document.body,document.documentElement].map(s=>t(s).backgroundColor).find(s=>b(s));r&&b(o.color)&&(e["--abg"]=r,e["--afg"]=o.color);let n=[...document.querySelectorAll("button:not([disabled]),[role=button],a[class*=btn],a[class*=button],input[type=submit]")].find(s=>!s.closest("[data-pt-consent],[data-pt-consent-manage]")&&b(t(s).backgroundColor)&&t(s).display!=="none"&&t(s).visibility!=="hidden"),l=n?t(n).backgroundColor:t(document.querySelector("a[href]"))?.color;l&&b(l)&&(e["--ap"]=l,e["--apf"]=n&&b(t(n).color)?t(n).color:E(l));let a=n&&parseFloat(t(n).borderTopLeftRadius);return a!==void 0&&a>=0&&a<40&&(e["--ar"]=a+"px"),e}var c=(t,o,e,r)=>{let n=document.createElement(t);return o&&(n.className=o),e!==void 0&&(n.textContent=e),r?.appendChild(n),n},A=t=>t.texts[(navigator.language||"en").slice(0,2)]??t.texts.en??Object.values(t.texts)[0];function S(t,o,e){let r=t.style,n=document.createElement("div");n.setAttribute(o,"");let l=n.attachShadow({mode:"open"}),a=c("div",e),s=z();for(let[f,p]of Object.entries(s))a.style.setProperty(f,p);return!s["--abg"]&&!r.primary&&!r.background&&!r.text&&matchMedia("(prefers-color-scheme: dark)").matches&&a.classList.add("d"),r.primary&&(a.style.setProperty("--p",r.primary),a.style.setProperty("--pf",E(r.primary))),r.background&&a.style.setProperty("--bg",r.background),r.text&&a.style.setProperty("--fg",r.text),r.font&&a.style.setProperty("--f",r.font),l.append(c("style","",j),a),{host:n,root:l,wrap:a}}var L=(t,o)=>{let e=()=>{document.body.appendChild(t),o?.()};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})};function N(t,o){let e=A(t);if(!e)return()=>{};let{host:r,wrap:n}=S(t,"data-pt-consent-manage","w"),l=c("button","m",void 0,n);l.type="button",l.setAttribute("aria-label",e.manage),l.title=e.manage;let a="http://www.w3.org/2000/svg",s=document.createElementNS(a,"svg"),f=document.createElementNS(a,"path");return s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("fill","currentColor"),s.setAttribute("aria-hidden","true"),f.setAttribute("d","M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5Zm-3.5 8a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm-5 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"),s.append(f),l.append(s),l.onclick=o,L(r),()=>r.remove()}function P({cfg:t,current:o,onChoice:e,onClose:r}){let n=A(t);if(!n)return()=>{};let l=t.style.position??"bottom",{host:a,root:s,wrap:f}=S(t,"data-pt-consent","w"+(l==="center"?" c":l==="bottom-left"?" bl":"")),p=c("div","b",void 0,f);if(p.setAttribute("role","dialog"),p.setAttribute("aria-modal",String(l==="center")),p.setAttribute("aria-labelledby","pt-t"),p.setAttribute("aria-describedby","pt-d"),p.tabIndex=-1,t.style.logo_url&&/^(https:|\/)/.test(t.style.logo_url)){let i=c("img","",void 0,p);i.src=t.style.logo_url,i.alt=""}c("h2","",n.title,p).id="pt-t",c("p","",n.body,p).id="pt-d";let k=[],m=c("ul","l",void 0,p);m.hidden=!o;for(let i of t.categories){let u=c("li","",void 0,m),d=c("input","",void 0,u);d.type="checkbox",d.id="pt-"+i.key,d.disabled=i.required||i.key==="necessary",d.checked=d.disabled||!!o?.[i.key];let v=c("label","",void 0,u);v.htmlFor=d.id,c("strong","",n.categories[i.key]?.label??i.key,v),c("small","",n.categories[i.key]?.description??"",v),k.push([i.key,d])}let M=c("div","r",void 0,p),g=(i,u)=>{let d=c("button","",i,M);return d.type="button",d.onclick=u,d},x=i=>y(Object.fromEntries(k.map(([u,d])=>[u,i===null?d.checked:i||d.disabled])));g(n.reject_all,()=>x(!1));let h=g(o?n.save:n.customize,()=>{if(!m.hidden)return x(null);m.hidden=!1,h.textContent=n.save,h.setAttribute("aria-expanded","true")});h.setAttribute("aria-expanded",String(!m.hidden)),g(n.accept_all,()=>x(!0));let T=document.activeElement,w=matchMedia("(prefers-reduced-motion: reduce)").matches,C=!1;function y(i){if(C)return;C=!0,i&&e(i);let u=!1,d=()=>{u||(u=!0,a.remove(),T?.focus?.(),r())};if(w||!p.animate)return d();p.animate({opacity:[1,0]},{duration:150,easing:"ease-in"}).onfinish=d,setTimeout(d,300)}return p.addEventListener("keydown",i=>{if(i.key==="Escape")return y();if(i.key!=="Tab"||l!=="center")return;let u=[...s.querySelectorAll("input:not(:disabled),button")],d=u[(u.indexOf(s.activeElement)+(i.shiftKey?-1:1)+u.length)%u.length];i.preventDefault(),d.focus()}),L(a,()=>{p.focus({preventScroll:!0}),!w&&p.animate&&p.animate({opacity:[0,1],transform:["translateY(16px)","translateY(0)"]},{duration:250,easing:"ease-out"})}),()=>y()}export{N as manage,z as pageTheme,b as rgb,P as show};
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var pe=["token","access_token","id_token","refresh_token","password","pwd","secret","key","api_key","apikey","auth","authorization","code","session","sid","email","mail","signature","sig","otp"];function M(){let e=crypto.getRandomValues(new Uint8Array(16)),n=Date.now();for(let r=5;r>=0;r--)e[r]=n%256,n=Math.floor(n/256);e[6]=e[6]&15|112,e[8]=e[8]&63|128;let t=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var z=(e,n)=>String(e??"").slice(0,n);function x(e,n){try{let t=new URL(e,location.href);t.username=t.password="";for(let r of[...t.searchParams.keys()])n.includes(r.toLowerCase())&&t.searchParams.delete(r);return/^#\/[^?=&]*$/.test(t.hash)||(t.hash=""),t.href}catch{return""}}function ge(e){let n=[];for(let t=e,r=0;t&&t!==document.documentElement&&r<4;t=t.parentElement,r++){let o=t.tagName.toLowerCase();if(t.id&&/^[\w-]{1,40}$/.test(t.id)&&!/\d{3,}/.test(t.id)){n.unshift(`${o}#${t.id}`);break}let i=[...t.classList].find(a=>/^[a-zA-Z][\w-]{0,30}$/.test(a)&&!/\d{3,}/.test(a));i&&(o+=`.${i}`),n.unshift(o)}return n.join(" > ").slice(0,120)}async function G(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"text/plain"});let n=await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"))).blob();return new Blob([n],{type:"text/plain"})}function me(){let e=navigator.userAgent,n=a=>e.match(a)?.[1],t=/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/iPhone|iPad|iPod/.test(e)?"iOS":/Mac OS X/.test(e)?"macOS":/CrOS/.test(e)?"ChromeOS":/Linux/.test(e)?"Linux":"Other",r=n(/(?:Windows NT|Android|OS|Mac OS X) ([\d._]+)/)?.replace(/_/g,"."),[o,i]=/Edg\//.test(e)?["Edge",/Edg\/([\d.]+)/]:/OPR\//.test(e)?["Opera",/OPR\/([\d.]+)/]:/Firefox\//.test(e)?["Firefox",/Firefox\/([\d.]+)/]:/Chrome\//.test(e)?["Chrome",/Chrome\/([\d.]+)/]:/Safari\//.test(e)?["Safari",/Version\/([\d.]+)/]:["Other",/$^/];return{os:t,os_version:r,browser:o,browser_version:n(i)}}var Xe="a[href],button,summary,[role=button],[data-pt-event]",We=1e3,Ve=500;function he(e,n,t){let r,o=0,i=[],a=!1;return n(()=>{a=!0}),addEventListener("pagehide",()=>{a=!0}),addEventListener("click",s=>{let c=s.target;if(!s.isTrusted||!(c instanceof Element)||o++>=Ve||c.closest("[data-pt-block]"))return;let l=ge(c),f=Math.round(s.clientX+scrollX),d=Math.round(s.clientY+scrollY),u=document.documentElement,_=c.closest("[data-pt-event]")?.getAttribute("data-pt-event"),b={selector:l,x:f,y:d,doc_w:u.scrollWidth,doc_h:u.scrollHeight};if(e("$autocapture",{...b,tag:c.tagName.toLowerCase(),pt_event:_||void 0}),_&&e(_.slice(0,100),{selector:l}),!t.frustration)return;let v=s.timeStamp||Date.now();r=b,setTimeout(()=>{r===b&&(r=void 0)},We),i=i.filter(Q=>v-Q.t<1e3&&Math.hypot(Q.x-f,Q.y-d)<30),i.push({t:v,x:f,y:d}),i.length>=3&&(e("$rageclick",{...b,count:i.length}),i=[]);let U=c.closest(Xe);if(!U||U.closest("a[target=_blank],a[download]")||/^(mailto|tel):/.test(U.getAttribute("href")||""))return;a=!1;let H=!1,B=new MutationObserver(()=>{H=!0});B.observe(u,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),setTimeout(()=>{B.disconnect(),!H&&!a&&e("$deadclick",b)},1e3)},{capture:!0,passive:!0}),s=>{r&&(e("$errorclick",{...r,...s}),r=void 0)}}function ve(e,n){let t=0,r=!1,o=0,i=()=>{let c=document.documentElement,l=Math.max(c.scrollHeight,1);return Math.min(100,Math.round((scrollY+c.clientHeight)/l*100))},a=()=>{o=0,t=Math.max(t,i())},s=()=>{if(r)return;r=!0;let c=document.documentElement;e("$scroll_depth",{max_pct:Math.max(t,i()),doc_h:c.scrollHeight,viewport_h:c.clientHeight})};addEventListener("scroll",()=>{o||(o=requestAnimationFrame(a))},{passive:!0}),addEventListener("pagehide",s),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&s()),n(()=>{s(),r=!1,t=0})}function Z(e,n=0){let t=new TextEncoder().encode(e),r=n>>>0,o=3432918353,i=461845907,a=t.length&-4;for(let c=0;c<a;c+=4){let l=t[c]|t[c+1]<<8|t[c+2]<<16|t[c+3]<<24;l=Math.imul(l,o),l=l<<15|l>>>17,l=Math.imul(l,i),r^=l,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196|0}let s=0;switch(t.length&3){case 3:s^=t[a+2]<<16;case 2:s^=t[a+1]<<8;case 1:s^=t[a],s=Math.imul(s,o),s=s<<15|s>>>17,s=Math.imul(s,i),r^=s}return r^=t.length,r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>0}function ye(e,n,t=""){return Z(`${e}.${n}${t}`)/4294967296}function we(e,n){let t=e.split(/[.+-]/).map(o=>parseInt(o,10)||0),r=n.split(/[.+-]/).map(o=>parseInt(o,10)||0);for(let o=0;o<3;o++)if((t[o]??0)!==(r[o]??0))return(t[o]??0)-(r[o]??0);return 0}function Ke(e,n){let t=n[e.property];if(e.operator==="is_set")return t!=null;if(e.operator==="is_not_set")return t==null;if(t==null)return!1;let r=String(t),o=Array.isArray(e.value)?e.value.map(String):[String(e.value)];switch(e.operator){case"eq":return r===String(e.value);case"neq":return r!==String(e.value);case"in":return o.includes(r);case"nin":return!o.includes(r);case"contains":return r.toLowerCase().includes(String(e.value).toLowerCase());case"ncontains":return!r.toLowerCase().includes(String(e.value).toLowerCase());case"regex":if(r.length>1024)return!1;try{return new RegExp(String(e.value)).test(r)}catch{return!1}case"gt":return Number(t)>Number(e.value);case"gte":return Number(t)>=Number(e.value);case"lt":return Number(t)<Number(e.value);case"lte":return Number(t)<=Number(e.value);case"semver_gte":return we(r,String(e.value))>=0;case"semver_lt":return we(r,String(e.value))<0}}function Se(e,n,t={}){if(!e.active)return{enabled:!1};let o=(e.groups.length?e.groups:[{conditions:[]}]).find(s=>s.conditions.every(c=>Ke(c,t)));if(!o)return{enabled:!1};let i=o.rollout_percent??e.rollout_percent;if(ye(e.key,n)*100>=i)return{enabled:!1};if(!e.variants?.length)return be({enabled:!0},e.payloads?.true);let a=o.variant;if(!a){let s=ye(e.key,n,".variant")*100,c=0;a=e.variants[e.variants.length-1].key;for(let l of e.variants)if(c+=l.weight,s<c){a=l.key;break}}return be({enabled:!0,variant:a},e.payloads?.[a])}function be(e,n){return n===void 0?e:{...e,payload:n}}var Ye=/\/(\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?=[/?#]|$)/gi;function _e(e,n,t){if(n.errors){let r=0,o=(i,a,s="",c)=>{if(r++>=20)return;let l=s.split(`
2
- `).slice(1,4).map(v=>v.replace(/[:\d]+\)?$/,"")).join("|"),f=Z([i,a.replace(/\d+/g,"N"),l].join("|")).toString(16),d=n.drop().map(v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),u=v=>v.replace(/https?:\/\/[^\s)'"]+/gi,U=>{let[,H,B=""]=U.match(/^(.*?)(:\d+:\d+)?$/);return x(H,n.drop())+B}),_=v=>d?v.replace(new RegExp(`([?&;#]|%3[bf]|%26|%23)(${d})(=|%3d)(?:%(?!26|23|3b)[0-9a-f]{2}|(?!:\\d+:\\d+(?:$|[\\s)]))[^&\\s)'"#%])*`,"gi"),"$1$2$3[redacted]"):v,b=v=>_(u(_(v)));n.onError?.({fingerprint:f,type:i}),e("$error",{message:z(b(a),500),stack:z(b(s),4e3),type:i,fingerprint:f,release:n.release,filename:c&&x(c,n.drop())})};addEventListener("error",i=>o(i.error?.name||"Error",i.message,i.error?.stack,i.filename)),addEventListener("unhandledrejection",i=>{let a=i.reason;o(a?.name||"UnhandledRejection",a?.message??String(a),a?.stack)})}if(n.network){let r=0,o=(s,c,l,f)=>{if(r>=200||c.startsWith(n.host))return;r++;let d=x(c,n.drop()).replace(Ye,"/:id");e("$network",{method:s,url:d,status:l,duration_ms:Math.round(performance.now()-f)})},i=window.fetch;i&&(window.fetch=function(s,c){let l=performance.now(),f=(c?.method||(s instanceof Request?s.method:"GET")).toUpperCase(),d=typeof s=="string"?s:s instanceof URL?s.href:s.url;return i.call(this,s,c).then(u=>(o(f,d,u.status,l),u),u=>{throw o(f,d,0,l),u})});let a=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(s,c,...l){let f=performance.now();return this.addEventListener("loadend",()=>o(s.toUpperCase(),String(c),this.status,f)),a.call(this,s,c,...l)}}if(n.console){let r=0;for(let o of n.console){let i=console[o];console[o]=(...a)=>{i.apply(console,a),r++<100&&e("$console",{level:o,message:z(a.map(s=>typeof s=="string"?s:s instanceof Error?s.message:Qe(s)).join(" "),500)})}}}n.vitals&&typeof PerformanceObserver<"u"&&Ge(e,t)}var Qe=e=>{try{return JSON.stringify(e)}catch{return String(e)}};function Ge(e,n){let t,r=0,o=0,i=0,a=0,s=[],c=0,l=(u,_,b={})=>{try{new PerformanceObserver(v=>v.getEntries().forEach(_)).observe({type:u,buffered:!0,...b})}catch{}};l("largest-contentful-paint",u=>{t=u.startTime}),l("layout-shift",u=>{u.hadRecentInput||(o&&u.startTime-i<1e3&&u.startTime-a<5e3?o+=u.value:(o=u.value,a=u.startTime),i=u.startTime,r=Math.max(r,o))});let f=new Set;l("event",u=>{u.interactionId&&(f.has(u.interactionId)||(f.add(u.interactionId),c++),s=[...s,u.duration].sort((_,b)=>b-_).slice(0,10))},{durationThreshold:40});let d=()=>{let u={lcp:t&&Math.round(t),inp:s.length?s[Math.min(9,Math.floor(c/50))]:void 0,cls:r?+r.toFixed(4):void 0};(u.lcp!==void 0||u.inp!==void 0||u.cls!==void 0)&&e("$web_vitals",u),r=o=0,s=[],c=0,f.clear(),t=void 0};addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&d()),n(d)}function ke(e){let n=[],t={},r=0,o=new Set,i=new Set;try{let l=e.load();l&&(n=JSON.parse(l))}catch{}async function a(l=!0){let f=await e.json(`/i/v1/flags/definitions?key=${encodeURIComponent(e.key)}${e.env?`&env=${e.env}`:""}`);if(f?.flags&&(n=f.flags,e.save(JSON.stringify(n))),l&&e.canPost()){let d=await e.json("/i/v1/flags",{api_key:e.key,distinct_id:e.id(),environment:e.env,properties:e.props()});d?.flags&&(t=d.flags)}o.forEach(d=>d())}function s(){r||typeof setInterval>"u"||(a(),r=setInterval(()=>document.visibilityState!=="hidden"&&a(!1),e.pollMs))}function c(l){s();let f=n.find(u=>u.key===l),d=f?Se(f,e.id(),e.props()):t[l];return d?(i.has(l)||(i.add(l),e.capture("$feature_flag_called",{flag:l,enabled:d.enabled,variant:d.variant})),d):{enabled:!1}}return{isEnabled:l=>c(l).enabled,getVariant:l=>c(l).variant,getPayload:l=>c(l).payload,reload:()=>a(),onChange(l){return s(),o.add(l),()=>{o.delete(l)}},reset(){i.clear(),r&&a()}}}var Re=["necessary","analytics","replay","personalization","marketing"],$e=30*6e4,Ze=2e3,et=15e5,tt=100,m,L="",R="",se,X=!1,g=null,p=null,S="anon_"+M(),k=null,$={},T=null,w,h=[],N=[],ie=Promise.resolve(),ee=0,te=0,ne=!1,ce=!1,Ie,re,Me="",Pe={},ue=!1,y=null,oe=!1,W=!1,J=!1,C,ae=[],Oe,Le=new Promise(e=>{Oe=e}),O=e=>{try{return JSON.parse(localStorage.getItem(e)||"null")}catch{return null}},E=(e,n)=>{try{n==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(n))}catch{}},V=(e,n)=>{I()==="full"&&E(e,n)},q=e=>!!e&&!!g&&Date.now()<e.t+(g.consent?.validity_days??180)*864e5&&(!g.consent||e.v===g.consent.version),A=e=>e==="necessary"||q(p)&&p.c[e]===!0,Te=()=>g?.consent?.respect_gpc!==!1&&(navigator.globalPrivacyControl===!0||navigator.doNotTrack==="1"),Ne=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone.startsWith("Europe/")}catch{return!0}};function I(){if(q(p))return p.c.analytics?"full":"off";if(!g)return"wait";let e=g.consent;return!e?.enabled||e.exempt_analytics||e.regions==="eu"&&!Ne()?"mem":Te()?"off":"wait"}function Ae(){let e=q(p)?p:null;return{id:e?.id,version:e?.v,categories:e?e.c:I()==="mem"?{analytics:!0}:{}}}var nt=e=>new Promise(n=>{let t=setTimeout(n,e);Ie=()=>{clearTimeout(t),n()}});async function Y(e,n,t=1/0){for(let r=0;;r++){let o=null;try{o=await fetch(e,{credentials:"omit",...n})}catch{}if(o&&o.status!==429&&o.status<500||r+1>=t)return o;await nt(Math.max((Number(o?.headers.get("retry-after"))||0)*1e3,Math.min(3e5,1e3*2**r)*(.5+Math.random()/2)))}}var qe=async(e,n,t)=>(await Y(R+e,{method:"POST",body:await G(n)},t))?.status??0,rt=async(e,n)=>{let t=await Y(R+e,n?{method:"POST",body:JSON.stringify(n),headers:{"content-type":"text/plain"}}:{},1).catch(()=>null);return t?.ok?t.json().catch(()=>null):null},F=()=>[...pe,...m?.sensitiveParams??[],...g?.replay.mask.ignore_url_params??[]].map(e=>e.toLowerCase());function Ue(){let e=document.documentElement;return{url:x(location.href,F()),referrer:Me,lang:navigator.language,viewport_w:e.clientWidth,viewport_h:e.clientHeight,platform:"web",...me(),app_version:m.release,...Pe}}function D(){let e=Date.now();return(!w||e-w.t>$e)&&(w={id:M(),t:e,u:Math.random(),v:Math.random(),n:0}),w.t=e,w.id}function P(e,n={},t={}){let r={id:M(),event:e,ts:new Date().toISOString(),distinct_id:k??S,session_id:D(),environment:se,props:{...Ue(),...n},...t};k&&(r.identified=!0),De(r),st(e)}function De(e){let n=I();if(n==="wait"||!g){N.push(e),N.length>tt&&N.shift();return}if(n==="off")return;let t=g.sampling;D(),!(w.u>=t.sessions||e.event!=="$identify"&&Math.random()>=t.events)&&(h.push(e),h.length>=m.batchSize?Ce():ee||(ee=setTimeout(()=>{ee=0,Ce()},m.batchInterval)),te||(te=setTimeout(()=>{te=0,j()},1e3)))}function j(){if(I()!=="full")return;let e=h.slice(-Ze);for(;e.length>1&&JSON.stringify(e).length>et;)e=e.slice(e.length>>1);E("pt_q",e.length?e:null),E("pt_s",w)}var Fe=e=>JSON.stringify({api_key:L,sent_at:new Date().toISOString(),consent:Ae(),batch:e}),K=()=>I()==="mem"||I()==="full";async function Ce(){if(!(ne||!h.length||!K())){ne=!0;try{for(await ie;h.length&&K();){let e=h.slice(0,100);await Y(R+"/i/v1/events",{method:"POST",body:await G(Fe(e))});let n=new Set(e);h=h.filter(t=>!n.has(t)),j()}}finally{ne=!1}}}function Ee(){for(j(),y?.beacon();h.length&&K();){let e=h.slice(0,25);if(!navigator.sendBeacon?.(R+"/i/v1/events",new Blob([Fe(e)],{type:"text/plain"})))break;let n=new Set(e);h=h.filter(t=>!n.has(t))}j()}function ot(){let e=S;S=O("pt_id")||S,E("pt_id",S);let n=O("pt_s");n&&Date.now()-n.t<$e&&(w=n);let t=O("pt_u");t&&A("personalization")&&(k=t.u,$=t.tr);let r=O("pt_q");Array.isArray(r)&&(h=[...r,...h]);for(let o of[...h,...N])o.distinct_id===e&&(o.distinct_id=S);ce=!0}function je(){for(let e of["pt_id","pt_s","pt_q","pt_u","pt_cfg","pt_flags"])E(e,null);h=[],N=[],k=null,$={},w=void 0,ce=!1,S="anon_"+M()}function He(){let e=I();e==="full"&&!ce&&ot(),e!=="wait"&&(N.splice(0).forEach(n=>e!=="off"&&De(n)),Be(),fe(),T&&A("personalization")&&(at(...T),T=null),j())}function de(e,n){let t=q(p)?p.c:null,r={...e,necessary:!0};p={id:p?.id||M(),v:g?.consent?.version??0,t:Date.now(),c:r},E("pt_consent",p),r.analytics?r.personalization||(k=null,$={},T=null,E("pt_u",null)):je(),r.replay||(y?.stop(),y=null);let o=n==="withdraw"||!!t&&Re.some(a=>t[a]&&!r[a]),i={api_key:L,consent_id:p.id,policy_version:p.v,choices:r,source:o?"withdraw":n};ie=ie.then(()=>qe("/i/v1/consent",JSON.stringify(i),6)),He(),C?.reset()}function Be(){!g||!ue||document.querySelectorAll('script[type="text/plain"][data-pt-category]').forEach(e=>{if(!A(e.dataset.ptCategory))return;let n=document.createElement("script");for(let t of Array.from(e.attributes))t.name!=="type"&&t.name!=="data-pt-category"&&n.setAttribute(t.name,t.value);n.text=e.text,e.replaceWith(n)})}async function ze(e){let n=g?.consent;if(!(!n||J)){J=!0;try{(await import("./consent.js")).show({cfg:n,current:e&&p?p.c:null,onChoice:r=>de(r,"banner"),onClose:()=>{J=!1}})}catch{J=!1}}}function xe(){He();let e=g?.consent;e?.enabled&&!q(p)&&!Te()&&(e.regions==="always"||Ne())&&ze(!1)}function fe(e=!1){let n=g?.replay;!ue||y||oe||W||!n?.enabled||!A("replay")||typeof document>"u"||(D(),!(w.u>=g.sampling.sessions||!(e||w.v<n.sample_rate))&&(oe=!0,import("./replay.js").then(t=>{if(y||!A("replay"))return;let r=(o,i)=>`/i/v1/replay/${o}/chunks?key=${encodeURIComponent(L)}&seq=${i}`;y=t.start({cfg:n,dropParams:F(),sessionId:D,distinctId:()=>k??S,consent:Ae,nextSeq:()=>(D(),w.n++),post:async(o,i,a)=>{let s=await qe(r(o,i),a,6);return s===403&&(y?.stop(),y=null,W=!0),s},beacon:(o,i,a)=>navigator.sendBeacon?.(R+r(o,i),new Blob([a],{type:"text/plain"}))})}).catch(()=>{}).finally(()=>{oe=!1})))}function st(e){let n=g?.replay.triggers;if(!n||y)return;let t=location.pathname+location.search,r=o=>new RegExp("^"+o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$").test(t);(e==="$error"&&n.on_error||n.events?.includes(e)||e==="$pageview"&&n.url_patterns?.some(r))&&fe(!0)}function le(){let e=x(location.href,F());if(e===re)return;Me=re??x(document.referrer,F()),re=e;let n=new URL(location.href).searchParams;for(let[t,r]of n)t.startsWith("utm_")&&(Pe[t]=r.slice(0,200));P("$pageview")}function it(){for(let e of["pushState","replaceState"]){let n=history[e];history[e]=function(...t){ae.forEach(o=>o());let r=n.apply(this,t);return le(),r}}addEventListener("popstate",()=>{ae.forEach(e=>e()),le()})}function kt(e,n){if(X||typeof window>"u")return;X=!0,L=e,m={batchInterval:5e3,batchSize:20,...n},R=m.host.replace(/\/$/,""),se=m.environment,p=O("pt_consent"),C=ke({key:L,env:se,pollMs:m.flagsPollMs??3e4,capture:P,json:rt,id:()=>k??S,props:()=>({...Ue(),$platform:"web",...$}),load:()=>I()==="full"?localStorage.getItem("pt_flags"):null,save:i=>V("pt_flags",JSON.parse(i)),canPost:()=>K()});let t=p?.c.analytics?O("pt_cfg"):null;t&&t.consent?.version===p.v&&(g=t,xe()),(async()=>{let i=await Y(`${R}/i/v1/config?key=${encodeURIComponent(L)}`,{},5),a=i?.ok?await i.json().catch(()=>null):null;a&&(g=a,ue=!0,V("pt_cfg",a),q(p)||(y?.stop(),y=null),xe(),Oe())})();let r=i=>{ae.push(i)};m.autocapture!==!1&&ve(P,r),addEventListener("online",()=>Ie?.()),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&Ee()),addEventListener("pagehide",Ee),m.pageviews!==!1&&(it(),le());let o=m.autocapture!==!1?he(P,r,{frustration:m.frustration!==!1}):void 0;_e(P,{errors:m.errors!==!1,network:m.network!==!1,vitals:m.vitals!==!1,console:m.console===void 0?["warn","error"]:m.console,drop:F,host:R,release:m.release,onError:o},r),document.addEventListener("DOMContentLoaded",Be)}function Ct(e,n){X&&P(e,n)}function at(e,n={}){if(!X)return;if(!A("personalization")){T=[e,n];return}let t=S;k=e,$={...$,...n},V("pt_u",{u:k,tr:$}),P("$identify",{},{anonymous_id:t,traits:n}),C?.reset()}function Et(){k=null,$={},T=null,w=void 0,S="anon_"+M(),E("pt_u",null),E("pt_s",null),V("pt_id",S),C?.reset()}var Je=e=>g?e():void Le.then(e),xt=e=>Je(()=>de(Object.fromEntries((e??Re).map(n=>[n,!0])),"api")),Rt=()=>{je(),Je(()=>de({},"withdraw"))},$t={open:()=>Le.then(()=>ze(!0))},It={pause(){W=!0,y?.pause()},resume(){W=!1,y?y.resume():fe()}},Mt={isEnabled:e=>C?.isEnabled(e)??!1,getVariant:e=>C?.getVariant(e),getPayload:e=>C?.getPayload(e),reload:()=>C?.reload(),onChange:e=>C?.onChange(e)??(()=>{})};export{$t as consent,Mt as flags,at as identify,kt as init,xt as optIn,Rt as optOut,It as replay,Et as reset,Ct as track};
1
+ var ve=["token","access_token","id_token","refresh_token","password","pwd","secret","key","api_key","apikey","auth","authorization","code","session","sid","email","mail","signature","sig","otp"];function P(){let e=crypto.getRandomValues(new Uint8Array(16)),t=Date.now();for(let r=5;r>=0;r--)e[r]=t%256,t=Math.floor(t/256);e[6]=e[6]&15|112,e[8]=e[8]&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var V=(e,t)=>String(e??"").slice(0,t);function R(e,t){try{let n=new URL(e,location.href);n.username=n.password="";for(let r of[...n.searchParams.keys()])t.includes(r.toLowerCase())&&n.searchParams.delete(r);return/^#\/[^?=&]*$/.test(n.hash)||(n.hash=""),n.href}catch{return""}}function ye(e){let t=[];for(let n=e,r=0;n&&n!==document.documentElement&&r<4;n=n.parentElement,r++){let o=n.tagName.toLowerCase();if(n.id&&/^[\w-]{1,40}$/.test(n.id)&&!/\d{3,}/.test(n.id)){t.unshift(`${o}#${n.id}`);break}let i=[...n.classList].find(a=>/^[a-zA-Z][\w-]{0,30}$/.test(a)&&!/\d{3,}/.test(a));i&&(o+=`.${i}`),t.unshift(o)}return t.join(" > ").slice(0,120)}async function ee(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"text/plain"});let t=await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"))).blob();return new Blob([t],{type:"text/plain"})}var et="a[href],button,summary,[role=button],[data-pt-event]",tt=1e3,nt=500;function we(e,t,n){let r,o=0,i=[],a=!1;return t(()=>{a=!0}),addEventListener("pagehide",()=>{a=!0}),addEventListener("click",s=>{let c=s.target;if(!s.isTrusted||!(c instanceof Element)||o++>=nt||c.closest("[data-pt-block]"))return;let l=ye(c),p=Math.round(s.clientX+scrollX),f=Math.round(s.clientY+scrollY),u=document.documentElement,C=c.closest("[data-pt-event]")?.getAttribute("data-pt-event"),b={selector:l,x:p,y:f,doc_w:u.scrollWidth,doc_h:u.scrollHeight};if(e("$autocapture",{...b,tag:c.tagName.toLowerCase(),pt_event:C||void 0}),C&&e(C.slice(0,100),{selector:l}),!n.frustration)return;let y=s.timeStamp||Date.now();r=b,setTimeout(()=>{r===b&&(r=void 0)},tt),i=i.filter(Z=>y-Z.t<1e3&&Math.hypot(Z.x-p,Z.y-f)<30),i.push({t:y,x:p,y:f}),i.length>=3&&(e("$rageclick",{...b,count:i.length}),i=[]);let D=c.closest(et);if(!D||D.closest("a[target=_blank],a[download]")||/^(mailto|tel):/.test(D.getAttribute("href")||""))return;a=!1;let J=!1,X=new MutationObserver(()=>{J=!0});X.observe(u,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),setTimeout(()=>{X.disconnect(),!J&&!a&&e("$deadclick",b)},1e3)},{capture:!0,passive:!0}),s=>{r&&(e("$errorclick",{...r,...s}),r=void 0)}}function be(e,t){let n=0,r=!1,o=0,i=()=>{let c=document.documentElement,l=Math.max(c.scrollHeight,1);return Math.min(100,Math.round((scrollY+c.clientHeight)/l*100))},a=()=>{o=0,n=Math.max(n,i())},s=()=>{if(r)return;r=!0;let c=document.documentElement;e("$scroll_depth",{max_pct:Math.max(n,i()),doc_h:c.scrollHeight,viewport_h:c.clientHeight})};addEventListener("scroll",()=>{o||(o=requestAnimationFrame(a))},{passive:!0}),addEventListener("pagehide",s),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&s()),t(()=>{s(),r=!1,n=0})}function te(e,t=0){let n=new TextEncoder().encode(e),r=t>>>0,o=3432918353,i=461845907,a=n.length&-4;for(let c=0;c<a;c+=4){let l=n[c]|n[c+1]<<8|n[c+2]<<16|n[c+3]<<24;l=Math.imul(l,o),l=l<<15|l>>>17,l=Math.imul(l,i),r^=l,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196|0}let s=0;switch(n.length&3){case 3:s^=n[a+2]<<16;case 2:s^=n[a+1]<<8;case 1:s^=n[a],s=Math.imul(s,o),s=s<<15|s>>>17,s=Math.imul(s,i),r^=s}return r^=n.length,r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>0}function Se(e,t,n=""){return te(`${e}.${t}${n}`)/4294967296}function Ce(e,t){let n=e.split(/[.+-]/).map(o=>parseInt(o,10)||0),r=t.split(/[.+-]/).map(o=>parseInt(o,10)||0);for(let o=0;o<3;o++)if((n[o]??0)!==(r[o]??0))return(n[o]??0)-(r[o]??0);return 0}function rt(e,t){let n=t[e.property];if(e.operator==="is_set")return n!=null;if(e.operator==="is_not_set")return n==null;if(n==null)return!1;let r=String(n),o=Array.isArray(e.value)?e.value.map(String):[String(e.value)];switch(e.operator){case"eq":return r===String(e.value);case"neq":return r!==String(e.value);case"in":return o.includes(r);case"nin":return!o.includes(r);case"contains":return r.toLowerCase().includes(String(e.value).toLowerCase());case"ncontains":return!r.toLowerCase().includes(String(e.value).toLowerCase());case"regex":if(r.length>1024)return!1;try{return new RegExp(String(e.value)).test(r)}catch{return!1}case"gt":return Number(n)>Number(e.value);case"gte":return Number(n)>=Number(e.value);case"lt":return Number(n)<Number(e.value);case"lte":return Number(n)<=Number(e.value);case"semver_gte":return Ce(r,String(e.value))>=0;case"semver_lt":return Ce(r,String(e.value))<0}}function _e(e,t,n={}){if(!e.active)return{enabled:!1};let o=(e.groups.length?e.groups:[{conditions:[]}]).find(s=>s.conditions.every(c=>rt(c,n)));if(!o)return{enabled:!1};let i=o.rollout_percent??e.rollout_percent;if(Se(e.key,t)*100>=i)return{enabled:!1};if(!e.variants?.length)return ke({enabled:!0},e.payloads?.true);let a=o.variant;if(!a){let s=Se(e.key,t,".variant")*100,c=0;a=e.variants[e.variants.length-1].key;for(let l of e.variants)if(c+=l.weight,s<c){a=l.key;break}}return ke({enabled:!0,variant:a},e.payloads?.[a])}function ke(e,t){return t===void 0?e:{...e,payload:t}}var ot=/\/(\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?=[/?#]|$)/gi;function Ee(e,t,n){if(t.errors){let r=0,o=(i,a,s="",c)=>{if(r++>=20)return;let l=s.split(`
2
+ `).slice(1,4).map(y=>y.replace(/[:\d]+\)?$/,"")).join("|"),p=te([i,a.replace(/\d+/g,"N"),l].join("|")).toString(16),f=t.drop().map(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),u=y=>y.replace(/https?:\/\/[^\s)'"]+/gi,D=>{let[,J,X=""]=D.match(/^(.*?)(:\d+:\d+)?$/);return R(J,t.drop())+X}),C=y=>f?y.replace(new RegExp(`([?&;#]|%3[bf]|%26|%23)(${f})(=|%3d)(?:%(?!26|23|3b)[0-9a-f]{2}|(?!:\\d+:\\d+(?:$|[\\s)]))[^&\\s)'"#%])*`,"gi"),"$1$2$3[redacted]"):y,b=y=>C(u(C(y)));t.onError?.({fingerprint:p,type:i}),e("$error",{message:V(b(a),500),stack:V(b(s),4e3),type:i,fingerprint:p,release:t.release,filename:c&&R(c,t.drop())})};addEventListener("error",i=>o(i.error?.name||"Error",i.message,i.error?.stack,i.filename)),addEventListener("unhandledrejection",i=>{let a=i.reason;o(a?.name||"UnhandledRejection",a?.message??String(a),a?.stack)})}if(t.network){let r=0,o=(s,c,l,p)=>{if(r>=200||c.startsWith(t.host))return;r++;let f=R(c,t.drop()).replace(ot,"/:id");e("$network",{method:s,url:f,status:l,duration_ms:Math.round(performance.now()-p)})},i=window.fetch;i&&(window.fetch=function(s,c){let l=performance.now(),p=(c?.method||(s instanceof Request?s.method:"GET")).toUpperCase(),f=typeof s=="string"?s:s instanceof URL?s.href:s.url;return i.call(this,s,c).then(u=>(o(p,f,u.status,l),u),u=>{throw o(p,f,0,l),u})});let a=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(s,c,...l){let p=performance.now();return this.addEventListener("loadend",()=>o(s.toUpperCase(),String(c),this.status,p)),a.call(this,s,c,...l)}}if(t.console){let r=0;for(let o of t.console){let i=console[o];console[o]=(...a)=>{i.apply(console,a),r++<100&&e("$console",{level:o,message:V(a.map(s=>typeof s=="string"?s:s instanceof Error?s.message:st(s)).join(" "),500)})}}}t.vitals&&typeof PerformanceObserver<"u"&&it(e,n)}var st=e=>{try{return JSON.stringify(e)}catch{return String(e)}};function it(e,t){let n,r=0,o=0,i=0,a=0,s=[],c=0,l=(u,C,b={})=>{try{new PerformanceObserver(y=>y.getEntries().forEach(C)).observe({type:u,buffered:!0,...b})}catch{}};l("largest-contentful-paint",u=>{n=u.startTime}),l("layout-shift",u=>{u.hadRecentInput||(o&&u.startTime-i<1e3&&u.startTime-a<5e3?o+=u.value:(o=u.value,a=u.startTime),i=u.startTime,r=Math.max(r,o))});let p=new Set;l("event",u=>{u.interactionId&&(p.has(u.interactionId)||(p.add(u.interactionId),c++),s=[...s,u.duration].sort((C,b)=>b-C).slice(0,10))},{durationThreshold:40});let f=()=>{let u={lcp:n&&Math.round(n),inp:s.length?s[Math.min(9,Math.floor(c/50))]:void 0,cls:r?+r.toFixed(4):void 0};(u.lcp!==void 0||u.inp!==void 0||u.cls!==void 0)&&e("$web_vitals",u),r=o=0,s=[],c=0,p.clear(),n=void 0};addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&f()),t(f)}function xe(e){let t=[],n={},r=0,o=new Set,i=new Set;try{let l=e.load();l&&(t=JSON.parse(l))}catch{}async function a(l=!0){let p=await e.json(`/i/v1/flags/definitions?key=${encodeURIComponent(e.key)}${e.env?`&env=${e.env}`:""}`);if(p?.flags&&(t=p.flags,e.save(JSON.stringify(t))),l&&e.canPost()){let f=await e.json("/i/v1/flags",{api_key:e.key,distinct_id:e.id(),environment:e.env,properties:e.props()});f?.flags&&(n=f.flags)}o.forEach(f=>f())}function s(){r||typeof setInterval>"u"||(a(),r=setInterval(()=>document.visibilityState!=="hidden"&&a(!1),e.pollMs))}function c(l){s();let p=t.find(u=>u.key===l),f=p?_e(p,e.id(),e.props()):n[l];return f?(i.has(l)||(i.add(l),e.capture("$feature_flag_called",{flag:l,enabled:f.enabled,variant:f.variant})),f):{enabled:!1}}return{isEnabled:l=>c(l).enabled,getVariant:l=>c(l).variant,getPayload:l=>c(l).payload,reload:()=>a(),onChange(l){return s(),o.add(l),()=>{o.delete(l)}},reset(){i.clear(),r&&a()}}}var Pe=["necessary","analytics","replay","personalization","marketing"],Le=30*6e4,Oe=2e3,at=15e5,lt=100,m,N="",$="",le,W=!1,g=null,d=null,S="anon_"+P(),k=null,I={},A=null,w,h=[],q=[],G=Promise.resolve(),Te,ne=0,re=0,oe=!1,fe=!1,Ne,se,Ae="",qe={},pe=!1,v=null,ie=!1,H=!1,O=!1,ae=!1,j,E,ce=[],ue=new Set,Re="null",Ue,De=new Promise(e=>{Ue=e}),T=e=>{try{return JSON.parse(localStorage.getItem(e)||"null")}catch{return null}},_=(e,t)=>{try{t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))}catch{}},K=(e,t)=>{M()==="full"&&_(e,t)},x=e=>!!e&&!!g&&Date.now()<e.t+(g.consent?.validity_days??180)*864e5&&(!g.consent||e.v===g.consent.version),U=e=>e==="necessary"||x(d)&&d.c[e]===!0,je=()=>g?.consent?.respect_gpc!==!1&&(navigator.globalPrivacyControl===!0||navigator.doNotTrack==="1"),ct=/^(Europe\/|Asia\/(Nicosia|Famagusta)$|Atlantic\/(Canary|Madeira|Azores|Reykjavik)$|Africa\/Ceuta$|Indian\/(Reunion|Mayotte)$|America\/(Guadeloupe|Martinique|Cayenne|Marigot|St_Barthelemy)$)/,Be=()=>{try{return ct.test(Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{return!0}};function M(){if(x(d))return d.c.analytics?"full":"off";if(!g)return"wait";let e=g.consent;return!e?.enabled||e.exempt_analytics||e.regions==="eu"&&!Be()?"mem":je()?"off":"wait"}function He(){let e=x(d)?d:null;return{id:e?.id,version:e?.v,categories:e?e.c:M()==="mem"?{analytics:!0}:{}}}var ut=e=>new Promise(t=>{let n=setTimeout(t,e);Ne=()=>{clearTimeout(n),t()}});async function Q(e,t,n=1/0){for(let r=0;;r++){let o=null;try{o=await fetch(e,{credentials:"omit",...t})}catch{}if(o&&o.status!==429&&o.status<500||r+1>=n)return o;await ut(Math.max((Number(o?.headers.get("retry-after"))||0)*1e3,Math.min(3e5,1e3*2**r)*(.5+Math.random()/2)))}}var ze=async(e,t,n,r)=>(await Q($+e,{method:"POST",body:await ee(t),keepalive:r},n))?.status??0,dt=async(e,t)=>{let n=await Q($+e,t?{method:"POST",body:JSON.stringify(t),headers:{"content-type":"text/plain"}}:{},1).catch(()=>null);return n?.ok?n.json().catch(()=>null):null},z=()=>[...ve,...m?.sensitiveParams??[],...g?.replay.mask.ignore_url_params??[]].map(e=>e.toLowerCase());function Fe(){let e=document.documentElement;return{url:R(location.href,z()),referrer:Ae,lang:navigator.language,viewport_w:e.clientWidth,viewport_h:e.clientHeight,platform:"web",app_version:m.release,...qe}}function B(){let e=Date.now();return(!w||e-w.t>Le)&&(w={id:P(),t:e,u:Math.random(),v:Math.random(),n:0}),w.t=e,w.id}function L(e,t={},n={}){let r={id:P(),event:e,ts:new Date().toISOString(),distinct_id:k??S,session_id:B(),environment:le,props:{...Fe(),...t},...n};k&&(r.identified=!0),Je(r),gt(e)}function Je(e){let t=M();if(t==="wait"||!g){q.push(e),q.length>lt&&q.shift();return}if(t==="off")return;let n=g.sampling;B(),!(w.u>=n.sessions||e.event!=="$identify"&&Math.random()>=n.events)&&(h.push(e)>Oe&&h.shift(),h.length>=m.batchSize?$e():ne||(ne=setTimeout(()=>{ne=0,$e()},m.batchInterval)),re||(re=setTimeout(()=>{re=0,F()},1e3)))}function F(){if(M()!=="full")return;let e=h.slice(-Oe);for(;e.length>1&&JSON.stringify(e).length>at;)e=e.slice(e.length>>1);_("pt_q",e.length?e:null),_("pt_s",w)}var Xe=e=>JSON.stringify({api_key:N,sent_at:new Date().toISOString(),consent:He(),batch:e}),Y=()=>M()==="mem"||M()==="full";async function $e(){if(!(oe||!h.length||!Y())){oe=!0;try{for(await G;h.length&&Y();){let e=h.slice(0,100);await Q($+"/i/v1/events",{method:"POST",body:await ee(Xe(e))});let t=new Set(e);h=h.filter(n=>!t.has(n)),F()}}finally{oe=!1}}}function Ie(){for(F(),v?.beacon();h.length&&Y();){let e=h.slice(0,25);if(!navigator.sendBeacon?.($+"/i/v1/events",new Blob([Xe(e)],{type:"text/plain"})))break;let t=new Set(e);h=h.filter(n=>!t.has(n))}F()}function ft(){let e=S;S=T("pt_id")||S,_("pt_id",S);let t=T("pt_s");t&&Date.now()-t.t<Le&&(w=t);let n=T("pt_u");n&&U("personalization")&&(k=n.u,I=n.tr);let r=T("pt_q");Array.isArray(r)&&(h=[...r,...h]);for(let o of[...h,...q])o.distinct_id===e&&(o.distinct_id=S);fe=!0}function Ve(){for(let e of["pt_id","pt_s","pt_q","pt_u","pt_cfg","pt_flags"])_(e,null);h=[],q=[],k=null,I={},w=void 0,fe=!1,S="anon_"+P()}function pt(){let e=Ze.get(),t=JSON.stringify(e);t!==Re&&(Re=t,ue.forEach(n=>{try{n(e)}catch{}}),dispatchEvent(new CustomEvent("pt:consent",{detail:e})))}function We(){pt();let e=M();e==="full"&&!fe&&ft(),e!=="wait"&&(q.splice(0).forEach(t=>e!=="off"&&Je(t)),Ke(),he(),A&&U("personalization")&&(ht(...A),A=null),F())}function ge(e,t){let n=x(d)?d.c:null,r={...e,necessary:!0},o=t==="withdraw"||!!n&&Pe.some(i=>n[i]&&!r[i]);d={id:d?.id||P(),v:g?.consent?.version??0,t:Date.now(),c:r,p:o?"withdraw":t},_("pt_consent",d),Ge(d),r.analytics?r.personalization||(k=null,I={},A=null,_("pt_u",null)):Ve(),r.replay||(v?.stop(),v=null),We(),E?.reset()}function Ge(e){Te=e;let t={api_key:N,consent_id:e.id,policy_version:e.v,choices:e.c,source:e.p};G=G.then(async()=>{let n=await ze("/i/v1/consent",JSON.stringify(t),6,!0);n>199&&n<300&&(delete e.p,d===e&&_("pt_consent",e))})}function Ke(){!g||!pe||document.querySelectorAll('script[type="text/plain"][data-pt-category]').forEach(e=>{if(!U(e.dataset.ptCategory))return;let t=document.createElement("script");for(let n of Array.from(e.attributes))n.name!=="type"&&n.name!=="data-pt-category"&&t.setAttribute(n.name,n.value);t.text=e.text,e.replaceWith(t)})}async function me(e){let t=g?.consent;if(!(!t||O)){O=!0,j?.(),j=void 0;try{(await import("./consent.js")).show({cfg:t,current:e&&d?d.c:null,onChoice:r=>ge(r,"banner"),onClose:()=>{O=!1,Ye()}})}catch{O=!1}}}async function Ye(){let e=g?.consent;if(!(!e?.enabled||!x(d)||O||j||ae||typeof document>"u")){ae=!0;try{if(document.readyState==="loading"&&await new Promise(t=>document.addEventListener("DOMContentLoaded",t,{once:!0})),await new Promise(t=>setTimeout(t,1e3)),O||j||document.querySelector("[data-pt-consent-open]"))return;j=(await import("./consent.js")).manage(e,()=>{me(!0)})}catch{}finally{ae=!1}}}function Me(){d?.p&&d!==Te&&x(d)&&Ge(d),We();let e=g?.consent;e?.enabled&&!x(d)&&!je()&&(e.regions==="always"||Be())?me(!1):Ye()}function he(e=!1){let t=g?.replay;!pe||v||ie||H||!t?.enabled||!U("replay")||typeof document>"u"||(B(),!(w.u>=g.sampling.sessions||!(e||w.v<t.sample_rate))&&(ie=!0,import("./replay.js").then(n=>{if(v||!U("replay"))return;let r=(o,i)=>`/i/v1/replay/${o}/chunks?key=${encodeURIComponent(N)}&seq=${i}`;v=n.start({cfg:t,dropParams:z(),sessionId:B,distinctId:()=>k??S,consent:He,nextSeq:()=>(B(),w.n++),post:async(o,i,a)=>{await G;let s=await ze(r(o,i),a,6);return s===403&&(v?.stop(),v=null,H=!0),s},beacon:(o,i,a)=>!!navigator.sendBeacon?.($+r(o,i),new Blob([a],{type:"text/plain"}))})}).catch(()=>{}).finally(()=>{ie=!1})))}function gt(e){let t=g?.replay.triggers;if(!t||v)return;let n=location.pathname+location.search,r=o=>new RegExp("^"+o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$").test(n);(e==="$error"&&t.on_error||t.events?.includes(e)||e==="$pageview"&&t.url_patterns?.some(r))&&he(!0)}function de(){let e=R(location.href,z());if(e===se)return;Ae=se??R(document.referrer,z()),se=e;let t=new URL(location.href).searchParams;for(let[n,r]of t)n.startsWith("utm_")&&(qe[n]=r.slice(0,200));L("$pageview")}function mt(){for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...n){ce.forEach(o=>o());let r=t.apply(this,n);return de(),r}}addEventListener("popstate",()=>{ce.forEach(e=>e()),de()})}function Lt(e,t){if(W||typeof window>"u")return;W=!0,N=e,m={batchInterval:5e3,batchSize:20,...t},$=m.host.replace(/\/$/,""),le=m.environment,d=T("pt_consent");let n=d?.c.analytics?T("pt_cfg"):null;n&&n.consent?.version===d.v&&(g=n,Me()),E=xe({key:N,env:le,pollMs:m.flagsPollMs??3e4,capture:L,json:dt,id:()=>k??S,props:()=>({...Fe(),$platform:"web",...I}),load:()=>M()==="full"?localStorage.getItem("pt_flags"):null,save:i=>K("pt_flags",JSON.parse(i)),canPost:()=>Y()}),(async()=>{let i=await Q(`${$}/i/v1/config?key=${encodeURIComponent(N)}`,{},5),a=i?.ok?await i.json().catch(()=>null):null;a&&(g=a,pe=!0,K("pt_cfg",a),x(d)||(v?.stop(),v=null),Me(),Ue())})();let r=i=>{ce.push(i)};m.autocapture!==!1&&be(L,r),addEventListener("online",()=>Ne?.()),document.addEventListener("click",i=>{i.target?.closest?.("[data-pt-consent-open]")&&(i.preventDefault(),Ze.open())}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){H||v?.resume();return}Ie(),v?.pause()}),addEventListener("pagehide",Ie),m.pageviews!==!1&&(mt(),de());let o=m.autocapture!==!1?we(L,r,{frustration:m.frustration!==!1}):void 0;Ee(L,{errors:m.errors!==!1,network:m.network!==!1,vitals:m.vitals!==!1,console:m.console===void 0?["warn","error"]:m.console,drop:z,host:$,release:m.release,onError:o},r),document.addEventListener("DOMContentLoaded",Ke)}function Ot(e,t){W&&L(e,t)}function ht(e,t={}){if(!W)return;if(!U("personalization")){A=[e,t];return}let n=S;k=e,I={...I,...t},K("pt_u",{u:k,tr:I}),L("$identify",{},{anonymous_id:n,traits:t}),E?.reset()}function Tt(){k=null,I={},A=null,w=void 0,S="anon_"+P(),_("pt_u",null),_("pt_s",null),K("pt_id",S),E?.reset()}var Qe=e=>g?e():void De.then(e),Nt=e=>Qe(()=>ge(Object.fromEntries((e??Pe).map(t=>[t,!0])),"api")),At=()=>{Ve(),Qe(()=>ge({},"withdraw"))},Ze={open:()=>De.then(()=>me(!0)),get:()=>x(d)?{...d.c}:null,onChange:e=>(ue.add(e),()=>{ue.delete(e)})},qt={pause(){H=!0,v?.pause()},resume(){H=!1,v?v.resume():he()}},Ut={isEnabled:e=>E?.isEnabled(e)??!1,getVariant:e=>E?.getVariant(e),getPayload:e=>E?.getPayload(e),reload:()=>E?.reload(),onChange:e=>E?.onChange(e)??(()=>{})};export{Ze as consent,Ut as flags,ht as identify,Lt as init,Nt as optIn,At as optOut,qt as replay,Tt as reset,Ot as track};
@@ -50,4 +50,4 @@ https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.p
50
50
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
51
51
  https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Ws().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return R([i(a)]).process(o,l)},i};R.stringify=uh;R.parse=ph;R.fromJSON=ch;R.list=mh;R.comment=s=>new go(s);R.atRule=s=>new yo(s);R.decl=s=>new po(s);R.rule=s=>new wo(s);R.root=s=>new bo(s);R.document=s=>new mo(s);R.CssSyntaxError=oh;R.Declaration=po;R.Container=lh;R.Processor=Ws;R.Document=mo;R.Comment=go;R.Warning=hh;R.AtRule=yo;R.Result=fh;R.Input=dh;R.Rule=wo;R.Root=bo;R.Node=gh;ah.registerPostcss(R);var yh=R;R.default=R;var F=Ru(yh);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;var ls=class s{constructor(...e){ee(this,"parentElement",null),ee(this,"parentNode",null),ee(this,"ownerDocument"),ee(this,"firstChild",null),ee(this,"lastChild",null),ee(this,"previousSibling",null),ee(this,"nextSibling",null),ee(this,"ELEMENT_NODE",1),ee(this,"TEXT_NODE",3),ee(this,"nodeType"),ee(this,"nodeName"),ee(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var Ti={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_i={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ot={},wh=()=>!!globalThis.Zone;function zs(s){if(Ot[s])return Ot[s];let e=globalThis[s],t=e.prototype,r=s in Ti?Ti[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in _i?_i[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!wh())return Ot[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?Ot[s]=u:t}catch{return t}}var Mr={};function pe(s,e,t){var r;let i=`${s}.${String(t)}`;if(Mr[i])return Mr[i].call(e);let n=zs(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Mr[i]=o,o.call(e)):e[t]}var Ar={};function So(s,e,t){let r=`${s}.${String(t)}`;if(Ar[r])return Ar[r].bind(e);let n=zs(s)[t];return typeof n!="function"?e[t]:(Ar[r]=n,n.bind(e))}function bh(s){return pe("Node",s,"ownerDocument")}function Sh(s){return pe("Node",s,"childNodes")}function vh(s){return pe("Node",s,"parentNode")}function Ch(s){return pe("Node",s,"parentElement")}function Ih(s){return pe("Node",s,"textContent")}function Eh(s,e){return So("Node",s,"contains")(e)}function xh(s){return So("Node",s,"getRootNode")()}function Nh(s){return!s||!("host"in s)?null:pe("ShadowRoot",s,"host")}function Mh(s){return s.styleSheets}function Ah(s){return!s||!("shadowRoot"in s)?null:pe("Element",s,"shadowRoot")}function Rh(s,e){return pe("Element",s,"querySelector")(e)}function Oh(s,e){return pe("Element",s,"querySelectorAll")(e)}function vo(){return zs("MutationObserver").constructor}function Ie(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var C={ownerDocument:bh,childNodes:Sh,parentNode:vh,parentElement:Ch,textContent:Ih,contains:Eh,getRootNode:xh,host:Nh,styleSheets:Mh,shadowRoot:Ah,querySelector:Rh,querySelectorAll:Oh,mutationObserver:vo,patch:Ie};function Z(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var xe=`Please stop import mirror directly. Instead of that,\r
52
52
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
53
- or you can use record.mirror to access the mirror instance during recording.`,ki={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ki=new Proxy(ki,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function rt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function fr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>fr(s,e,n||{},!0)}var Qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>new Date().getTime());function Co(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Io(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Eo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function xo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=xo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Vt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Dh(s,e){return e.getId(s)!==-1}function Rr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===He}function No(s,e){if(Ge(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?No(r,e):!0}function us(s){return!!s.changedTouches}function Th(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Mo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Ao(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function cs(s){return s?s instanceof ls&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var hs=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ro(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=Ro(e);)e=t;return e}function kh(s){let e=C.ownerDocument(s);if(!e)return!1;let t=_h(s);return C.contains(e,t)}function Oo(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||kh(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),I=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(I||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ce=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ce||{}),Pe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Pe||{}),Ne=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ne||{});var Do=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Do||{});function $i(s){return"__ln"in s}var fs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$i(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&$i(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Pi=(s,e)=>`${s}@${e}`,ds=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new fs,i=a=>{let u=a,c=He;for(;c===He;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Oo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ge(u)?this.mirror.getId(Ro(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Ae(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:m=>{Mo(m,this.mirror)&&this.iframeManager.addIframe(m),Ao(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),cs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Li(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Fi(this.droppedSet,a)&&!Li(this.removesSubTreeCache,a,this.mirror)||Fi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Bt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Rr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Qi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,xo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Wt(t);i=Bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Ki(t.tagName,r))if(n.attributes[r]=Ji(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ge(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Rr(t,this.mirror,this.slimDOMOptions)||!Dh(t,this.mirror)||(this.addedSet.has(t)?(ps(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||No(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Pi(r,i)]?ps(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ge(e.target)&&je(e.target)?!0:void 0}),$h(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Rr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Pi(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),cs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function ps(s,e){s.delete(e),C.childNodes(e).forEach(t=>ps(s,t))}function $h(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Li(s,e,t){return s.size===0?!1:Ph(s,e)}function Ph(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:To(s,e)}function To(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:To(s,t):!1}var Ye;function Lh(s){Ye=s}function Fh(){Ye=void 0}var E=s=>Ye?(...t)=>{try{return s(...t)}catch(r){if(Ye&&Ye(r)===!0)return;throw r}}:s,be=[];function at(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function _o(s,e){let t=new ds;be.push(t),t.init(s);let r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Uh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=rt(E(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=E(rt(E(h=>{let p=at(h),{clientX:g,clientY:m}=us(h)?h.changedTouches[0]:h;l||(l=Qt()),o.push({x:g,y:m,id:r.getId(p),timeOffset:Qt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return E(()=>{c.forEach(h=>h())})}function Bh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=at(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ce.Mouse;break;case"touch":g=ce.Touch;break;case"pen":g=ce.Pen;break}g===ce.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ce.Pen}else us(h)&&(g=ce.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ce.Touch||m.startsWith("Mouse")&&g===ce.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=us(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;E(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(c=>c())})}function ko({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=E(rt(E(l=>{let a=at(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=Co(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function Wh({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=E(rt(E(()=>{let n=Io(),o=Eo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var zh=["INPUT","TEXTAREA","SELECT"],Ui=new WeakMap;function Vh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=at(S),v=S.isTrusted,O=y&&y.tagName;if(y&&O==="OPTION"&&(y=C.parentElement(y)),!y||!O||zh.indexOf(O)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,P=Wt(y)||"";P==="radio"||P==="checkbox"?V=y.checked:(l[O.toLowerCase()]||l[P])&&(T=Bt({element:y,maskInputOptions:l,tagName:O,type:P,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;P==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(Y=>{if(Y!==y){let Q=Y.value;p(Y,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=Ui.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Ui.set(S,y);let O=t.getId(S);E(s)({...y,id:O})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>fr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,d))),E(()=>{m.forEach(S=>S())})}function qt(s){let e=[];function t(r,i){if(Dt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Dt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Dt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Dt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Gh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};Tt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Tt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Tt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Tt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:E((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...qt(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:E((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...qt(g),d]}]}),p.apply(g,m)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function $o({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function jh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:qt(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:E((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:qt(a.parentRule)}),l.apply(a,u)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Yh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=E(a=>rt(E(u=>{let c=at(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Ne.Play),n),Z("pause",o(Ne.Pause),n),Z("seeked",o(Ne.Seeked),n),Z("volumechange",o(Ne.VolumeChange),n),Z("ratechange",o(Ne.RateChange),n)];return E(()=>{l.forEach(a=>a())})}function Hh({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ie(e.fonts,"add",function(l){return function(a){return setTimeout(E(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),E(()=>{r.forEach(l=>l())})}function Zh(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=E(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Xh({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ie(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Jh(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Kh(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Jh(s,e);let r;s.recordDOM&&(r=_o(s,s.doc));let i=Uh(s),n=Bh(s),o=ko(s),l=Wh(s,{win:t}),a=Vh(s),u=Yh(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=Gh(s,{win:t}),h=$o(s,s.doc),p=jh(s,{win:t}),s.collectFonts&&(g=Hh(s)));let m=Zh(s),d=Xh(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return E(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Dt(s){return typeof window[s]<"u"}function Tt(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var er=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ms=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new er(Xi)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new er(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Do.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},gs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!je(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=_o({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ko({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push($o({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ie(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Oo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ve=0;Ve<Re.length;Ve++)Qh[Re.charCodeAt(Ve)]=Ve;var Ve,qh=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Re[e[t]>>2],i+=Re[(e[t]&3)<<4|e[t+1]>>4],i+=Re[(e[t+1]&15)<<2|e[t+2]>>6],i+=Re[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Bi=new Map;function ef(s,e){let t=Bi.get(s);return t||(t=new Map,Bi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Po=(s,e,t)=>{if(!s||!(Fo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=ef(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Lt(s,e,t){if(s instanceof Array)return s.map(r=>Lt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=qh(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Lt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Lt(s.data,e,t),s.width,s.height]};if(Fo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Po(s,e,t);return{rr_type:r,index:i}}}}return s}var Lo=(s,e,t)=>s.map(r=>Lt(r,e,t)),Fo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ie(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Lo(u,e,this);s(this.canvas,{type:Pe["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=fr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:Pe["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function rf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){let i=[];try{let n=Ie(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=rf(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function zi(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ie(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Po(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Lo(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=fr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function sf(s,e,t,r){let i=[];return i.push(...zi(e.WebGLRenderingContext.prototype,Pe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...zi(e.WebGL2RenderingContext.prototype,Pe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",nf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof window<"u"&&window.Blob&&new Blob([nf(Uo)],{type:"text/javascript;charset=utf-8"});function of(s){let e;try{if(e=Vi&&(window.URL||window.webkitURL).createObjectURL(Vi),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Uo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ys=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=Wi(t,r,i,!0),l=new Map,a=new of;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:Pe["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Wi(e,t,r,!1),n=tf(this.processMutation.bind(this),e,t,r),o=sf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},ws=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new hs),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Hi(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},bs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,Ft,Or,tr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Hs=s.contentWindow)==null?void 0:Hs.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=fa();function ue(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:O=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:Y=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:Le=new Set([]),errorHandler:Fe}=s;Lh(Fe);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=qi(g);Th();let Vs,pr=0,Gs=M=>{for(let te of ne||[])te.eventProcessor&&(M=te.eventProcessor(M));return b&&!q&&(M=b(M)),M};W=(M,te)=>{var U;let B=M;if(B.timestamp=Qt(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===I.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(Gs(B),te);else if(q){let K={type:"rrweb",event:Gs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Vs=B,pr=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===I.Mutation&&B.data.isAttachIframe)return;pr++;let K=r&&pr>=r,D=t&&B.timestamp-Vs.timestamp>t;(K||D)&&Ft(!0)}};let lt=M=>{W({type:x.IncrementalSnapshot,data:{source:I.Mutation,...M}})},js=M=>W({type:x.IncrementalSnapshot,data:{source:I.Scroll,...M}}),Ys=M=>W({type:x.IncrementalSnapshot,data:{source:I.CanvasMutation,...M}}),Wo=M=>W({type:x.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...M}}),ye=new ws({mutationCb:lt,adoptedStyleSheetCb:Wo}),we=new ms({mirror:re,mutationCb:lt,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let M of ne||[])M.getMirror&&M.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let mr=new bs;Or=new ys({recordCanvas:T,mutationCb:Ys,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let ut=new gs({mutationCb:lt,scrollCb:js,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Or,keepIframeSrcFn:N,processedNodeManager:mr},mirror:re});Ft=(M=!1)=>{if(!O)return;W({type:x.Meta,data:{href:window.location.href,width:Eo(),height:Io()}},M),ye.reset(),ut.init(),be.forEach(U=>U.lock());let te=Pa(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Mo(U,re)&&we.addIframe(U),Ao(U,re)&&ye.trackLinkElement(U),cs(U)&&ut.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),ut.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:N});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:Co(window)}},M),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let M=[],te=B=>{var K;return E(Kh)({mutationCb:lt,mousemoveCb:(D,gr)=>W({type:x.IncrementalSnapshot,data:{source:gr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MouseInteraction,...D}}),scrollCb:js,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleDeclaration,...D}}),canvasMutationCb:Ys,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:O,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:Y,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:N,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:ut,processedNodeManager:mr,canvasManager:Or,ignoreCSSAttributes:Le,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:gr=>W({type:x.Plugin,data:{plugin:D.name,payload:gr}})})))||[]},f)};we.addLoadListener(B=>{try{M.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{Ft(),M.push(te(document)),tr=!0};return["interactive","complete"].includes(document.readyState)?U():(M.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&U()})),M.push(Z("load",()=>{W({type:x.Load,data:{}}),P==="load"&&U()},window))),()=>{M.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),mr.destroy(),tr=!1,Fh()}}catch(M){console.warn(M)}}ue.addCustomEvent=(s,e)=>{if(!tr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};ue.freezePage=()=>{be.forEach(s=>s.freeze())};ue.takeFullSnapshot=s=>{if(!tr)throw new Error("please take full snapshot after start recording");Ft(s)};ue.mirror=re;var Gi;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Gi||(Gi={}));var Yf=5*1e3;var{addCustomEvent:Hf}=ue,{freezePage:Zf}=ue,{takeFullSnapshot:Xf}=ue;var af=5e3,lf=1e6,uf=20,cf=/token|secret|password|passwd|email|auth|csrf|nonce|card/i,hf=new Set(["href","src","action","poster","srcset"]);function dr(s,e){if(!s||typeof s!="object")return;let t=s.attributes;if(t)for(let r of Object.keys(t)){let i=t[r];typeof i=="string"&&(cf.test(r)||(s.tagName==="input"||s.tagName==="textarea")&&r==="value"?t[r]="*".repeat(Math.min(i.length,8)):hf.has(r)&&!i.startsWith("data:")&&(t[r]=Bo(i,e)))}s.childNodes?.forEach(r=>dr(r,e))}function Bo(s,e){try{let t=new URL(s,location.href);t.username=t.password="";for(let r of[...t.searchParams.keys()])e.includes(r.toLowerCase())&&t.searchParams.delete(r);return t.hash="",t.origin===location.origin?t.pathname+t.search:t.href}catch{return s}}function ff(s,e){let t=s.data;return s.type===4&&typeof t?.href=="string"?t.href=Bo(t.href,e):s.type===2?dr(t?.node,e):s.type===3&&t&&(t.adds?.forEach(r=>dr(r.node,e)),t.attributes?.forEach(r=>dr({attributes:r.attributes},e))),s}function Qf(s){let{cfg:e}=s,t=s.dropParams,r=[],i=0,n=0,o=0,l,a="",u=[],c=!1,h=!1;async function p(){if(!c){for(c=!0;u.length&&!h;){let b=u[0];if(await s.post(b.sid,b.seq,b.json)===403){f();break}if(h)break;u.shift()}c=!1}}function g(){if(!r.length)return null;let b=s.sessionId(),S=r;r=[],i=0;let y=JSON.stringify({distinct_id:s.distinctId(),consent:s.consent(),first_ts:n,last_ts:S[S.length-1].timestamp,events:S});return a&&b!==a&&setTimeout(()=>ue.takeFullSnapshot(),0),a=b,{sid:b,seq:s.nextSeq(),json:y}}function m(){clearTimeout(o),o=0;let b=g();b&&(u.push(b),u.length>uf&&u.shift(),p())}function d(){let b=e.mask;l=ue({emit(S){r.length||(n=S.timestamp),ff(S,t),r.push(S),i+=JSON.stringify(S).length,i>=lf?m():o||(o=setTimeout(m,af))},maskAllInputs:b.all_inputs!==!1,maskInputOptions:{password:!0,email:!0,tel:!0,text:!0,search:!0,url:!0,number:!0,textarea:!0,select:!0},maskTextSelector:["[data-pt-mask]","option",b.text_selector].filter(Boolean).join(","),blockSelector:["[data-pt-block]",b.block_selector].filter(Boolean).join(","),recordCanvas:!1,sampling:{mousemove:50,scroll:150},slimDOMOptions:"all",inlineStylesheet:!0})}function f(){l?.(),l=void 0,h=!0,clearTimeout(o),o=0,r=[],i=0,u.length=0}return d(),{stop:f,pause(){l?.(),l=void 0,m()},resume(){!l&&!h&&d()},beacon(){if(h)return;let b=g();b&&u.push(b),u.splice(0).forEach(S=>s.beacon(S.sid,S.seq,S.json))}}}export{Qf as start};
53
+ or you can use record.mirror to access the mirror instance during recording.`,ki={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ki=new Proxy(ki,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function rt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function fr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>fr(s,e,n||{},!0)}var Qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>new Date().getTime());function Co(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Io(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Eo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function xo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=xo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Vt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Dh(s,e){return e.getId(s)!==-1}function Rr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===He}function No(s,e){if(Ge(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?No(r,e):!0}function us(s){return!!s.changedTouches}function Th(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Mo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Ao(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function cs(s){return s?s instanceof ls&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var hs=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ro(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=Ro(e);)e=t;return e}function kh(s){let e=C.ownerDocument(s);if(!e)return!1;let t=_h(s);return C.contains(e,t)}function Oo(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||kh(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),I=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(I||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ce=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ce||{}),Pe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Pe||{}),Ne=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ne||{});var Do=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Do||{});function $i(s){return"__ln"in s}var fs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$i(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&$i(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Pi=(s,e)=>`${s}@${e}`,ds=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new fs,i=a=>{let u=a,c=He;for(;c===He;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Oo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ge(u)?this.mirror.getId(Ro(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Ae(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:m=>{Mo(m,this.mirror)&&this.iframeManager.addIframe(m),Ao(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),cs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Li(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Fi(this.droppedSet,a)&&!Li(this.removesSubTreeCache,a,this.mirror)||Fi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Bt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Rr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Qi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,xo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Wt(t);i=Bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Ki(t.tagName,r))if(n.attributes[r]=Ji(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ge(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Rr(t,this.mirror,this.slimDOMOptions)||!Dh(t,this.mirror)||(this.addedSet.has(t)?(ps(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||No(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Pi(r,i)]?ps(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ge(e.target)&&je(e.target)?!0:void 0}),$h(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Rr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Pi(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),cs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function ps(s,e){s.delete(e),C.childNodes(e).forEach(t=>ps(s,t))}function $h(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Li(s,e,t){return s.size===0?!1:Ph(s,e)}function Ph(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:To(s,e)}function To(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:To(s,t):!1}var Ye;function Lh(s){Ye=s}function Fh(){Ye=void 0}var E=s=>Ye?(...t)=>{try{return s(...t)}catch(r){if(Ye&&Ye(r)===!0)return;throw r}}:s,be=[];function at(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function _o(s,e){let t=new ds;be.push(t),t.init(s);let r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Uh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=rt(E(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=E(rt(E(h=>{let p=at(h),{clientX:g,clientY:m}=us(h)?h.changedTouches[0]:h;l||(l=Qt()),o.push({x:g,y:m,id:r.getId(p),timeOffset:Qt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return E(()=>{c.forEach(h=>h())})}function Bh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=at(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ce.Mouse;break;case"touch":g=ce.Touch;break;case"pen":g=ce.Pen;break}g===ce.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ce.Pen}else us(h)&&(g=ce.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ce.Touch||m.startsWith("Mouse")&&g===ce.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=us(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;E(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(c=>c())})}function ko({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=E(rt(E(l=>{let a=at(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=Co(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function Wh({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=E(rt(E(()=>{let n=Io(),o=Eo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var zh=["INPUT","TEXTAREA","SELECT"],Ui=new WeakMap;function Vh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=at(S),v=S.isTrusted,O=y&&y.tagName;if(y&&O==="OPTION"&&(y=C.parentElement(y)),!y||!O||zh.indexOf(O)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,P=Wt(y)||"";P==="radio"||P==="checkbox"?V=y.checked:(l[O.toLowerCase()]||l[P])&&(T=Bt({element:y,maskInputOptions:l,tagName:O,type:P,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;P==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(Y=>{if(Y!==y){let Q=Y.value;p(Y,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=Ui.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Ui.set(S,y);let O=t.getId(S);E(s)({...y,id:O})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>fr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,d))),E(()=>{m.forEach(S=>S())})}function qt(s){let e=[];function t(r,i){if(Dt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Dt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Dt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Dt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Gh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};Tt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Tt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Tt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Tt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:E((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...qt(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:E((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...qt(g),d]}]}),p.apply(g,m)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function $o({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function jh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:qt(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:E((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:qt(a.parentRule)}),l.apply(a,u)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Yh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=E(a=>rt(E(u=>{let c=at(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Ne.Play),n),Z("pause",o(Ne.Pause),n),Z("seeked",o(Ne.Seeked),n),Z("volumechange",o(Ne.VolumeChange),n),Z("ratechange",o(Ne.RateChange),n)];return E(()=>{l.forEach(a=>a())})}function Hh({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ie(e.fonts,"add",function(l){return function(a){return setTimeout(E(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),E(()=>{r.forEach(l=>l())})}function Zh(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=E(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Xh({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ie(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Jh(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Kh(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Jh(s,e);let r;s.recordDOM&&(r=_o(s,s.doc));let i=Uh(s),n=Bh(s),o=ko(s),l=Wh(s,{win:t}),a=Vh(s),u=Yh(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=Gh(s,{win:t}),h=$o(s,s.doc),p=jh(s,{win:t}),s.collectFonts&&(g=Hh(s)));let m=Zh(s),d=Xh(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return E(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Dt(s){return typeof window[s]<"u"}function Tt(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var er=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ms=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new er(Xi)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new er(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Do.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},gs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!je(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=_o({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ko({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push($o({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ie(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Oo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ve=0;Ve<Re.length;Ve++)Qh[Re.charCodeAt(Ve)]=Ve;var Ve,qh=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Re[e[t]>>2],i+=Re[(e[t]&3)<<4|e[t+1]>>4],i+=Re[(e[t+1]&15)<<2|e[t+2]>>6],i+=Re[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Bi=new Map;function ef(s,e){let t=Bi.get(s);return t||(t=new Map,Bi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Po=(s,e,t)=>{if(!s||!(Fo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=ef(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Lt(s,e,t){if(s instanceof Array)return s.map(r=>Lt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=qh(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Lt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Lt(s.data,e,t),s.width,s.height]};if(Fo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Po(s,e,t);return{rr_type:r,index:i}}}}return s}var Lo=(s,e,t)=>s.map(r=>Lt(r,e,t)),Fo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ie(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Lo(u,e,this);s(this.canvas,{type:Pe["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=fr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:Pe["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function rf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){let i=[];try{let n=Ie(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=rf(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function zi(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ie(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Po(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Lo(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=fr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function sf(s,e,t,r){let i=[];return i.push(...zi(e.WebGLRenderingContext.prototype,Pe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...zi(e.WebGL2RenderingContext.prototype,Pe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",nf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof window<"u"&&window.Blob&&new Blob([nf(Uo)],{type:"text/javascript;charset=utf-8"});function of(s){let e;try{if(e=Vi&&(window.URL||window.webkitURL).createObjectURL(Vi),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Uo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ys=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=Wi(t,r,i,!0),l=new Map,a=new of;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:Pe["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Wi(e,t,r,!1),n=tf(this.processMutation.bind(this),e,t,r),o=sf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},ws=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new hs),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Hi(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},bs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,Ft,Or,tr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Hs=s.contentWindow)==null?void 0:Hs.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=fa();function ue(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:O=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:Y=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:Le=new Set([]),errorHandler:Fe}=s;Lh(Fe);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=qi(g);Th();let Vs,pr=0,Gs=M=>{for(let te of ne||[])te.eventProcessor&&(M=te.eventProcessor(M));return b&&!q&&(M=b(M)),M};W=(M,te)=>{var U;let B=M;if(B.timestamp=Qt(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===I.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(Gs(B),te);else if(q){let K={type:"rrweb",event:Gs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Vs=B,pr=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===I.Mutation&&B.data.isAttachIframe)return;pr++;let K=r&&pr>=r,D=t&&B.timestamp-Vs.timestamp>t;(K||D)&&Ft(!0)}};let lt=M=>{W({type:x.IncrementalSnapshot,data:{source:I.Mutation,...M}})},js=M=>W({type:x.IncrementalSnapshot,data:{source:I.Scroll,...M}}),Ys=M=>W({type:x.IncrementalSnapshot,data:{source:I.CanvasMutation,...M}}),Wo=M=>W({type:x.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...M}}),ye=new ws({mutationCb:lt,adoptedStyleSheetCb:Wo}),we=new ms({mirror:re,mutationCb:lt,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let M of ne||[])M.getMirror&&M.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let mr=new bs;Or=new ys({recordCanvas:T,mutationCb:Ys,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let ut=new gs({mutationCb:lt,scrollCb:js,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Or,keepIframeSrcFn:N,processedNodeManager:mr},mirror:re});Ft=(M=!1)=>{if(!O)return;W({type:x.Meta,data:{href:window.location.href,width:Eo(),height:Io()}},M),ye.reset(),ut.init(),be.forEach(U=>U.lock());let te=Pa(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Mo(U,re)&&we.addIframe(U),Ao(U,re)&&ye.trackLinkElement(U),cs(U)&&ut.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),ut.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:N});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:Co(window)}},M),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let M=[],te=B=>{var K;return E(Kh)({mutationCb:lt,mousemoveCb:(D,gr)=>W({type:x.IncrementalSnapshot,data:{source:gr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MouseInteraction,...D}}),scrollCb:js,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleDeclaration,...D}}),canvasMutationCb:Ys,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:O,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:Y,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:N,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:ut,processedNodeManager:mr,canvasManager:Or,ignoreCSSAttributes:Le,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:gr=>W({type:x.Plugin,data:{plugin:D.name,payload:gr}})})))||[]},f)};we.addLoadListener(B=>{try{M.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{Ft(),M.push(te(document)),tr=!0};return["interactive","complete"].includes(document.readyState)?U():(M.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&U()})),M.push(Z("load",()=>{W({type:x.Load,data:{}}),P==="load"&&U()},window))),()=>{M.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),mr.destroy(),tr=!1,Fh()}}catch(M){console.warn(M)}}ue.addCustomEvent=(s,e)=>{if(!tr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};ue.freezePage=()=>{be.forEach(s=>s.freeze())};ue.takeFullSnapshot=s=>{if(!tr)throw new Error("please take full snapshot after start recording");Ft(s)};ue.mirror=re;var Gi;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Gi||(Gi={}));var Yf=5*1e3;var{addCustomEvent:Hf}=ue,{freezePage:Zf}=ue,{takeFullSnapshot:Xf}=ue;var af=5e3,lf=1e6,uf=20,cf=/token|secret|password|passwd|email|auth|csrf|nonce|card/i,hf=new Set(["href","src","action","poster","srcset"]);function dr(s,e){if(!s||typeof s!="object")return;let t=s.attributes;if(t)for(let r of Object.keys(t)){let i=t[r];typeof i=="string"&&(cf.test(r)||(s.tagName==="input"||s.tagName==="textarea")&&r==="value"?t[r]="*".repeat(Math.min(i.length,8)):hf.has(r)&&!i.startsWith("data:")&&(t[r]=Bo(i,e)))}s.childNodes?.forEach(r=>dr(r,e))}function Bo(s,e){try{let t=new URL(s,location.href);t.username=t.password="";for(let r of[...t.searchParams.keys()])e.includes(r.toLowerCase())&&t.searchParams.delete(r);return t.hash="",t.origin===location.origin?t.pathname+t.search:t.href}catch{return s}}function ff(s,e){let t=s.data;return s.type===4&&typeof t?.href=="string"?t.href=Bo(t.href,e):s.type===2?dr(t?.node,e):s.type===3&&t&&(t.adds?.forEach(r=>dr(r.node,e)),t.attributes?.forEach(r=>dr({attributes:r.attributes},e))),s}function Qf(s){let{cfg:e}=s,t=s.dropParams,r=[],i=0,n=0,o=0,l,a="",u=[],c=!1,h=!1;async function p(){if(!c){for(c=!0;u.length&&!h;){let b=u[0];if(await s.post(b.sid,b.seq,b.json)===403){f();break}if(h)break;let y=u.indexOf(b);y>=0&&u.splice(y,1)}c=!1}}function g(){if(!r.length)return null;let b=s.sessionId(),S=r;r=[],i=0;let y=JSON.stringify({distinct_id:s.distinctId(),consent:s.consent(),first_ts:n,last_ts:S[S.length-1].timestamp,events:S});return a&&b!==a&&setTimeout(()=>ue.takeFullSnapshot(),0),a=b,{sid:b,seq:s.nextSeq(),json:y}}function m(){clearTimeout(o),o=0;let b=g();b&&(u.push(b),u.length>uf&&u.shift(),p())}function d(){let b=e.mask;l=ue({emit(S){r.length||(n=S.timestamp),ff(S,t),r.push(S),i+=JSON.stringify(S).length,i>=lf?m():o||(o=setTimeout(m,af))},maskAllInputs:b.all_inputs!==!1,maskInputOptions:{password:!0,email:!0,tel:!0,text:!0,search:!0,url:!0,number:!0,textarea:!0,select:!0},maskTextSelector:["[data-pt-mask]","option","[contenteditable]:not([contenteditable=false])",b.text_selector].filter(Boolean).join(","),blockSelector:["[data-pt-block]",b.block_selector].filter(Boolean).join(","),recordCanvas:!1,sampling:{mousemove:50,scroll:150},slimDOMOptions:"all",inlineStylesheet:!0})}function f(){l?.(),l=void 0,h=!0,clearTimeout(o),o=0,r=[],i=0,u.length=0}return d(),{stop:f,pause(){l?.(),l=void 0,m()},resume(){!l&&!h&&d()},beacon(){if(h)return;let b=g();b&&u.push(b);for(let S of u.slice(c?1:0))s.beacon(S.sid,S.seq,S.json)&&u.splice(u.indexOf(S),1)}}}export{Qf as start};
package/dist/replay.js CHANGED
@@ -50,4 +50,4 @@ https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.p
50
50
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
51
51
  https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Ws().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return R([i(a)]).process(o,l)},i};R.stringify=uh;R.parse=ph;R.fromJSON=ch;R.list=mh;R.comment=s=>new go(s);R.atRule=s=>new yo(s);R.decl=s=>new po(s);R.rule=s=>new wo(s);R.root=s=>new bo(s);R.document=s=>new mo(s);R.CssSyntaxError=oh;R.Declaration=po;R.Container=lh;R.Processor=Ws;R.Document=mo;R.Comment=go;R.Warning=hh;R.AtRule=yo;R.Result=fh;R.Input=dh;R.Rule=wo;R.Root=bo;R.Node=gh;ah.registerPostcss(R);var yh=R;R.default=R;var F=Ru(yh);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;var ls=class s{constructor(...e){ee(this,"parentElement",null),ee(this,"parentNode",null),ee(this,"ownerDocument"),ee(this,"firstChild",null),ee(this,"lastChild",null),ee(this,"previousSibling",null),ee(this,"nextSibling",null),ee(this,"ELEMENT_NODE",1),ee(this,"TEXT_NODE",3),ee(this,"nodeType"),ee(this,"nodeName"),ee(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var Ti={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_i={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ot={},wh=()=>!!globalThis.Zone;function zs(s){if(Ot[s])return Ot[s];let e=globalThis[s],t=e.prototype,r=s in Ti?Ti[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in _i?_i[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!wh())return Ot[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?Ot[s]=u:t}catch{return t}}var Mr={};function pe(s,e,t){var r;let i=`${s}.${String(t)}`;if(Mr[i])return Mr[i].call(e);let n=zs(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Mr[i]=o,o.call(e)):e[t]}var Ar={};function So(s,e,t){let r=`${s}.${String(t)}`;if(Ar[r])return Ar[r].bind(e);let n=zs(s)[t];return typeof n!="function"?e[t]:(Ar[r]=n,n.bind(e))}function bh(s){return pe("Node",s,"ownerDocument")}function Sh(s){return pe("Node",s,"childNodes")}function vh(s){return pe("Node",s,"parentNode")}function Ch(s){return pe("Node",s,"parentElement")}function Ih(s){return pe("Node",s,"textContent")}function Eh(s,e){return So("Node",s,"contains")(e)}function xh(s){return So("Node",s,"getRootNode")()}function Nh(s){return!s||!("host"in s)?null:pe("ShadowRoot",s,"host")}function Mh(s){return s.styleSheets}function Ah(s){return!s||!("shadowRoot"in s)?null:pe("Element",s,"shadowRoot")}function Rh(s,e){return pe("Element",s,"querySelector")(e)}function Oh(s,e){return pe("Element",s,"querySelectorAll")(e)}function vo(){return zs("MutationObserver").constructor}function Ie(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var C={ownerDocument:bh,childNodes:Sh,parentNode:vh,parentElement:Ch,textContent:Ih,contains:Eh,getRootNode:xh,host:Nh,styleSheets:Mh,shadowRoot:Ah,querySelector:Rh,querySelectorAll:Oh,mutationObserver:vo,patch:Ie};function Z(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var xe=`Please stop import mirror directly. Instead of that,\r
52
52
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
53
- or you can use record.mirror to access the mirror instance during recording.`,ki={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ki=new Proxy(ki,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function rt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function fr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>fr(s,e,n||{},!0)}var Qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>new Date().getTime());function Co(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Io(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Eo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function xo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=xo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Vt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Dh(s,e){return e.getId(s)!==-1}function Rr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===He}function No(s,e){if(Ge(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?No(r,e):!0}function us(s){return!!s.changedTouches}function Th(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Mo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Ao(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function cs(s){return s?s instanceof ls&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var hs=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ro(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=Ro(e);)e=t;return e}function kh(s){let e=C.ownerDocument(s);if(!e)return!1;let t=_h(s);return C.contains(e,t)}function Oo(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||kh(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),I=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(I||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ce=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ce||{}),Pe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Pe||{}),Ne=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ne||{});var Do=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Do||{});function $i(s){return"__ln"in s}var fs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$i(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&$i(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Pi=(s,e)=>`${s}@${e}`,ds=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new fs,i=a=>{let u=a,c=He;for(;c===He;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Oo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ge(u)?this.mirror.getId(Ro(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Ae(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:m=>{Mo(m,this.mirror)&&this.iframeManager.addIframe(m),Ao(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),cs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Li(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Fi(this.droppedSet,a)&&!Li(this.removesSubTreeCache,a,this.mirror)||Fi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Bt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Rr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Qi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,xo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Wt(t);i=Bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Ki(t.tagName,r))if(n.attributes[r]=Ji(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ge(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Rr(t,this.mirror,this.slimDOMOptions)||!Dh(t,this.mirror)||(this.addedSet.has(t)?(ps(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||No(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Pi(r,i)]?ps(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ge(e.target)&&je(e.target)?!0:void 0}),$h(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Rr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Pi(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),cs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function ps(s,e){s.delete(e),C.childNodes(e).forEach(t=>ps(s,t))}function $h(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Li(s,e,t){return s.size===0?!1:Ph(s,e)}function Ph(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:To(s,e)}function To(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:To(s,t):!1}var Ye;function Lh(s){Ye=s}function Fh(){Ye=void 0}var E=s=>Ye?(...t)=>{try{return s(...t)}catch(r){if(Ye&&Ye(r)===!0)return;throw r}}:s,be=[];function at(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function _o(s,e){let t=new ds;be.push(t),t.init(s);let r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Uh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=rt(E(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=E(rt(E(h=>{let p=at(h),{clientX:g,clientY:m}=us(h)?h.changedTouches[0]:h;l||(l=Qt()),o.push({x:g,y:m,id:r.getId(p),timeOffset:Qt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return E(()=>{c.forEach(h=>h())})}function Bh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=at(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ce.Mouse;break;case"touch":g=ce.Touch;break;case"pen":g=ce.Pen;break}g===ce.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ce.Pen}else us(h)&&(g=ce.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ce.Touch||m.startsWith("Mouse")&&g===ce.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=us(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;E(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(c=>c())})}function ko({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=E(rt(E(l=>{let a=at(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=Co(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function Wh({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=E(rt(E(()=>{let n=Io(),o=Eo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var zh=["INPUT","TEXTAREA","SELECT"],Ui=new WeakMap;function Vh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=at(S),v=S.isTrusted,O=y&&y.tagName;if(y&&O==="OPTION"&&(y=C.parentElement(y)),!y||!O||zh.indexOf(O)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,P=Wt(y)||"";P==="radio"||P==="checkbox"?V=y.checked:(l[O.toLowerCase()]||l[P])&&(T=Bt({element:y,maskInputOptions:l,tagName:O,type:P,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;P==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(Y=>{if(Y!==y){let Q=Y.value;p(Y,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=Ui.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Ui.set(S,y);let O=t.getId(S);E(s)({...y,id:O})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>fr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,d))),E(()=>{m.forEach(S=>S())})}function qt(s){let e=[];function t(r,i){if(Dt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Dt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Dt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Dt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Gh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};Tt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Tt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Tt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Tt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:E((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...qt(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:E((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...qt(g),d]}]}),p.apply(g,m)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function $o({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function jh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:qt(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:E((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:qt(a.parentRule)}),l.apply(a,u)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Yh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=E(a=>rt(E(u=>{let c=at(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Ne.Play),n),Z("pause",o(Ne.Pause),n),Z("seeked",o(Ne.Seeked),n),Z("volumechange",o(Ne.VolumeChange),n),Z("ratechange",o(Ne.RateChange),n)];return E(()=>{l.forEach(a=>a())})}function Hh({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ie(e.fonts,"add",function(l){return function(a){return setTimeout(E(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),E(()=>{r.forEach(l=>l())})}function Zh(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=E(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Xh({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ie(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Jh(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Kh(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Jh(s,e);let r;s.recordDOM&&(r=_o(s,s.doc));let i=Uh(s),n=Bh(s),o=ko(s),l=Wh(s,{win:t}),a=Vh(s),u=Yh(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=Gh(s,{win:t}),h=$o(s,s.doc),p=jh(s,{win:t}),s.collectFonts&&(g=Hh(s)));let m=Zh(s),d=Xh(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return E(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Dt(s){return typeof window[s]<"u"}function Tt(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var er=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ms=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new er(Xi)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new er(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Do.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},gs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!je(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=_o({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ko({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push($o({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ie(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Oo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ve=0;Ve<Re.length;Ve++)Qh[Re.charCodeAt(Ve)]=Ve;var Ve,qh=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Re[e[t]>>2],i+=Re[(e[t]&3)<<4|e[t+1]>>4],i+=Re[(e[t+1]&15)<<2|e[t+2]>>6],i+=Re[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Bi=new Map;function ef(s,e){let t=Bi.get(s);return t||(t=new Map,Bi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Po=(s,e,t)=>{if(!s||!(Fo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=ef(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Lt(s,e,t){if(s instanceof Array)return s.map(r=>Lt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=qh(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Lt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Lt(s.data,e,t),s.width,s.height]};if(Fo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Po(s,e,t);return{rr_type:r,index:i}}}}return s}var Lo=(s,e,t)=>s.map(r=>Lt(r,e,t)),Fo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ie(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Lo(u,e,this);s(this.canvas,{type:Pe["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=fr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:Pe["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function rf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){let i=[];try{let n=Ie(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=rf(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function zi(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ie(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Po(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Lo(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=fr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function sf(s,e,t,r){let i=[];return i.push(...zi(e.WebGLRenderingContext.prototype,Pe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...zi(e.WebGL2RenderingContext.prototype,Pe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",nf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof window<"u"&&window.Blob&&new Blob([nf(Uo)],{type:"text/javascript;charset=utf-8"});function of(s){let e;try{if(e=Vi&&(window.URL||window.webkitURL).createObjectURL(Vi),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Uo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ys=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=Wi(t,r,i,!0),l=new Map,a=new of;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:Pe["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Wi(e,t,r,!1),n=tf(this.processMutation.bind(this),e,t,r),o=sf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},ws=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new hs),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Hi(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},bs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,Ft,Or,tr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Hs=s.contentWindow)==null?void 0:Hs.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=fa();function ue(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:O=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:Y=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:Le=new Set([]),errorHandler:Fe}=s;Lh(Fe);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=qi(g);Th();let Vs,pr=0,Gs=M=>{for(let te of ne||[])te.eventProcessor&&(M=te.eventProcessor(M));return b&&!q&&(M=b(M)),M};W=(M,te)=>{var U;let B=M;if(B.timestamp=Qt(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===I.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(Gs(B),te);else if(q){let K={type:"rrweb",event:Gs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Vs=B,pr=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===I.Mutation&&B.data.isAttachIframe)return;pr++;let K=r&&pr>=r,D=t&&B.timestamp-Vs.timestamp>t;(K||D)&&Ft(!0)}};let lt=M=>{W({type:x.IncrementalSnapshot,data:{source:I.Mutation,...M}})},js=M=>W({type:x.IncrementalSnapshot,data:{source:I.Scroll,...M}}),Ys=M=>W({type:x.IncrementalSnapshot,data:{source:I.CanvasMutation,...M}}),Wo=M=>W({type:x.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...M}}),ye=new ws({mutationCb:lt,adoptedStyleSheetCb:Wo}),we=new ms({mirror:re,mutationCb:lt,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let M of ne||[])M.getMirror&&M.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let mr=new bs;Or=new ys({recordCanvas:T,mutationCb:Ys,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let ut=new gs({mutationCb:lt,scrollCb:js,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Or,keepIframeSrcFn:N,processedNodeManager:mr},mirror:re});Ft=(M=!1)=>{if(!O)return;W({type:x.Meta,data:{href:window.location.href,width:Eo(),height:Io()}},M),ye.reset(),ut.init(),be.forEach(U=>U.lock());let te=Pa(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Mo(U,re)&&we.addIframe(U),Ao(U,re)&&ye.trackLinkElement(U),cs(U)&&ut.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),ut.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:N});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:Co(window)}},M),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let M=[],te=B=>{var K;return E(Kh)({mutationCb:lt,mousemoveCb:(D,gr)=>W({type:x.IncrementalSnapshot,data:{source:gr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MouseInteraction,...D}}),scrollCb:js,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleDeclaration,...D}}),canvasMutationCb:Ys,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:O,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:Y,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:N,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:ut,processedNodeManager:mr,canvasManager:Or,ignoreCSSAttributes:Le,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:gr=>W({type:x.Plugin,data:{plugin:D.name,payload:gr}})})))||[]},f)};we.addLoadListener(B=>{try{M.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{Ft(),M.push(te(document)),tr=!0};return["interactive","complete"].includes(document.readyState)?U():(M.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&U()})),M.push(Z("load",()=>{W({type:x.Load,data:{}}),P==="load"&&U()},window))),()=>{M.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),mr.destroy(),tr=!1,Fh()}}catch(M){console.warn(M)}}ue.addCustomEvent=(s,e)=>{if(!tr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};ue.freezePage=()=>{be.forEach(s=>s.freeze())};ue.takeFullSnapshot=s=>{if(!tr)throw new Error("please take full snapshot after start recording");Ft(s)};ue.mirror=re;var Gi;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Gi||(Gi={}));var Yf=5*1e3;var{addCustomEvent:Hf}=ue,{freezePage:Zf}=ue,{takeFullSnapshot:Xf}=ue;var af=5e3,lf=1e6,uf=20,cf=/token|secret|password|passwd|email|auth|csrf|nonce|card/i,hf=new Set(["href","src","action","poster","srcset"]);function dr(s,e){if(!s||typeof s!="object")return;let t=s.attributes;if(t)for(let r of Object.keys(t)){let i=t[r];typeof i=="string"&&(cf.test(r)||(s.tagName==="input"||s.tagName==="textarea")&&r==="value"?t[r]="*".repeat(Math.min(i.length,8)):hf.has(r)&&!i.startsWith("data:")&&(t[r]=Bo(i,e)))}s.childNodes?.forEach(r=>dr(r,e))}function Bo(s,e){try{let t=new URL(s,location.href);t.username=t.password="";for(let r of[...t.searchParams.keys()])e.includes(r.toLowerCase())&&t.searchParams.delete(r);return t.hash="",t.origin===location.origin?t.pathname+t.search:t.href}catch{return s}}function ff(s,e){let t=s.data;return s.type===4&&typeof t?.href=="string"?t.href=Bo(t.href,e):s.type===2?dr(t?.node,e):s.type===3&&t&&(t.adds?.forEach(r=>dr(r.node,e)),t.attributes?.forEach(r=>dr({attributes:r.attributes},e))),s}function Qf(s){let{cfg:e}=s,t=s.dropParams,r=[],i=0,n=0,o=0,l,a="",u=[],c=!1,h=!1;async function p(){if(!c){for(c=!0;u.length&&!h;){let b=u[0];if(await s.post(b.sid,b.seq,b.json)===403){f();break}if(h)break;u.shift()}c=!1}}function g(){if(!r.length)return null;let b=s.sessionId(),S=r;r=[],i=0;let y=JSON.stringify({distinct_id:s.distinctId(),consent:s.consent(),first_ts:n,last_ts:S[S.length-1].timestamp,events:S});return a&&b!==a&&setTimeout(()=>ue.takeFullSnapshot(),0),a=b,{sid:b,seq:s.nextSeq(),json:y}}function m(){clearTimeout(o),o=0;let b=g();b&&(u.push(b),u.length>uf&&u.shift(),p())}function d(){let b=e.mask;l=ue({emit(S){r.length||(n=S.timestamp),ff(S,t),r.push(S),i+=JSON.stringify(S).length,i>=lf?m():o||(o=setTimeout(m,af))},maskAllInputs:b.all_inputs!==!1,maskInputOptions:{password:!0,email:!0,tel:!0,text:!0,search:!0,url:!0,number:!0,textarea:!0,select:!0},maskTextSelector:["[data-pt-mask]","option",b.text_selector].filter(Boolean).join(","),blockSelector:["[data-pt-block]",b.block_selector].filter(Boolean).join(","),recordCanvas:!1,sampling:{mousemove:50,scroll:150},slimDOMOptions:"all",inlineStylesheet:!0})}function f(){l?.(),l=void 0,h=!0,clearTimeout(o),o=0,r=[],i=0,u.length=0}return d(),{stop:f,pause(){l?.(),l=void 0,m()},resume(){!l&&!h&&d()},beacon(){if(h)return;let b=g();b&&u.push(b),u.splice(0).forEach(S=>s.beacon(S.sid,S.seq,S.json))}}}export{Qf as start};
53
+ or you can use record.mirror to access the mirror instance during recording.`,ki={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ki=new Proxy(ki,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function rt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function fr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>fr(s,e,n||{},!0)}var Qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>new Date().getTime());function Co(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Io(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Eo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function xo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=xo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Vt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Dh(s,e){return e.getId(s)!==-1}function Rr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===He}function No(s,e){if(Ge(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?No(r,e):!0}function us(s){return!!s.changedTouches}function Th(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Mo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Ao(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function cs(s){return s?s instanceof ls&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var hs=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ro(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=Ro(e);)e=t;return e}function kh(s){let e=C.ownerDocument(s);if(!e)return!1;let t=_h(s);return C.contains(e,t)}function Oo(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||kh(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),I=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(I||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ce=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ce||{}),Pe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Pe||{}),Ne=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ne||{});var Do=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Do||{});function $i(s){return"__ln"in s}var fs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$i(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&$i(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Pi=(s,e)=>`${s}@${e}`,ds=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new fs,i=a=>{let u=a,c=He;for(;c===He;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Oo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ge(u)?this.mirror.getId(Ro(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Ae(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:m=>{Mo(m,this.mirror)&&this.iframeManager.addIframe(m),Ao(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),cs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Li(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Fi(this.droppedSet,a)&&!Li(this.removesSubTreeCache,a,this.mirror)||Fi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Bt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Rr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Qi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,xo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Wt(t);i=Bt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Ki(t.tagName,r))if(n.attributes[r]=Ji(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ge(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Rr(t,this.mirror,this.slimDOMOptions)||!Dh(t,this.mirror)||(this.addedSet.has(t)?(ps(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||No(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Pi(r,i)]?ps(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ge(e.target)&&je(e.target)?!0:void 0}),$h(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Rr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Pi(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),cs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function ps(s,e){s.delete(e),C.childNodes(e).forEach(t=>ps(s,t))}function $h(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Li(s,e,t){return s.size===0?!1:Ph(s,e)}function Ph(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:To(s,e)}function To(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:To(s,t):!1}var Ye;function Lh(s){Ye=s}function Fh(){Ye=void 0}var E=s=>Ye?(...t)=>{try{return s(...t)}catch(r){if(Ye&&Ye(r)===!0)return;throw r}}:s,be=[];function at(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function _o(s,e){let t=new ds;be.push(t),t.init(s);let r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Uh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=rt(E(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=E(rt(E(h=>{let p=at(h),{clientX:g,clientY:m}=us(h)?h.changedTouches[0]:h;l||(l=Qt()),o.push({x:g,y:m,id:r.getId(p),timeOffset:Qt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return E(()=>{c.forEach(h=>h())})}function Bh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=at(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ce.Mouse;break;case"touch":g=ce.Touch;break;case"pen":g=ce.Pen;break}g===ce.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ce.Pen}else us(h)&&(g=ce.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ce.Touch||m.startsWith("Mouse")&&g===ce.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=us(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;E(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(c=>c())})}function ko({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=E(rt(E(l=>{let a=at(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=Co(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function Wh({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=E(rt(E(()=>{let n=Io(),o=Eo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var zh=["INPUT","TEXTAREA","SELECT"],Ui=new WeakMap;function Vh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=at(S),v=S.isTrusted,O=y&&y.tagName;if(y&&O==="OPTION"&&(y=C.parentElement(y)),!y||!O||zh.indexOf(O)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,P=Wt(y)||"";P==="radio"||P==="checkbox"?V=y.checked:(l[O.toLowerCase()]||l[P])&&(T=Bt({element:y,maskInputOptions:l,tagName:O,type:P,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;P==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(Y=>{if(Y!==y){let Q=Y.value;p(Y,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=Ui.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Ui.set(S,y);let O=t.getId(S);E(s)({...y,id:O})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>fr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,d))),E(()=>{m.forEach(S=>S())})}function qt(s){let e=[];function t(r,i){if(Dt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Dt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Dt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Dt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Gh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};Tt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Tt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Tt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Tt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:E((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...qt(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:E((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...qt(g),d]}]}),p.apply(g,m)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function $o({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function jh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:qt(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:E((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:qt(a.parentRule)}),l.apply(a,u)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Yh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=E(a=>rt(E(u=>{let c=at(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Ne.Play),n),Z("pause",o(Ne.Pause),n),Z("seeked",o(Ne.Seeked),n),Z("volumechange",o(Ne.VolumeChange),n),Z("ratechange",o(Ne.RateChange),n)];return E(()=>{l.forEach(a=>a())})}function Hh({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ie(e.fonts,"add",function(l){return function(a){return setTimeout(E(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),E(()=>{r.forEach(l=>l())})}function Zh(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=E(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Xh({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ie(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Jh(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Kh(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Jh(s,e);let r;s.recordDOM&&(r=_o(s,s.doc));let i=Uh(s),n=Bh(s),o=ko(s),l=Wh(s,{win:t}),a=Vh(s),u=Yh(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=Gh(s,{win:t}),h=$o(s,s.doc),p=jh(s,{win:t}),s.collectFonts&&(g=Hh(s)));let m=Zh(s),d=Xh(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return E(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Dt(s){return typeof window[s]<"u"}function Tt(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var er=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},ms=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new er(Xi)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new er(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Do.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},gs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!je(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=_o({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ko({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push($o({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ie(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Oo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ve=0;Ve<Re.length;Ve++)Qh[Re.charCodeAt(Ve)]=Ve;var Ve,qh=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Re[e[t]>>2],i+=Re[(e[t]&3)<<4|e[t+1]>>4],i+=Re[(e[t+1]&15)<<2|e[t+2]>>6],i+=Re[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Bi=new Map;function ef(s,e){let t=Bi.get(s);return t||(t=new Map,Bi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Po=(s,e,t)=>{if(!s||!(Fo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=ef(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Lt(s,e,t){if(s instanceof Array)return s.map(r=>Lt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=qh(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Lt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Lt(s.data,e,t),s.width,s.height]};if(Fo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Po(s,e,t);return{rr_type:r,index:i}}}}return s}var Lo=(s,e,t)=>s.map(r=>Lt(r,e,t)),Fo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ie(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Lo(u,e,this);s(this.canvas,{type:Pe["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=fr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:Pe["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function rf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){let i=[];try{let n=Ie(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=rf(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function zi(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ie(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Po(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Lo(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=fr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function sf(s,e,t,r){let i=[];return i.push(...zi(e.WebGLRenderingContext.prototype,Pe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...zi(e.WebGL2RenderingContext.prototype,Pe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",nf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof window<"u"&&window.Blob&&new Blob([nf(Uo)],{type:"text/javascript;charset=utf-8"});function of(s){let e;try{if(e=Vi&&(window.URL||window.webkitURL).createObjectURL(Vi),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Uo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var ys=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=Wi(t,r,i,!0),l=new Map,a=new of;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:Pe["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Wi(e,t,r,!1),n=tf(this.processMutation.bind(this),e,t,r),o=sf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},ws=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new hs),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Hi(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},bs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,Ft,Or,tr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Hs=s.contentWindow)==null?void 0:Hs.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=fa();function ue(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:O=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:Y=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:Le=new Set([]),errorHandler:Fe}=s;Lh(Fe);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=qi(g);Th();let Vs,pr=0,Gs=M=>{for(let te of ne||[])te.eventProcessor&&(M=te.eventProcessor(M));return b&&!q&&(M=b(M)),M};W=(M,te)=>{var U;let B=M;if(B.timestamp=Qt(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===I.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(Gs(B),te);else if(q){let K={type:"rrweb",event:Gs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Vs=B,pr=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===I.Mutation&&B.data.isAttachIframe)return;pr++;let K=r&&pr>=r,D=t&&B.timestamp-Vs.timestamp>t;(K||D)&&Ft(!0)}};let lt=M=>{W({type:x.IncrementalSnapshot,data:{source:I.Mutation,...M}})},js=M=>W({type:x.IncrementalSnapshot,data:{source:I.Scroll,...M}}),Ys=M=>W({type:x.IncrementalSnapshot,data:{source:I.CanvasMutation,...M}}),Wo=M=>W({type:x.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...M}}),ye=new ws({mutationCb:lt,adoptedStyleSheetCb:Wo}),we=new ms({mirror:re,mutationCb:lt,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let M of ne||[])M.getMirror&&M.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let mr=new bs;Or=new ys({recordCanvas:T,mutationCb:Ys,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let ut=new gs({mutationCb:lt,scrollCb:js,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Or,keepIframeSrcFn:N,processedNodeManager:mr},mirror:re});Ft=(M=!1)=>{if(!O)return;W({type:x.Meta,data:{href:window.location.href,width:Eo(),height:Io()}},M),ye.reset(),ut.init(),be.forEach(U=>U.lock());let te=Pa(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Mo(U,re)&&we.addIframe(U),Ao(U,re)&&ye.trackLinkElement(U),cs(U)&&ut.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),ut.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:N});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:Co(window)}},M),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let M=[],te=B=>{var K;return E(Kh)({mutationCb:lt,mousemoveCb:(D,gr)=>W({type:x.IncrementalSnapshot,data:{source:gr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MouseInteraction,...D}}),scrollCb:js,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.StyleDeclaration,...D}}),canvasMutationCb:Ys,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:I.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:I.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:O,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:Y,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:N,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:ut,processedNodeManager:mr,canvasManager:Or,ignoreCSSAttributes:Le,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:gr=>W({type:x.Plugin,data:{plugin:D.name,payload:gr}})})))||[]},f)};we.addLoadListener(B=>{try{M.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{Ft(),M.push(te(document)),tr=!0};return["interactive","complete"].includes(document.readyState)?U():(M.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&U()})),M.push(Z("load",()=>{W({type:x.Load,data:{}}),P==="load"&&U()},window))),()=>{M.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),mr.destroy(),tr=!1,Fh()}}catch(M){console.warn(M)}}ue.addCustomEvent=(s,e)=>{if(!tr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};ue.freezePage=()=>{be.forEach(s=>s.freeze())};ue.takeFullSnapshot=s=>{if(!tr)throw new Error("please take full snapshot after start recording");Ft(s)};ue.mirror=re;var Gi;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Gi||(Gi={}));var Yf=5*1e3;var{addCustomEvent:Hf}=ue,{freezePage:Zf}=ue,{takeFullSnapshot:Xf}=ue;var af=5e3,lf=1e6,uf=20,cf=/token|secret|password|passwd|email|auth|csrf|nonce|card/i,hf=new Set(["href","src","action","poster","srcset"]);function dr(s,e){if(!s||typeof s!="object")return;let t=s.attributes;if(t)for(let r of Object.keys(t)){let i=t[r];typeof i=="string"&&(cf.test(r)||(s.tagName==="input"||s.tagName==="textarea")&&r==="value"?t[r]="*".repeat(Math.min(i.length,8)):hf.has(r)&&!i.startsWith("data:")&&(t[r]=Bo(i,e)))}s.childNodes?.forEach(r=>dr(r,e))}function Bo(s,e){try{let t=new URL(s,location.href);t.username=t.password="";for(let r of[...t.searchParams.keys()])e.includes(r.toLowerCase())&&t.searchParams.delete(r);return t.hash="",t.origin===location.origin?t.pathname+t.search:t.href}catch{return s}}function ff(s,e){let t=s.data;return s.type===4&&typeof t?.href=="string"?t.href=Bo(t.href,e):s.type===2?dr(t?.node,e):s.type===3&&t&&(t.adds?.forEach(r=>dr(r.node,e)),t.attributes?.forEach(r=>dr({attributes:r.attributes},e))),s}function Qf(s){let{cfg:e}=s,t=s.dropParams,r=[],i=0,n=0,o=0,l,a="",u=[],c=!1,h=!1;async function p(){if(!c){for(c=!0;u.length&&!h;){let b=u[0];if(await s.post(b.sid,b.seq,b.json)===403){f();break}if(h)break;let y=u.indexOf(b);y>=0&&u.splice(y,1)}c=!1}}function g(){if(!r.length)return null;let b=s.sessionId(),S=r;r=[],i=0;let y=JSON.stringify({distinct_id:s.distinctId(),consent:s.consent(),first_ts:n,last_ts:S[S.length-1].timestamp,events:S});return a&&b!==a&&setTimeout(()=>ue.takeFullSnapshot(),0),a=b,{sid:b,seq:s.nextSeq(),json:y}}function m(){clearTimeout(o),o=0;let b=g();b&&(u.push(b),u.length>uf&&u.shift(),p())}function d(){let b=e.mask;l=ue({emit(S){r.length||(n=S.timestamp),ff(S,t),r.push(S),i+=JSON.stringify(S).length,i>=lf?m():o||(o=setTimeout(m,af))},maskAllInputs:b.all_inputs!==!1,maskInputOptions:{password:!0,email:!0,tel:!0,text:!0,search:!0,url:!0,number:!0,textarea:!0,select:!0},maskTextSelector:["[data-pt-mask]","option","[contenteditable]:not([contenteditable=false])",b.text_selector].filter(Boolean).join(","),blockSelector:["[data-pt-block]",b.block_selector].filter(Boolean).join(","),recordCanvas:!1,sampling:{mousemove:50,scroll:150},slimDOMOptions:"all",inlineStylesheet:!0})}function f(){l?.(),l=void 0,h=!0,clearTimeout(o),o=0,r=[],i=0,u.length=0}return d(),{stop:f,pause(){l?.(),l=void 0,m()},resume(){!l&&!h&&d()},beacon(){if(h)return;let b=g();b&&u.push(b);for(let S of u.slice(c?1:0))s.beacon(S.sid,S.seq,S.json)&&u.splice(u.indexOf(S),1)}}}export{Qf as start};
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{var Ze=Object.create;var Z=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var ve=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ot=(e,t)=>{for(var n in t)Z(e,n,{get:t[n],enumerable:!0})},st=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tt(t))!rt.call(e,o)&&o!==n&&Z(e,o,{get:()=>t[o],enumerable:!(r=et(t,o))||r.enumerable});return e};var ye=(e,t,n)=>(n=e!=null?Ze(nt(e)):{},st(t||!e||!e.__esModule?Z(n,"default",{value:e,enumerable:!0}):n,e));var he={};ot(he,{consent:()=>Et,flags:()=>Rt,identify:()=>Qe,init:()=>me,optIn:()=>kt,optOut:()=>Ct,replay:()=>xt,reset:()=>_t,track:()=>St});var we=["token","access_token","id_token","refresh_token","password","pwd","secret","key","api_key","apikey","auth","authorization","code","session","sid","email","mail","signature","sig","otp"];function M(){let e=crypto.getRandomValues(new Uint8Array(16)),t=Date.now();for(let r=5;r>=0;r--)e[r]=t%256,t=Math.floor(t/256);e[6]=e[6]&15|112,e[8]=e[8]&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var J=(e,t)=>String(e??"").slice(0,t);function x(e,t){try{let n=new URL(e,location.href);n.username=n.password="";for(let r of[...n.searchParams.keys()])t.includes(r.toLowerCase())&&n.searchParams.delete(r);return/^#\/[^?=&]*$/.test(n.hash)||(n.hash=""),n.href}catch{return""}}function be(e){let t=[];for(let n=e,r=0;n&&n!==document.documentElement&&r<4;n=n.parentElement,r++){let o=n.tagName.toLowerCase();if(n.id&&/^[\w-]{1,40}$/.test(n.id)&&!/\d{3,}/.test(n.id)){t.unshift(`${o}#${n.id}`);break}let i=[...n.classList].find(a=>/^[a-zA-Z][\w-]{0,30}$/.test(a)&&!/\d{3,}/.test(a));i&&(o+=`.${i}`),t.unshift(o)}return t.join(" > ").slice(0,120)}async function ee(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"text/plain"});let t=await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"))).blob();return new Blob([t],{type:"text/plain"})}function Se(){let e=navigator.userAgent,t=a=>e.match(a)?.[1],n=/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/iPhone|iPad|iPod/.test(e)?"iOS":/Mac OS X/.test(e)?"macOS":/CrOS/.test(e)?"ChromeOS":/Linux/.test(e)?"Linux":"Other",r=t(/(?:Windows NT|Android|OS|Mac OS X) ([\d._]+)/)?.replace(/_/g,"."),[o,i]=/Edg\//.test(e)?["Edge",/Edg\/([\d.]+)/]:/OPR\//.test(e)?["Opera",/OPR\/([\d.]+)/]:/Firefox\//.test(e)?["Firefox",/Firefox\/([\d.]+)/]:/Chrome\//.test(e)?["Chrome",/Chrome\/([\d.]+)/]:/Safari\//.test(e)?["Safari",/Version\/([\d.]+)/]:["Other",/$^/];return{os:n,os_version:r,browser:o,browser_version:t(i)}}var it="a[href],button,summary,[role=button],[data-pt-event]",at=1e3,lt=500;function _e(e,t,n){let r,o=0,i=[],a=!1;return t(()=>{a=!0}),addEventListener("pagehide",()=>{a=!0}),addEventListener("click",s=>{let c=s.target;if(!s.isTrusted||!(c instanceof Element)||o++>=lt||c.closest("[data-pt-block]"))return;let l=be(c),f=Math.round(s.clientX+scrollX),d=Math.round(s.clientY+scrollY),u=document.documentElement,_=c.closest("[data-pt-event]")?.getAttribute("data-pt-event"),b={selector:l,x:f,y:d,doc_w:u.scrollWidth,doc_h:u.scrollHeight};if(e("$autocapture",{...b,tag:c.tagName.toLowerCase(),pt_event:_||void 0}),_&&e(_.slice(0,100),{selector:l}),!n.frustration)return;let v=s.timeStamp||Date.now();r=b,setTimeout(()=>{r===b&&(r=void 0)},at),i=i.filter(G=>v-G.t<1e3&&Math.hypot(G.x-f,G.y-d)<30),i.push({t:v,x:f,y:d}),i.length>=3&&(e("$rageclick",{...b,count:i.length}),i=[]);let D=c.closest(it);if(!D||D.closest("a[target=_blank],a[download]")||/^(mailto|tel):/.test(D.getAttribute("href")||""))return;a=!1;let B=!1,z=new MutationObserver(()=>{B=!0});z.observe(u,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),setTimeout(()=>{z.disconnect(),!B&&!a&&e("$deadclick",b)},1e3)},{capture:!0,passive:!0}),s=>{r&&(e("$errorclick",{...r,...s}),r=void 0)}}function ke(e,t){let n=0,r=!1,o=0,i=()=>{let c=document.documentElement,l=Math.max(c.scrollHeight,1);return Math.min(100,Math.round((scrollY+c.clientHeight)/l*100))},a=()=>{o=0,n=Math.max(n,i())},s=()=>{if(r)return;r=!0;let c=document.documentElement;e("$scroll_depth",{max_pct:Math.max(n,i()),doc_h:c.scrollHeight,viewport_h:c.clientHeight})};addEventListener("scroll",()=>{o||(o=requestAnimationFrame(a))},{passive:!0}),addEventListener("pagehide",s),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&s()),t(()=>{s(),r=!1,n=0})}function te(e,t=0){let n=new TextEncoder().encode(e),r=t>>>0,o=3432918353,i=461845907,a=n.length&-4;for(let c=0;c<a;c+=4){let l=n[c]|n[c+1]<<8|n[c+2]<<16|n[c+3]<<24;l=Math.imul(l,o),l=l<<15|l>>>17,l=Math.imul(l,i),r^=l,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196|0}let s=0;switch(n.length&3){case 3:s^=n[a+2]<<16;case 2:s^=n[a+1]<<8;case 1:s^=n[a],s=Math.imul(s,o),s=s<<15|s>>>17,s=Math.imul(s,i),r^=s}return r^=n.length,r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>0}function Ce(e,t,n=""){return te(`${e}.${t}${n}`)/4294967296}function Ee(e,t){let n=e.split(/[.+-]/).map(o=>parseInt(o,10)||0),r=t.split(/[.+-]/).map(o=>parseInt(o,10)||0);for(let o=0;o<3;o++)if((n[o]??0)!==(r[o]??0))return(n[o]??0)-(r[o]??0);return 0}function ct(e,t){let n=t[e.property];if(e.operator==="is_set")return n!=null;if(e.operator==="is_not_set")return n==null;if(n==null)return!1;let r=String(n),o=Array.isArray(e.value)?e.value.map(String):[String(e.value)];switch(e.operator){case"eq":return r===String(e.value);case"neq":return r!==String(e.value);case"in":return o.includes(r);case"nin":return!o.includes(r);case"contains":return r.toLowerCase().includes(String(e.value).toLowerCase());case"ncontains":return!r.toLowerCase().includes(String(e.value).toLowerCase());case"regex":if(r.length>1024)return!1;try{return new RegExp(String(e.value)).test(r)}catch{return!1}case"gt":return Number(n)>Number(e.value);case"gte":return Number(n)>=Number(e.value);case"lt":return Number(n)<Number(e.value);case"lte":return Number(n)<=Number(e.value);case"semver_gte":return Ee(r,String(e.value))>=0;case"semver_lt":return Ee(r,String(e.value))<0}}function Re(e,t,n={}){if(!e.active)return{enabled:!1};let o=(e.groups.length?e.groups:[{conditions:[]}]).find(s=>s.conditions.every(c=>ct(c,n)));if(!o)return{enabled:!1};let i=o.rollout_percent??e.rollout_percent;if(Ce(e.key,t)*100>=i)return{enabled:!1};if(!e.variants?.length)return xe({enabled:!0},e.payloads?.true);let a=o.variant;if(!a){let s=Ce(e.key,t,".variant")*100,c=0;a=e.variants[e.variants.length-1].key;for(let l of e.variants)if(c+=l.weight,s<c){a=l.key;break}}return xe({enabled:!0,variant:a},e.payloads?.[a])}function xe(e,t){return t===void 0?e:{...e,payload:t}}var ut=/\/(\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?=[/?#]|$)/gi;function $e(e,t,n){if(t.errors){let r=0,o=(i,a,s="",c)=>{if(r++>=20)return;let l=s.split(`
2
- `).slice(1,4).map(v=>v.replace(/[:\d]+\)?$/,"")).join("|"),f=te([i,a.replace(/\d+/g,"N"),l].join("|")).toString(16),d=t.drop().map(v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),u=v=>v.replace(/https?:\/\/[^\s)'"]+/gi,D=>{let[,B,z=""]=D.match(/^(.*?)(:\d+:\d+)?$/);return x(B,t.drop())+z}),_=v=>d?v.replace(new RegExp(`([?&;#]|%3[bf]|%26|%23)(${d})(=|%3d)(?:%(?!26|23|3b)[0-9a-f]{2}|(?!:\\d+:\\d+(?:$|[\\s)]))[^&\\s)'"#%])*`,"gi"),"$1$2$3[redacted]"):v,b=v=>_(u(_(v)));t.onError?.({fingerprint:f,type:i}),e("$error",{message:J(b(a),500),stack:J(b(s),4e3),type:i,fingerprint:f,release:t.release,filename:c&&x(c,t.drop())})};addEventListener("error",i=>o(i.error?.name||"Error",i.message,i.error?.stack,i.filename)),addEventListener("unhandledrejection",i=>{let a=i.reason;o(a?.name||"UnhandledRejection",a?.message??String(a),a?.stack)})}if(t.network){let r=0,o=(s,c,l,f)=>{if(r>=200||c.startsWith(t.host))return;r++;let d=x(c,t.drop()).replace(ut,"/:id");e("$network",{method:s,url:d,status:l,duration_ms:Math.round(performance.now()-f)})},i=window.fetch;i&&(window.fetch=function(s,c){let l=performance.now(),f=(c?.method||(s instanceof Request?s.method:"GET")).toUpperCase(),d=typeof s=="string"?s:s instanceof URL?s.href:s.url;return i.call(this,s,c).then(u=>(o(f,d,u.status,l),u),u=>{throw o(f,d,0,l),u})});let a=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(s,c,...l){let f=performance.now();return this.addEventListener("loadend",()=>o(s.toUpperCase(),String(c),this.status,f)),a.call(this,s,c,...l)}}if(t.console){let r=0;for(let o of t.console){let i=console[o];console[o]=(...a)=>{i.apply(console,a),r++<100&&e("$console",{level:o,message:J(a.map(s=>typeof s=="string"?s:s instanceof Error?s.message:dt(s)).join(" "),500)})}}}t.vitals&&typeof PerformanceObserver<"u"&&ft(e,n)}var dt=e=>{try{return JSON.stringify(e)}catch{return String(e)}};function ft(e,t){let n,r=0,o=0,i=0,a=0,s=[],c=0,l=(u,_,b={})=>{try{new PerformanceObserver(v=>v.getEntries().forEach(_)).observe({type:u,buffered:!0,...b})}catch{}};l("largest-contentful-paint",u=>{n=u.startTime}),l("layout-shift",u=>{u.hadRecentInput||(o&&u.startTime-i<1e3&&u.startTime-a<5e3?o+=u.value:(o=u.value,a=u.startTime),i=u.startTime,r=Math.max(r,o))});let f=new Set;l("event",u=>{u.interactionId&&(f.has(u.interactionId)||(f.add(u.interactionId),c++),s=[...s,u.duration].sort((_,b)=>b-_).slice(0,10))},{durationThreshold:40});let d=()=>{let u={lcp:n&&Math.round(n),inp:s.length?s[Math.min(9,Math.floor(c/50))]:void 0,cls:r?+r.toFixed(4):void 0};(u.lcp!==void 0||u.inp!==void 0||u.cls!==void 0)&&e("$web_vitals",u),r=o=0,s=[],c=0,f.clear(),n=void 0};addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&d()),t(d)}function Ie(e){let t=[],n={},r=0,o=new Set,i=new Set;try{let l=e.load();l&&(t=JSON.parse(l))}catch{}async function a(l=!0){let f=await e.json(`/i/v1/flags/definitions?key=${encodeURIComponent(e.key)}${e.env?`&env=${e.env}`:""}`);if(f?.flags&&(t=f.flags,e.save(JSON.stringify(t))),l&&e.canPost()){let d=await e.json("/i/v1/flags",{api_key:e.key,distinct_id:e.id(),environment:e.env,properties:e.props()});d?.flags&&(n=d.flags)}o.forEach(d=>d())}function s(){r||typeof setInterval>"u"||(a(),r=setInterval(()=>document.visibilityState!=="hidden"&&a(!1),e.pollMs))}function c(l){s();let f=t.find(u=>u.key===l),d=f?Re(f,e.id(),e.props()):n[l];return d?(i.has(l)||(i.add(l),e.capture("$feature_flag_called",{flag:l,enabled:d.enabled,variant:d.variant})),d):{enabled:!1}}return{isEnabled:l=>c(l).enabled,getVariant:l=>c(l).variant,getPayload:l=>c(l).payload,reload:()=>a(),onChange(l){return s(),o.add(l),()=>{o.delete(l)}},reset(){i.clear(),r&&a()}}}var Oe=["necessary","analytics","replay","personalization","marketing"],Te=30*6e4,pt=2e3,gt=15e5,mt=100,m,T="",R="",ae,W=!1,g=null,p=null,S="anon_"+M(),k=null,$={},N=null,w,h=[],A=[],le=Promise.resolve(),ne=0,re=0,oe=!1,de=!1,Ne,se,Ae="",Ue={},fe=!1,y=null,ie=!1,V=!1,X=!1,C,ce=[],qe,De=new Promise(e=>{qe=e}),O=e=>{try{return JSON.parse(localStorage.getItem(e)||"null")}catch{return null}},E=(e,t)=>{try{t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))}catch{}},K=(e,t)=>{I()==="full"&&E(e,t)},q=e=>!!e&&!!g&&Date.now()<e.t+(g.consent?.validity_days??180)*864e5&&(!g.consent||e.v===g.consent.version),U=e=>e==="necessary"||q(p)&&p.c[e]===!0,Fe=()=>g?.consent?.respect_gpc!==!1&&(navigator.globalPrivacyControl===!0||navigator.doNotTrack==="1"),He=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone.startsWith("Europe/")}catch{return!0}};function I(){if(q(p))return p.c.analytics?"full":"off";if(!g)return"wait";let e=g.consent;return!e?.enabled||e.exempt_analytics||e.regions==="eu"&&!He()?"mem":Fe()?"off":"wait"}function je(){let e=q(p)?p:null;return{id:e?.id,version:e?.v,categories:e?e.c:I()==="mem"?{analytics:!0}:{}}}var ht=e=>new Promise(t=>{let n=setTimeout(t,e);Ne=()=>{clearTimeout(n),t()}});async function Q(e,t,n=1/0){for(let r=0;;r++){let o=null;try{o=await fetch(e,{credentials:"omit",...t})}catch{}if(o&&o.status!==429&&o.status<500||r+1>=n)return o;await ht(Math.max((Number(o?.headers.get("retry-after"))||0)*1e3,Math.min(3e5,1e3*2**r)*(.5+Math.random()/2)))}}var Be=async(e,t,n)=>(await Q(R+e,{method:"POST",body:await ee(t)},n))?.status??0,vt=async(e,t)=>{let n=await Q(R+e,t?{method:"POST",body:JSON.stringify(t),headers:{"content-type":"text/plain"}}:{},1).catch(()=>null);return n?.ok?n.json().catch(()=>null):null},H=()=>[...we,...m?.sensitiveParams??[],...g?.replay.mask.ignore_url_params??[]].map(e=>e.toLowerCase());function ze(){let e=document.documentElement;return{url:x(location.href,H()),referrer:Ae,lang:navigator.language,viewport_w:e.clientWidth,viewport_h:e.clientHeight,platform:"web",...Se(),app_version:m.release,...Ue}}function F(){let e=Date.now();return(!w||e-w.t>Te)&&(w={id:M(),t:e,u:Math.random(),v:Math.random(),n:0}),w.t=e,w.id}function P(e,t={},n={}){let r={id:M(),event:e,ts:new Date().toISOString(),distinct_id:k??S,session_id:F(),environment:ae,props:{...ze(),...t},...n};k&&(r.identified=!0),Je(r),wt(e)}function Je(e){let t=I();if(t==="wait"||!g){A.push(e),A.length>mt&&A.shift();return}if(t==="off")return;let n=g.sampling;F(),!(w.u>=n.sessions||e.event!=="$identify"&&Math.random()>=n.events)&&(h.push(e),h.length>=m.batchSize?Me():ne||(ne=setTimeout(()=>{ne=0,Me()},m.batchInterval)),re||(re=setTimeout(()=>{re=0,j()},1e3)))}function j(){if(I()!=="full")return;let e=h.slice(-pt);for(;e.length>1&&JSON.stringify(e).length>gt;)e=e.slice(e.length>>1);E("pt_q",e.length?e:null),E("pt_s",w)}var Xe=e=>JSON.stringify({api_key:T,sent_at:new Date().toISOString(),consent:je(),batch:e}),Y=()=>I()==="mem"||I()==="full";async function Me(){if(!(oe||!h.length||!Y())){oe=!0;try{for(await le;h.length&&Y();){let e=h.slice(0,100);await Q(R+"/i/v1/events",{method:"POST",body:await ee(Xe(e))});let t=new Set(e);h=h.filter(n=>!t.has(n)),j()}}finally{oe=!1}}}function Pe(){for(j(),y?.beacon();h.length&&Y();){let e=h.slice(0,25);if(!navigator.sendBeacon?.(R+"/i/v1/events",new Blob([Xe(e)],{type:"text/plain"})))break;let t=new Set(e);h=h.filter(n=>!t.has(n))}j()}function yt(){let e=S;S=O("pt_id")||S,E("pt_id",S);let t=O("pt_s");t&&Date.now()-t.t<Te&&(w=t);let n=O("pt_u");n&&U("personalization")&&(k=n.u,$=n.tr);let r=O("pt_q");Array.isArray(r)&&(h=[...r,...h]);for(let o of[...h,...A])o.distinct_id===e&&(o.distinct_id=S);de=!0}function We(){for(let e of["pt_id","pt_s","pt_q","pt_u","pt_cfg","pt_flags"])E(e,null);h=[],A=[],k=null,$={},w=void 0,de=!1,S="anon_"+M()}function Ve(){let e=I();e==="full"&&!de&&yt(),e!=="wait"&&(A.splice(0).forEach(t=>e!=="off"&&Je(t)),Ke(),ge(),N&&U("personalization")&&(Qe(...N),N=null),j())}function pe(e,t){let n=q(p)?p.c:null,r={...e,necessary:!0};p={id:p?.id||M(),v:g?.consent?.version??0,t:Date.now(),c:r},E("pt_consent",p),r.analytics?r.personalization||(k=null,$={},N=null,E("pt_u",null)):We(),r.replay||(y?.stop(),y=null);let o=t==="withdraw"||!!n&&Oe.some(a=>n[a]&&!r[a]),i={api_key:T,consent_id:p.id,policy_version:p.v,choices:r,source:o?"withdraw":t};le=le.then(()=>Be("/i/v1/consent",JSON.stringify(i),6)),Ve(),C?.reset()}function Ke(){!g||!fe||document.querySelectorAll('script[type="text/plain"][data-pt-category]').forEach(e=>{if(!U(e.dataset.ptCategory))return;let t=document.createElement("script");for(let n of Array.from(e.attributes))n.name!=="type"&&n.name!=="data-pt-category"&&t.setAttribute(n.name,n.value);t.text=e.text,e.replaceWith(t)})}async function Ye(e){let t=g?.consent;if(!(!t||X)){X=!0;try{(await import("./consent.js")).show({cfg:t,current:e&&p?p.c:null,onChoice:r=>pe(r,"banner"),onClose:()=>{X=!1}})}catch{X=!1}}}function Le(){Ve();let e=g?.consent;e?.enabled&&!q(p)&&!Fe()&&(e.regions==="always"||He())&&Ye(!1)}function ge(e=!1){let t=g?.replay;!fe||y||ie||V||!t?.enabled||!U("replay")||typeof document>"u"||(F(),!(w.u>=g.sampling.sessions||!(e||w.v<t.sample_rate))&&(ie=!0,import("./replay.js").then(n=>{if(y||!U("replay"))return;let r=(o,i)=>`/i/v1/replay/${o}/chunks?key=${encodeURIComponent(T)}&seq=${i}`;y=n.start({cfg:t,dropParams:H(),sessionId:F,distinctId:()=>k??S,consent:je,nextSeq:()=>(F(),w.n++),post:async(o,i,a)=>{let s=await Be(r(o,i),a,6);return s===403&&(y?.stop(),y=null,V=!0),s},beacon:(o,i,a)=>navigator.sendBeacon?.(R+r(o,i),new Blob([a],{type:"text/plain"}))})}).catch(()=>{}).finally(()=>{ie=!1})))}function wt(e){let t=g?.replay.triggers;if(!t||y)return;let n=location.pathname+location.search,r=o=>new RegExp("^"+o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$").test(n);(e==="$error"&&t.on_error||t.events?.includes(e)||e==="$pageview"&&t.url_patterns?.some(r))&&ge(!0)}function ue(){let e=x(location.href,H());if(e===se)return;Ae=se??x(document.referrer,H()),se=e;let t=new URL(location.href).searchParams;for(let[n,r]of t)n.startsWith("utm_")&&(Ue[n]=r.slice(0,200));P("$pageview")}function bt(){for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...n){ce.forEach(o=>o());let r=t.apply(this,n);return ue(),r}}addEventListener("popstate",()=>{ce.forEach(e=>e()),ue()})}function me(e,t){if(W||typeof window>"u")return;W=!0,T=e,m={batchInterval:5e3,batchSize:20,...t},R=m.host.replace(/\/$/,""),ae=m.environment,p=O("pt_consent"),C=Ie({key:T,env:ae,pollMs:m.flagsPollMs??3e4,capture:P,json:vt,id:()=>k??S,props:()=>({...ze(),$platform:"web",...$}),load:()=>I()==="full"?localStorage.getItem("pt_flags"):null,save:i=>K("pt_flags",JSON.parse(i)),canPost:()=>Y()});let n=p?.c.analytics?O("pt_cfg"):null;n&&n.consent?.version===p.v&&(g=n,Le()),(async()=>{let i=await Q(`${R}/i/v1/config?key=${encodeURIComponent(T)}`,{},5),a=i?.ok?await i.json().catch(()=>null):null;a&&(g=a,fe=!0,K("pt_cfg",a),q(p)||(y?.stop(),y=null),Le(),qe())})();let r=i=>{ce.push(i)};m.autocapture!==!1&&ke(P,r),addEventListener("online",()=>Ne?.()),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&Pe()),addEventListener("pagehide",Pe),m.pageviews!==!1&&(bt(),ue());let o=m.autocapture!==!1?_e(P,r,{frustration:m.frustration!==!1}):void 0;$e(P,{errors:m.errors!==!1,network:m.network!==!1,vitals:m.vitals!==!1,console:m.console===void 0?["warn","error"]:m.console,drop:H,host:R,release:m.release,onError:o},r),document.addEventListener("DOMContentLoaded",Ke)}function St(e,t){W&&P(e,t)}function Qe(e,t={}){if(!W)return;if(!U("personalization")){N=[e,t];return}let n=S;k=e,$={...$,...t},K("pt_u",{u:k,tr:$}),P("$identify",{},{anonymous_id:n,traits:t}),C?.reset()}function _t(){k=null,$={},N=null,w=void 0,S="anon_"+M(),E("pt_u",null),E("pt_s",null),K("pt_id",S),C?.reset()}var Ge=e=>g?e():void De.then(e),kt=e=>Ge(()=>pe(Object.fromEntries((e??Oe).map(t=>[t,!0])),"api")),Ct=()=>{We(),Ge(()=>pe({},"withdraw"))},Et={open:()=>De.then(()=>Ye(!0))},xt={pause(){V=!0,y?.pause()},resume(){V=!1,y?y.resume():ge()}},Rt={isEnabled:e=>C?.isEnabled(e)??!1,getVariant:e=>C?.getVariant(e),getPayload:e=>C?.getPayload(e),reload:()=>C?.reload(),onChange:e=>C?.onChange(e)??(()=>{})};var L=document.currentScript;globalThis.SheepTrack=he;L?.dataset.key&&me(L.dataset.key,{host:L.dataset.host||new URL(L.src).origin,environment:L.dataset.env==="dev"||L.dataset.env==="prod"?L.dataset.env:void 0});})();
1
+ "use strict";(()=>{var at=Object.create;var te=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ut=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty;var ne=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ft=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},pt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ct(t))!dt.call(e,o)&&o!==n&&te(e,o,{get:()=>t[o],enumerable:!(r=lt(t,o))||r.enumerable});return e};var re=(e,t,n)=>(n=e!=null?at(ut(e)):{},pt(t||!e||!e.__esModule?te(n,"default",{value:e,enumerable:!0}):n,e));var Ce={};ft(Ce,{consent:()=>ke,flags:()=>Nt,identify:()=>st,init:()=>Se,optIn:()=>Pt,optOut:()=>Ot,replay:()=>Tt,reset:()=>Lt,track:()=>It});var _e=["token","access_token","id_token","refresh_token","password","pwd","secret","key","api_key","apikey","auth","authorization","code","session","sid","email","mail","signature","sig","otp"];function L(){let e=crypto.getRandomValues(new Uint8Array(16)),t=Date.now();for(let r=5;r>=0;r--)e[r]=t%256,t=Math.floor(t/256);e[6]=e[6]&15|112,e[8]=e[8]&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var W=(e,t)=>String(e??"").slice(0,t);function x(e,t){try{let n=new URL(e,location.href);n.username=n.password="";for(let r of[...n.searchParams.keys()])t.includes(r.toLowerCase())&&n.searchParams.delete(r);return/^#\/[^?=&]*$/.test(n.hash)||(n.hash=""),n.href}catch{return""}}function Ee(e){let t=[];for(let n=e,r=0;n&&n!==document.documentElement&&r<4;n=n.parentElement,r++){let o=n.tagName.toLowerCase();if(n.id&&/^[\w-]{1,40}$/.test(n.id)&&!/\d{3,}/.test(n.id)){t.unshift(`${o}#${n.id}`);break}let i=[...n.classList].find(a=>/^[a-zA-Z][\w-]{0,30}$/.test(a)&&!/\d{3,}/.test(a));i&&(o+=`.${i}`),t.unshift(o)}return t.join(" > ").slice(0,120)}async function oe(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"text/plain"});let t=await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"))).blob();return new Blob([t],{type:"text/plain"})}var gt="a[href],button,summary,[role=button],[data-pt-event]",mt=1e3,ht=500;function Re(e,t,n){let r,o=0,i=[],a=!1;return t(()=>{a=!0}),addEventListener("pagehide",()=>{a=!0}),addEventListener("click",s=>{let c=s.target;if(!s.isTrusted||!(c instanceof Element)||o++>=ht||c.closest("[data-pt-block]"))return;let l=Ee(c),p=Math.round(s.clientX+scrollX),f=Math.round(s.clientY+scrollY),u=document.documentElement,k=c.closest("[data-pt-event]")?.getAttribute("data-pt-event"),b={selector:l,x:p,y:f,doc_w:u.scrollWidth,doc_h:u.scrollHeight};if(e("$autocapture",{...b,tag:c.tagName.toLowerCase(),pt_event:k||void 0}),k&&e(k.slice(0,100),{selector:l}),!n.frustration)return;let y=s.timeStamp||Date.now();r=b,setTimeout(()=>{r===b&&(r=void 0)},mt),i=i.filter(ee=>y-ee.t<1e3&&Math.hypot(ee.x-p,ee.y-f)<30),i.push({t:y,x:p,y:f}),i.length>=3&&(e("$rageclick",{...b,count:i.length}),i=[]);let j=c.closest(gt);if(!j||j.closest("a[target=_blank],a[download]")||/^(mailto|tel):/.test(j.getAttribute("href")||""))return;a=!1;let X=!1,V=new MutationObserver(()=>{X=!0});V.observe(u,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),setTimeout(()=>{V.disconnect(),!X&&!a&&e("$deadclick",b)},1e3)},{capture:!0,passive:!0}),s=>{r&&(e("$errorclick",{...r,...s}),r=void 0)}}function xe(e,t){let n=0,r=!1,o=0,i=()=>{let c=document.documentElement,l=Math.max(c.scrollHeight,1);return Math.min(100,Math.round((scrollY+c.clientHeight)/l*100))},a=()=>{o=0,n=Math.max(n,i())},s=()=>{if(r)return;r=!0;let c=document.documentElement;e("$scroll_depth",{max_pct:Math.max(n,i()),doc_h:c.scrollHeight,viewport_h:c.clientHeight})};addEventListener("scroll",()=>{o||(o=requestAnimationFrame(a))},{passive:!0}),addEventListener("pagehide",s),addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&s()),t(()=>{s(),r=!1,n=0})}function se(e,t=0){let n=new TextEncoder().encode(e),r=t>>>0,o=3432918353,i=461845907,a=n.length&-4;for(let c=0;c<a;c+=4){let l=n[c]|n[c+1]<<8|n[c+2]<<16|n[c+3]<<24;l=Math.imul(l,o),l=l<<15|l>>>17,l=Math.imul(l,i),r^=l,r=r<<13|r>>>19,r=Math.imul(r,5)+3864292196|0}let s=0;switch(n.length&3){case 3:s^=n[a+2]<<16;case 2:s^=n[a+1]<<8;case 1:s^=n[a],s=Math.imul(s,o),s=s<<15|s>>>17,s=Math.imul(s,i),r^=s}return r^=n.length,r^=r>>>16,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,r>>>0}function $e(e,t,n=""){return se(`${e}.${t}${n}`)/4294967296}function Me(e,t){let n=e.split(/[.+-]/).map(o=>parseInt(o,10)||0),r=t.split(/[.+-]/).map(o=>parseInt(o,10)||0);for(let o=0;o<3;o++)if((n[o]??0)!==(r[o]??0))return(n[o]??0)-(r[o]??0);return 0}function vt(e,t){let n=t[e.property];if(e.operator==="is_set")return n!=null;if(e.operator==="is_not_set")return n==null;if(n==null)return!1;let r=String(n),o=Array.isArray(e.value)?e.value.map(String):[String(e.value)];switch(e.operator){case"eq":return r===String(e.value);case"neq":return r!==String(e.value);case"in":return o.includes(r);case"nin":return!o.includes(r);case"contains":return r.toLowerCase().includes(String(e.value).toLowerCase());case"ncontains":return!r.toLowerCase().includes(String(e.value).toLowerCase());case"regex":if(r.length>1024)return!1;try{return new RegExp(String(e.value)).test(r)}catch{return!1}case"gt":return Number(n)>Number(e.value);case"gte":return Number(n)>=Number(e.value);case"lt":return Number(n)<Number(e.value);case"lte":return Number(n)<=Number(e.value);case"semver_gte":return Me(r,String(e.value))>=0;case"semver_lt":return Me(r,String(e.value))<0}}function Le(e,t,n={}){if(!e.active)return{enabled:!1};let o=(e.groups.length?e.groups:[{conditions:[]}]).find(s=>s.conditions.every(c=>vt(c,n)));if(!o)return{enabled:!1};let i=o.rollout_percent??e.rollout_percent;if($e(e.key,t)*100>=i)return{enabled:!1};if(!e.variants?.length)return Ie({enabled:!0},e.payloads?.true);let a=o.variant;if(!a){let s=$e(e.key,t,".variant")*100,c=0;a=e.variants[e.variants.length-1].key;for(let l of e.variants)if(c+=l.weight,s<c){a=l.key;break}}return Ie({enabled:!0,variant:a},e.payloads?.[a])}function Ie(e,t){return t===void 0?e:{...e,payload:t}}var yt=/\/(\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?=[/?#]|$)/gi;function Pe(e,t,n){if(t.errors){let r=0,o=(i,a,s="",c)=>{if(r++>=20)return;let l=s.split(`
2
+ `).slice(1,4).map(y=>y.replace(/[:\d]+\)?$/,"")).join("|"),p=se([i,a.replace(/\d+/g,"N"),l].join("|")).toString(16),f=t.drop().map(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),u=y=>y.replace(/https?:\/\/[^\s)'"]+/gi,j=>{let[,X,V=""]=j.match(/^(.*?)(:\d+:\d+)?$/);return x(X,t.drop())+V}),k=y=>f?y.replace(new RegExp(`([?&;#]|%3[bf]|%26|%23)(${f})(=|%3d)(?:%(?!26|23|3b)[0-9a-f]{2}|(?!:\\d+:\\d+(?:$|[\\s)]))[^&\\s)'"#%])*`,"gi"),"$1$2$3[redacted]"):y,b=y=>k(u(k(y)));t.onError?.({fingerprint:p,type:i}),e("$error",{message:W(b(a),500),stack:W(b(s),4e3),type:i,fingerprint:p,release:t.release,filename:c&&x(c,t.drop())})};addEventListener("error",i=>o(i.error?.name||"Error",i.message,i.error?.stack,i.filename)),addEventListener("unhandledrejection",i=>{let a=i.reason;o(a?.name||"UnhandledRejection",a?.message??String(a),a?.stack)})}if(t.network){let r=0,o=(s,c,l,p)=>{if(r>=200||c.startsWith(t.host))return;r++;let f=x(c,t.drop()).replace(yt,"/:id");e("$network",{method:s,url:f,status:l,duration_ms:Math.round(performance.now()-p)})},i=window.fetch;i&&(window.fetch=function(s,c){let l=performance.now(),p=(c?.method||(s instanceof Request?s.method:"GET")).toUpperCase(),f=typeof s=="string"?s:s instanceof URL?s.href:s.url;return i.call(this,s,c).then(u=>(o(p,f,u.status,l),u),u=>{throw o(p,f,0,l),u})});let a=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(s,c,...l){let p=performance.now();return this.addEventListener("loadend",()=>o(s.toUpperCase(),String(c),this.status,p)),a.call(this,s,c,...l)}}if(t.console){let r=0;for(let o of t.console){let i=console[o];console[o]=(...a)=>{i.apply(console,a),r++<100&&e("$console",{level:o,message:W(a.map(s=>typeof s=="string"?s:s instanceof Error?s.message:wt(s)).join(" "),500)})}}}t.vitals&&typeof PerformanceObserver<"u"&&bt(e,n)}var wt=e=>{try{return JSON.stringify(e)}catch{return String(e)}};function bt(e,t){let n,r=0,o=0,i=0,a=0,s=[],c=0,l=(u,k,b={})=>{try{new PerformanceObserver(y=>y.getEntries().forEach(k)).observe({type:u,buffered:!0,...b})}catch{}};l("largest-contentful-paint",u=>{n=u.startTime}),l("layout-shift",u=>{u.hadRecentInput||(o&&u.startTime-i<1e3&&u.startTime-a<5e3?o+=u.value:(o=u.value,a=u.startTime),i=u.startTime,r=Math.max(r,o))});let p=new Set;l("event",u=>{u.interactionId&&(p.has(u.interactionId)||(p.add(u.interactionId),c++),s=[...s,u.duration].sort((k,b)=>b-k).slice(0,10))},{durationThreshold:40});let f=()=>{let u={lcp:n&&Math.round(n),inp:s.length?s[Math.min(9,Math.floor(c/50))]:void 0,cls:r?+r.toFixed(4):void 0};(u.lcp!==void 0||u.inp!==void 0||u.cls!==void 0)&&e("$web_vitals",u),r=o=0,s=[],c=0,p.clear(),n=void 0};addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&f()),t(f)}function Oe(e){let t=[],n={},r=0,o=new Set,i=new Set;try{let l=e.load();l&&(t=JSON.parse(l))}catch{}async function a(l=!0){let p=await e.json(`/i/v1/flags/definitions?key=${encodeURIComponent(e.key)}${e.env?`&env=${e.env}`:""}`);if(p?.flags&&(t=p.flags,e.save(JSON.stringify(t))),l&&e.canPost()){let f=await e.json("/i/v1/flags",{api_key:e.key,distinct_id:e.id(),environment:e.env,properties:e.props()});f?.flags&&(n=f.flags)}o.forEach(f=>f())}function s(){r||typeof setInterval>"u"||(a(),r=setInterval(()=>document.visibilityState!=="hidden"&&a(!1),e.pollMs))}function c(l){s();let p=t.find(u=>u.key===l),f=p?Le(p,e.id(),e.props()):n[l];return f?(i.has(l)||(i.add(l),e.capture("$feature_flag_called",{flag:l,enabled:f.enabled,variant:f.variant})),f):{enabled:!1}}return{isEnabled:l=>c(l).enabled,getVariant:l=>c(l).variant,getPayload:l=>c(l).payload,reload:()=>a(),onChange(l){return s(),o.add(l),()=>{o.delete(l)}},reset(){i.clear(),r&&a()}}}var Ue=["necessary","analytics","replay","personalization","marketing"],De=30*6e4,je=2e3,St=15e5,kt=100,m,A="",$="",fe,G=!1,g=null,d=null,S="anon_"+L(),C=null,M={},q=null,w,h=[],U=[],K=Promise.resolve(),He,ie=0,ae=0,le=!1,he=!1,Be,ce,ze="",Fe={},ve=!1,v=null,ue=!1,z=!1,T=!1,de=!1,H,E,pe=[],ge=new Set,Te="null",Je,Xe=new Promise(e=>{Je=e}),N=e=>{try{return JSON.parse(localStorage.getItem(e)||"null")}catch{return null}},_=(e,t)=>{try{t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))}catch{}},Y=(e,t)=>{I()==="full"&&_(e,t)},R=e=>!!e&&!!g&&Date.now()<e.t+(g.consent?.validity_days??180)*864e5&&(!g.consent||e.v===g.consent.version),D=e=>e==="necessary"||R(d)&&d.c[e]===!0,Ve=()=>g?.consent?.respect_gpc!==!1&&(navigator.globalPrivacyControl===!0||navigator.doNotTrack==="1"),Ct=/^(Europe\/|Asia\/(Nicosia|Famagusta)$|Atlantic\/(Canary|Madeira|Azores|Reykjavik)$|Africa\/Ceuta$|Indian\/(Reunion|Mayotte)$|America\/(Guadeloupe|Martinique|Cayenne|Marigot|St_Barthelemy)$)/,We=()=>{try{return Ct.test(Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{return!0}};function I(){if(R(d))return d.c.analytics?"full":"off";if(!g)return"wait";let e=g.consent;return!e?.enabled||e.exempt_analytics||e.regions==="eu"&&!We()?"mem":Ve()?"off":"wait"}function Ge(){let e=R(d)?d:null;return{id:e?.id,version:e?.v,categories:e?e.c:I()==="mem"?{analytics:!0}:{}}}var _t=e=>new Promise(t=>{let n=setTimeout(t,e);Be=()=>{clearTimeout(n),t()}});async function Z(e,t,n=1/0){for(let r=0;;r++){let o=null;try{o=await fetch(e,{credentials:"omit",...t})}catch{}if(o&&o.status!==429&&o.status<500||r+1>=n)return o;await _t(Math.max((Number(o?.headers.get("retry-after"))||0)*1e3,Math.min(3e5,1e3*2**r)*(.5+Math.random()/2)))}}var Ke=async(e,t,n,r)=>(await Z($+e,{method:"POST",body:await oe(t),keepalive:r},n))?.status??0,Et=async(e,t)=>{let n=await Z($+e,t?{method:"POST",body:JSON.stringify(t),headers:{"content-type":"text/plain"}}:{},1).catch(()=>null);return n?.ok?n.json().catch(()=>null):null},F=()=>[..._e,...m?.sensitiveParams??[],...g?.replay.mask.ignore_url_params??[]].map(e=>e.toLowerCase());function Ye(){let e=document.documentElement;return{url:x(location.href,F()),referrer:ze,lang:navigator.language,viewport_w:e.clientWidth,viewport_h:e.clientHeight,platform:"web",app_version:m.release,...Fe}}function B(){let e=Date.now();return(!w||e-w.t>De)&&(w={id:L(),t:e,u:Math.random(),v:Math.random(),n:0}),w.t=e,w.id}function P(e,t={},n={}){let r={id:L(),event:e,ts:new Date().toISOString(),distinct_id:C??S,session_id:B(),environment:fe,props:{...Ye(),...t},...n};C&&(r.identified=!0),Qe(r),$t(e)}function Qe(e){let t=I();if(t==="wait"||!g){U.push(e),U.length>kt&&U.shift();return}if(t==="off")return;let n=g.sampling;B(),!(w.u>=n.sessions||e.event!=="$identify"&&Math.random()>=n.events)&&(h.push(e)>je&&h.shift(),h.length>=m.batchSize?Ne():ie||(ie=setTimeout(()=>{ie=0,Ne()},m.batchInterval)),ae||(ae=setTimeout(()=>{ae=0,J()},1e3)))}function J(){if(I()!=="full")return;let e=h.slice(-je);for(;e.length>1&&JSON.stringify(e).length>St;)e=e.slice(e.length>>1);_("pt_q",e.length?e:null),_("pt_s",w)}var Ze=e=>JSON.stringify({api_key:A,sent_at:new Date().toISOString(),consent:Ge(),batch:e}),Q=()=>I()==="mem"||I()==="full";async function Ne(){if(!(le||!h.length||!Q())){le=!0;try{for(await K;h.length&&Q();){let e=h.slice(0,100);await Z($+"/i/v1/events",{method:"POST",body:await oe(Ze(e))});let t=new Set(e);h=h.filter(n=>!t.has(n)),J()}}finally{le=!1}}}function Ae(){for(J(),v?.beacon();h.length&&Q();){let e=h.slice(0,25);if(!navigator.sendBeacon?.($+"/i/v1/events",new Blob([Ze(e)],{type:"text/plain"})))break;let t=new Set(e);h=h.filter(n=>!t.has(n))}J()}function Rt(){let e=S;S=N("pt_id")||S,_("pt_id",S);let t=N("pt_s");t&&Date.now()-t.t<De&&(w=t);let n=N("pt_u");n&&D("personalization")&&(C=n.u,M=n.tr);let r=N("pt_q");Array.isArray(r)&&(h=[...r,...h]);for(let o of[...h,...U])o.distinct_id===e&&(o.distinct_id=S);he=!0}function et(){for(let e of["pt_id","pt_s","pt_q","pt_u","pt_cfg","pt_flags"])_(e,null);h=[],U=[],C=null,M={},w=void 0,he=!1,S="anon_"+L()}function xt(){let e=ke.get(),t=JSON.stringify(e);t!==Te&&(Te=t,ge.forEach(n=>{try{n(e)}catch{}}),dispatchEvent(new CustomEvent("pt:consent",{detail:e})))}function tt(){xt();let e=I();e==="full"&&!he&&Rt(),e!=="wait"&&(U.splice(0).forEach(t=>e!=="off"&&Qe(t)),rt(),be(),q&&D("personalization")&&(st(...q),q=null),J())}function ye(e,t){let n=R(d)?d.c:null,r={...e,necessary:!0},o=t==="withdraw"||!!n&&Ue.some(i=>n[i]&&!r[i]);d={id:d?.id||L(),v:g?.consent?.version??0,t:Date.now(),c:r,p:o?"withdraw":t},_("pt_consent",d),nt(d),r.analytics?r.personalization||(C=null,M={},q=null,_("pt_u",null)):et(),r.replay||(v?.stop(),v=null),tt(),E?.reset()}function nt(e){He=e;let t={api_key:A,consent_id:e.id,policy_version:e.v,choices:e.c,source:e.p};K=K.then(async()=>{let n=await Ke("/i/v1/consent",JSON.stringify(t),6,!0);n>199&&n<300&&(delete e.p,d===e&&_("pt_consent",e))})}function rt(){!g||!ve||document.querySelectorAll('script[type="text/plain"][data-pt-category]').forEach(e=>{if(!D(e.dataset.ptCategory))return;let t=document.createElement("script");for(let n of Array.from(e.attributes))n.name!=="type"&&n.name!=="data-pt-category"&&t.setAttribute(n.name,n.value);t.text=e.text,e.replaceWith(t)})}async function we(e){let t=g?.consent;if(!(!t||T)){T=!0,H?.(),H=void 0;try{(await import("./consent.js")).show({cfg:t,current:e&&d?d.c:null,onChoice:r=>ye(r,"banner"),onClose:()=>{T=!1,ot()}})}catch{T=!1}}}async function ot(){let e=g?.consent;if(!(!e?.enabled||!R(d)||T||H||de||typeof document>"u")){de=!0;try{if(document.readyState==="loading"&&await new Promise(t=>document.addEventListener("DOMContentLoaded",t,{once:!0})),await new Promise(t=>setTimeout(t,1e3)),T||H||document.querySelector("[data-pt-consent-open]"))return;H=(await import("./consent.js")).manage(e,()=>{we(!0)})}catch{}finally{de=!1}}}function qe(){d?.p&&d!==He&&R(d)&&nt(d),tt();let e=g?.consent;e?.enabled&&!R(d)&&!Ve()&&(e.regions==="always"||We())?we(!1):ot()}function be(e=!1){let t=g?.replay;!ve||v||ue||z||!t?.enabled||!D("replay")||typeof document>"u"||(B(),!(w.u>=g.sampling.sessions||!(e||w.v<t.sample_rate))&&(ue=!0,import("./replay.js").then(n=>{if(v||!D("replay"))return;let r=(o,i)=>`/i/v1/replay/${o}/chunks?key=${encodeURIComponent(A)}&seq=${i}`;v=n.start({cfg:t,dropParams:F(),sessionId:B,distinctId:()=>C??S,consent:Ge,nextSeq:()=>(B(),w.n++),post:async(o,i,a)=>{await K;let s=await Ke(r(o,i),a,6);return s===403&&(v?.stop(),v=null,z=!0),s},beacon:(o,i,a)=>!!navigator.sendBeacon?.($+r(o,i),new Blob([a],{type:"text/plain"}))})}).catch(()=>{}).finally(()=>{ue=!1})))}function $t(e){let t=g?.replay.triggers;if(!t||v)return;let n=location.pathname+location.search,r=o=>new RegExp("^"+o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$").test(n);(e==="$error"&&t.on_error||t.events?.includes(e)||e==="$pageview"&&t.url_patterns?.some(r))&&be(!0)}function me(){let e=x(location.href,F());if(e===ce)return;ze=ce??x(document.referrer,F()),ce=e;let t=new URL(location.href).searchParams;for(let[n,r]of t)n.startsWith("utm_")&&(Fe[n]=r.slice(0,200));P("$pageview")}function Mt(){for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...n){pe.forEach(o=>o());let r=t.apply(this,n);return me(),r}}addEventListener("popstate",()=>{pe.forEach(e=>e()),me()})}function Se(e,t){if(G||typeof window>"u")return;G=!0,A=e,m={batchInterval:5e3,batchSize:20,...t},$=m.host.replace(/\/$/,""),fe=m.environment,d=N("pt_consent");let n=d?.c.analytics?N("pt_cfg"):null;n&&n.consent?.version===d.v&&(g=n,qe()),E=Oe({key:A,env:fe,pollMs:m.flagsPollMs??3e4,capture:P,json:Et,id:()=>C??S,props:()=>({...Ye(),$platform:"web",...M}),load:()=>I()==="full"?localStorage.getItem("pt_flags"):null,save:i=>Y("pt_flags",JSON.parse(i)),canPost:()=>Q()}),(async()=>{let i=await Z(`${$}/i/v1/config?key=${encodeURIComponent(A)}`,{},5),a=i?.ok?await i.json().catch(()=>null):null;a&&(g=a,ve=!0,Y("pt_cfg",a),R(d)||(v?.stop(),v=null),qe(),Je())})();let r=i=>{pe.push(i)};m.autocapture!==!1&&xe(P,r),addEventListener("online",()=>Be?.()),document.addEventListener("click",i=>{i.target?.closest?.("[data-pt-consent-open]")&&(i.preventDefault(),ke.open())}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){z||v?.resume();return}Ae(),v?.pause()}),addEventListener("pagehide",Ae),m.pageviews!==!1&&(Mt(),me());let o=m.autocapture!==!1?Re(P,r,{frustration:m.frustration!==!1}):void 0;Pe(P,{errors:m.errors!==!1,network:m.network!==!1,vitals:m.vitals!==!1,console:m.console===void 0?["warn","error"]:m.console,drop:F,host:$,release:m.release,onError:o},r),document.addEventListener("DOMContentLoaded",rt)}function It(e,t){G&&P(e,t)}function st(e,t={}){if(!G)return;if(!D("personalization")){q=[e,t];return}let n=S;C=e,M={...M,...t},Y("pt_u",{u:C,tr:M}),P("$identify",{},{anonymous_id:n,traits:t}),E?.reset()}function Lt(){C=null,M={},q=null,w=void 0,S="anon_"+L(),_("pt_u",null),_("pt_s",null),Y("pt_id",S),E?.reset()}var it=e=>g?e():void Xe.then(e),Pt=e=>it(()=>ye(Object.fromEntries((e??Ue).map(t=>[t,!0])),"api")),Ot=()=>{et(),it(()=>ye({},"withdraw"))},ke={open:()=>Xe.then(()=>we(!0)),get:()=>R(d)?{...d.c}:null,onChange:e=>(ge.add(e),()=>{ge.delete(e)})},Tt={pause(){z=!0,v?.pause()},resume(){z=!1,v?v.resume():be()}},Nt={isEnabled:e=>E?.isEnabled(e)??!1,getVariant:e=>E?.getVariant(e),getPayload:e=>E?.getPayload(e),reload:()=>E?.reload(),onChange:e=>E?.onChange(e)??(()=>{})};var O=document.currentScript;globalThis.SheepTrack=Ce;O?.dataset.key&&Se(O.dataset.key,{host:O.dataset.host||new URL(O.src).origin,environment:O.dataset.env==="dev"||O.dataset.env==="prod"?O.dataset.env:void 0});})();
@@ -1,3 +1,9 @@
1
- import type { BannerArgs } from './ctx.js';
1
+ import type { BannerArgs, ConsentCfg } from './ctx.js';
2
+ /** [r, g, b] of a #rrggbb or a computed rgb()/rgba() colour; null when unknown or (almost) transparent. */
3
+ export declare const rgb: (c?: string | null) => number[] | null;
4
+ /** Look of the host page (font, text and background colours, its first button) so the banner fits the site without settings. */
5
+ export declare function pageTheme(): Record<string, string>;
6
+ /** Small floating "Manage my cookies" button, so a choice can be changed or withdrawn at any time (FR-CMP-07). */
7
+ export declare function manage(cfg: ConsentCfg, onOpen: () => void): () => void;
2
8
  /** Consent banner in a Shadow DOM, fixed-position overlay (no layout shift). Texts are set with textContent only. */
3
9
  export declare function show({ cfg, current, onChoice, onClose }: BannerArgs): () => void;
@@ -11,7 +11,8 @@ export interface ReplayCtx {
11
11
  dropParams: string[];
12
12
  /** Resolves with the final HTTP status (0 = gave up). */
13
13
  post(sid: string, seq: number, json: string): Promise<number>;
14
- beacon(sid: string, seq: number, json: string): void;
14
+ /** false when the browser refused it (size limit): the chunk is kept for a later POST. */
15
+ beacon(sid: string, seq: number, json: string): boolean;
15
16
  }
16
17
  export interface ReplayHandle {
17
18
  stop(): void;
@@ -1,5 +1,6 @@
1
1
  /** Copy of the protocol type so the published .d.ts does not import the private workspace package. */
2
2
  export type ConsentCategory = 'necessary' | 'analytics' | 'replay' | 'personalization' | 'marketing';
3
+ export type ConsentChoices = Partial<Record<ConsentCategory, boolean>>;
3
4
  export interface InitOptions {
4
5
  host: string;
5
6
  /** Default: the project's "default environment" setting. */
@@ -28,6 +29,10 @@ export declare const optIn: (cats?: ConsentCategory[]) => void;
28
29
  export declare const optOut: () => void;
29
30
  export declare const consent: {
30
31
  open: () => Promise<void>;
32
+ /** The visitor's choice per category, or null while there is none (or it expired, or the policy version changed). */
33
+ get: () => ConsentChoices | null;
34
+ /** Called with consent.get() each time it changes; returns the unsubscribe function. */
35
+ onChange: (cb: (c: ConsentChoices | null) => void) => () => void;
31
36
  };
32
37
  export declare const replay: {
33
38
  pause(): void;
@@ -7,9 +7,3 @@ export declare function cleanUrl(u: string, drop: string[]): string;
7
7
  export declare function selector(el: Element): string;
8
8
  /** gzip when CompressionStream exists; text/plain avoids the CORS preflight. */
9
9
  export declare function pack(s: string): Promise<Blob>;
10
- export declare function ua(): {
11
- os: string;
12
- os_version?: string;
13
- browser: string;
14
- browser_version?: string;
15
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheeptrack/web",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "SheepTrack browser SDK: analytics, consent banner, session replay, debug.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,10 +16,17 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
- "README.md"
19
+ "README.md",
20
+ "CHANGELOG.md"
20
21
  ],
22
+ "scripts": {
23
+ "build": "node scripts/build.mjs && tsc -p tsconfig.build.json",
24
+ "size": "node scripts/build.mjs && node scripts/size.mjs",
25
+ "typecheck": "pnpm --filter @sheeptrack/protocol run build && tsc -p tsconfig.json --noEmit",
26
+ "test": "vitest run"
27
+ },
21
28
  "devDependencies": {
22
- "@sheeptrack/protocol": "0.1.0",
29
+ "@sheeptrack/protocol": "workspace:*",
23
30
  "@types/node": "^24.19.2",
24
31
  "esbuild": "^0.28.2",
25
32
  "happy-dom": "^21.0.3",
@@ -30,11 +37,5 @@
30
37
  },
31
38
  "publishConfig": {
32
39
  "access": "public"
33
- },
34
- "scripts": {
35
- "build": "node scripts/build.mjs && tsc -p tsconfig.build.json",
36
- "size": "node scripts/build.mjs && node scripts/size.mjs",
37
- "typecheck": "pnpm --filter @sheeptrack/protocol run build && tsc -p tsconfig.json --noEmit",
38
- "test": "vitest run"
39
40
  }
40
- }
41
+ }