@packstub/session-replay 0.0.0-stage → 1.3.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Packstub <support@packstub.dev>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,83 @@
1
- # Temporary Holding Version
1
+ # @packstub/session-replay
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The browser recorder of [Session Replay for Laravel](https://github.com/packstub/session-replay), for a frontend that runs on its own origin: a Vue or React app on `app.example.com` that talks to your Laravel API on `api.example.com`. It records the page with [rrweb](https://github.com/rrweb-io/rrweb) and uploads to your own Laravel app, where the recordings are stored and watched. Nothing goes to a third party.
4
+
5
+ If Laravel renders your pages (Blade, Livewire, Inertia), you don't need this package: the `@sessionReplay` directive of the Composer package loads the same recorder.
6
+
7
+ ## Requirements
8
+
9
+ A Laravel app with [`packstub/session-replay`](https://packagist.org/packages/packstub/session-replay) installed, the token route turned on and your frontend's origin listed:
10
+
11
+ ```dotenv
12
+ SESSION_REPLAY_TOKEN_ENDPOINT=true
13
+ SESSION_REPLAY_ORIGINS=https://app.example.com
14
+ ```
15
+
16
+ Use the same version of both packages: this one is released with the Composer package, under the same version number.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm install @packstub/session-replay
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```js
27
+ import { start } from '@packstub/session-replay';
28
+
29
+ start({ endpoint: 'https://api.example.com/session-replay/token' });
30
+ ```
31
+
32
+ `start()` fetches the recorder's config and a signed token from your app, behind your app's own sign-in, and resolves to `true` once the tab records. Call it again whenever the person signs in or out (the options of the first call carry over): a token for someone else ends the current recording and starts a new one.
33
+
34
+ With a bearer token instead of the session cookie:
35
+
36
+ ```js
37
+ start({
38
+ endpoint: 'https://api.example.com/session-replay/token',
39
+ credentials: 'omit',
40
+ headers: { Authorization: `Bearer ${token}` },
41
+ });
42
+ ```
43
+
44
+ | Option | Default | Meaning |
45
+ | --- | --- | --- |
46
+ | `endpoint` | required | The token route's URL. |
47
+ | `credentials` | `'include'` | Sent with the token request. Use `'omit'` with a bearer token. |
48
+ | `headers` | `{}` | Extra headers for the token request only, such as `Authorization`. |
49
+ | `fetch` | the browser's | The `fetch` the token request goes through. |
50
+ | `global` | `false` | Also expose the recorder as `window.SessionReplay`. |
51
+
52
+ ## API
53
+
54
+ | Function | What it does |
55
+ | --- | --- |
56
+ | `start(options)` | Fetches a token and records. Resolves to whether this tab records. |
57
+ | `stop()` | Stops recording until `start()` or `consent(true)`. |
58
+ | `mark(label, payload)` | Puts a moment of your own on the recording's timeline. |
59
+ | `send(label, payload)` | Sends the replay now, for a "report a problem" button. |
60
+ | `consent(given)` | `true` remembers the answer and starts recording, `false` forgets it and stops. |
61
+ | `sessionId()` | The running recording's id, or `null`. |
62
+ | `isRecording()` | Whether this tab uploads right now. |
63
+ | `header()` | `{ 'X-Session-Replay': '…' }` to link your API's log lines to the replay, `{}` while nothing records. |
64
+
65
+ `header()` carries the recording's write key: send it to your own API only.
66
+
67
+ ```js
68
+ api.interceptors.request.use((config) => {
69
+ Object.assign(config.headers, header());
70
+
71
+ return config;
72
+ });
73
+ ```
74
+
75
+ The package ships TypeScript declarations and can be imported during server-side rendering; it records only in a browser.
76
+
77
+ ## Documentation
78
+
79
+ The full guide, with the Laravel side, Vue and React examples, CORS and the limits: [Standalone frontend](https://packstub.dev/docs/session-replay/standalone).
80
+
81
+ ## License
82
+
83
+ MIT
@@ -0,0 +1,142 @@
1
+ var Ei=Object.defineProperty;var vi=(e,t,n)=>t in e?Ei(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>vi(e,typeof t!="symbol"?t+"":t,n);var Ti=Object.defineProperty,Ci=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>Ci(e,typeof t!="symbol"?t+"":t,n),Br,I=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(I||{}),N=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(N||{}),K=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(K||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),Qe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Qe||{}),je=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(je||{}),B=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(B||{}),Wr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},zr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ft={},Tn={},$r=0,xi=()=>!!globalThis.Zone;function Un(e){if(ft[e])return ft[e];let t=globalThis[e],n=t.prototype,r=e in Wr?Wr[e]:void 0,o=!!(r&&r.every(l=>{var a,d;return!!((d=(a=Object.getOwnPropertyDescriptor(n,l))==null?void 0:a.get)!=null&&d.toString().includes("[native code]"))})),s=e in zr?zr[e]:void 0,i=!!(s&&s.every(l=>{var a;return typeof n[l]=="function"&&((a=n[l])==null?void 0:a.toString().includes("[native code]"))}));if(o&&i&&!xi())return ft[e]=t.prototype,t.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let a=l.contentWindow;if(!a)return t.prototype;let d=a[e].prototype;if(!d)return l.remove(),n;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),Tn[e]=()=>l.remove()):l.remove(),ft[e]=d}catch{return n}}var bn={};function ee(e,t,n){var r,o;let s=(r=bn[e])==null?void 0:r[n];if(s)return s.call(t);let i=Un(e),l=(o=Object.getOwnPropertyDescriptor(i,n))==null?void 0:o.get;return l?((bn[e]||(bn[e]={}))[n]=l,l.call(t)):t[n]}var wn={};function to(e,t,n){let r=`${e}.${String(n)}`;if(wn[r])return wn[r].bind(t);let s=Un(e)[n];return typeof s!="function"?t[n]:(wn[r]=s,s.bind(t))}function Mi(e){return ee("Node",e,"ownerDocument")}function Ii(e){return ee("Node",e,"childNodes")}function Ni(e){return ee("Node",e,"parentNode")}function ki(e){return ee("Node",e,"parentElement")}function Ri(e){return ee("Node",e,"textContent")}function Oi(e){return ee("Node",e,"firstChild")}function Li(e){return ee("Node",e,"lastChild")}function Ai(e){return ee("Node",e,"nextSibling")}function _i(e){return ee("Node",e,"previousSibling")}function Di(e,t){return to("Node",e,"contains")(t)}function Pi(e){return to("Node",e,"getRootNode")()}function Ui(e){return!e||!("host"in e)?null:ee("ShadowRoot",e,"host")}function Fi(e){return e.styleSheets}function Hi(e){return!e||!("shadowRoot"in e)?null:ee("Element",e,"shadowRoot")}function Bi(e,t){return ee("Element",e,"querySelector")(t)}function Wi(e,t){return ee("Element",e,"querySelectorAll")(t)}function no(){let e=Un("MutationObserver");$r++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--$r!==0))return;let n=Tn.MutationObserver;if(n)try{n()}finally{delete ft.MutationObserver,delete Tn.MutationObserver}}]}var gt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(gt=()=>new Date().getTime());function Oe(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}var T={ownerDocument:Mi,childNodes:Ii,parentNode:Ni,parentElement:ki,textContent:Ri,firstChild:Oi,lastChild:Li,nextSibling:Ai,previousSibling:_i,contains:Di,getRootNode:Pi,host:Ui,styleSheets:Fi,shadowRoot:Hi,querySelector:Bi,querySelectorAll:Wi,nowTimestamp:gt,mutationObserverCtor:no,patch:Oe};function ro(e){return e.nodeType===e.ELEMENT_NODE}function pt(e){let t=e&&"host"in e&&"mode"in e&&T.host(e)||null;return!!(t&&"shadowRoot"in t&&T.shadowRoot(t)===e)}function ht(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function zi(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function $i(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function Cn(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,o=>oo(o,n)).join("");return zi(r)}catch{return null}}function oo(e,t){if(qi(e)){let n;try{n=Cn(e.styleSheet)||$i(e)}catch{n=e.cssText}return e.styleSheet.href?Vt(n,e.styleSheet.href):n}else{let n=e.cssText;return ji(e)&&e.selectorText.includes(":")&&(n=Vi(n)),t?Vt(n,t):n}}function Vi(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function qi(e){return"styleSheet"in e}function ji(e){return"selectorText"in e}var Wt=class{constructor(){b(this,"idNodeMap",new Map),b(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o));let r=T.shadowRoot(t);r&&this.removeNodeFromMap(r)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Gi(){return new Wt}function zt({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:s}){let i=o||"",l=r&&ve(r);return(t[n.toLowerCase()]||l&&t[l])&&(s?i=s(i,e):i="*".repeat(i.length)),i}function ve(e){return e.toLowerCase()}var Vr="__rrweb_original__";function Xi(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let o=0;o<e.height;o+=n){let s=t.getImageData,i=Vr in s?s[Vr]:s;if(new Uint32Array(i.call(t,r,o,Math.min(n,e.width-r),Math.min(n,e.height-o)).data.buffer).some(a=>a!==0))return!1}return!0}function $t(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ve(t):null}function so(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,o=n.pathname.match(r);return o?.[1]??null}function Yi(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Ji=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ki=/^(?:[a-z+]+:)?\/\//i,Qi=/^www\..*/i,Zi=/^(data:)([^,]*),(.*)/i;function Vt(e,t){return(e||"").replace(Ji,(n,r,o,s,i,l)=>{let a=o||i||l,d=r||s||"";if(!a)return n;if(Ki.test(a)||Qi.test(a))return`url(${d}${a}${d})`;if(Zi.test(a))return`url(${d}${a}${d})`;if(a[0]==="/")return`url(${d}${Yi(t)+a}${d})`;let u=a.split("#")[0],h=a.substring(u.length),m=t.split("#")[0].split("/"),p=u.split("/");m.pop();for(let f of p)f!=="."&&(f===".."?m.pop():m.push(f));return`url(${d}${m.join("/")}${h}${d})`})}var io="(?:/\\*[^*]*\\*/)|[\\s;]",ea=new RegExp(`${io}|\\b(0)px?`,"g"),ta=new RegExp(io,"g");function Pt(e,t=!1){return t?e.replace(ta,""):e.replace(ea,"$1")}function na(e,t,n=!1){let r=Array.from(t.childNodes),o=[],s=0;if(r.length>1&&e&&typeof e=="string"){let i=Pt(e,n),l=i.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){let d=Pt(r[a].textContent,n),u=100,h=3;for(;h<d.length&&(d[h].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,h),1)!==-1);h++);for(;h<d.length;h++){let m=d.substring(0,h),p=i.split(m),f=-1;if(p.length===2)f=p[0].length;else if(p.length>2&&p[0]===""&&r[a-1].textContent!=="")f=i.indexOf(m,1);else if(p.length===1){if(m=m.substring(0,m.length-1),p=i.split(m),p.length<=1)return o.push(e),o;h=u+1}else h===d.length-1&&(f=i.indexOf(m));if(p.length>=2&&h>u){let c=r[a-1].textContent;if(c&&typeof c=="string"){let y=Pt(c).length;f=i.indexOf(m,y)}f===-1&&(f=p[0].length)}if(f!==-1){let c=Math.floor(f/l);for(;c>0&&c<e.length;){if(s+=1,s>50*r.length)return o.push(e),o;let y=Pt(e.substring(0,c),n);if(y.length===f){o.push(e.substring(0,c)),e=e.substring(c),i=i.substring(f);break}else y.length<f?c+=Math.max(1,Math.floor((f-y.length)/l)):c-=Math.max(1,Math.floor((y.length-f)*l))}break}}}}return o.push(e),o}function ra(e,t){return na(e,t).join("/* rr_split */")}var oa=1,sa=new RegExp("[^a-z0-9-_:]"),qt=-2;function ao(){return oa++}function ia(e){if(e instanceof HTMLFormElement)return"form";let t=ve(e.tagName);return sa.test(t)?"div":t}var qe,qr,aa=/^[^ \t\n\r\u000c]+/,la=/^[, \t\n\r\u000c]+/;function ca(e,t){if(t.trim()==="")return t;let n=0;function r(s){let i,l=s.exec(t.substring(n));return l?(i=l[0],n+=i.length,i):""}let o=[];for(;r(la),!(n>=t.length);){let s=r(aa);if(s.slice(-1)===",")s=Xe(e,s.substring(0,s.length-1)),o.push(s);else{let i="";s=Xe(e,s);let l=!1;for(;;){let a=t.charAt(n);if(a===""){o.push((s+i).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){n+=1,o.push((s+i).trim());break}else a==="("&&(l=!0);i+=a,n+=1}}}return o.join(", ")}var jr=new WeakMap;function Xe(e,t){return!t||t.trim()===""?t:Fn(e,t)}function ua(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Fn(e,t){let n=jr.get(e);if(n||(n=e.createElement("a"),jr.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function lo(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?Xe(e,r):n==="srcset"?ca(e,r):n==="style"?Vt(r,Fn(e)):t==="object"&&n==="data"?Xe(e,r):r)}function co(e,t,n){return["video","audio"].includes(e)&&ve(t)==="autoplay"}function da(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch{}return!1}function jt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?jt(T.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let o=e.classList[r];if(t.test(o))return!0}return n?jt(T.parentNode(e),t,n):!1}function uo(e,t,n,r){let o;if(ro(e)){if(o=e,!T.childNodes(o).length)return!1}else{if(T.parentElement(e)===null)return!1;o=T.parentElement(e)}try{if(typeof t=="string"){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(jt(o,t,r))return!0;if(n){if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}}catch{}return!1}function fa(e,t,n){let r=e.contentWindow;if(!r)return;let o=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){let l=setTimeout(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{clearTimeout(l),o=!0,t()});return}let i="about:blank";if(r.location.href!==i||e.src===i||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function pa(e,t,n){let r=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(s),r=!0,t()})}function ha(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:i,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:d,maskInputFn:u,dataURLOptions:h={},inlineImages:m,recordCanvas:p,keepIframeSrcFn:f,newlyAddedElement:c=!1,cssCaptured:y=!1}=t,w=ma(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:B.Document,childNodes:[],compatMode:e.compatMode}:{type:B.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:B.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return ya(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:a,maskInputFn:u,dataURLOptions:h,inlineImages:m,recordCanvas:p,keepIframeSrcFn:f,newlyAddedElement:c,rootId:w});case e.TEXT_NODE:return ga(e,{doc:n,needsMask:i,maskTextFn:d,rootId:w,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:B.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:B.Comment,textContent:T.textContent(e)||"",rootId:w};default:return!1}}function ma(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function ga(e,t){let{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:s}=t,i=T.parentNode(e),l=i&&i.tagName,a="",d=l==="STYLE"?!0:void 0,u=l==="SCRIPT"?!0:void 0;return u?a="SCRIPT_PLACEHOLDER":s||(a=T.textContent(e),d&&a&&(a=Vt(a,Fn(t.doc)))),!d&&!u&&a&&n&&(a=r?r(a,T.parentElement(e)):a.replace(/[\S]/g,"*")),{type:B.Text,textContent:a||"",rootId:o}}function ya(e,t){let{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:s,maskInputOptions:i={},maskInputFn:l,dataURLOptions:a={},inlineImages:d,recordCanvas:u,keepIframeSrcFn:h,newlyAddedElement:m=!1,rootId:p}=t,f=da(e,r,o),c=ia(e),y={},w=e.attributes.length;for(let g=0;g<w;g++){let x=e.attributes[g];co(c,x.name,x.value)||(y[x.name]=lo(n,c,ve(x.name),x.value))}if(c==="link"&&s){let g=Array.from(n.styleSheets).find(A=>A.href===e.href),x=null;g&&(x=Cn(g)),x&&(delete y.rel,delete y.href,y._cssText=x)}if(c==="style"&&e.sheet){let g=Cn(e.sheet);g&&(e.childNodes.length>1&&(g=ra(g,e)),y._cssText=g)}if(["input","textarea","select"].includes(c)){let g=e.value,x=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=zt({element:e,type:$t(e),tagName:c,value:g,maskInputOptions:i,maskInputFn:l}):x&&(y.checked=x)}if(c==="option"&&(e.selected&&!i.select?y.selected=!0:delete y.selected),c==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&u){if(e.__context==="2d")Xi(e)||(y.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let g=e.toDataURL(a.type,a.quality),x=n.createElement("canvas");x.width=e.width,x.height=e.height;let A=x.toDataURL(a.type,a.quality);g!==A&&(y.rr_dataURL=g)}}if(c==="img"&&d){qe||(qe=n.createElement("canvas"),qr=qe.getContext("2d"));let g=e,x=g.currentSrc||g.getAttribute("src")||"<unknown-src>",A=g.crossOrigin,_=()=>{g.removeEventListener("load",_);try{qe.width=g.naturalWidth,qe.height=g.naturalHeight,qr.drawImage(g,0,0),y.rr_dataURL=qe.toDataURL(a.type,a.quality)}catch(C){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_);return}else console.warn(`Cannot inline img src=${x}! Error: ${C}`)}g.crossOrigin==="anonymous"&&(A?y.crossOrigin=A:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_)}if(["audio","video"].includes(c)){let g=y;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(m||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),f){let{width:g,height:x}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${x}px`}}c==="iframe"&&!h(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let E;try{customElements.get(c)&&(E=!0)}catch{}return{type:B.Element,tagName:c,attributes:y,childNodes:[],isSVG:ua(e)||void 0,needBlock:f,rootId:p,isCustom:E}}function P(e){return e==null?"":e.toLowerCase()}function fo(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Sa(e,t){if(t.comment&&e.type===B.Comment)return!0;if(e.type===B.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&so(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(P(e.attributes.name).match(/^msapplication-tile(image|color)$/)||P(e.attributes.name)==="application-name"||P(e.attributes.rel)==="icon"||P(e.attributes.rel)==="apple-touch-icon"||P(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&P(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(P(e.attributes.property).match(/^(og|twitter|fb):/)||P(e.attributes.name).match(/^(og|twitter):/)||P(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(P(e.attributes.name)==="robots"||P(e.attributes.name)==="googlebot"||P(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(P(e.attributes.name)==="author"||P(e.attributes.name)==="generator"||P(e.attributes.name)==="framework"||P(e.attributes.name)==="publisher"||P(e.attributes.name)==="progid"||P(e.attributes.property).match(/^article:/)||P(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(P(e.attributes.name)==="google-site-verification"||P(e.attributes.name)==="yandex-verification"||P(e.attributes.name)==="csrf-token"||P(e.attributes.name)==="p:domain_verify"||P(e.attributes.name)==="verify-v1"||P(e.attributes.name)==="verification"||P(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ye(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:d=!0,maskInputOptions:u={},maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f={},inlineImages:c=!1,recordCanvas:y=!1,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:C=!1,cssCaptured:$=!1}=t,{needsMask:te}=t,{preserveWhiteSpace:ae=!0}=t;te||(te=uo(e,i,l,te===void 0));let ne=ha(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,dataURLOptions:f,inlineImages:c,recordCanvas:y,keepIframeSrcFn:_,newlyAddedElement:C,cssCaptured:$});if(!ne)return console.warn(e,"not serialized"),null;let de;r.hasNode(e)?de=r.getId(e):Sa(ne,p)||!ae&&ne.type===B.Text&&!ne.textContent.replace(/^\s+|\s+$/gm,"").length?de=qt:de=ao();let R=Object.assign(ne,{id:de});if(r.add(e,R),de===qt)return null;w&&w(e);let ct=!a;if(R.type===B.Element){ct=ct&&!R.needBlock,delete R.needBlock;let W=T.shadowRoot(e);W&&ht(W)&&(R.isShadowHost=!0)}if((R.type===B.Document||R.type===B.Element)&&ct){p.headWhitespace&&R.type===B.Element&&R.tagName==="head"&&(ae=!1);let W={doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:a,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:A,keepIframeSrcFn:_,cssCaptured:!1};if(!(R.type===B.Element&&R.tagName==="textarea"&&R.attributes.value!==void 0)){R.type===B.Element&&R.attributes._cssText!==void 0&&typeof R.attributes._cssText=="string"&&(W.cssCaptured=!0);for(let ke of Array.from(T.childNodes(e))){let fe=Ye(ke,W);fe&&R.childNodes.push(fe)}}let re=null;if(ro(e)&&(re=T.shadowRoot(e)))for(let ke of Array.from(T.childNodes(re))){let fe=Ye(ke,W);fe&&(ht(re)&&(fe.isShadow=!0),R.childNodes.push(fe))}}let ut=T.parentNode(e);return ut&&pt(ut)&&ht(ut)&&(R.isShadow=!0),R.type===B.Element&&R.tagName==="iframe"&&fa(e,()=>{let W=e.contentDocument;if(W&&E){let re=Ye(W,{doc:W,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:A,keepIframeSrcFn:_});re&&E(e,re)}},g),R.type===B.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&so(R.attributes.href)==="css")&&pa(e,()=>{if(x){let W=Ye(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:A,keepIframeSrcFn:_});W&&x(e,W)}},A),R}function ba(e,t){let{mirror:n=new Wt,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:i=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:d=!1,maskAllInputs:u=!1,maskTextFn:h,maskInputFn:m,slimDOM:p=!1,dataURLOptions:f,preserveWhiteSpace:c,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:A=()=>!1}=t,_=u===!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}:u===!1?{password:!0}:u,C=fo(p);return Ye(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:s,maskTextSelector:i,skipChild:!1,inlineStylesheet:l,maskInputOptions:_,maskTextFn:h,maskInputFn:m,slimDOMOptions:C,dataURLOptions:f,inlineImages:a,recordCanvas:d,preserveWhiteSpace:c,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:A,newlyAddedElement:!1})}var xn=class e{constructor(...t){b(this,"parentElement",null),b(this,"parentNode",null),b(this,"ownerDocument"),b(this,"firstChild",null),b(this,"lastChild",null),b(this,"previousSibling",null),b(this,"nextSibling",null),b(this,"ELEMENT_NODE",1),b(this,"TEXT_NODE",3),b(this,"nodeType"),b(this,"nodeName"),b(this,"RRNodeType")}get childNodes(){let t=[],n=this.firstChild;for(;n;)t.push(n),n=n.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function V(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var Ge=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`,Gr={map:{},getId(){return console.error(Ge),-1},getNode(){return console.error(Ge),null},removeNodeFromMap(){console.error(Ge)},has(){return console.error(Ge),!1},reset(){console.error(Ge)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Gr=new Proxy(Gr,{get(e,t,n){return t==="map"&&console.error(Ge),Reflect.get(e,t,n)}}));function yt(e,t,n={}){let r=null,o=0;return function(...s){let i=Date.now();!o&&n.leading===!1&&(o=i);let l=t-(i-o),a=this;l<=0||l>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(a,s)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{o=n.leading===!1?0:Date.now(),r=null,e.apply(a,s)},l))}}function Yt(e,t,n,r,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(i){setTimeout(()=>{n.set.call(this,i)},0),s&&s.set&&s.set.call(this,i)}}),()=>Yt(e,t,s||{},!0)}function po(e){var t,n,r,o;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=T.parentElement(s.body))==null?void 0:t.scrollLeft)||((n=s?.body)==null?void 0:n.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((r=T.parentElement(s.body))==null?void 0:r.scrollTop)||((o=s?.body)==null?void 0:o.scrollTop)||0}}function ho(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function mo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function go(e){return e?e.nodeType===e.ELEMENT_NODE?e:T.parentElement(e):null}function j(e,t,n,r){if(!e)return!1;let o=go(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||r&&o.closest("."+t)!==null)return!0}else if(jt(o,t,r))return!0}catch{}return!!(n&&(o.matches(n)||r&&o.closest(n)!==null))}function wa(e,t){return t.getId(e)!==-1}function En(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===qt}function yo(e,t){if(pt(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=T.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?yo(r,t):!0}function Mn(e){return!!e.changedTouches}function Ea(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function So(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function bo(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function In(e){return e?e instanceof xn&&"shadowRoot"in e?!!e.shadowRoot:!!T.shadowRoot(e):!1}var Nn=class{constructor(){b(this,"id",1),b(this,"styleIDMap",new WeakMap),b(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function wo(e){var t;let n=null;return"getRootNode"in e&&((t=T.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&T.host(T.getRootNode(e))&&(n=T.host(T.getRootNode(e))),n}function va(e){let t=e,n;for(;n=wo(t);)t=n;return t}function Ta(e){let t=T.ownerDocument(e);if(!t)return!1;let n=va(e);return T.contains(t,n)}function kn(e){let t=T.ownerDocument(e);return t?T.contains(t,e)||Ta(e):!1}var Xr=(e,t)=>`${e}@${t}`,Rn=class{constructor(){b(this,"frozen",!1),b(this,"locked",!1),b(this,"texts",[]),b(this,"attributes",[]),b(this,"attributeMap",new WeakMap),b(this,"removes",[]),b(this,"mapRemoves",[]),b(this,"movedMap",{}),b(this,"addedSet",new Set),b(this,"movedSet",new Set),b(this,"droppedSet",new Set),b(this,"removesSubTreeCache",new Set),b(this,"mutationCb"),b(this,"blockClass"),b(this,"blockSelector"),b(this,"maskTextClass"),b(this,"maskTextSelector"),b(this,"inlineStylesheet"),b(this,"maskInputOptions"),b(this,"maskTextFn"),b(this,"maskInputFn"),b(this,"keepIframeSrcFn"),b(this,"recordCanvas"),b(this,"inlineImages"),b(this,"slimDOMOptions"),b(this,"dataURLOptions"),b(this,"doc"),b(this,"mirror"),b(this,"iframeManager"),b(this,"stylesheetManager"),b(this,"shadowDomManager"),b(this,"processedNodeManager"),b(this,"unattachedDoc"),b(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),b(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],n=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let m of this.movedSet){let p=T.parentNode(m);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(m)}let r=null,o=null,s=-1,i=null,l=!1,a=new Set,d=this.addedSet.values(),u=d.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(T.previousSibling(r)))i=r,r=T.previousSibling(r);else{for(this.addedSet.has(u.value)||(u=d.next()),r=u.value;;){if(o=T.parentNode(r),this.addedSet.has(o)){r=o;continue}break}if(a.has(o))o=null;else if(o){if(kn(o)?(l=Yr(this.droppedSet,o)||this.removesSubTreeCache.has(o),l&&Yr(this.movedSet,r)&&(l=!1)):l=!0,this.addedSet.has(T.lastChild(o)))r=T.lastChild(o),i=null;else for(;;){if(i=T.nextSibling(r),this.addedSet.has(i)){r=i;continue}break}if(s=pt(o)?this.mirror.getId(wo(r)):this.mirror.getId(o),s===-1&&o.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let c=T.host(o);s=this.mirror.getId(c)}}}if(this.addedSet.delete(r),!o||s===-1){a.add(r);continue}else if(l){this.droppedSet.add(r);continue}let m=!1;if(r.nodeType===Node.TEXT_NODE){let c=o.tagName;if(c==="TEXTAREA")continue;c==="STYLE"&&n.has(s)&&(m=!0)}let p=i?this.mirror.getId(i):null;for(;p===qt;)i=i&&T.nextSibling(i),p=i&&this.mirror.getId(i);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",i),r=null;continue}let f=Ye(r,{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:c=>{So(c,this.mirror)&&this.iframeManager.addIframe(c),bo(c,this.mirror)&&this.stylesheetManager.trackLinkElement(c),In(r)&&this.shadowDomManager.addShadowRoot(T.shadowRoot(r),this.doc)},onIframeLoad:(c,y)=>{this.iframeManager.attachIframe(c,y),this.shadowDomManager.observeAttachShadow(c)},onStylesheetLoad:(c,y)=>{this.stylesheetManager.attachLinkElement(c,y)},cssCaptured:m});f&&(t.push({parentId:s,nextId:p,node:f}),n.add(f.id))}let h={texts:this.texts.map(m=>{let p=m.node,f=T.parentNode(p);return f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f),{id:this.mirror.getId(p),value:m.value}}).filter(m=>!n.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{let{attributes:p}=m;if(typeof p.style=="string"){let f=JSON.stringify(m.styleDiff),c=JSON.stringify(m._unchangedStyles);f.length<p.style.length&&(f+c).split("var(").length===p.style.split("var(").length&&(p.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:p}}).filter(m=>!n.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.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(h))}),b(this,"genTextAreaValueMutation",t=>{let n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(T.childNodes(t),o=>T.textContent(o)||"").join("");n.attributes.value=zt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:$t(t),value:r,maskInputFn:this.maskInputFn})}),b(this,"processMutation",t=>{if(!En(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=T.textContent(t.target);!j(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:uo(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,go(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=ve(n.tagName),o=t.attributeName,s=t.target.getAttribute(o);if(o==="value"){let l=$t(n);s=zt({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:l,value:s,maskInputFn:this.maskInputFn})}if(j(t.target,this.blockClass,this.blockSelector,!1)||s===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r==="iframe"&&o==="src"&&!this.keepIframeSrcFn(s))if(!n.contentDocument)o="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),o==="type"&&r==="input"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!co(r,o))if(i.attributes[o]=lo(this.doc,r,ve(o),s),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");t.oldValue&&l.setAttribute("style",t.oldValue);for(let a of Array.from(n.style)){let d=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);d!==l.style.getPropertyValue(a)||u!==l.style.getPropertyPriority(a)?u===""?i.styleDiff[a]=d:i.styleDiff[a]=[d,u]:i._unchangedStyles[a]=[d,u]}for(let a of Array.from(l.style))n.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else o==="open"&&n.tagName==="DIALOG"&&(n.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(j(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{kn(n)||this.shadowDomManager.removeShadowRootsIn(n);let r=this.mirror.getId(n),o=pt(t.target)?this.mirror.getId(T.host(t.target)):this.mirror.getId(t.target);j(t.target,this.blockClass,this.blockSelector,!1)||En(n,this.mirror,this.slimDOMOptions)||!wa(n,this.mirror)||(this.addedSet.has(n)?(On(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||yo(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Xr(r,o)]?On(this.movedSet,n):(this.removes.push({parentId:o,id:r,isShadow:pt(t.target)&&ht(t.target)?!0:void 0}),Ca(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),b(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(En(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Xr(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);j(t,this.blockClass,this.blockSelector,!1)||(T.childNodes(t).forEach(r=>this.genAdds(r)),In(t)&&T.childNodes(T.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function On(e,t){e.delete(t),T.childNodes(t).forEach(n=>On(e,n))}function Ca(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),T.childNodes(r).forEach(o=>n.push(o)))}}function Yr(e,t){return e.size===0?!1:Eo(e,t)}function Eo(e,t){if(e.has(t))return!0;let n=T.parentNode(t);return n?Eo(e,n):!1}var mt;function xa(e){mt=e}function Ma(){mt=void 0}var k=e=>mt?(...n)=>{try{return e(...n)}catch(r){if(mt&&mt(r)===!0)return;throw r}}:e,Ke=new Set;function bt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function vo(e,t){let n=new Rn;Ke.add(n),n.init(e);let[r,o]=no(),s=new r(k(n.processMutations.bind(n)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{s.disconnect(),Ke.delete(n),o()}}function Ia({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,i=[],l,a=yt(k(h=>{let m=Date.now()-l;e(i.map(p=>(p.timeOffset-=m,p)),h),i=[],l=null}),s),d=k(yt(k(h=>{let m=bt(h),{clientX:p,clientY:f}=Mn(h)?h.changedTouches[0]:h;l||(l=gt()),i.push({x:p,y:f,id:r.getId(m),timeOffset:gt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?N.Drag:h instanceof MouseEvent?N.MouseMove:N.TouchMove)}),o,{trailing:!1})),u=[V("mousemove",d,n),V("touchmove",d,n),V("drag",d,n)];return k(()=>{u.forEach(h=>h())})}function Na({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let i=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[],a=null,d=u=>h=>{let m=bt(h);if(j(m,r,o,!0))return;let p=null,f=u;if("pointerType"in h){switch(h.pointerType){case"mouse":p=me.Mouse;break;case"touch":p=me.Touch;break;case"pen":p=me.Pen;break}p===me.Touch?K[u]===K.MouseDown?f="TouchStart":K[u]===K.MouseUp&&(f="TouchEnd"):me.Pen}else Mn(h)&&(p=me.Touch);p!==null?(a=p,(f.startsWith("Touch")&&p===me.Touch||f.startsWith("Mouse")&&p===me.Mouse)&&(p=null)):K[u]===K.Click&&(p=a,a=null);let c=Mn(h)?h.changedTouches[0]:h;if(!c)return;let y=n.getId(m),{clientX:w,clientY:E}=c;k(e)({type:K[f],id:y,x:w,y:E,...p!==null&&{pointerType:p}})};return Object.keys(K).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&i[u]!==!1).forEach(u=>{let h=ve(u),m=d(u);if(window.PointerEvent)switch(K[u]){case K.MouseDown:case K.MouseUp:h=h.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}l.push(V(h,m,t))}),k(()=>{l.forEach(u=>u())})}function To({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){let i=k(yt(k(l=>{let a=bt(l);if(!a||j(a,r,o,!0))return;let d=n.getId(a);if(a===t&&t.defaultView){let u=po(t.defaultView);e({id:d,x:u.left,y:u.top})}else e({id:d,x:a.scrollLeft,y:a.scrollTop})}),s.scroll||100));return V("scroll",i,t)}function ka({viewportResizeCb:e},{win:t}){let n=-1,r=-1,o=k(yt(k(()=>{let s=ho(),i=mo();(n!==s||r!==i)&&(e({width:Number(i),height:Number(s)}),n=s,r=i)}),200));return V("resize",o,t)}var Ra=["INPUT","TEXTAREA","SELECT"],Jr=new WeakMap;function Oa({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:l,maskInputFn:a,sampling:d,userTriggeredOnInput:u}){function h(E){let g=bt(E),x=E.isTrusted,A=g&&g.tagName;if(g&&A==="OPTION"&&(g=T.parentElement(g)),!g||!A||Ra.indexOf(A)<0||j(g,r,o,!0)||g.classList.contains(s)||i&&g.matches(i))return;let _=g.value,C=!1,$=$t(g)||"";$==="radio"||$==="checkbox"?C=g.checked:(l[A.toLowerCase()]||l[$])&&(_=zt({element:g,maskInputOptions:l,tagName:A,type:$,value:_,maskInputFn:a})),m(g,u?{text:_,isChecked:C,userTriggered:x}:{text:_,isChecked:C});let te=g.name;$==="radio"&&te&&C&&t.querySelectorAll(`input[type="radio"][name="${te}"]`).forEach(ae=>{if(ae!==g){let ne=ae.value;m(ae,u?{text:ne,isChecked:!C,userTriggered:!1}:{text:ne,isChecked:!C})}})}function m(E,g){let x=Jr.get(E);if(!x||x.text!==g.text||x.isChecked!==g.isChecked){Jr.set(E,g);let A=n.getId(E);k(e)({...g,id:A})}}let f=(d.input==="last"?["change"]:["input","change"]).map(E=>V(E,k(h),t)),c=t.defaultView;if(!c)return()=>{f.forEach(E=>E())};let y=c.Object.getOwnPropertyDescriptor(c.HTMLInputElement.prototype,"value"),w=[[c.HTMLInputElement.prototype,"value"],[c.HTMLInputElement.prototype,"checked"],[c.HTMLSelectElement.prototype,"value"],[c.HTMLTextAreaElement.prototype,"value"],[c.HTMLSelectElement.prototype,"selectedIndex"],[c.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&f.push(...w.map(E=>Yt(E[0],E[1],{set(){k(h)({target:this,isTrusted:!1})}},!1,c))),k(()=>{f.forEach(E=>E())})}function Gt(e){let t=[];function n(r,o){if(Ut("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ut("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ut("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ut("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let i=Array.from(r.parentRule.cssRules).indexOf(r);return o.unshift(i),n(r.parentRule,o)}else if(r.parentStyleSheet){let i=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(i)}return o}return n(e,t)}function Ee(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function La({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:k((u,h,m)=>{let[p,f]=m,{id:c,styleId:y}=Ee(h,t,n.styleMirror);return(c&&c!==-1||y&&y!==-1)&&e({id:c,styleId:y,adds:[{rule:p,index:f}]}),u.apply(h,m)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,m=this.cssRules.length){let p=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,m])};let s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:k((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Ee(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,removes:[{index:p}]}),u.apply(h,m)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let i;r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:k((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Ee(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,replace:p}),u.apply(h,m)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:k((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Ee(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,replaceSync:p}),u.apply(h,m)})}));let a={};Ft("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Ft("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Ft("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Ft("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let d={};return Object.entries(a).forEach(([u,h])=>{d[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(d[u].insertRule,{apply:k((m,p,f)=>{let[c,y]=f,{id:w,styleId:E}=Ee(p.parentStyleSheet,t,n.styleMirror);return(w&&w!==-1||E&&E!==-1)&&e({id:w,styleId:E,adds:[{rule:c,index:[...Gt(p),y||0]}]}),m.apply(p,f)})}),h.prototype.deleteRule=new Proxy(d[u].deleteRule,{apply:k((m,p,f)=>{let[c]=f,{id:y,styleId:w}=Ee(p.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||w&&w!==-1)&&e({id:y,styleId:w,removes:[{index:[...Gt(p),c]}]}),m.apply(p,f)})})}),k(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=d[u].insertRule,h.prototype.deleteRule=d[u].deleteRule})})}function Co({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;n.nodeName==="#document"?i=e.getId(n):i=e.getId(T.host(n));let l=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(s=(o=n.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return i===null||i===-1||!l||!a?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var d;return(d=a.get)==null?void 0:d.call(this)},set(d){var u;let h=(u=a.set)==null?void 0:u.call(this,d);if(i!==null&&i!==-1)try{t.adoptStyleSheets(d,i)}catch{}return h}}),k(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Aa({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:k((l,a,d)=>{var u;let[h,m,p]=d;if(n.has(h))return s.apply(a,[h,m,p]);let{id:f,styleId:c}=Ee((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,set:{property:h,value:m,priority:p},index:Gt(a.parentRule)}),l.apply(a,d)})});let i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:k((l,a,d)=>{var u;let[h]=d;if(n.has(h))return i.apply(a,[h]);let{id:m,styleId:p}=Ee((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(m&&m!==-1||p&&p!==-1)&&e({id:m,styleId:p,remove:{property:h},index:Gt(a.parentRule)}),l.apply(a,d)})}),k(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i})}function _a({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){let i=k(a=>yt(k(d=>{let u=bt(d);if(!u||j(u,t,n,!0))return;let{currentTime:h,volume:m,muted:p,playbackRate:f,loop:c}=u;e({type:a,id:r.getId(u),currentTime:h,volume:m,muted:p,playbackRate:f,loop:c})}),o.media||500)),l=[V("play",i(je.Play),s),V("pause",i(je.Pause),s),V("seeked",i(je.Seeked),s),V("volumechange",i(je.VolumeChange),s),V("ratechange",i(je.RateChange),s)];return k(()=>{l.forEach(a=>a())})}function Da({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(a,d,u){let h=new s(a,d,u);return o.set(h,{family:a,buffer:typeof d!="string",descriptors:u,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),h};let i=Oe(t.fonts,"add",function(l){return function(a){return setTimeout(k(()=>{let d=o.get(a);d&&(e(d),o.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{n.FontFace=s}),r.push(i),k(()=>{r.forEach(l=>l())})}function Pa(e){let{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e,i=!0,l=k(()=>{let a=t.getSelection();if(!a||i&&a?.isCollapsed)return;i=a.isCollapsed||!1;let d=[],u=a.rangeCount||0;for(let h=0;h<u;h++){let m=a.getRangeAt(h),{startContainer:p,startOffset:f,endContainer:c,endOffset:y}=m;j(p,r,o,!0)||j(c,r,o,!0)||d.push({start:n.getId(p),startOffset:f,end:n.getId(c),endOffset:y})}s({ranges:d})});return l(),V("selectionchange",l)}function Ua({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Oe(n.customElements,"define",function(o){return function(s,i,l){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,i,l])}})}function Fa(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:d,styleDeclarationCb:u,canvasMutationCb:h,fontCb:m,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...c)=>{t.mutation&&t.mutation(...c),n(...c)},e.mousemoveCb=(...c)=>{t.mousemove&&t.mousemove(...c),r(...c)},e.mouseInteractionCb=(...c)=>{t.mouseInteraction&&t.mouseInteraction(...c),o(...c)},e.scrollCb=(...c)=>{t.scroll&&t.scroll(...c),s(...c)},e.viewportResizeCb=(...c)=>{t.viewportResize&&t.viewportResize(...c),i(...c)},e.inputCb=(...c)=>{t.input&&t.input(...c),l(...c)},e.mediaInteractionCb=(...c)=>{t.mediaInteaction&&t.mediaInteaction(...c),a(...c)},e.styleSheetRuleCb=(...c)=>{t.styleSheetRule&&t.styleSheetRule(...c),d(...c)},e.styleDeclarationCb=(...c)=>{t.styleDeclaration&&t.styleDeclaration(...c),u(...c)},e.canvasMutationCb=(...c)=>{t.canvasMutation&&t.canvasMutation(...c),h(...c)},e.fontCb=(...c)=>{t.font&&t.font(...c),m(...c)},e.selectionCb=(...c)=>{t.selection&&t.selection(...c),p(...c)},e.customElementCb=(...c)=>{t.customElement&&t.customElement(...c),f(...c)}}function Ha(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};Fa(e,t);let r;e.recordDOM&&(r=vo(e,e.doc));let o=Ia(e),s=Na(e),i=To(e),l=ka(e,{win:n}),a=Oa(e),d=_a(e),u=()=>{},h=()=>{},m=()=>{},p=()=>{};e.recordDOM&&(u=La(e,{win:n}),h=Co(e,e.doc),m=Aa(e,{win:n}),e.collectFonts&&(p=Da(e)));let f=Pa(e),c=Ua(e),y=[];for(let w of e.plugins)y.push(w.observer(w.callback,n,w.options));return k(()=>{r?.(),o(),s(),i(),l(),a(),d(),u(),h(),m(),p(),f(),c(),y.forEach(w=>w())})}function Ut(e){return typeof window[e]<"u"}function Ft(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Xt=class{constructor(t){b(this,"iframeIdToRemoteIdMap",new WeakMap),b(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,o){let s=r||this.getIdToRemoteIdMap(t),i=o||this.getRemoteIdToIdMap(t),l=s.get(n);return l||(l=this.generateIdFn(),s.set(n,l),i.set(l,n)),l}getIds(t,n){let r=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return n.map(s=>this.getId(t,s,r,o))}getRemoteId(t,n,r){let o=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let s=o.get(n);return s||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(o=>this.getRemoteId(t,o,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},Ln=class{constructor(t){b(this,"iframes",new WeakMap),b(this,"crossOriginIframeMap",new WeakMap),b(this,"crossOriginIframeMirror",new Xt(ao)),b(this,"crossOriginIframeStyleMirror"),b(this,"crossOriginIframeRootIdMap",new WeakMap),b(this,"mirror"),b(this,"mutationCb"),b(this,"wrappedEmit"),b(this,"loadListener"),b(this,"unloadListener"),b(this,"attachedWindows",new Map),b(this,"messageHandler",n=>this.handleMessage(n)),b(this,"stylesheetManager"),b(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Xt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(r=this.loadListener)==null||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let n=t.contentWindow;if(!n||this.attachedWindows.has(n))return;let r=[],o=()=>{this.attachedWindows.delete(n),r.forEach(s=>{try{s()}catch{}})};this.attachedWindows.set(n,o),this.recordCrossOriginIframes&&r.push(V("message",this.messageHandler,n)),r.push(V("pagehide",s=>{var i;if(s.persisted)return;let l=n.document;o(),(i=this.unloadListener)==null||i.call(this,l)},n))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let s=this.transformCrossOriginEvent(o,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case I.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let o=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(n.data.node,o),{timestamp:n.timestamp,type:I.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case I.Meta:case I.Load:case I.DomContentLoaded:return!1;case I.Annotation:case I.Plugin:return n;case I.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case I.IncrementalSnapshot:switch(n.data.source){case N.Mutation:return n.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(o.node,s)}),n.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),n.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),n.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case N.Drag:case N.TouchMove:case N.MouseMove:return n.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(n.data,t,["id"]),n;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case N.Font:return n;case N.Selection:return n.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),n;case N.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),n}}return!1}replace(t,n,r,o){for(let s of o)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=t.getIds(r,n[s]):n[s]=t.getId(r,n[s]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==B.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},An=class{constructor(t){b(this,"shadowDoms",new Map),b(this,"mutationCb"),b(this,"scrollCb"),b(this,"bypassOptions"),b(this,"mirror"),b(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!ht(t)||this.shadowDoms.has(t))return;let r=[];this.shadowDoms.set(t,r);let o=vo({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);r.push(o),r.push(To({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===r&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(T.host(t))),r.push(Co({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let n=T.shadowRoot(t);n&&(this.shadowDoms.has(n)&&this.removeShadowRoot(n),this.removeShadowRootsIn(n)),T.childNodes(t).forEach(r=>this.removeShadowRootsIn(r))}removeShadowRoot(t){let n=this.shadowDoms.get(t);this.shadowDoms.delete(t),n?.forEach(vn)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(Oe(t.prototype,"attachShadow",function(o){return function(s){let i=o.call(this,s),l=T.shadowRoot(this);return l&&kn(this)&&r.addShadowRoot(l,n),i}}))}reset(){this.restoreHandlers.forEach(vn),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(n=>n.forEach(vn))}};function vn(e){try{e()}catch{}}var Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ba=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(dt=0;dt<Je.length;dt++)Ba[Je.charCodeAt(dt)]=dt;var dt,Wa=function(e){var t=new Uint8Array(e),n,r=t.length,o="";for(n=0;n<r;n+=3)o+=Je[t[n]>>2],o+=Je[(t[n]&3)<<4|t[n+1]>>4],o+=Je[(t[n+1]&15)<<2|t[n+2]>>6],o+=Je[t[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o},Kr=new Map;function za(e,t){let n=Kr.get(e);return n||(n=new Map,Kr.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var xo=(e,t,n)=>{if(!e||!(Io(e,t)||typeof e=="object"))return;let r=e.constructor.name,o=za(n,r),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function Ht(e,t,n){if(e instanceof Array)return e.map(r=>Ht(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,o=Wa(e);return{rr_type:r,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Ht(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:o}=e;return{rr_type:r,src:o}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",o=e.toDataURL();return{rr_type:r,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Ht(e.data,t,n),e.width,e.height]};if(Io(e,t)||typeof e=="object"){let r=e.constructor.name,o=xo(e,t,n);return{rr_type:r,index:o}}}}return e}var Mo=(e,t,n)=>e.map(r=>Ht(r,t,n)),Io=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function $a(e,t,n,r){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let i of s)try{if(typeof t.CanvasRenderingContext2D.prototype[i]!="function")continue;let l=Oe(t.CanvasRenderingContext2D.prototype,i,function(a){return function(...d){return j(this.canvas,n,r,!0)||setTimeout(()=>{let u=Mo(d,t,this);e(this.canvas,{type:Qe["2D"],property:i,args:u})},0),a.apply(this,d)}});o.push(l)}catch{let l=Yt(t.CanvasRenderingContext2D.prototype,i,{set(a){e(this.canvas,{type:Qe["2D"],property:i,args:[a],setter:!0})}});o.push(l)}return()=>{o.forEach(i=>i())}}function Va(e){return e==="experimental-webgl"?"webgl":e}function Qr(e,t,n,r){let o=[];try{let s=Oe(e.HTMLCanvasElement.prototype,"getContext",function(i){return function(l,...a){if(!j(this,t,n,!0)){let d=Va(l);if("__context"in this||(this.__context=d),r&&["webgl","webgl2"].includes(d))if(a[0]&&typeof a[0]=="object"){let u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return i.apply(this,[l,...a])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function Zr(e,t,n,r,o,s){let i=[],l=Object.getOwnPropertyNames(e);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let d=Oe(e,a,function(u){return function(...h){let m=u.apply(this,h);if(xo(m,s,this),"tagName"in this.canvas&&!j(this.canvas,r,o,!0)){let p=Mo(h,s,this),f={type:t,property:a,args:p};n(this.canvas,f)}return m}});i.push(d)}catch{let d=Yt(e,a,{set(u){n(this.canvas,{type:t,property:a,args:[u],setter:!0})}});i.push(d)}return i}function qa(e,t,n,r){let o=[];return typeof t.WebGLRenderingContext<"u"&&o.push(...Zr(t.WebGLRenderingContext.prototype,Qe.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Zr(t.WebGL2RenderingContext.prototype,Qe.WebGL2,e,n,r,t)),()=>{o.forEach(s=>s())}}var No=`(function() {
4
+ "use strict";
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
7
+ for (var i = 0; i < chars.length; i++) {
8
+ lookup[chars.charCodeAt(i)] = i;
9
+ }
10
+ var encode = function(arraybuffer) {
11
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
12
+ for (i2 = 0; i2 < len; i2 += 3) {
13
+ base64 += chars[bytes[i2] >> 2];
14
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
15
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
16
+ base64 += chars[bytes[i2 + 2] & 63];
17
+ }
18
+ if (len % 3 === 2) {
19
+ base64 = base64.substring(0, base64.length - 1) + "=";
20
+ } else if (len % 3 === 1) {
21
+ base64 = base64.substring(0, base64.length - 2) + "==";
22
+ }
23
+ return base64;
24
+ };
25
+ const lastBlobMap = /* @__PURE__ */ new Map();
26
+ const transparentBlobMap = /* @__PURE__ */ new Map();
27
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
28
+ const id = \`\${width}-\${height}\`;
29
+ if ("OffscreenCanvas" in globalThis) {
30
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
31
+ const offscreen = new OffscreenCanvas(width, height);
32
+ offscreen.getContext("2d");
33
+ const blob = await offscreen.convertToBlob(dataURLOptions);
34
+ const arrayBuffer = await blob.arrayBuffer();
35
+ const base64 = encode(arrayBuffer);
36
+ transparentBlobMap.set(id, base64);
37
+ return base64;
38
+ } else {
39
+ return "";
40
+ }
41
+ }
42
+ const worker = self;
43
+ worker.onmessage = async function(e) {
44
+ if ("OffscreenCanvas" in globalThis) {
45
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
46
+ const transparentBase64 = getTransparentBlobFor(
47
+ width,
48
+ height,
49
+ dataURLOptions
50
+ );
51
+ const offscreen = new OffscreenCanvas(width, height);
52
+ const ctx = offscreen.getContext("2d");
53
+ ctx.drawImage(bitmap, 0, 0);
54
+ bitmap.close();
55
+ const blob = await offscreen.convertToBlob(dataURLOptions);
56
+ const type = blob.type;
57
+ const arrayBuffer = await blob.arrayBuffer();
58
+ const base64 = encode(arrayBuffer);
59
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
60
+ lastBlobMap.set(id, base64);
61
+ return worker.postMessage({ id });
62
+ }
63
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
64
+ worker.postMessage({
65
+ id,
66
+ type,
67
+ base64,
68
+ width,
69
+ height
70
+ });
71
+ lastBlobMap.set(id, base64);
72
+ } else {
73
+ return worker.postMessage({ id: e.data.id });
74
+ }
75
+ };
76
+ })();
77
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
78
+ `,eo=typeof self<"u"&&self.Blob&&new Blob([No],{type:"text/javascript;charset=utf-8"});function ja(e){let t;try{if(t=eo&&(self.URL||self.webkitURL).createObjectURL(eo),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(No),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var _n=class{constructor(t){b(this,"pendingCanvasMutations",new Map),b(this,"rafStamps",{latestId:0,invokeId:null}),b(this,"mirror"),b(this,"mutationCb"),b(this,"resetObservers"),b(this,"frozen",!1),b(this,"locked",!1),b(this,"processMutation",(a,d)=>{(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(d)});let{sampling:n="all",win:r,blockClass:o,blockSelector:s,recordCanvas:i,dataURLOptions:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,i&&n==="all"&&this.initCanvasMutationObserver(r,o,s),i&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,o,s,{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(t,n,r,o,s){let i=Qr(n,r,o,!0),l=new Map,a=new ja;a.onmessage=f=>{let{id:c}=f.data;if(l.set(c,!1),!("base64"in f.data))return;let{base64:y,type:w,width:E,height:g}=f.data;this.mutationCb({id:c,type:Qe["2D"],commands:[{property:"clearRect",args:[0,0,E,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:w}]},0,0]}]})};let d=1e3/t,u=0,h,m=()=>{let f=[];return n.document.querySelectorAll("canvas").forEach(c=>{j(c,r,o,!0)||f.push(c)}),f},p=f=>{if(u&&f-u<d){h=requestAnimationFrame(p);return}u=f,m().forEach(async c=>{var y;let w=this.mirror.getId(c);if(l.get(w)||c.width===0||c.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(c.__context)){let g=c.getContext(c.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let E=await createImageBitmap(c);a.postMessage({id:w,bitmap:E,width:c.width,height:c.height,dataURLOptions:s.dataURLOptions},[E])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{i(),cancelAnimationFrame(h)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Qr(t,n,r,!1),s=$a(this.processMutation.bind(this),t,n,r),i=qa(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{o(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let o=r.map(i=>{let{type:l,...a}=i;return a}),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}},Dn=class{constructor(t){b(this,"trackedLinkElements",new WeakSet),b(this,"mutationCb"),b(this,"adoptedStyleSheetCb"),b(this,"styleMirror",new Nn),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},o=[];for(let s of t){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),o.push({styleId:i,rules:Array.from(s.rules||CSSRule,(l,a)=>({rule:oo(l,s.href),index:a}))})),r.styleIds.push(i)}o.length>0&&(r.styles=o),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Pn=class{constructor(){b(this,"nodeMap",new WeakMap),b(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(o=>o!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},F,Bt,we,St=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Br=e.contentWindow)==null?void 0:Br.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ie=Gi();function Q(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:d=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:m,slimDOMOptions:p,maskInputFn:f,maskTextFn:c,hooks:y,packFn:w,sampling:E={},dataURLOptions:g={},mousemoveWait:x,recordDOM:A=!0,recordCanvas:_=!1,recordCrossOriginIframes:C=!1,recordAfter:$=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:te=!1,collectFonts:ae=!1,inlineImages:ne=!1,plugins:de,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:ct=new Set([]),errorHandler:ut}=e;xa(ut);let W=C?window.parent===window:!0,re=!1;if(!W)try{window.parent.document&&(re=!1)}catch{re=!0}if(W&&!t)throw new Error("emit function is required");if(!W&&!re)return()=>{};x!==void 0&&E.mousemove===void 0&&(E.mousemove=x),ie.reset();let ke=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}:m!==void 0?m:{password:!0},fe=fo(p);Ea();let Pr,gn=0,Ur=L=>{for(let le of de||[])le.eventProcessor&&(L=le.eventProcessor(L));return w&&!re&&(L=w(L)),L};F=(L,le)=>{let M=L;if(M.timestamp=gt(),M.type!==I.FullSnapshot&&!(M.type===I.IncrementalSnapshot&&M.data.source===N.Mutation)){we.unfreeze();for(let Y of Ke)if(Y.isFrozen())Y.unfreeze();else break}if(W)t?.(Ur(M),le);else if(re){let Y={type:"rrweb",event:Ur(M),origin:window.location.origin,isCheckout:le};window.parent.postMessage(Y,"*")}if(M.type===I.FullSnapshot)Pr=M,gn=0;else if(M.type===I.IncrementalSnapshot){if(M.data.source===N.Mutation&&M.data.isAttachIframe)return;gn++;let Y=r&&gn>=r,oe=n&&M.timestamp-Pr.timestamp>n;(Y||oe)&&Bt(!0)}};let Dt=L=>{F({type:I.IncrementalSnapshot,data:{source:N.Mutation,...L}})},Fr=L=>F({type:I.IncrementalSnapshot,data:{source:N.Scroll,...L}}),Hr=L=>F({type:I.IncrementalSnapshot,data:{source:N.CanvasMutation,...L}}),wi=L=>F({type:I.IncrementalSnapshot,data:{source:N.AdoptedStyleSheet,...L}}),Re=new Dn({mutationCb:Dt,adoptedStyleSheetCb:wi}),he=new Ln({mirror:ie,mutationCb:Dt,stylesheetManager:Re,recordCrossOriginIframes:C,wrappedEmit:F});for(let L of de||[])L.getMirror&&L.getMirror({nodeMirror:ie,crossOriginIframeMirror:he.crossOriginIframeMirror,crossOriginIframeStyleMirror:he.crossOriginIframeStyleMirror});let yn=new Pn;we=new _n({recordCanvas:_,mutationCb:Hr,win:window,blockClass:o,blockSelector:s,mirror:ie,sampling:E.canvas,dataURLOptions:g});let Ve=new An({mutationCb:Dt,scrollCb:Fr,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:d,inlineStylesheet:u,maskInputOptions:ke,dataURLOptions:g,maskTextFn:c,maskInputFn:f,recordCanvas:_,inlineImages:ne,sampling:E,slimDOMOptions:fe,iframeManager:he,stylesheetManager:Re,canvasManager:we,keepIframeSrcFn:R,processedNodeManager:yn},mirror:ie});Bt=(L=!1)=>{if(!A)return;F({type:I.Meta,data:{href:window.location.href,width:mo(),height:ho()}},L),Re.reset(),Ve.init(),we.lock(),Ke.forEach(M=>M.lock());let le=ba(document,{mirror:ie,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:d,inlineStylesheet:u,maskAllInputs:ke,maskTextFn:c,maskInputFn:f,slimDOM:fe,dataURLOptions:g,recordCanvas:_,inlineImages:ne,onSerialize:M=>{So(M,ie)&&he.addIframe(M),bo(M,ie)&&Re.trackLinkElement(M),In(M)&&Ve.addShadowRoot(T.shadowRoot(M),document)},onIframeLoad:(M,Y)=>{he.attachIframe(M,Y),Ve.observeAttachShadow(M)},onStylesheetLoad:(M,Y)=>{Re.attachLinkElement(M,Y)},keepIframeSrcFn:R});if(!le)return console.warn("Failed to snapshot the document");F({type:I.FullSnapshot,data:{node:le,initialOffset:po(window)}},L),we.unlock(),Ke.forEach(M=>M.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,ie.getId(document))};try{let L=[],le=oe=>{var J;return k(Ha)({mutationCb:Dt,mousemoveCb:(D,Sn)=>F({type:I.IncrementalSnapshot,data:{source:Sn,positions:D}}),mouseInteractionCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.MouseInteraction,...D}}),scrollCb:Fr,viewportResizeCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.ViewportResize,...D}}),inputCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.Input,...D}}),mediaInteractionCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.MediaInteraction,...D}}),styleSheetRuleCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.StyleSheetRule,...D}}),styleDeclarationCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.StyleDeclaration,...D}}),canvasMutationCb:Hr,fontCb:D=>F({type:I.IncrementalSnapshot,data:{source:N.Font,...D}}),selectionCb:D=>{F({type:I.IncrementalSnapshot,data:{source:N.Selection,...D}})},customElementCb:D=>{F({type:I.IncrementalSnapshot,data:{source:N.CustomElement,...D}})},blockClass:o,ignoreClass:i,ignoreSelector:l,maskTextClass:a,maskTextSelector:d,maskInputOptions:ke,inlineStylesheet:u,sampling:E,recordDOM:A,recordCanvas:_,inlineImages:ne,userTriggeredOnInput:te,collectFonts:ae,doc:oe,maskInputFn:f,maskTextFn:c,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:fe,dataURLOptions:g,mirror:ie,iframeManager:he,stylesheetManager:Re,shadowDomManager:Ve,processedNodeManager:yn,canvasManager:we,ignoreCSSAttributes:ct,plugins:((J=de?.filter(D=>D.observer))==null?void 0:J.map(D=>({observer:D.observer,options:D.options,callback:Sn=>F({type:I.Plugin,data:{plugin:D.name,payload:Sn}})})))||[]},y)},M=new Map;he.addLoadListener(oe=>{try{let J=oe.contentDocument;if(M.has(J))return;M.set(J,le(J))}catch(J){console.warn(J)}}),he.addUnloadListener(oe=>{let J=M.get(oe);J&&(M.delete(oe),J(),Ve.removeShadowRootsIn(oe),ie.removeNodeFromMap(oe))});let Y=()=>{Bt(),L.push(le(document)),St=!0};return["interactive","complete"].includes(document.readyState)?Y():(L.push(V("DOMContentLoaded",()=>{F({type:I.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&Y()})),L.push(V("load",()=>{F({type:I.Load,data:{}}),$==="load"&&Y()},window))),()=>{[...L,...M.values()].forEach(oe=>{try{oe()}catch(J){String(J).toLowerCase().includes("cross-origin")||console.warn(J)}}),M.clear(),he.destroy(),yn.destroy(),Ve.reset(),we.reset(),St=!1,Ma()}}catch(L){console.warn(L)}}Q.addCustomEvent=(e,t)=>{if(!St)throw new Error("please add custom event after start recording");F({type:I.Custom,data:{tag:e,payload:t}})};Q.addAnnotation=e=>{if(!St)throw new Error("please add annotation after recording started");F({type:I.Annotation,data:e})};Q.freezePage=()=>{we.freeze(),Ke.forEach(e=>e.freeze())};Q.takeFullSnapshot=e=>{if(!St)throw new Error("please take full snapshot after start recording");Bt(e)};Q.mirror=ie;var Ga=Object.defineProperty,Xa=(e,t,n)=>t in e?Ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jt=(e,t,n)=>Xa(e,typeof t!="symbol"?t+"":t,n);Date.now().toString();function Ya(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}var Te=class{constructor(t){Jt(this,"fileName"),Jt(this,"functionName"),Jt(this,"lineNumber"),Jt(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){let t=this.lineNumber||"",n=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${n})`:`${this.fileName}:${t}:${n}`}},Ja=/(^|@)\S+:\d+/,ko=/^\s*at .*(\S+:\d+|\(native\))/m,Ka=/^(eval@)?(\[native code])?$/,Hn={parse:function(e){return e?typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u"?this.parseOpera(e):e.stack&&e.stack.match(ko)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];let n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!n)throw new Error(`Cannot parse given url: ${e}`);return[n[1],n[2]||void 0,n[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
79
+ `).filter(function(n){return!!n.match(ko)},this).map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let r=n.replace(/^\s+/,"").replace(/\(eval code/g,"("),o=r.match(/ (\((.+):(\d+):(\d+)\)$)/);r=o?r.replace(o[0],""):r;let s=r.split(/\s+/).slice(1),i=this.extractLocation(o?o[1]:s.pop()),l=s.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Te({functionName:l,fileName:a,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
80
+ `).filter(function(n){return!n.match(Ka)},this).map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new Te({functionName:n});{let r=/((.*".+"[^@]*)?[^@]*)(?:@)/,o=n.match(r),s=o&&o[1]?o[1]:void 0,i=this.extractLocation(n.replace(r,""));return new Te({functionName:s,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
81
+ `)>-1&&e.message.split(`
82
+ `).length>e.stacktrace.split(`
83
+ `).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){let t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split(`
84
+ `),r=[];for(let o=2,s=n.length;o<s;o+=2){let i=t.exec(n[o]);i&&r.push(new Te({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){let t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split(`
85
+ `),r=[];for(let o=0,s=n.length;o<s;o+=2){let i=t.exec(n[o]);i&&r.push(new Te({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split(`
86
+ `).filter(function(n){return!!n.match(Ja)&&!n.match(/^Error created at/)},this).map(function(n){let r=n.split("@"),o=this.extractLocation(r.pop()),i=(r.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Te({functionName:i,fileName:o[0],lineNumber:o[1],columnNumber:o[2]})},this)}};function Qa(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();let r=e.parentElement,o=[];if(r.children&&r.children.length>0)for(let s=0;s<r.children.length;s++){let i=r.children[s];i.localName&&i.localName.toLowerCase&&i.localName.toLowerCase()===n&&o.push(i)}o.length>1&&(n+=`:eq(${o.indexOf(e)})`),t=n+(t?">"+t:""),e=r}return t}function Bn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Oo(e,t){if(t===0)return!0;let n=Object.keys(e);for(let r of n)if(Bn(e[r])&&Oo(e[r],t-1))return!0;return!1}function Ze(e,t){let n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);let r=[],o=[];return JSON.stringify(e,function(l,a){if(r.length>0){let d=r.indexOf(this);~d?r.splice(d+1):r.push(this),~d?o.splice(d,1/0,l):o.push(l),~r.indexOf(a)&&(r[0]===a?a="[Circular ~]":a="[Circular ~."+o.slice(0,r.indexOf(a)).join(".")+"]")}else r.push(a);if(a===null)return a;if(a===void 0)return"undefined";if(s(a))return i(a);if(typeof a=="bigint")return a.toString()+"n";if(a instanceof Event){let d={};for(let u in a){let h=a[u];Array.isArray(h)?d[u]=Qa(h.length?h[0]:null):d[u]=h}return d}else{if(a instanceof Node)return a instanceof HTMLElement?a?a.outerHTML:"":a.nodeName;if(a instanceof Error)return a.stack?a.stack+`
87
+ End of stack for Error object`:a.name+": "+a.message}return a});function s(l){return!!(Bn(l)&&Object.keys(l).length>n.numOfKeysLimit||typeof l=="function"||Bn(l)&&Oo(l,n.depthOfLimit))}function i(l){let a=l.toString();return n.stringLengthLimit&&a.length>n.stringLengthLimit&&(a=`${a.slice(0,n.stringLengthLimit)}...`),a}}var Ro={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Za(e,t,n){let r=n?Object.assign({},Ro,n):Ro,o=r.logger;if(!o)return()=>{};let s;typeof o=="string"?s=t[o]:s=o;let i=0,l=!1,a=[];if(r.level.includes("error")){let u=m=>{let p=m.message,f=m.error,c=Hn.parse(f).map(w=>w.toString()),y=[Ze(p,r.stringifyOptions)];e({level:"error",trace:c,payload:y})};t.addEventListener("error",u),a.push(()=>{t.removeEventListener("error",u)});let h=m=>{let p,f;m.reason instanceof Error?(p=m.reason,f=[Ze(`Uncaught (in promise) ${p.name}: ${p.message}`,r.stringifyOptions)]):(p=new Error,f=[Ze("Uncaught (in promise)",r.stringifyOptions),Ze(m.reason,r.stringifyOptions)]);let c=Hn.parse(p).map(y=>y.toString());e({level:"error",trace:c,payload:f})};t.addEventListener("unhandledrejection",h),a.push(()=>{t.removeEventListener("unhandledrejection",h)})}for(let u of r.level)a.push(d(s,u));return()=>{a.forEach(u=>u())};function d(u,h){return u[h]?Ya(u,h,m=>(...p)=>{if(m.apply(u,p),!(h==="assert"&&p[0])&&!l){l=!0;try{let f=Hn.parse(new Error).map(w=>w.toString()).splice(1),y=(h==="assert"?p.slice(1):p).map(w=>Ze(w,r.stringifyOptions));i++,i<r.lengthThreshold?e({level:h,trace:f,payload:y}):i===r.lengthThreshold&&e({level:"warn",trace:[],payload:[Ze("The number of log records reached the threshold.")]})}catch(f){m.apply(u,["rrweb logger error:",f,...p])}finally{l=!1}}}):()=>{}}}var el="rrweb/console@1",Lo=e=>({name:el,observer:Za,options:e});var Fo=-1,Et=()=>Fo,vt=e=>{addEventListener("pageshow",t=>{t.persisted&&(Fo=t.timeStamp,e(t))},!0)},pe=(e,t,n,r)=>{let o,s;return i=>{t.value>=0&&(i||r)&&(s=t.value-(o??0),(s||o===void 0)&&(o=t.value,t.delta=s,t.rating=((l,a)=>l>a[1]?"poor":l>a[0]?"needs-improvement":"good")(t.value,n),e(t)))}},Jn=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Ho=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Qt=()=>Ho()?.activationStart??0,Le=-1,Bo=new Set,Ao=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Vn=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Bo)t();isFinite(Le)||(Le=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Vn,!0))}},wt=(e=!1)=>{if(e&&(Le=1/0),Le<0){let t=Qt();Le=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=t)?.startTime)??Ao(),addEventListener("visibilitychange",Vn,!0),addEventListener("prerenderingchange",Vn,!0),vt(()=>{setTimeout(()=>{Le=Ao()})})}return{get firstHiddenTime(){return Le},onHidden(t){Bo.add(t)}}},ge=(e,t=-1,n,r=0,o,s,i)=>{let l=Ho(),a=l?.navigationId||0,d="navigate";return n?d=n:Et()>=0?d="back-forward-cache":l&&(document.prerendering||Qt()>0?d="prerender":document.wasDiscarded?d="restore":l.type&&(d=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:d,navigationId:r||a,navigationInteractionId:o,navigationURL:s||l?.name,navigationStartTime:i||0}},_o=new WeakMap;function Zt(e,t){let n=_o.get(t);return n||(n=new WeakMap,_o.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var qn=class{constructor(){se(this,"t");se(this,"i",0);se(this,"o",[])}h(t){if(t.hadRecentInput)return;let n=this.o[0],r=this.o.at(-1);this.i&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),this.t?.(t)}},et=(e,t,n={})=>{try{let r=e.filter(o=>PerformanceObserver.supportedEntryTypes.includes(o));if(r.length>0){let o=new PerformanceObserver(s=>{queueMicrotask(()=>{let i=s.getEntries();r.length>1&&i.sort((l,a)=>l.startTime+l.duration-(a.startTime+a.duration)),t(i)})});for(let s of r)o.observe({type:s,buffered:!0,...n});return o}}catch{}},en=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint=="function"&&e&&e.reportSoftNavs,Wo=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let n=e.keys().next().value;n!==void 0&&e.delete(n)}},zo=e=>{let t=!1;return()=>{t||(e(),t=!0)}},jn=class{constructor(){se(this,"l")}},Kn=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Wn=[1800,3e3],tl=(e,t={})=>{let n=en(t);Kn(()=>{let r=Zt(t,jn),o=wt(),s,i=ge("FCP"),l=et(["paint"],a=>{for(let d of a)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<o.firstHiddenTime&&(i.value=Math.max(d.startTime-Qt(),0),i.entries.push(d),i.navigationId=d.navigationId||i.navigationId,s(!0)))});l&&(s=pe(e,i,Wn,t.reportAllChanges),vt(a=>{i=ge("FCP",-1,"back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Et()),s=pe(e,i,Wn,t.reportAllChanges),Jn(()=>{i.value=performance.now()-a.timeStamp,s(!0)})})),n&&et(["soft-navigation"],a=>{a.forEach(d=>{r.l&&d.navigationId&&Wo(r.l,d);let u=Math.max((d.presentationTime||d.paintTime||0)-d.startTime,0);i=ge("FCP",u,"soft-navigation",d.navigationId,d.interactionId,d.name,d.startTime),s=pe(e,i,Wn,t.reportAllChanges),s(!0)})},t)})},Do=[.1,.25],$o=(e,t={})=>{let n=wt();tl(zo(()=>{let r,o=ge("CLS",0),s=Zt(t,qn),i=(m,p,f,c,y)=>{o=ge("CLS",0,m,p,f,c,y),s.i=0,r=pe(e,o,Do,t.reportAllChanges)},l=(m=!1)=>{s.i>o.value&&(o.value=s.i,o.entries=s.o),r(m)},a=m=>{l(!0),i("soft-navigation",m.navigationId,m.interactionId,m.name,m.startTime)},d=m=>{for(let p of m)p.entryType!=="soft-navigation"?s.h(p):a(p);l()},u=["layout-shift"];en(t)&&u.push("soft-navigation");let h=et(u,d);h&&(r=pe(e,o,Do,t.reportAllChanges),n.onHidden(()=>{d(h.takeRecords()),r(!0)}),vt(()=>{i("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Et()),Jn(r)}),setTimeout(r))}))},Vo=0,zn=1/0,Kt=0,nl=e=>{for(let t of e)t.interactionId&&(zn=Math.min(zn,t.interactionId),Kt=Math.max(Kt,t.interactionId),Vo=Kt?(Kt-zn)/7+1:0)},Gn,Po=()=>Gn?Vo:performance.interactionCount??0,rl=()=>{"interactionCount"in performance||Gn||(Gn=et(["event"],nl,{durationThreshold:0}))},Xn=class{constructor(){se(this,"u",0);se(this,"v",[]);se(this,"m",new Map);se(this,"p");se(this,"T")}_(){return Po()-this.u}M(){this.u=Po(),this.v.length=0,this.m.clear()}L(t){let n=this._(),r=Math.min(this.v.length-1,Math.floor(n/50));return!n||r!==-1||t!=="soft-navigation"&&t!=="back-forward-cache"?this.v[r]:{P:8,id:-1,entries:[]}}h(t){if(this.p?.(t),!t.interactionId)return;let n=this.v.at(-1),r=this.m.get(t.interactionId);if(r||this.v.length<10||t.duration>n.P){if(r?t.duration>r.P?(r.entries=[t],r.P=t.duration):t.duration===r.P&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],P:t.duration},this.m.set(r.id,r),this.v.push(r)),this.v.sort((o,s)=>s.P-o.P),this.v.length>10){let o=this.v.splice(10);for(let s of o)this.m.delete(s.id)}this.T?.(r)}}},qo=e=>{let t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let o=zo(e),s=-1,i=()=>{r(s),o()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),s=n(()=>{removeEventListener("visibilitychange",i,{capture:!0}),o()},{timeout:t})}},Uo=[200,500],jo=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=wt();Kn(()=>{rl();let r,o=ge("INP"),s=Zt(t,Xn),i=(m,p,f,c,y)=>{s.M(),o=ge("INP",-1,m,p,f,c,y),r=pe(e,o,Uo,t.reportAllChanges)},l=()=>{let m=s.L(o.navigationType);m&&m.P!==o.value&&(o.value=m.P,o.entries=m.entries,r())},a=m=>{l(),r(!0),i("soft-navigation",m.navigationId,m.interactionId,m.name,m.startTime)},d=(m,p=!1)=>{qo(()=>{for(let f of m)f.entryType!=="soft-navigation"?s.h(f):a(f);l(),p&&r(!0)})},u=["event","first-input"];en(t)&&u.push("soft-navigation");let h=et(u,d,{...t,durationThreshold:t.durationThreshold??40});r=pe(e,o,Uo,t.reportAllChanges),h&&(n.onHidden(()=>{d(h.takeRecords(),!0)}),vt(()=>{i("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Et())}))})},Yn=class{constructor(){se(this,"p");se(this,"l")}h(t){this.p?.(t)}},$n=[2500,4e3],Go=(e,t={})=>{let n=!1,r=en(t);Kn(()=>{let o,s=wt(),i=ge("LCP"),l=Zt(t,Yn),a=(p,f,c,y,w)=>{i=ge("LCP",-1,p,f,c,y,w),o=pe(e,i,$n,t.reportAllChanges),n=!1,p==="soft-navigation"&&(s=wt(!0))},d=p=>{l.l&&p.navigationId&&Wo(l.l,p),n||o(!0),a("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime);let f=p.getLargestInteractionContentfulPaint?.();f&&u([f])},u=p=>{t.reportAllChanges||r||(p=p.slice(-1));for(let f of p){if(!f)continue;if(f.entryType==="soft-navigation"){d(f);continue}let c=0,y=[],w=f.startTime;if(f.entryType==="largest-contentful-paint")c=Math.max(f.startTime-Qt(),0),l.h(f),y=[f];else if(f.entryType==="interaction-contentful-paint"){let E=f;if(!i.navigationId||"interactionId"in E&&E.interactionId!=i.navigationInteractionId)continue;w=E.largestContentfulPaint?.renderTime||0,c=Math.max(w-f.startTime,0),E.largestContentfulPaint&&(l.h(E.largestContentfulPaint),y=[E.largestContentfulPaint])}w<s.firstHiddenTime&&(i.value=c,i.entries=y,o())}},h=["largest-contentful-paint"];r&&h.push("interaction-contentful-paint","soft-navigation");let m=et(h,u);if(m){o=pe(e,i,$n,t.reportAllChanges);let p=["keydown","click","visibilitychange"],f=c=>{if(c.isTrusted&&!n){let y=i.id;qo(()=>{if(!n){if(!r){m.disconnect();for(let w of p)removeEventListener(w,f,{capture:!0})}y===i.id&&(n=!0,o(!0))}})}};for(let c of p)addEventListener(c,f,{capture:!0});vt(c=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Et()),o=pe(e,i,$n,t.reportAllChanges),Jn(()=>{i.value=performance.now()-c.timeStamp,n=!0,o(!0)})})}})};var Xo="redacted";function tn(e){return new Set((e||[]).map(t=>String(t).toLowerCase()))}function tt(e,t,n=void 0){let r=tn(t);if(!e||r.size===0)return e;let o;try{o=new URL(e,n)}catch{return e}let s=!1;for(let i of[...o.searchParams.keys()])r.has(i.toLowerCase())&&o.searchParams.get(i)!==Xo&&(o.searchParams.set(i,Xo),s=!0);return s?o.toString():e}function Ae(e,t){return!e||tn(t).size===0?e:String(e).replace(/(https?:\/\/[^\s"'<>()]+?)((?::\d+){1,2})?(?=[\s"'<>()]|$)/g,(n,r,o="")=>tt(r,t)+o)}var ol=["href","src","action","formaction","poster","xlink:href"],sl=["srcset","imagesrcset"];function il(e,t,n){return e.split(",").map(r=>{let[,o="",s="",i=""]=r.match(/^(\s*)(\S*)(.*)$/s)||[];return o+tt(s,t,n)+i}).join(",")}function Yo(e,t,n=void 0){if(tn(t).size===0)return e;let r=o=>{if(o){for(let s of ol)typeof o[s]=="string"&&o[s].includes("?")&&(o[s]=tt(o[s],t,n));for(let s of sl)typeof o[s]=="string"&&o[s].includes("?")&&(o[s]=il(o[s],t,n));typeof o.ping=="string"&&o.ping.includes("?")&&(o.ping=o.ping.split(/\s+/).map(s=>tt(s,t,n)).join(" "))}};for(let o of Zn(e))er(o,s=>s.type===2&&r(s.attributes));if(e.type===3&&e.data&&e.data.source===0)for(let o of e.data.attributes||[])r(o.attributes);return e}function Zn(e){let t=[];if(e.type===2&&e.data&&e.data.node&&t.push(e.data.node),e.type===3&&e.data&&e.data.source===0)for(let n of e.data.adds||[])n.node&&t.push(n.node);return t}function er(e,t){let n=[e];for(;n.length;){let r=n.pop();if(t(r),r.childNodes)for(let o of r.childNodes)n.push(o)}}function Jo(e){for(let t of Zn(e))er(t,n=>{n.type===2&&n.tagName==="input"&&n.attributes&&String(n.attributes.type||"").toLowerCase()==="hidden"&&delete n.attributes.value});return e}function Ko(e){return e?{input:!0,textarea:!0,select:!0,password:!0,hidden:!0,file:!0}:{password:!0,hidden:!0,file:!0}}var al=["alt","title","aria-label","aria-description","aria-valuetext","placeholder","download","label"],ll=new Set(["submit","button","reset"]);function Qn(e){return typeof e=="string"?e.replace(/\S/g,"*"):e}function Qo(e,t,n=null){let r=(o,s,i,l)=>{if(!o)return;let a=al.filter(h=>typeof o[h]=="string"),d=i==="input"&&typeof o.value=="string"&&ll.has(String(l||"").toLowerCase()),u=i==="meta"&&typeof o.content=="string";if(!(a.length===0&&!d&&!u||!t(s))){for(let h of a)o[h]=Qn(o[h]);d&&(o.value=Qn(o.value)),u&&(o.content=Qn(o.content))}};for(let o of Zn(e))er(o,s=>s.type===2&&r(s.attributes,s.id,s.tagName,s.attributes?.type));if(e.type===3&&e.data&&e.data.source===0)for(let o of e.data.attributes||[]){let s=typeof n=="function"?n(o.id):null;r(o.attributes,o.id,s?.tagName??null,s?.type??o.attributes?.type)}return e}function Zo(e,t){if(e.type!==6||!e.data||!e.data.payload||tn(t).size===0)return e;let n=e.data.payload;for(let r of["payload","trace"])Array.isArray(n[r])&&(n[r]=n[r].map(o=>typeof o=="string"?Ae(o,t):o));return e}function tr(e,t,n){if(!e||!t||typeof e.closest!="function")return!1;try{return!!e.closest(t)&&!(n&&e.closest(n))}catch{return!1}}function es(e,t){return(n,r)=>tr(r,e,t)?n:String(n??"").replace(/\S/g,"*")}function ts(e){if(typeof e!="string"||e.includes("("))return e;let t=e.split(",").map(r=>r.trim()).filter(Boolean),n=new Set(t);return t.filter(r=>!(r.endsWith(" *")&&n.has(r.slice(0,-2).trim()))).join(", ")}var os="/*sr-asset:";var cl=/^\/\*sr-asset:([a-f0-9]{64})\*\/$/;function ss(e){return os+e+"*/"}function ul(e){let t=typeof e=="string"&&e.length===os.length+64+2?cl.exec(e):null;return t?t[1]:null}function ns(e){let t=new Set,n=[];for(let r of e)typeof r!="string"||r===""||r==="*"||(r.endsWith("*")?n.push(r.slice(0,-1)):t.add(r));return t.size===0&&n.length===0?null:r=>t.has(r)||n.some(o=>r.startsWith(o))}function is(e=[],t=[]){let n=ns(e),r=ns(t);return n===null?null:o=>n(o)&&!(r&&r(o))}function as(e){return e.type===2&&e.data&&e.data.node?[e.data.node]:e.type===3&&e.data&&e.data.source===0?(e.data.adds||[]).map(t=>t.node).filter(Boolean):[]}function nt(e,t){let n=[e];for(;n.length;){let r=n.pop();if(t(r),r.childNodes)for(let o of r.childNodes)n.push(o)}}function ls(e,t){if(!t)return e;for(let n of as(e))nt(n,r=>{if(!(r.type!==2||!r.attributes))for(let o of Object.keys(r.attributes))o!=="_cssText"&&t(o)&&delete r.attributes[o]});return e.type===3&&e.data&&e.data.source===0&&e.data.attributes&&(e.data.attributes=e.data.attributes.filter(n=>{for(let r of Object.keys(n.attributes||{}))r!=="_cssText"&&t(r)&&delete n.attributes[r];return Object.keys(n.attributes||{}).length>0||n.styleDiff||n._unchangedStyles})),e}function nr(e,t=0){let n=[];if(e.type===3&&e.data&&e.data.source===0&&Array.isArray(e.data.attributes))for(let r of e.data.attributes)r&&r.attributes&&typeof r.attributes._cssText=="string"&&r.attributes._cssText.length>=t&&n.push({holder:r.attributes,key:"_cssText",text:r.attributes._cssText});for(let r of as(e))nt(r,o=>{o.type===2&&o.attributes&&typeof o.attributes._cssText=="string"&&o.attributes._cssText.length>=t&&n.push({holder:o.attributes,key:"_cssText",text:o.attributes._cssText}),o.type===3&&o.isStyle&&typeof o.textContent=="string"&&o.textContent.length>=t&&n.push({holder:o,key:"textContent",text:o.textContent})});return n}function cs(e){let t=new Set;for(let n of e)for(let r of nr(n)){let o=ul(r.text);o&&t.add(o)}return[...t]}var us="srSnapshot",dl=/^[a-f0-9]{64}$/,fl=["id","for","form","list","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns","popovertarget"];function pl(e){let t=e&&e.type===2&&e.data?e.data[us]:null;return typeof t=="string"&&dl.test(t)?t:null}function ds(e,t){return delete e.data.node,e.data[us]=t,e}function fs(e){let t=new Set;for(let n of e){let r=pl(n);r&&t.add(r)}return[...t]}function ps(e,t=[]){let n=t.filter(s=>typeof s=="string"&&s.length>1&&s.endsWith("*")).map(s=>s.slice(0,-1));if(!e||n.length===0)return e;let r=new Map,o=s=>{let i=n.find(l=>s.length>l.length&&s.startsWith(l));return i?(r.has(s)||r.set(s,`${i}sr${r.size+1}`),r.get(s)):s};return nt(e,s=>{if(!(s.type!==2||!s.attributes))for(let i of fl){let l=s.attributes[i];if(typeof l!="string"||l==="")continue;let a=l.trim().split(/\s+/),d=a.map(o);d.some((u,h)=>u!==a[h])&&(s.attributes[i]=d.join(" "))}}),e}var hl="data-replay-skip";function nn(e){return!!e&&e.type===2&&!!e.attributes&&Object.prototype.hasOwnProperty.call(e.attributes,hl)}function hs(e,t){nt(e,n=>{typeof n.id=="number"&&t.add(n.id)})}function rs(e,t){nt(e,n=>{Array.isArray(n.childNodes)&&(n.childNodes=n.childNodes.filter(r=>nn(r)?(hs(r,t),!1):!0))})}function ms(e,t){if(!e||!e.data)return!0;if(e.type===2)return e.data.node&&(t.clear(),rs(e.data.node,t)),!0;if(e.type!==3)return!0;let n=e.data;if(n.source!==0)return!(typeof n.id=="number"&&t.has(n.id));let r=Array.isArray(n.adds)?n.adds:[];if(t.size===0&&!r.some(l=>l&&l.node&&(nn(l.node)||ml(l.node))))return!0;let o=r.length+(n.removes?.length||0)+(n.attributes?.length||0)+(n.texts?.length||0),s=!0;for(;s;){s=!1;for(let l of r)!l||!l.node||t.has(l.node.id)||(nn(l.node)||t.has(l.parentId))&&(hs(l.node,t),s=!0)}n.adds=r.filter(l=>!l||!l.node?!0:t.has(l.node.id)?!1:(rs(l.node,t),t.has(l.nextId)&&(l.nextId=null),t.has(l.previousId)&&(l.previousId=null),!0)),Array.isArray(n.removes)&&(n.removes=n.removes.filter(l=>!t.has(l.id)&&!t.has(l.parentId))),Array.isArray(n.attributes)&&(n.attributes=n.attributes.filter(l=>!t.has(l.id))),Array.isArray(n.texts)&&(n.texts=n.texts.filter(l=>!t.has(l.id)));let i=n.adds.length+(n.removes?.length||0)+(n.attributes?.length||0)+(n.texts?.length||0);return o===0||i>0}function ml(e){let t=!1;return nt(e,n=>{nn(n)&&(t=!0)}),t}var gl=["error","request","console","rage-click","custom"],or=new Set([1,2,3,5,6,12]);function ys(e){return Math.min(3e4,Math.max(5e3,Math.round(e/2)))}function sr(e,t){return Array.isArray(t)&&gl.includes(e)&&t.includes(e)}function Ss(e,t){let n=null;for(let s of e)s.type===2&&s.timestamp<=t&&(n===null||s.timestamp>n.timestamp)&&(n=s);if(n===null)return null;let r=n.timestamp,o=-1/0;for(let s of e)s.type===4&&s.timestamp<=n.timestamp&&s.timestamp>o&&(o=s.timestamp);return o>-1/0&&(r=o),r}function bs(e,t,n){if(n===null)return{events:e,markers:t};let r=e.filter(i=>i.timestamp>=n),o=null,s=[];for(let i of t)i.at>=n?s.push(i):i.type==="navigation"&&(o===null||i.at>=o.at)&&(o=i);return o!==null&&s.unshift({...o,at:n}),{events:r,markers:s}}var rr=120;function gs(e){let t=0,n=e?[e]:[];for(;n.length;){let r=n.pop();if(t++,r.childNodes)for(let o of r.childNodes)n.push(o)}return t}function rn(e){if(e.type===2)return Math.max(2e5,gs(e.data?.node)*rr);let t=e.type===3&&e.data?.source===0?e.data:null;if(t&&((t.adds?.length||0)>10||(t.texts?.length||0)>20||(t.attributes?.length||0)>20)){let n=300+(t.texts?.length||0)*80+(t.attributes?.length||0)*rr+(t.removes?.length||0)*30;for(let r of t.adds||[])n+=gs(r?.node)*rr;return n}return 300}function ws(e){let t=0;for(let n of e)t+=rn(n);return t}function Es(e){let t=0;for(let n of e)n.type===2?t=0:t+=rn(n);return t}function vs(e){let t=0,n=0;for(let r of e)r.type!==3||!or.has(r.data?.source)||(n&&r.timestamp-n<5e3&&r.timestamp>n&&(t+=r.timestamp-n),n=Math.max(n,r.timestamp));return t}function Ts({pause:e,resume:t,current:n,skipped:r=null,setTimer:o=setTimeout,clearTimer:s=clearTimeout,now:i=Date.now,timeoutMs:l=5e3}){let a=!1,d=null,u=!1,h=!1,m=!1,p=null,f=[];function c(){d!==null&&s(d),d=null}function y(w){if(!h)return!1;let E=n();if(!E)return a&&!m&&(p=i()),m=!0,f=[],w?(h=!1,c()):d=null,!1;let g=a,x=g?p:null,A=f;h=!1,m=!1,p=null,a=!1,f=[],c();let _=t(E,g);x!==null&&_!==!1&&r?.(x,i());for(let C of A)C();return g}return{navigating(w){u=!0,h=!0;let E=!1;return!a&&w&&e()!==!1&&(a=!0,E=!0),d===null&&(d=o(()=>y(!1),l)),E},navigated:()=>y(!0),defer(w){return m?!0:h?(f.push(w),!0):!1},stop(){c(),a=!1,p=null,f=[]},isPaused:()=>a,isExcluded:()=>m,isAwaiting:()=>h,swapped:()=>u}}function Cs(e,t,n){let r=null,o=null;return{plugin:{...e,observer(s,i,l){return i!==n?e.observer(s,i,l):(r=s,o||(o=e.observer(a=>r?r(a):t(a),i,l)),()=>{r===s&&(r=null)})}},stop(){let s=o;r=null,o=null,s?.()}}}function xs({url:e,method:t="GET",status:n=0,duration:r=0,threshold:o=500,page:s,skip:i=[],type:l=null,origins:a=[]}){if(l==="opaque"||l==="opaqueredirect")return null;let d,u;try{d=new URL(e,s),u=new URL(s).origin}catch{return null}if(d.origin!==u&&!a.includes(d.origin)||i.some(m=>m&&d.href.startsWith(m))||n!==0&&n<o)return null;let h=String(t||"GET").toUpperCase();return{label:`${h} ${d.pathname} ${n?`failed (${n})`:"got no answer"}`,payload:{method:h,status:n||null,url:d.href,duration:Math.round(r)}}}function ir(e,t){if(!e)return!1;let n=t.toLowerCase();try{return typeof e.has=="function"?e.has(t):Array.isArray(e)?e.some(r=>String(r?.[0]).toLowerCase()===n):Object.keys(e).some(r=>r.toLowerCase()===n)}catch{return!1}}function Ms(e,t,n){return e.then(r=>{try{t(r)}catch{}return r},r=>{try{n(r)}catch{}throw r})}function Ns(e,t=Math.random){let n=Math.min(6e4,1e3*2**Math.max(1,e));return Math.round(n*(.5+cr(t())))}var Is=3e4,ar=12e4;function ks(e){let t=Number(e)||0;return t===0||t===502||t===503||t===504}function Rs(e=Math.random){return Math.round(Is+(ar-Is)*cr(e()))}var _e=10*6e4,Os=10;function Ls(e,t=Date.now(),n=Math.random){if(e==null)return null;let r=String(e).trim();if(r==="")return null;let o;if(/^\d+$/.test(r))o=Number(r)*1e3;else{let s=/[a-z]{3}/i.test(r)?Date.parse(r):Number.NaN;if(Number.isNaN(s))return null;o=s-t}return o=Math.min(_e,Math.max(1e3,o)),Math.min(_e,Math.round(o*(1+.2*cr(n()))))}function lr(e,t,n){let r=Number(e)-t;return Number.isFinite(r)?Math.min(n,Math.max(0,r)):0}function cr(e){let t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):.5}function ur(e,t){return`${e}:${t}`}function dr(e,{sessionId:t,identity:n,now:r,idleTimeout:o}){return!e||typeof e.session!="string"||typeof e.savedAt!="number"||r-e.savedAt>o||e.savedAt>r+6e4||(e.identity??null)!==(n??null)?"drop":e.session===t?"send":"keep"}var on=null;function Tt(){on?.()}var yl=`
88
+ :host { all: initial; }
89
+ dialog {
90
+ box-sizing: border-box; width: calc(100% - 32px); max-width: 26rem; max-height: calc(100% - 32px); margin: auto; padding: 20px;
91
+ overflow: auto; border: 0; border-radius: 12px; background: #fff; color: #0f172a;
92
+ box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); outline: none;
93
+ font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
94
+ color-scheme: light dark;
95
+ }
96
+ dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
97
+ .toast {
98
+ box-sizing: border-box; position: fixed; inset: auto 16px 16px auto; margin: 0; width: calc(100% - 32px); max-width: 24rem;
99
+ max-height: calc(100% - 32px); overflow: auto; padding: 16px; border: 0; border-radius: 12px; background: #fff; color: #0f172a;
100
+ box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); z-index: 2147483647;
101
+ font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
102
+ color-scheme: light dark;
103
+ }
104
+ .toast h2 { font-size: 15px; }
105
+ .toast p { margin-bottom: 12px; }
106
+ .toast label { margin-bottom: 12px; }
107
+ /* A browser without showModal(): the same place, over the page, without the top layer. */
108
+ dialog[open]:not(:modal) { position: fixed; inset: 0; z-index: 2147483647; }
109
+ h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.35; }
110
+ .error { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; font-size: 13px; color: #64748b; }
111
+ .code { padding: 1px 7px; border-radius: 6px; background: #f1f5f9; color: #475569; font-weight: 600; font-variant-numeric: tabular-nums; }
112
+ .message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
113
+ p { margin: 0 0 16px; color: #334155; }
114
+ p.failed { margin-bottom: 8px; }
115
+ .notice {
116
+ position: fixed; inset: auto 16px 16px; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); z-index: 2147483647;
117
+ padding: 10px 14px; border: 0; border-radius: 10px; background: #0f172a; color: #f8fafc;
118
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
119
+ font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
120
+ }
121
+ label { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; cursor: pointer; }
122
+ input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: #2563eb; }
123
+ .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
124
+ button {
125
+ font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; cursor: pointer;
126
+ border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
127
+ }
128
+ button.share { border-color: #2563eb; background: #2563eb; color: #fff; }
129
+ button:focus-visible, input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
130
+ @media (prefers-color-scheme: dark) {
131
+ dialog::backdrop { background: rgba(2, 6, 23, 0.6); }
132
+ dialog { background: #0f172a; color: #e2e8f0; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
133
+ p { color: #cbd5e1; }
134
+ .error { color: #94a3b8; }
135
+ .code { background: #1e293b; color: #cbd5e1; }
136
+ .notice { background: #f1f5f9; color: #0f172a; }
137
+ .toast { background: #0f172a; color: #e2e8f0; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
138
+ button { background: #1e293b; color: #e2e8f0; border-color: #334155; }
139
+ button.share { background: #3b82f6; border-color: #3b82f6; color: #fff; }
140
+ button:focus-visible, input:focus-visible { outline-color: #93c5fd; }
141
+ }
142
+ `;function q(e,t={},n=null){let r=document.createElement(e);for(let[o,s]of Object.entries(t))r.setAttribute(o,s);return n!==null&&(r.textContent=n),r}var As=typeof document<"u"&&document.currentScript?.nonce||"";function _s(){let e=q("style",{},yl);return As&&(e.nonce=As),e}function Ds(e,{offerAnonymous:t=!1,error:n=null,toast:r=!1,timeoutMs:o=6e4}={}){return new Promise(s=>{let i=q("div",{"data-session-replay-ask":""}),l=i.attachShadow({mode:"closed"}),a=document.activeElement,d=_s(),u=r?q("div",{class:"toast",role:"dialog","aria-live":"polite",popover:"manual","aria-labelledby":"sr-ask-title","aria-describedby":"sr-ask-body"}):q("dialog",{"aria-labelledby":"sr-ask-title","aria-describedby":"sr-ask-body",tabindex:"-1"}),h=q("input",{type:"checkbox",id:"sr-ask-anonymous"}),m=q("button",{type:"button",class:"decline"},e.decline),p=q("button",{type:"button",class:"share"},e.share),f=q("div",{class:"actions"});if(u.append(q("h2",{id:"sr-ask-title"},e.title)),n){let g=q("div",{class:"error"});n.status&&g.append(q("span",{class:"code"},String(n.status))),n.message&&g.append(q("span",{class:"message",title:n.message},n.message)),g.childElementCount&&u.append(g),e.failed&&u.append(q("p",{class:"failed"},e.failed))}if(u.append(q("p",{id:"sr-ask-body"},e.body)),t){let g=q("label",{for:"sr-ask-anonymous"});g.append(h,document.createTextNode(e.anonymous)),u.append(g)}f.append(m,p),u.append(f),l.append(d,u);let c=!1,y=null,w=()=>E({share:!1,anonymous:!1});on=w;let E=g=>{if(!c){c=!0,clearTimeout(y),on===w&&(on=null),i.remove();try{(!r||l.activeElement)&&a?.focus?.({preventScroll:!0})}catch{}s(g)}};if(m.addEventListener("click",()=>E({share:!1,anonymous:!1})),p.addEventListener("click",()=>E({share:!0,anonymous:t&&h.checked})),r){document.documentElement.append(i);try{u.showPopover()}catch{}o>0&&(y=setTimeout(()=>E({share:!1,anonymous:!1}),o));return}u.addEventListener("cancel",g=>{g.preventDefault(),E({share:!1,anonymous:!1})}),l.addEventListener("keydown",g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),E({share:!1,anonymous:!1}))}),u.addEventListener("close",()=>E({share:!1,anonymous:!1})),document.documentElement.append(i),setTimeout(()=>{c||(typeof u.showModal=="function"?u.showModal():u.setAttribute("open",""),u.focus())},0)})}function Ps(e){if(!e)return;let t=q("div",{"data-session-replay-notice":""}),n=t.attachShadow({mode:"closed"}),r=q("div",{class:"notice",role:"status",popover:"manual"},e);n.append(_s(),r),document.documentElement.append(t);try{r.showPopover()}catch{}setTimeout(()=>t.remove(),4e3)}var Us="session-replay",fr="pending",Ct=null;function Sl(){return Ct||(Ct=new Promise(e=>{let t;try{t=window.indexedDB.open(Us,1)}catch{e(null);return}t.onupgradeneeded=()=>{try{t.result.createObjectStore(fr,{keyPath:"key"})}catch{}},t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>{n.close(),Ct=null},e(n)},t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Ct)}async function Fs(){try{return typeof window.indexedDB?.databases!="function"?null:(await window.indexedDB.databases()).some(e=>e.name===Us)}catch{return null}}async function pr(e,t){let n=await Sl();return n?new Promise(r=>{try{let o=n.transaction(fr,e).objectStore(fr),s=t(o);s.onsuccess=()=>r(s.result??null),s.onerror=()=>r(null)}catch{r(null)}}):null}function Hs(e,t,n,r,o){return pr("readwrite",s=>s.put({key:ur(e,t.seq),session:e,seq:t.seq,meta:t.meta,anonymous:!!t.anonymous,identity:o??null,assets:r,blob:n,notBefore:t.notBefore||0,savedAt:Date.now()}))}function xt(e,t){return pr("readwrite",n=>n.delete(ur(e,t)))}async function hr(){let e=await pr("readonly",t=>t.getAll());return Array.isArray(e)?e:[]}var bl="sr:assist",Bs="sr:tab";function wl(){let e=new Uint8Array(12),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return[...e].map(n=>n.toString(16).padStart(2,"0")).join("")}function El(e,t){let n=e(Bs);if(typeof n=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(n))return n;let r=wl();return t(Bs,r),r}function vl(e){try{let t=JSON.parse(e(bl)||"null");return t&&typeof t.id=="string"&&typeof t.secret=="string"?t:null}catch{return null}}var Ws=["cancelled","declined","expired","withdrawn","ended"];function Tl(e,t){let n;try{n=new URL(String(e??""),t?.href)}catch{throw new Error("The Assist module URL is not a URL.")}if(!t?.origin||n.origin!==t.origin||!["http:","https:"].includes(n.protocol))throw new Error("The Assist module must come from the page's own origin.");return n.href}function zs({settings:e,token:t,recording:n,read:r,write:o,load:s,lend:i,fetch:l,document:a=globalThis.document,location:d=globalThis.location}){let u=El(r,o),h=l||((...C)=>globalThis.fetch(...C)),m=s||(C=>import(C)),p=null,f=null,c=null;function y(){return p?Promise.resolve(p):(f||(f=Promise.resolve().then(()=>m(Tl(e().module,d))).then(C=>(p=C.installAssist({...i,tab:u}),p)).catch(C=>{throw f=null,C})),f)}function w(C){!C||typeof C.id!="string"||y().then($=>$.knock(C)).catch(()=>{})}async function E(){clearTimeout(c),c=setTimeout(E,e().heartbeatMs||15e3);let C=n();if(!(a?.visibilityState!=="visible"||!C||!e().routes?.heartbeat))try{let $=await h(e().routes.heartbeat,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:t(),session:C.id,key:C.key??null})});if(!$.ok)return;w((await $.json())?.assist)}catch{}}let g=()=>vl(r),x=()=>{let C=g();return!!C&&!Ws.includes(C.status)},A={request:C=>y().then($=>$.api.request(C)),cancel:()=>p||x()?y().then(C=>C.api.cancel()):Promise.resolve(),end:()=>p||x()?y().then(C=>C.api.end()):Promise.resolve(),status(){if(p)return p.api.status();let C=g();return C&&!Ws.includes(C.status)?{id:C.id,status:C.status??null,agent:C.agent?{name:C.agent.name,avatar:C.agent.avatar}:null}:{id:null,status:null,agent:null}}};function _(){a?.addEventListener?.("visibilitychange",()=>{a.visibilityState==="visible"&&E()}),E(),(x()||e().button)&&y().catch(()=>{})}return{tab:u,api:A,ensure:y,knock:w,heartbeat:E,start:_,tap:C=>p?.tap(C),loaded:()=>!!p,stop:()=>clearTimeout(c)}}var S=null,Pe={},Xs=4,xl=3,Ml=5,Il=6,Tr="sr:session",Ys=800,Js="sr:consent",Nl="rrweb/console@1",mr=60*1024,kl=40,Ks="sr:pause",Rl=400,Ol=15e5,v=null,z=null,G=null,Ce=null,an=new WeakSet,O=!1,U=[],Be=0,lt=0,We=0,Me=[],it=new Set,ce=new Map,sn=new Set,ln=0,It=Promise.resolve(!1),gr=0,cn=null,Nt=5e3,Rt=0,Mt=0,un={at:0,label:""},ot=0,yr=!1,rt=!1,Z=!1,br=null,Ot=new Set,ye=0,wr=null,Er=0,st=0,dn=!1,Ll=new Set,De=null,xe=!1,ze=0,Qs=0,Lt=!1,vr=0,Zs=null,Cr=!1;function ei(e){try{return window[e]}catch{return null}}function at(e,t){try{return ei(e)?.getItem(t)??null}catch{return null}}function Ue(e,t,n){try{ei(e)?.setItem(t,n)}catch{}}function Al(){if(window.crypto?.randomUUID)return window.crypto.randomUUID();let e=new Uint8Array(16);(window.crypto||{getRandomValues:n=>n.forEach((r,o)=>n[o]=Math.floor(Math.random()*256))}).getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(n=>n.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)}`}function _l(){let e=new Uint8Array(16);return(window.crypto||{getRandomValues:t=>t.forEach((n,r)=>t[r]=Math.floor(Math.random()*256))}).getRandomValues(e),[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function Dl(){let e=Date.now(),t=null;try{t=JSON.parse(at("sessionStorage",Tr)||"null")}catch{t=null}return(!t||typeof t.id!="string"||e-t.lastActivity>S.idleTimeout||(t.identity??null)!==(S.identity??null))&&(t={id:Al(),key:_l(),seq:0,lastActivity:e,sampled:Math.random()<S.sampleRate,identity:S.identity??null}),typeof t.key!="string"&&(t.key=null),["buffering","recording","declined","stopped"].includes(t.phase)||(t.phase=xe&&t.seq===0?"buffering":"recording"),!xe&&t.phase==="buffering"&&(t.phase="recording"),t}function Se(){if(v&&(v.lastActivity=Date.now(),Ue("sessionStorage",Tr,JSON.stringify(v)),S.cookie&&!["declined","stopped"].includes(v.phase)&&v.sampled)){let e=location.protocol==="https:"?"; Secure":"",t=v.key?`${v.id}.${v.key}`:v.id;document.cookie=`${S.cookie}=${t}; path=/; max-age=${Math.round(S.idleTimeout/1e3)}; SameSite=Lax${e}`}}function Pl(){S.cookie&&(document.cookie=`${S.cookie}=; path=/; max-age=0; SameSite=Lax`)}function Ul(){return S.respectGpc&&navigator.globalPrivacyControl?!1:S.consent!=="opt-in"||at("localStorage",Js)==="1"}function ue(e,t,n={},r=null){if(!z||O)return!1;let o=r??Date.now();return X.defer(()=>ue(e,t,n,o))?!1:(ti(e,t,n,o,r===null),sr(e,S.onError?.triggers)?ni(e==="request"&&ks(n?.status)):!1)}function ti(e,t,n,r,o){let s=String(t??"").slice(0,480)||e;Me.push({type:e,label:s,payload:n,at:r});try{G&&o?Q.addCustomEvent(`sr:${e}`,{label:s,...n}):xr({type:Ml,data:{tag:`sr:${e}`,payload:{label:s,...n}},timestamp:r})}catch{}}function Fl(e,t={}){if(!z||O||!v)return Promise.resolve(!1);let n=Date.now();return X.defer(()=>ue("report",e,t,n))||ti("report",e,t,n,!0),v.phase==="buffering"&&(Z&&Tt(),Z=!1,At(n-ze),fn(!1)),v.phase!=="recording"?Promise.resolve(!1):(wr?.(),Ie())}async function Hl(e){let t=await window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return[...new Uint8Array(t)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function Bl(e,t){for(let n of t){let r=await Hl(n.text);n.holder[n.key]=ss(r),it.add(r),ce.has(r)||ce.set(r,n.text)}return e}function $s(e){let t=rn(e);if(U.push(e),Be+=t,e.type===2?(lt++,We=0):We+=t,v?.phase==="buffering"){Wl(e);return}(U.length>=Rl||Be>=Ol)&&Ie()}function Wl(e){if(e.type===2){ot=Math.max(ot,e.timestamp),(!Z||rt)&&At(rt?1/0:Date.now()-ze),rt=!1;return}Be>=vr&&(rt=!0);let t=lt>1||We>=vr/2;e.type===xl&&(rt&&t||ot&&e.timestamp-ot>Qs&&!Z)&&zl()}function zl(){yr||(yr=!0,setTimeout(()=>{yr=!1;try{G&&!O&&v?.phase==="buffering"&&(Q.takeFullSnapshot(!0),ot=Date.now())}catch{}},0))}function At(e){let t=bs(U,Me,Ss(U,e));if(U=t.events,Me=t.markers,Be=ws(U),lt=U.filter(n=>n.type===2).length,We=Es(U),Rt=vs(U),ln===0){it=new Set(cs(U));for(let n of ce.keys())it.has(n)||ce.delete(n)}Se()}function ni(e=!1){if(!v||v.phase!=="buffering"||Z||O||v.declinedAt&&Date.now()-v.declinedAt<ze)return!1;if(At(Date.now()-ze),!S.onError.ask)return fn(!1,e),!1;Z=!0;let t=v;return Ds(S.onError.labels,{offerAnonymous:!!S.onError.offerAnonymous,error:br,toast:S.onError.ask==="toast",timeoutMs:S.onError.askTimeoutMs??6e4}).then(n=>{if(Z=!1,!(O||v!==t||v.phase!=="buffering")){if(n.share){fn(n.anonymous,e),Ps(S.onError.labels.sent);return}if(S.onError.askAgain){v.declinedAt=Date.now(),At(1/0),Se();return}_t(),v.phase="declined",Se()}}).catch(()=>{Z=!1}),!0}function fn(e,t=!1){if(v.phase="recording",v.anonymous=!!e,Se(),U.length){let n=Ir();n.window=Lt,t&&Lt&&(n.notBefore=Date.now()+Rs()),Rr(n)}Or()}function $l(e){e.type!==3||!or.has(e.data?.source)||(Mt&&e.timestamp-Mt<5e3&&(Rt+=e.timestamp-Mt),Mt=e.timestamp)}function Vl(e){if(e.type!==6||e.data?.plugin!==Nl||e.data.payload?.level!=="error")return;let t=Ae((e.data.payload.payload||[]).join(" "),S.privacy.redactQuery).slice(0,480);e.timestamp-un.at<250&&t.includes(un.label.slice(0,80))||(Me.push({type:"console",label:t||"console.error",payload:{},at:e.timestamp}),sr("console",S.onError?.triggers)&&setTimeout(ni,0))}function ql(){return!!(S.privacy.maskAllText||S.privacy.maskTextSelector)}function jl(e){try{let t=Q.mirror.getNode(e),n=t&&t.nodeType===1?t:t?.parentElement;return ri(n)}catch{return!0}}function Gl(e){try{let t=Q.mirror.getNode(e);return t&&t.nodeType===1?{tagName:t.tagName.toLowerCase(),type:t.getAttribute("type")||""}:null}catch{return null}}function ri(e){return S.privacy.maskAllText?!tr(e,S.privacy.unmaskTextSelector,S.privacy.maskTextSelector):!!e?.closest?.(S.privacy.maskTextSelector)}function xr(e){if(O||!ms(e,Ll))return;$l(e),Vl(e),ls(e,Zs),Jo(e),Yo(e,S.privacy.redactQuery,location.href),Zo(e,S.privacy.redactQuery),ql()&&Qo(e,jl,Gl),e.type===Xs&&e.data&&e.data.href&&(e.data.href=$e(e.data.href)),e.type===2&&X.swapped()&&an.add(e),e.type===2&&!S.snapshots?.share&&an.add(e),De?.tap(e);let t=S.size.dedupeStylesheets&&Cr?nr(e,S.size.dedupeMinBytes):[];if(t.length===0){$s(e);return}let n=Er;ln++,Bl(e,t).catch(()=>e).then(r=>{ln--,n===Er&&$s(r)})}async function Mr(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"application/json"});let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Blob([await new Response(t).arrayBuffer()],{type:"application/gzip"})}function Ir(){let e={seq:v.seq++,events:U,meta:{url:U.find(t=>t.type===Xs)?.data?.href||$e(location.href),viewport:{width:window.innerWidth,height:window.innerHeight},from:U[0].timestamp,to:U[U.length-1].timestamp,events:U.length,activeMs:Math.round(Rt),markers:Me,assets:[...it]},anonymous:!!v.anonymous,session:v,token:S.token,identity:S.identity??null,tries:0,blob:null,window:!1,kept:!1};return U=[],Be=0,lt=0,We=0,Me=[],it=new Set,Rt=0,Se(),e}function oi(e,t){let n=new FormData;return n.append("token",e.token),n.append("session",e.session.id),e.session.key&&n.append("key",e.session.key),n.append("seq",String(e.seq)),e.anonymous&&n.append("anonymous","1"),n.append("meta",JSON.stringify(e.meta)),n.append("events",t,"events"),n}async function Xl(e,t,n){let r=[];for(let o of e){let s=ce.get(o);if(s===void 0)continue;if(kr()){r.push(o);continue}let i=new FormData;i.append("token",t),i.append("hash",o),i.append("session",n.id),n.key&&i.append("key",n.key),i.append("content",await Mr(s),"content");try{let l=await fetch(S.assetUrl,{method:"POST",body:i});if(l.status===429&&(await ai(l)).stop)return _t(!0),r;(l.status===429||l.status>=500)&&(Nr(l),r.push(o))}catch{r.push(o)}}return r}var si="sr:shared",Yl=3600*1e3;function Jl(){try{let e=Date.now(),t=JSON.parse(at("sessionStorage",si)||"{}");return(t.identity??null)!==(S.identity??null)?{}:Object.fromEntries(Object.entries(t.hashes||{}).filter(([,n])=>e-n<Yl))}catch{return{}}}async function Kl(e){for(let t of e.events)if(!(t.type!==2||!t.data||!t.data.node||an.has(t)))try{ps(t.data.node,S.snapshots.volatileIds);let n=JSON.stringify(t.data.node),r=await window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(n)),o=[...new Uint8Array(r)].map(i=>i.toString(16).padStart(2,"0")).join(""),s=Jl();if(!s[o]){if(kr())continue;let i=new FormData;i.append("token",e.token),i.append("hash",o),i.append("content",await Mr(n),"content");let l=await fetch(S.snapshots.url,{method:"POST",body:i});if(!l.ok){Nr(l);continue}s[o]=Date.now(),Ue("sessionStorage",si,JSON.stringify({identity:S.identity??null,hashes:Object.fromEntries(Object.entries(s).slice(-50))}))}ds(t,o)}catch{}e.meta.snapshots=fs(e.events)}async function ii(e){e.blob||(S.snapshots&&Cr&&e.events.some(t=>t.type===2&&!an.has(t))&&await Kl(e),e.blob=await Mr(JSON.stringify(e.events))),(e.blob.size<=S.maxBatchBytes||e.events.length<=1)&&(e.events=[])}async function Fe(e){if(O||e.era!==st)return!1;await ii(e);let t=e.blob;if(t.size>S.maxBatchBytes&&e.events.length>1){let o=Math.ceil(e.events.length/2),s={...e,seq:e.session.seq++,events:e.events.slice(o),meta:{...e.meta,markers:[],assets:[],activeMs:0},blob:null};e.blob=null,e.events=e.events.slice(0,o),e.meta.events=e.events.length,e.meta.to=e.events[e.events.length-1].timestamp,s.meta.events=s.events.length,s.meta.from=s.events[0].timestamp,Se();let i=await Fe(e);return await Fe(s)&&i}if(e.window&&!e.kept&&!O&&await ci(e),e.notBefore&&(await new Promise(o=>{wr=o,li(e.notBefore,ar).then(o)}),wr=null,e.notBefore=0),await Ql(),O||e.era!==st)return!1;let n;try{n=await fetch(S.ingestUrl,{method:"POST",body:oi(e,t)})}catch{return Sr(e)}if(n.status===401&&Pe.refreshToken&&!e.refreshed){e.refreshed=!0;let o=null;try{o=await Pe.refreshToken(e.identity)}catch{o=null}if(typeof o=="string"&&o&&!O&&e.era===st)return e.token=o,Fe(e)}let r=await ai(n);if(r.stop)return e.kept&&Vs(e),_t(!0),!1;if(n.status===429||n.status>=500)return n.status===429&&(Nt=Math.min(Nt*2,6e4)),Nr(n)&&(e.pauses||0)<Os?(e.pauses=(e.pauses||0)+1,Sr(e,!0)):Sr(e);if(e.kept&&Vs(e),n.ok){Nt=S.flushInterval,De&&r.assist&&De.knock(r.assist),sn=new Set(await Xl([...new Set([...r.missing_assets||[],...sn])],e.token,e.session));for(let o of e.meta.assets)sn.has(o)||ce.delete(o)}return n.ok}async function ai(e){try{let t=await e.json();return t&&typeof t=="object"?t:{}}catch{return{}}}async function Sr(e,t=!1){return e.window&&!e.kept&&!O&&await ci(e),t?O?!1:Fe(e):Zl(e)}function Nr(e){if(e.status!==503&&e.status!==429)return!1;let t=null;try{t=Ls(e.headers.get("Retry-After"))}catch{}return t===null?!1:(ye=Math.max(ye,Date.now()+t),Ue("sessionStorage",Ks,String(ye)),!0)}function kr(){let e=Date.now();return ye||(ye=Number(at("sessionStorage",Ks))||0),ye>e+_e&&(ye=e+_e),lr(ye,e,_e)>0}async function Ql(){for(;kr()&&!O;)await li(ye,_e)}function li(e,t){let n=lr(e,Date.now(),t);return n>0?new Promise(r=>setTimeout(r,n)):Promise.resolve()}async function ci(e){e.kept=!0,Ot.add(e);let t={};for(let n of e.meta.assets)ce.has(n)&&(t[n]=ce.get(n));await Hs(e.session.id,e,e.blob,t,e.identity)}function Vs(e){e.kept=!1,Ot.delete(e),xt(e.session.id,e.seq)}function Zl(e){return++e.tries>8||O?!1:ec(Ns(e.tries)).then(()=>O?!1:Fe(e))}function ec(e){return new Promise(t=>{let n=()=>{clearTimeout(r),window.removeEventListener("online",n),t()},r=setTimeout(n,e);window.addEventListener("online",n)})}function Rr(e){if(gr>=kl)return Promise.resolve(!1);gr++,e.era=st;let t=ii(e).catch(()=>{});return It=It.then(()=>t).then(()=>Fe(e)).catch(()=>!1).finally(()=>gr--),It}function Ie(){return O||!v||v.phase!=="recording"||U.length===0?Promise.resolve(!1):Rr(Ir())}async function tc(){let e=[];for(let t of await hr()){let n=dr(t,{sessionId:v.id,identity:S.identity,now:Date.now(),idleTimeout:S.idleTimeout});n==="drop"&&xt(t.session,t.seq),n==="send"&&e.push(t)}e.sort((t,n)=>t.seq-n.seq);for(let t of e){if(O)return;for(let[r,o]of Object.entries(t.assets||{}))ce.has(r)||ce.set(r,o);let n={seq:t.seq,events:[],meta:t.meta,anonymous:!!t.anonymous,session:v,token:S.token,identity:S.identity??null,tries:0,blob:t.blob,window:!0,kept:!0,era:st,notBefore:Number(t.notBefore)||0};Ot.add(n),await Fe(n)}}function qs(e=!0){if(O||!v||v.phase!=="recording"||U.length===0)return;let t=Ir(),n=new Blob([JSON.stringify(t.events)],{type:"application/json"}),r=n.size+JSON.stringify(t.meta).length+String(t.token).length+1024;if(!e&&r>=mr){Rr(t);return}try{let o=oi(t,n);if(r<mr&&!("keepalive"in Request.prototype)&&navigator.sendBeacon?.(S.ingestUrl,o))return;fetch(S.ingestUrl,{method:"POST",body:o,keepalive:r<mr}).catch(()=>{})}catch{}}function Or(){clearTimeout(cn),cn=setTimeout(()=>{Ie(),Or()},Nt)}function $e(e){return tt(e,S.privacy.redactQuery,location.href)}function nc(e,t){let n=t.filter(Boolean).join(", ");if(!n)return!1;try{return!!e.querySelector(n)}catch{return!0}}function rc(e){if(!(e instanceof Element))return"unknown";if(e=e.closest('button, a, [role="button"], summary, label, input, select, textarea')||e,S.privacy.blockSelector&&e.closest(S.privacy.blockSelector))return e.tagName.toLowerCase();let t=(S.privacy.maskAllText||S.privacy.maskTextSelector)&&ri(e),n=e.tagName.toLowerCase(),r=(e.getAttribute("alt")||e.getAttribute("aria-label")||e.getAttribute("title")||"").trim();if(!r&&!nc(e,[S.privacy.maskTextSelector,S.privacy.blockSelector])&&(n==="button"||e.getAttribute("role")==="button")&&(r=(e.textContent||"").replace(/\s+/g," ").trim()),r&&!t)return`${n} "${r.slice(0,60)}"`;let o=e.id?`#${e.id}`:"",s=typeof e.className=="string"&&e.className?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"";return`${n}${o}${s}`.slice(0,120)}var js=null;function Lr(){if(js===location.pathname+location.search)return;js=location.pathname+location.search;let e=new URL($e(location.href));ue("navigation",e.pathname+e.search,S.privacy.maskAllText?{url:e.href}:{url:e.href,title:document.title.slice(0,200)})}function oc(){window.addEventListener("error",e=>{if(!e.message)return;let t=Ae(e.message,S.privacy.redactQuery);un={at:Date.now(),label:t},ue("error",t,{source:$e(e.filename),line:e.lineno,column:e.colno,stack:Ae(String(e.error?.stack||""),S.privacy.redactQuery).slice(0,2e3)})}),window.addEventListener("unhandledrejection",e=>{let t=Ae(String(e.reason?.message||e.reason||"Unhandled promise rejection"),S.privacy.redactQuery);un={at:Date.now(),label:t},ue("error",t,{stack:Ae(String(e.reason?.stack||""),S.privacy.redactQuery).slice(0,2e3)})})}function sc(e){if(typeof e!="string"||!e)return null;try{let t=new DOMParser().parseFromString(e.slice(0,2e4),"text/html").title.trim().replace(/\s+/g," ");return!t||t===String(S.appName||"").trim()?null:t.slice(0,120)}catch{return null}}function ic(){let e=()=>{try{window.Livewire.hook("request",({url:t,fail:n})=>{n(({status:r,content:o,preventDefault:s})=>{br={status:Number(r)||null,message:sc(o)};let i=ue("request",`Livewire request failed (${r})`,{status:r,url:$e(String(t||"")).slice(0,500)});br=null,i&&S.onError?.replaceLivewireModal&&r!==419&&s?.()})})}catch{}};window.Livewire?e():document.addEventListener("livewire:init",e,{once:!0}),document.addEventListener("livewire:navigated",()=>Lr())}function ac(){let e=S.capture.requests,t=[S.ingestUrl],n=Array.isArray(Pe.requestOrigins)?Pe.requestOrigins:[],r=!1,o=null,s=()=>{r=!0,clearTimeout(o),o=setTimeout(()=>r=!1,3e3)};window.addEventListener("beforeunload",s),window.addEventListener("pagehide",s);let i=f=>{if(r)return;let c=xs({...f,threshold:e,page:location.href,skip:t,origins:n});c&&ue("request",c.label,{...c.payload,url:$e(c.payload.url)})},l=window.fetch;if(typeof l=="function"&&(window.fetch=function(f,c){let y=performance.now(),w=l.apply(this,arguments);try{let E=typeof f=="string"||f instanceof URL?String(f):f?.url,g=c?.method||f?.method||"GET";if(!ir(c?.headers,"X-Livewire")&&!ir(f?.headers,"X-Livewire"))return Ms(w,x=>i({url:x.url||E,method:g,status:x.status,type:x.type,duration:performance.now()-y}),x=>x?.name!=="AbortError"&&i({url:E,method:g,status:0,duration:performance.now()-y}))}catch{}return w}),typeof XMLHttpRequest>"u")return;let a=new WeakMap,d=new WeakSet,u=XMLHttpRequest.prototype,h=u.open,m=u.setRequestHeader,p=u.send;u.open=function(f,c){return a.set(this,{method:f,url:String(c),livewire:!1,aborted:!1,started:0}),h.apply(this,arguments)},u.setRequestHeader=function(f){let c=a.get(this);return c&&String(f).toLowerCase()==="x-livewire"&&(c.livewire=!0),m.apply(this,arguments)},u.send=function(){let f=a.get(this);return f&&(f.started=performance.now()),f&&!d.has(this)&&(d.add(this),this.addEventListener("abort",()=>{let c=a.get(this);c&&(c.aborted=!0)}),this.addEventListener("loadend",()=>{let c=a.get(this);!c||c.livewire||c.aborted||i({url:this.responseURL||c.url,method:c.method,status:this.status,duration:performance.now()-c.started})})),p.apply(this,arguments)}}function lc(){let e=()=>{X.isAwaiting()||setTimeout(()=>X.isAwaiting()||Lr(),0)},t=history.pushState;history.pushState=function(){let n=t.apply(this,arguments);return e(),n},window.addEventListener("popstate",e)}function cc(){let e=[],t=0;document.addEventListener("click",n=>{if(n.detail===0)return;let r=Date.now();e=e.filter(s=>r-s.at<700),e.push({at:r,x:n.clientX,y:n.clientY}),e.filter(s=>Math.hypot(s.x-n.clientX,s.y-n.clientY)<30).length>=3&&r>t&&(t=r+2e3,e=[],ue("rage-click",rc(n.target),{x:n.clientX,y:n.clientY}))},!0)}function uc(){let e=t=>ue("vital",`${t.name} ${t.name==="CLS"?t.value.toFixed(3):Math.round(t.value)+" ms"}`,{name:t.name,value:t.value,rating:t.rating});Go(e),jo(e),$o(e)}function ui(){return{emit:xr,plugins:Ce?[Ce.plugin]:[],maskAllInputs:!1,maskInputOptions:Ko(S.privacy.maskAllInputs),maskTextSelector:S.privacy.maskAllText?"*":ts(S.privacy.maskTextSelector)||void 0,maskTextFn:S.privacy.maskAllText&&S.privacy.unmaskTextSelector?es(S.privacy.unmaskTextSelector,S.privacy.maskTextSelector):void 0,blockSelector:S.privacy.blockSelector||void 0,ignoreSelector:S.privacy.ignoreSelector||void 0,slimDOMOptions:"all",inlineStylesheet:!0,recordCanvas:!1,collectFonts:!1,sampling:S.size.sampling}}var X=Ts({current:()=>window.__sessionReplay||null,pause(){try{G?.()}catch{}G=null},resume(e,t){if(z&&!O&&v&&((e.identity??null)!==(v.identity??null)||Date.now()-v.lastActivity>e.idleTimeout))return fi(e),!1;if(S=e,dn&&!z){kt();return}if(!(!t||O||!z)){try{G=Q(ui())||null}catch{G=null}G&&v?.phase==="recording"&&setTimeout(()=>{!O&&U.length&&Ie()},Ys)}},skipped(e,t){ue("navigation","Page not recorded",{skipped:!0,durationMs:Math.max(0,t-e)},e)}});function dc(){document.addEventListener("livewire:navigating",()=>{window.__sessionReplay=void 0,X.navigating(!!G&&!O)}),document.addEventListener("livewire:navigated",()=>X.navigated())}async function pn({all:e=!1,recording:t=null}={}){let n=await Fs();if(n===!1||n===null&&!xe)return;let r=Date.now();for(let o of await hr())(e||o.session===t||dr(o,{sessionId:v?.id??"",identity:S.identity,now:r,idleTimeout:S.idleTimeout})==="drop")&&xt(o.session,o.seq)}var Gs=null;function di(){let e=z&&v?v.id:null;if(e!==Gs){Gs=e;try{window.dispatchEvent(new CustomEvent("session-replay:session",{detail:{id:e}}))}catch{}}}function kt(){let e=fc();return di(),e}function fc(){if(z||!S)return!1;if(!Ul())return pn({all:!0}).catch(()=>{}),!1;if(X.isExcluded()||X.isAwaiting())return dn=!0,!1;if(dn=!1,v=Dl(),Se(),pn({all:!Lt}).catch(()=>{}),!v.sampled||v.phase==="declined"||v.phase==="stopped")return!1;if(O=!1,ot=0,Ce=null,S.capture.console.length){let e=Lo({level:S.capture.console,lengthThreshold:1e3,logger:window.console}),t=(n,r=Date.now())=>{X.defer(()=>t(n,r))||xr({type:Il,data:{plugin:e.name,payload:n},timestamp:r})};Ce=Cs(e,t,window)}return G=Q(ui())||null,G?(z=()=>{let e=G;G=null,e?.(),Ce?.stop(),Ce=null},Lr(),v.phase==="buffering"||(Lt&&(It=It.then(tc).catch(()=>{})),Or(),setTimeout(()=>{!O&&U.length&&Ie()},Ys)),!0):(Ce?.stop(),Ce=null,!1)}function fi(e){Ie(),clearTimeout(cn),Ue("sessionStorage",Tr,"null"),Z&&Tt(),Z=!1;try{z?.()}catch{}z=null,Er++,U=[],Be=0,lt=0,We=0,Me=[],it=new Set,Rt=0,Mt=0,rt=!1,v=null,S=e,kt()}function pc(){!z||O||!v||v.phase!=="buffering"||(Z&&Tt(),Z=!1,At(Date.now()-ze),fn(!1))}function _t(e=!1){O=!0,dn=!1,clearTimeout(cn),X.stop(),Z&&Tt(),Z=!1,e&&v&&(v.phase="stopped",Se());try{z?.()}catch{}z=null,st++,U=[],Be=0,lt=0,We=0,Me=[],ce=new Map,sn=new Set,Pl();for(let t of Ot)xt(t.session.id,t.seq);Ot=new Set,v&&pn({recording:v.id}).catch(()=>{}),di()}function hc(e){if(e){if(z&&!O&&v&&((e.identity??null)!==(v.identity??null)||Date.now()-v.lastActivity>e.idleTimeout)){fi(e);return}S=e}}function pi(e,t={}){S=e,Pe=t||{},Nt=S.flushInterval,xe=S.mode==="on_error",ze=xe?S.onError.bufferMs:0,Qs=xe?ys(ze):0,Lt=xe&&!!S.onError.keepPending,vr=xe?S.onError.maxWindowChars||5e6:0,Zs=is(S.size.stripAttributes,S.size.keepAttributes),Cr=!!(window.crypto&&window.crypto.subtle&&window.TextEncoder),Pe.pageConfig&&dc(),S.capture.vitals&&uc(),S.capture.errors&&oc(),S.capture.livewire&&ic(),S.capture.requests&&ac(),lc(),S.capture.rageClicks&&cc(),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&(ln===0?qs(!1):Ie())}),window.addEventListener("pagehide",()=>qs());let n={start:kt,stop:()=>_t(),flush:Ie,mark:(r,o={})=>ue("custom",r,o),send:(r="Problem reported",o={})=>Fl(r,o),consent(r){return Ue("localStorage",Js,r?"1":"0"),r?kt():(_t(),pn({all:!0}).catch(()=>{}),!1)},isRecording:()=>!!z&&!O&&!X.isExcluded()&&v?.phase==="recording",isBuffering:()=>!!z&&!O&&!X.isExcluded()&&v?.phase==="buffering",sessionId:()=>z&&v?v.id:null};if(Pe.global&&(window.SessionReplay=n),S.assist)try{let r=()=>z&&!O&&v&&v.phase==="recording"?{id:v.id,key:v.key}:null;De=zs({settings:()=>S.assist||{},token:()=>S.token,recording:r,read:o=>at("sessionStorage",o),write:(o,s)=>Ue("sessionStorage",o,s),lend:{config:()=>S,recording:r,snapshot(){try{return G?(Q.takeFullSnapshot(),!0):!1}catch{return!1}},mirrors:()=>!!G&&!O&&!X.isExcluded()&&!X.isAwaiting(),node:o=>{try{return G?Q.mirror.getNode(o):null}catch{return null}},goLive:pc,touch:()=>Se(),redacted:$e,read:o=>at("sessionStorage",o),write:(o,s)=>Ue("sessionStorage",o,s)}}),n.assist=De.api,De.start()}catch{De=null}return kt(),{api:n,update:hc,recording:()=>z&&!O&&v&&v.sampled&&!["declined","stopped"].includes(v.phase)?{id:v.id,key:v.key}:null}}var mc="X-Session-Replay";var gc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,yc=/^[A-Za-z0-9]{1,128}$/;function _r(e,t){if(typeof e!="string"||e.trim()==="")throw new TypeError('Session Replay: start() needs the token endpoint, e.g. "https://api.example.com/session-replay/token".');let n=new URL(e.trim(),t);if(n.protocol!=="https:"&&n.protocol!=="http:")throw new TypeError("Session Replay: the token endpoint must be an http or https URL.");if(n.username||n.password)throw new TypeError("Session Replay: the token endpoint must not carry a user name or password.");return n.hash="",n.href}function Ar(e,t){if(typeof e!="string"||e==="")return!1;try{let n=new URL(e);return(n.protocol==="https:"||n.protocol==="http:")&&n.origin===t}catch{return!1}}var Ne=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),hn=e=>typeof e=="number"&&Number.isFinite(e),Sc=e=>e==null||typeof e=="string",mn=e=>Array.isArray(e)&&e.every(t=>typeof t=="string");function bc(e,t){return Ne(e)?typeof e.token!="string"||e.token===""||e.token.length>16384?"token":Sc(e.identity)?Ar(e.ingestUrl,t)?Ar(e.assetUrl,t)?!hn(e.sampleRate)||e.sampleRate<0||e.sampleRate>1?"sampleRate":!hn(e.idleTimeout)||e.idleTimeout<=0?"idleTimeout":!hn(e.flushInterval)||e.flushInterval<1e3?"flushInterval":!hn(e.maxBatchBytes)||e.maxBatchBytes<=0?"maxBatchBytes":e.consent!=="always"&&e.consent!=="opt-in"?"consent":e.mode!=="session"&&e.mode!=="on_error"?"mode":e.mode==="on_error"&&!Ne(e.onError)?"onError":!Ne(e.privacy)||!mn(e.privacy.redactQuery)?"privacy":!Ne(e.capture)||!mn(e.capture.console)?"capture":!Ne(e.size)||!mn(e.size.stripAttributes)||!mn(e.size.keepAttributes)?"size":!Ne(e.snapshots)||!Ar(e.snapshots.url,t)?"snapshots":null:"assetUrl":"ingestUrl":"identity":"no config"}function hi(e,t,n){if(!Ne(e)||typeof e.record!="boolean")return null;if(!e.record)return{record:!1};let r=new URL(t).origin;if(bc(e.config,r)!==null)return null;let o=typeof e.expires_at=="string"?Date.parse(e.expires_at):NaN;return{record:!0,config:{...e.config,identity:e.config.identity??null,assist:null,snapshots:{...e.config.snapshots,share:!1},cookie:r===n&&typeof e.config.cookie=="string"?e.config.cookie:null},expiresAt:Number.isFinite(o)?o:null}}function mi(e){if(!e||typeof e.id!="string"||!gc.test(e.id))return{};let t=typeof e.key=="string"&&yc.test(e.key)?e.key:null;return{[mc]:t?`${e.id}.${t}`:e.id}}function gi(e){let t={Accept:"application/json","X-Requested-With":"XMLHttpRequest"};if(Ne(e))for(let[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}var wc=typeof fetch=="function"?fetch.bind(globalThis):null,Ec="sr:consent",H=null,be={},yi=Promise.resolve(!1);function Dr(e){try{console.warn(`Session Replay: ${e}`)}catch{}}async function bi(){let e=_r(be.endpoint,location.href),t=typeof be.fetch=="function"?be.fetch:wc;if(!t)return null;let n=await t(e,{method:"GET",credentials:be.credentials??"include",headers:gi(be.headers),cache:"no-store",redirect:"error"});if(n.status===401||n.status===403)return{record:!1};if(!n.ok)return null;let r=null;try{r=await n.json()}catch{r=null}let o=hi(r,e,location.origin);return o===null&&Dr("the token route answered something that is not a recorder config for its own origin; nothing is recorded."),o}async function vc(e){let t=null;try{t=await bi()}catch{return null}return!t?.record||(t.config.identity??null)!==(e??null)?null:(H?.update(t.config),t.config.token)}function Si(){return!!H&&(H.api.isRecording()||H.api.isBuffering())}async function Tc(e){if(be={...be,...e||{}},typeof window>"u"||typeof document>"u")return!1;if(!H&&window.SessionReplay)return Dr("window.SessionReplay is already there (the @sessionReplay directive?); start() does nothing."),!1;let t;try{t=await bi()}catch(n){return Dr(n?.message||"the token could not be fetched."),!1}return t===null?!1:t.record?H?(H.update(t.config),H.api.start(),Si()):(H=pi(t.config,{global:!!be.global,refreshToken:vc,requestOrigins:[new URL(_r(be.endpoint,location.href)).origin]}),Si()):(H?.api.stop(),!1)}function tu(e={}){let t=yi.then(()=>Tc(e));return yi=t.catch(()=>!1),t}function nu(){H?.api.stop()}function ru(e,t={}){return H?H.api.mark(e,t):!1}function ou(e="Problem reported",t={}){return H?H.api.send(e,t):Promise.resolve(!1)}function su(e){if(H)return H.api.consent(e);try{window.localStorage.setItem(Ec,e?"1":"0")}catch{}return!1}function iu(){return H?H.api.sessionId():null}function au(){return H?H.api.isRecording():!1}function lu(){return mi(H?.recording()??null)}export{su as consent,lu as header,au as isRecording,ru as mark,ou as send,iu as sessionId,tu as start,nu as stop};
package/npm/index.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @packstub/session-replay: the Session Replay for Laravel recorder for a frontend served apart from the Laravel app.
3
+ * See https://packstub.dev/docs/session-replay (Standalone frontend).
4
+ */
5
+
6
+ export interface StartOptions {
7
+ /** The app's token route, e.g. "https://api.example.com/session-replay/token". */
8
+ endpoint: string;
9
+ /** Sent with the token request: "include" (the default) for a session cookie, "omit" with a bearer token. */
10
+ credentials?: RequestCredentials;
11
+ /** Extra headers for the token request only, e.g. { Authorization: `Bearer ${token}` }. */
12
+ headers?: Record<string, string>;
13
+ /** The fetch the token request goes through; the browser's own by default. */
14
+ fetch?: (input: string, init: RequestInit) => Promise<Response>;
15
+ /** Also put the recorder on window.SessionReplay. */
16
+ global?: boolean;
17
+ }
18
+
19
+ /** Fetches a token and records; resolves to whether this tab records. Call it again after a sign-in or sign-out. */
20
+ export function start(options?: StartOptions): Promise<boolean>;
21
+
22
+ /** Stops recording until start() or consent(true). */
23
+ export function stop(): void;
24
+
25
+ /** Records a moment of your own on the timeline. */
26
+ export function mark(label: string, payload?: Record<string, unknown>): boolean;
27
+
28
+ /** Sends the replay now (a "report a problem" button); resolves to whether anything went up. */
29
+ export function send(label?: string, payload?: Record<string, unknown>): Promise<boolean>;
30
+
31
+ /** true remembers the answer and starts recording, false forgets it and stops. */
32
+ export function consent(given: boolean): boolean;
33
+
34
+ /** The running recording's id, or null. */
35
+ export function sessionId(): string | null;
36
+
37
+ /** Whether this tab uploads right now. */
38
+ export function isRecording(): boolean;
39
+
40
+ /** The header that links your API's log lines to the replay; {} while nothing records. Send it to your own API only. */
41
+ export function header(): { 'X-Session-Replay'?: string };
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
- "name": "@packstub/session-replay",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@packstub/session-replay",
3
+ "version": "1.3.0",
4
+ "description": "Session Replay for Laravel: the rrweb recorder for a frontend on its own origin (Vue, React), uploading to your Laravel app.",
5
+ "license": "MIT",
6
+ "homepage": "https://packstub.dev/docs/session-replay",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/packstub/session-replay.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/packstub/session-replay/issues"
13
+ },
14
+ "keywords": [
15
+ "session-replay",
16
+ "rrweb",
17
+ "laravel",
18
+ "vue",
19
+ "react"
20
+ ],
21
+ "type": "module",
22
+ "main": "./npm/dist/index.js",
23
+ "module": "./npm/dist/index.js",
24
+ "types": "./npm/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./npm/index.d.ts",
28
+ "import": "./npm/dist/index.js",
29
+ "default": "./npm/dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "npm/dist",
34
+ "npm/index.d.ts"
35
+ ],
36
+ "sideEffects": [
37
+ "./resources/js/**"
38
+ ],
39
+ "scripts": {
40
+ "build": "node build.mjs",
41
+ "dev": "node build.mjs --watch",
42
+ "test": "node --test resources/js/tests/*.test.js",
43
+ "test:types": "tsc -p npm",
44
+ "test:e2e": "playwright test"
45
+ },
46
+ "devDependencies": {
47
+ "@packstub/holler": "^1.0",
48
+ "@playwright/test": "^1.64.1",
49
+ "@rrweb/record": "^2.2.0",
50
+ "@rrweb/replay": "^2.2.0",
51
+ "@rrweb/rrweb-plugin-console-record": "^2.2.0",
52
+ "esbuild": "^0.28.2",
53
+ "rrweb-player": "^2.2.0",
54
+ "typescript": "^7.0.2",
55
+ "web-vitals": "^6.2.2"
56
+ }
57
+ }