@lensmcp/client-runtime 1.25.18 → 1.25.21
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/lib/auto.js +1 -1
- package/lib/install.js +1 -1
- package/lib/replay/anchors.js +1 -1
- package/lib/replay/blobs.js +1 -1
- package/lib/replay/recorder.js +1 -1
- package/lib/replay/start.js +1 -1
- package/lib/replay/target.js +1 -1
- package/lib/replay/uploader.js +1 -1
- package/package.json +2 -2
- package/replay.bundle.js +4 -4
- package/replay.js +1 -1
package/lib/auto.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _=Object.defineProperty;var r=(t,e)=>_(t,"name",{value:e,configurable:!0});var h=Object.defineProperty,s=r((t,e)=>h(t,"name",{value:e,configurable:!0}),"r");import{installClientRuntime as g}from"./install.js";const y=5747,w="127.0.0.1";export function resolveLensmcpWsUrl(t){if(t)return t;const e=globalThis,n=e.__LENSMCP_WS_URL__;if(typeof n=="string"&&n.length>0)return n;const o=i("lensmcp-ws");if(o)return o;const l=e.__LENSMCP_WS_PORT__,a=typeof l=="number"||typeof l=="string"?String(l):i("lensmcp-ws-port")??String(y),c=e.__LENSMCP_WS_HOST__;return`ws://${typeof c=="string"&&c.length>0?c:i("lensmcp-ws-host")??(typeof location<"u"&&location.hostname?location.hostname:w)}:${a}`}r(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),s(resolveLensmcpWsUrl,"resolveLensmcpWsUrl");export function resolveLensmcpWsToken(t){if(t)return t;const e=globalThis.__LENSMCP_WS_TOKEN__;return typeof e=="string"&&e.length>0?e:i("lensmcp-ws-token")}r(resolveLensmcpWsToken,"resolveLensmcpWsToken"),s(resolveLensmcpWsToken,"resolveLensmcpWsToken");export function installLensmcp(t={}){if(typeof window>"u")return;const e={wsUrl:resolveLensmcpWsUrl(t.wsUrl)},n=resolveLensmcpWsToken(t.wsToken);n!==void 0&&(e.wsToken=n),t.reconnectIntervalMs!==void 0&&(e.reconnectIntervalMs=t.reconnectIntervalMs);const o=typeof window.fetch=="function"?window.fetch.bind(window):void 0;g(e),replayWanted(t.replay)&&p(e.wsUrl,n,o)}r(installLensmcp,"installLensmcp"),s(installLensmcp,"installLensmcp");export function replayWanted(t){if(t===!1||globalThis.__LENSMCP_REPLAY__===!1)return!1;const e=i("lensmcp-replay")?.toLowerCase();return e!=="off"&&e!=="false"&&e!=="0"}r(replayWanted,"replayWanted"),s(replayWanted,"replayWanted");function p(t,e,n){const o=replayEndpoint(t,e);if(!o)return;const{endpoint:l,token:a}=o,c=n;import("../replay.js").then(({startReplay:f})=>f({endpoint:l,...a?{token:a}:{},tabId:u(),...c?{env:{fetch:s((m,d)=>c(m,d),"fetch")}}:{}})).catch(()=>{})}r(p,"m"),s(p,"startNoBuildReplay");export function replayEndpoint(t,e){try{const n=new URL(t),o=e??n.searchParams.get("token")??void 0;return{endpoint:`${n.protocol==="wss:"?"https:":"http:"}//${n.host}`,...o?{token:o}:{}}}catch{return}}r(replayEndpoint,"replayEndpoint"),s(replayEndpoint,"replayEndpoint");function u(){try{let t=sessionStorage.getItem("lensmcp:tabId");return t||(t=`tab-${Math.random().toString(36).slice(2,10)}`,sessionStorage.setItem("lensmcp:tabId",t)),t}catch{return`tab-${Math.random().toString(36).slice(2,10)}`}}r(u,"g"),s(u,"noBuildTabId");function i(t){if(!(typeof document>"u"))try{const e=document.querySelector(`meta[name="${t}"]`)?.getAttribute("content");return e&&e.length>0?e:void 0}catch{return}}r(i,"i"),s(i,"readMeta");
|
package/lib/install.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var O=Object.defineProperty;var u=(e,o)=>O(e,"name",{value:o,configurable:!0});var J=Object.defineProperty,a=u((e,o)=>J(e,"name",{value:o,configurable:!0}),"i");const L="__LENSMCP_CLIENT__";export function installClientRuntime(e){if(typeof window>"u"||window[L])return;window[L]=!0;const o=N(e.wsUrl,e.wsToken),d=e.reconnectIntervalMs??1e3;let c=null,S=!1;const w=[];let f=[],m=!1;const v=a(()=>{if(m=!1,!f.length)return;const n=f;if(f=[],c&&c.readyState===1)try{let t=0;for(;t<n.length;){const r=[];let h=0;for(;t<n.length&&r.length<200;){let i=JSON.stringify(n[t]);if(i.length>3e5&&(i=JSON.stringify({kind:"console",level:"warn",at:Date.now(),truncated:!0,args:[`[lensmcp] dropped an oversized ${String(n[t]?.kind)} event (${i.length} chars)`]})),r.length&&h+i.length>3e5)break;r.push(i),h+=i.length+1,t+=1}c.send(r.length===1?r[0]:`{"kind":"batch","at":${Date.now()},"events":[${r.join(",")}]}`)}return}catch{}for(const t of n)w.push(t)},"flushBatch"),s=a(n=>{n.at=Date.now(),f.push(n),m||(m=!0,setTimeout(v,0))},"send");window.addEventListener("pagehide",v);const p=a(()=>{try{c=new WebSocket(o)}catch{setTimeout(p,d);return}c.addEventListener("open",()=>{for(S=!0;w.length;){const n=w.splice(0,200);try{c.send(JSON.stringify(n.length===1?n[0]:{kind:"batch",at:Date.now(),events:n}))}catch{}}s({kind:"ready",userAgent:navigator.userAgent,url:location.href})}),c.addEventListener("close",()=>{S&&setTimeout(p,d)}),c.addEventListener("error",()=>{})},"open");p(),window.__LENSMCP_PUBLISH__=n=>{s({...n,kind:"publish"})},window.addEventListener("error",n=>{const t=n.target;if(t&&t!==window&&t.tagName&&!n.message){s({kind:"resource-error",tagName:t.tagName.toLowerCase(),url:t.currentSrc||t.src||t.href||void 0});return}const r=n.error;s({kind:"error",message:n.message,name:r?.name,stack:g(r?.stack),source:n.filename,lineno:n.lineno,colno:n.colno})},!0),window.addEventListener("unhandledrejection",n=>{const t=n.reason;s({kind:"unhandledrejection",reason:g(E(t)),name:typeof t=="object"&&t?t.name:void 0,stack:typeof t=="object"&&t?g(t.stack):void 0})});const T=["log","info","warn","error","debug"];for(const n of T){const t=console[n];console[n]=function(...r){try{s({kind:"console",level:n,args:r.map(_)})}catch{}t.apply(console,r)}}const j=window.fetch.bind(window);window.fetch=async function(n,t){const r=t?.method??(typeof n=="object"&&n&&"method"in n?n.method:"GET"),h=typeof n=="string"?n:n instanceof URL?n.toString():n.url,i=Date.now();try{const l=await j(n,t);return s({kind:"fetch",method:r,url:h,status:l.status,statusText:l.statusText,ok:l.ok,durationMs:Date.now()-i}),l}catch(l){const b=l;throw s({kind:"fetch",method:r,url:h,error:b.message??String(b),durationMs:Date.now()-i}),l}};const C=history.pushState.bind(history),D=history.replaceState.bind(history),y=a(n=>s({kind:"route",url:location.href,from:n}),"notify");history.pushState=function(...n){const t=location.href,r=C(...n);return y(t),r},history.replaceState=function(...n){const t=location.href,r=D(...n);return y(t),r},window.addEventListener("popstate",()=>y())}u(installClientRuntime,"installClientRuntime"),a(installClientRuntime,"installClientRuntime");function N(e,o){if(!o)return e;try{const d=new URL(e);return d.searchParams.has("token")||d.searchParams.set("token",o),d.toString()}catch{return e}}u(N,"T"),a(N,"withToken");const k=4096;function g(e){return e===void 0||e.length<=k?e:`${e.slice(0,k)}\u2026[lensmcp truncated: ${e.length-k} more chars]`}u(g,"k"),a(g,"clipStack");function E(e){if(e==null)return String(e);if(typeof e=="string")return e;if(typeof e.message=="string"&&e.message)return e.message;try{const o=JSON.stringify(e);if(o&&o!=="{}"&&o!=="null")return o}catch{}return String(e)}u(E,"M"),a(E,"describeReason");function _(e){if(e===null)return null;const o=typeof e;if(o==="string"||o==="number"||o==="boolean")return e;try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}}u(_,"C"),a(_,"safe");
|
package/lib/replay/anchors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var s=(r,t)=>c(r,"name",{value:t,configurable:!0});var p=Object.defineProperty,n=s((r,t)=>p(r,"name",{value:t,configurable:!0}),"t");import{redactUrl as d}from"@lensmcp/core/redact";export const LENS_TAGS=["lens/session","lens/flow","lens/target","lens/request","lens/response","lens/visit","lens/nav","lens/hmr","lens/error","lens/gap"];const y=new Set(LENS_TAGS);export function isLensTag(r){return typeof r=="string"&&y.has(r)}s(isLensTag,"isLensTag"),n(isLensTag,"isLensTag");const u=512,v=20,g=3,I=new Set(["url","to","from"]);export function sanitizeAnchor(r,t){if(!(!isLensTag(r)||!t||typeof t!="object"||Array.isArray(t)))return o(t,0,void 0)}s(sanitizeAnchor,"sanitizeAnchor"),n(sanitizeAnchor,"sanitizeAnchor");function o(r,t,i){if(r===null||typeof r=="boolean")return r;if(typeof r=="number")return Number.isFinite(r)?r:void 0;if(typeof r=="string"){const e=i&&I.has(i)?d(r):r;return e.length>u?`${e.slice(0,u-1)}\u2026`:e}if(typeof r!="object"||t>=g)return;if(Array.isArray(r))return r.slice(0,v).map(e=>o(e,t+1,void 0));const f={};for(const[e,a]of Object.entries(r)){const l=o(a,t+1,e);l!==void 0&&(f[e]=l)}return f}s(o,"s"),n(o,"walk");export function anchorIds(r,t){return r==="lens/flow"&&typeof t.flowId=="string"?[`f:${t.flowId}`]:(r==="lens/request"||r==="lens/response")&&typeof t.requestId=="string"?[`r:${t.requestId}`]:r==="lens/visit"&&typeof t.visitId=="string"?[`v:${t.visitId}`]:[]}s(anchorIds,"anchorIds"),n(anchorIds,"anchorIds");
|
package/lib/replay/blobs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var S=Object.defineProperty;var c=(e,t)=>S(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,h=c((e,t)=>m(e,"name",{value:t,configurable:!0}),"f");export const BLOB_PREFIX="\0lens-blob:";const O=2,v=3;export async function sha256Hex(e,t){const s=await e.digest("SHA-256",new TextEncoder().encode(t));let r="";for(const i of new Uint8Array(s))r+=i.toString(16).padStart(2,"0");return r}c(sha256Hex,"sha256Hex"),h(sha256Hex,"sha256Hex");export async function serializeChunk(e,t){const s=[],r=new Map;let i,n=0;for(const a of e){let o=t.perf();if(!t.subtle||a.type!==2&&a.type!==3){s.push(JSON.stringify(a)),n+=t.perf()-o;continue}if(a.type===2&&t.isBase(a)){const d=a.data,g=JSON.stringify(d.node);n+=t.perf()-o;const y=await sha256Hex(t.subtle,g);o=t.perf(),r.set(y,g),i=y,s.push(u(a,JSON.stringify({...d,node:BLOB_PREFIX+y}))),n+=t.perf()-o;continue}const p=JSON.stringify(a.data);if(p.length<t.blobMinChars){s.push(u(a,p)),n+=t.perf()-o;continue}n+=t.perf()-o;const l=await sha256Hex(t.subtle,p);o=t.perf(),r.set(l,p),s.push(u(a,JSON.stringify(BLOB_PREFIX+l))),n+=t.perf()-o}const f=t.perf(),b=`[${s.join(",")}]`;return n+=t.perf()-f,{json:b,blobs:r,...i?{base:i}:{},ms:n}}c(serializeChunk,"serializeChunk"),h(serializeChunk,"serializeChunk");function u(e,t){const s=e.delay;return`{"type":${e.type},"data":${t},"timestamp":${e.timestamp}${s!==void 0?`,"delay":${s}`:""}}`}c(u,"d"),h(u,"eventJson");export function rehydrate(e,t){if(typeof e=="string"){if(!e.startsWith(BLOB_PREFIX))return e;const s=t(e.slice(BLOB_PREFIX.length));return s===void 0?e:rehydrate(JSON.parse(s),t)}if(Array.isArray(e))return e.map(s=>rehydrate(s,t));if(e&&typeof e=="object"){const s={};for(const[r,i]of Object.entries(e))s[r]=rehydrate(i,t);return s}return e}c(rehydrate,"rehydrate"),h(rehydrate,"rehydrate");export class KnownHashes{static{c(this,"KnownHashes")}static{h(this,"KnownHashes")}constructor(t,s,r="lensmcp:replay:blobs"){this.max=t,this.storage=s,this.key=r,this.set=new Set;try{const i=s?.getItem(r),n=i?JSON.parse(i):[];if(Array.isArray(n))for(const f of n.slice(-t))typeof f=="string"&&/^[0-9a-f]{64}$/.test(f)&&this.set.add(f)}catch{}}has(t){return this.set.has(t)}add(t){for(this.set.delete(t),this.set.add(t);this.set.size>this.max;)this.set.delete(this.set.values().next().value);this.save()}forget(t){this.set.delete(t)&&this.save()}save(){try{this.storage?.setItem(this.key,JSON.stringify([...this.set]))}catch{}}}
|
package/lib/replay/recorder.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var a=(i,t)=>f(i,"name",{value:t,configurable:!0});var m=Object.defineProperty,r=a((i,t)=>m(i,"name",{value:t,configurable:!0}),"i");import{anchorIds as g,sanitizeAnchor as b}from"./anchors.js";import{KnownHashes as v,serializeChunk as y}from"./blobs.js";import{describeTarget as k}from"./target.js";import{gzip as S,Uploader as w}from"./uploader.js";import{DEFAULT_LIMITS as I,DEV_PRIVACY as C,REPLAY_WIRE_VERSION as M,RRWEB_VERSION as R}from"./types.js";const c=2,A=3,u=4,E=5,q=0;function l(i){if(i.type===c)return 64*1024;if(i.type===A){const t=i.data;if(t.source===q)return 64+160*(t.adds?.length??0)+60*(t.attributes?.length??0)+80*(t.texts?.length??0)+24*(t.removes?.length??0)}return 120}a(l,"E"),r(l,"estimateChars");const O=r(()=>`load-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,"newLoadId");export class ReplayRecorder{static{a(this,"ReplayRecorder")}static{r(this,"ReplayRecorder")}constructor(t,s){this.cfg=t,this.env=s,this.loadId=O(),this.state="idle",this.seq=0,this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.awaitingCheckout=!1,this.checkoutPending=!1,this.processing=Promise.resolve(),this.costWindowStart=0,this.costSpent=0,this.overSeconds=0,this.limits={...I,...t.limits},this.privacy={...C,...t.privacy},this.record=t.record,this.uploader=new w({endpoint:t.endpoint.replace(/\/+$/,""),...t.token?{token:t.token}:{},tabId:t.tabId,loadId:this.loadId,...t.app?{app:t.app}:{},env:s,known:new v(this.limits.knownHashes,s.storage),retryMaxMs:this.limits.retryMaxMs,noChannelAfter:this.limits.noChannelAfter,beaconMaxBytes:this.limits.beaconMaxBytes,onOutcome:r((e,h)=>this.onOutcome(e,h),"onOutcome")})}get status(){return this.state}start(){this.state==="idle"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.begin(),this.mark("lens/session",{tabId:this.cfg.tabId,loadId:this.loadId,...this.cfg.app?{app:this.cfg.app}:{},url:this.env.href(),wire:M,rrweb:R,viewport:this.env.viewport()}))}mark(t,s){if(t==="lens/nav"&&this.state==="paused"&&this.resume(),this.state!=="recording")return;const e=b(t,s);if(e)try{this.record.addCustomEvent(t,e)}catch{}}target(t,s){if(this.state!=="recording")return;const e=k(t,s,h=>this.record.mirror.getId(h));e&&this.mark("lens/target",e)}checkpoint(){this.state!=="recording"||this.checkoutPending||this.awaitingCheckout||(this.checkoutPending=!0,this.env.idle(()=>{this.checkoutPending=!1,this.checkoutNow()||this.env.idle(()=>this.checkoutNow())}))}pagehide(){if(this.state!=="recording"&&this.state!=="paused"||(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),this.uploader.beaconQueued(),!this.buffer.length||this.awaitingCheckout))return;const t=this.buffer,s=this.takeSummary(t);try{this.uploader.beacon(s,JSON.stringify(t),"identity")}catch{}}stop(){this.state!=="stopped"&&(this.state==="recording"&&this.cut(),this.halt())}begin(){const t=this.privacy;try{this.stopRecord=this.record({emit:r(s=>this.onEmit(s),"emit"),checkoutEveryNms:this.limits.checkoutEveryMs,maskAllInputs:t.maskAllInputs,...t.maskAllInputs?{}:{maskInputOptions:{password:!1}},...t.maskTextSelector?{maskTextSelector:t.maskTextSelector}:{},...t.blockSelector?{blockSelector:t.blockSelector}:{},slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,collectFonts:!1,errorHandler:r(()=>!0,"errorHandler")})}catch{this.halt()}}onEmit(t){if(this.state!=="recording"||this.awaitingCheckout)return;const s=this.env.perf();if(t.type===u&&this.buffer.length&&this.cut(),t.type===c&&!this.base&&(this.base=t),this.buffer.push(t),this.bufferChars+=l(t),t.type===E){const e=t.data;typeof e.tag=="string"&&e.payload&&typeof e.payload=="object"&&this.bufferAnchors.push(...g(e.tag,e.payload))}this.buffer.length>=this.limits.flushEvents||this.bufferChars>=this.limits.flushChars?this.cut():this.timer===void 0&&(this.timer=this.env.setTimeout(()=>{this.timer=void 0,this.cut()},this.limits.flushMs)),this.spend(this.env.perf()-s)}takeSummary(t){const s={seq:this.seq++,t0:t[0]?.timestamp??0,t1:t[t.length-1]?.timestamp??0,n:t.length,full:t[0]?.type===u&&t.some(e=>e.type===c),anchors:[...new Set(this.bufferAnchors)]};return this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],s}cut(){if(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),!this.buffer.length)return;const t=this.buffer,s=this.takeSummary(t);this.processing=this.processing.then(()=>this.prepare(s,t)).catch(()=>{})}async prepare(t,s){if(this.uploader.disabled||this.state==="stopped")return;const e=await y(s,{...this.env.subtle?{subtle:this.env.subtle}:{},blobMinChars:this.limits.blobMinChars,isBase:r(n=>n===this.base,"isBase"),perf:r(()=>this.env.perf(),"perf")});this.spend(e.ms);const h=await S(e.json),o=h??e.json;let d=typeof o=="string"?o.length:o.byteLength;for(const n of e.blobs.values())d+=n.length;const p={summary:e.base?{...t,base:e.base}:t,body:o,enc:h?"gzip":"identity",blobs:e.blobs,size:d};this.uploader.enqueue(p),this.uploader.pendingSize>this.limits.pendingChars&&this.gap("overflow")}onOutcome(t,s){if(s==="refused"){this.halt();return}if(s==="too-big"){this.gap("too-big",t.summary.seq);return}this.awaitingCheckout&&(this.awaitingCheckout=!1,this.checkoutNow())}gap(t,s){if(this.state!=="recording"||this.awaitingCheckout)return;const e=this.uploader.drop();this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.mark("lens/gap",{fromSeq:s??e??this.seq,reason:t}),this.cut(),this.awaitingCheckout=!0,this.publish("replay-gap",`session replay lost a stretch of this page (${t})`,{reason:t,fromSeq:s??e??this.seq})}checkoutNow(){if(this.state!=="recording")return!0;const t=this.env.perf();try{return this.record.takeFullSnapshot(!0),!0}catch{return!1}finally{this.spend(this.env.perf()-t)}}spend(t){const s=this.env.perf();if(s-this.costWindowStart>=1e3&&(this.overSeconds=this.costSpent>this.limits.budgetMsPerSecond?this.overSeconds+1:0,this.costSpent=0,this.costWindowStart=s,this.overSeconds>=this.limits.budgetSeconds)){this.pause();return}this.costSpent+=t}pause(){if(this.state==="recording"){this.mark("lens/gap",{fromSeq:this.seq,reason:"budget"}),this.cut();try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.state="paused",this.overSeconds=0,this.publish("replay-paused",`session replay paused: its own work stayed over ${this.limits.budgetMsPerSecond} ms a second for ${this.limits.budgetSeconds} s`,{})}}resume(){this.state==="paused"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.costSpent=0,this.begin())}halt(){this.state="stopped",this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0);try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.uploader.drop(),this.buffer=[]}publish(t,s,e){try{this.env.publish?.({source:"client-runtime",category:"runtime",severity:"info",title:s,fingerprint:`replay:${t}:${this.loadId}`,raw:{kind:t,loadId:this.loadId,tabId:this.cfg.tabId,...e}})}catch{}}}
|
package/lib/replay/start.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var s=(
|
|
1
|
+
"use strict";var u=Object.defineProperty;var s=(a,e)=>u(a,"name",{value:e,configurable:!0});var p=Object.defineProperty,o=s((a,e)=>p(a,"name",{value:e,configurable:!0}),"n");import{ReplayRecorder as f}from"./recorder.js";export const REPLAY_HANDLE="__LENSMCP_REPLAY__";const d=["click","submit","change"];export function startReplay(a){if(typeof window>"u"||typeof document>"u")return;const e=globalThis;if(e[REPLAY_HANDLE]===!1)return;const c=e[REPLAY_HANDLE];if(c)return c;const r=new f(a,pageEnv(a.env)),i={loadId:r.loadId,mark:o((t,n)=>r.mark(t,n),"mark"),checkpoint:o(()=>r.checkpoint(),"checkpoint"),stop:o(()=>r.stop(),"stop")};e[REPLAY_HANDLE]=i,r.start();for(const t of d)document.addEventListener(t,n=>r.target(n.target,t),{capture:!0,passive:!0});return window.addEventListener("pagehide",()=>r.pagehide()),i}s(startReplay,"startReplay"),o(startReplay,"startReplay");export function pageEnv(a={}){const e=window;let c;try{c=e.localStorage}catch{}const r=e.isSecureContext&&e.crypto?.subtle?e.crypto.subtle:void 0,i=typeof e.fetch=="function"?e.fetch.bind(e):void 0;return{fetch:o((t,n)=>i?i(t,n):Promise.reject(new Error("no fetch")),"fetch"),...typeof navigator<"u"&&typeof navigator.sendBeacon=="function"?{sendBeacon:o((t,n)=>navigator.sendBeacon(t,n),"sendBeacon")}:{},now:o(()=>Date.now(),"now"),perf:o(()=>typeof performance<"u"?performance.now():Date.now(),"perf"),setTimeout:o((t,n)=>e.setTimeout(t,n),"setTimeout"),clearTimeout:o(t=>e.clearTimeout(t),"clearTimeout"),idle:o(t=>{typeof e.requestIdleCallback=="function"?e.requestIdleCallback(t,{timeout:2e3}):e.setTimeout(t,50)},"idle"),...c?{storage:c}:{},...r?{subtle:r}:{},href:o(()=>e.location.href,"href"),viewport:o(()=>({width:e.innerWidth,height:e.innerHeight}),"viewport"),publish:o(t=>{const n=e.__LENSMCP_PUBLISH__;typeof n=="function"&&n(t)},"publish"),...a}}s(pageEnv,"pageEnv"),o(pageEnv,"pageEnv");
|
package/lib/replay/target.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var x=Object.defineProperty;var r=(t,n)=>x(t,"name",{value:n,configurable:!0});var A=Object.defineProperty,s=r((t,n)=>A(t,"name",{value:n,configurable:!0}),"c");const T="a,button,input,select,textarea,label,summary,option,[role],[data-testid],[onclick],[tabindex]",k=80,N=s(t=>!!t&&typeof t.closest=="function"&&typeof t.getAttribute=="function"&&typeof t.tagName=="string","isElement");export function describeTarget(t,n,m){if(!N(t))return;const o=t.closest(T)??t,e=s(v=>o.getAttribute(v)??void 0,"attr"),c=(o.textContent??"").replace(/\s+/g," ").trim(),f=o.closest("[data-agent-source]"),y=o.closest("[data-agent-component]");let i=-1;try{i=m(o)}catch{}const a={kind:n,id:i,tag:o.tagName.toLowerCase()},l=e("role");l&&(a.role=l),c&&(a.text=c.length>80?`${c.slice(0,79)}\u2026`:c);const d=e("aria-label")??e("title")??e("placeholder")??e("name")??e("alt");d&&(a.label=d);const u=e("data-testid")??e("data-test")??e("data-cy");u&&(a.testId=u);const g=o.tagName==="INPUT"?e("type"):void 0;g&&(a.inputType=g);const p=f?.getAttribute("data-agent-source");p&&(a.source=p);const b=y?.getAttribute("data-agent-component");return b&&(a.component=b),a}r(describeTarget,"describeTarget"),s(describeTarget,"describeTarget");
|
package/lib/replay/uploader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var a=(n,t)=>d(n,"name",{value:t,configurable:!0});var y=Object.defineProperty,u=a((n,t)=>y(n,"name",{value:t,configurable:!0}),"a");import{REPLAY_WIRE_VERSION as b}from"./types.js";const g=4e3;export async function gzip(n){if(!(typeof CompressionStream!="function"||typeof Blob!="function"||typeof Response!="function"))try{const t=new Blob([n]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}a(gzip,"gzip"),u(gzip,"gzip");export class Uploader{static{a(this,"Uploader")}static{u(this,"Uploader")}constructor(t){this.o=t,this.queue=[],this.busy=!1,this.queued=0,this.answered=!1,this.networkFailures=0,this.disabled=!1}get pendingSize(){return this.queued}enqueue(t){this.disabled||(this.queue.push(t),this.queued+=t.size,this.pump())}drop(){const t=this.queue[0]?.summary.seq;for(const e of this.queue.splice(0))this.queued-=e.size;return t}beaconQueued(){for(const t of this.queue.splice(0))this.queued-=t.size,[...t.blobs.keys()].every(e=>this.o.known.has(e))&&this.beacon(t.summary,t.body,t.enc)}beacon(t,e,s){const i=this.o.env.sendBeacon,o=typeof e=="string"?e.length:e.byteLength;if(this.disabled||!i||o>this.o.beaconMaxBytes)return!1;try{return i(this.url("/replay",this.params(t,s,[])),new Blob([e],{type:"text/plain"}))}catch{return!1}}async pump(){if(!this.busy){this.busy=!0;try{for(;!this.disabled&&this.queue.length;){const t=this.queue.shift(),e=await this.send(t);this.queued-=t.size,e==="refused"&&(this.disabled=!0),this.o.onOutcome(t,e)}}finally{this.busy=!1}}}async send(t){for(let e=0;!this.disabled;e++){e>0&&await this.sleep(Math.min(this.o.retryMaxMs,500*2**(e-1)));try{for(const[o,r]of t.blobs){if(this.o.known.has(o))continue;const f=await gzip(r),h=await this.post("/replay/blob",{sha:o,enc:f?"gzip":"identity"},f??r);if(h.status>=200&&h.status<300){this.o.known.add(o);continue}const l=c(h.status);if(l)return l;throw new Error(`blob ${h.status}`)}const s=await this.post("/replay",this.params(t.summary,t.enc,[...t.blobs.keys()]),t.body);if(s.status>=200&&s.status<300)return this.answered=!0,"ok";if(s.status===409){const o=await p(s);for(const r of o.length?o:t.blobs.keys())this.o.known.forget(r);continue}const i=c(s.status);if(i)return i}catch{if(!this.answered&&++this.networkFailures>=this.o.noChannelAfter)return"refused"}}return"refused"}params(t,e,s){const i={v:String(b),load:this.o.loadId,tab:this.o.tabId,seq:String(t.seq),t0:String(t.t0),t1:String(t.t1),n:String(t.n),full:t.full?"1":"0",enc:e};if(this.o.app&&(i.app=this.o.app),t.base&&(i.base=t.base),t.anchors.length){let o="";for(const r of t.anchors){if(o.length+r.length+1>g){i.am="1";break}o+=(o?",":"")+r}i.a=o}return s.length&&(i.b=s.join(",")),i}url(t,e){const s=new URLSearchParams(this.o.token?{token:this.o.token,...e}:e);return`${this.o.endpoint}${t}?${s.toString()}`}async post(t,e,s){const i=await this.o.env.fetch(this.url(t,e),{method:"POST",headers:{"content-type":"text/plain"},body:s,credentials:"omit",keepalive:(typeof s=="string"?s.length:s.byteLength)<=this.o.beaconMaxBytes}),o=await i.text().catch(()=>"");return{status:i.status,text:u(async()=>o,"text")}}sleep(t){return new Promise(e=>this.o.env.setTimeout(e,t))}}function c(n){if(n===413)return"too-big";if(n===400||n===401||n===403||n===404||n===405||n===426)return"refused"}a(c,"c"),u(c,"verdictOf");async function p(n){try{const t=JSON.parse(await n.text());return Array.isArray(t.missing)?t.missing.filter(e=>typeof e=="string"):[]}catch{return[]}}a(p,"y"),u(p,"missingOf");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lensmcp/client-runtime",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@lensmcp/core": "1.25.
|
|
37
|
+
"@lensmcp/core": "1.25.21",
|
|
38
38
|
"@rrweb/record": "2.1.7",
|
|
39
39
|
"@rrweb/types": "2.1.7",
|
|
40
40
|
"tslib": "^2.3.0"
|
package/replay.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Us=Object.defineProperty;var u=(t,e)=>Us(t,"name",{value:e,configurable:!0});var Fs=Object.defineProperty,o=u((t,e)=>Fs(t,"name",{value:e,configurable:!0}),"o");/*! @lensmcp/client-runtime session replay recorder.
|
|
2
2
|
Third-party code in this bundle, each under the MIT License:
|
|
3
3
|
|
|
4
4
|
@rrweb/record, rrweb, rrweb-snapshot, @rrweb/utils, @rrweb/types 2.1.7 (https://github.com/rrweb-io/rrweb)
|
|
@@ -20,9 +20,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
20
20
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
21
21
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
22
22
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/var _r=Object.defineProperty,xr=o((e,t,r)=>t in e?_r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"xr"),g=o((e,t,r)=>xr(e,typeof t!="symbol"?t+"":t,r),"g"),Mt,M=(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))(M||{}),I=(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))(I||{}),z=(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))(z||{}),K=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(K||{}),pe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(pe||{}),le=(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))(le||{}),D=(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))(D||{}),Et={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},kt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ee={},Wt={},Lr=o(()=>!!globalThis.Zone,"Lr");function ut(e){if(Ee[e])return Ee[e];let t=globalThis[e],r=t.prototype,n=e in Et?Et[e]:void 0,s=!!(n&&n.every(d=>{var a,f;return!!((f=(a=Object.getOwnPropertyDescriptor(r,d))==null?void 0:a.get)!=null&&f.toString().includes("[native code]"))})),i=e in kt?kt[e]:void 0,l=!!(i&&i.every(d=>{var a;return typeof r[d]=="function"&&((a=r[d])==null?void 0:a.toString().includes("[native code]"))}));if(s&&l&&!Lr())return Ee[e]=t.prototype,t.prototype;try{let d=document.createElement("iframe");d.style.display="none",document.body.appendChild(d);let a=d.contentWindow;if(!a)return t.prototype;let f=a[e].prototype;if(!f)return d.remove(),r;let y=navigator.userAgent;return y.includes("Safari")&&!y.includes("Chrome")?(d.classList.add("rr-block"),d.setAttribute("__rrwebUntaintedMutationObserver",""),Wt[e]=()=>d.remove()):d.remove(),Ee[e]=f}catch{return r}}c(ut,"ut"),u(ut,"ut"),o(ut,"ut");var Xe={};function H(e,t,r){var n,s;let i=(n=Xe[e])==null?void 0:n[r];if(i)return i.call(t);let l=ut(e),d=(s=Object.getOwnPropertyDescriptor(l,r))==null?void 0:s.get;return d?((Xe[e]||(Xe[e]={}))[r]=d,d.call(t)):t[r]}c(H,"H"),u(H,"H"),o(H,"H");var Je={};function zt(e,t,r){let n=`${e}.${String(r)}`;if(Je[n])return Je[n].bind(t);let s=ut(e)[r];return typeof s!="function"?t[r]:(Je[n]=s,s.bind(t))}c(zt,"zt"),u(zt,"zt"),o(zt,"zt");function Dr(e){return H("Node",e,"ownerDocument")}c(Dr,"Dr"),u(Dr,"Dr"),o(Dr,"Dr");function Pr(e){return H("Node",e,"childNodes")}c(Pr,"Pr"),u(Pr,"Pr"),o(Pr,"Pr");function Fr(e){return H("Node",e,"parentNode")}c(Fr,"Fr"),u(Fr,"Fr"),o(Fr,"Fr");function Ur(e){return H("Node",e,"parentElement")}c(Ur,"Ur"),u(Ur,"Ur"),o(Ur,"Ur");function Wr(e){return H("Node",e,"textContent")}c(Wr,"Wr"),u(Wr,"Wr"),o(Wr,"Wr");function zr(e){return H("Node",e,"firstChild")}c(zr,"zr"),u(zr,"zr"),o(zr,"zr");function Br(e){return H("Node",e,"lastChild")}c(Br,"Br"),u(Br,"Br"),o(Br,"Br");function Hr(e){return H("Node",e,"nextSibling")}c(Hr,"Hr"),u(Hr,"Hr"),o(Hr,"Hr");function $r(e){return H("Node",e,"previousSibling")}c($r,"$r"),u($r,"$r"),o($r,"$r");function jr(e,t){return zt("Node",e,"contains")(t)}c(jr,"jr"),u(jr,"jr"),o(jr,"jr");function Gr(e){return zt("Node",e,"getRootNode")()}c(Gr,"Gr"),u(Gr,"Gr"),o(Gr,"Gr");function Vr(e){return!e||!("host"in e)?null:H("ShadowRoot",e,"host")}c(Vr,"Vr"),u(Vr,"Vr"),o(Vr,"Vr");function qr(e){return e.styleSheets}c(qr,"qr"),u(qr,"qr"),o(qr,"qr");function Xr(e){return!e||!("shadowRoot"in e)?null:H("Element",e,"shadowRoot")}c(Xr,"Xr"),u(Xr,"Xr"),o(Xr,"Xr");function Jr(e,t){return H("Element",e,"querySelector")(t)}c(Jr,"Jr"),u(Jr,"Jr"),o(Jr,"Jr");function Yr(e,t){return H("Element",e,"querySelectorAll")(t)}c(Yr,"Yr"),u(Yr,"Yr"),o(Yr,"Yr");function Bt(){return[ut("MutationObserver").constructor,Wt.MutationObserver??(()=>{})]}c(Bt,"Bt"),u(Bt,"Bt"),o(Bt,"Bt");var ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ve=o(()=>new Date().getTime(),"ve"));function oe(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}c(oe,"oe"),u(oe,"oe"),o(oe,"oe");var S={ownerDocument:Dr,childNodes:Pr,parentNode:Fr,parentElement:Ur,textContent:Wr,firstChild:zr,lastChild:Br,nextSibling:Hr,previousSibling:$r,contains:jr,getRootNode:Gr,host:Vr,styleSheets:qr,shadowRoot:Xr,querySelector:Jr,querySelectorAll:Yr,nowTimestamp:ve,mutationObserverCtor:Bt,patch:oe};function Ht(e){return e.nodeType===e.ELEMENT_NODE}c(Ht,"Ht"),u(Ht,"Ht"),o(Ht,"Ht");function be(e){let t=e&&"host"in e&&"mode"in e&&S.host(e)||null;return!!(t&&"shadowRoot"in t&&S.shadowRoot(t)===e)}c(be,"be"),u(be,"be"),o(be,"be");function Se(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}c(Se,"Se"),u(Se,"Se"),o(Se,"Se");function Zr(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}c(Zr,"Zr"),u(Zr,"Zr"),o(Zr,"Zr");function Qr(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}c(Qr,"Qr"),u(Qr,"Qr"),o(Qr,"Qr");function Qe(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>$t(s,r)).join("");return Zr(n)}catch{return null}}c(Qe,"Qe"),u(Qe,"Qe"),o(Qe,"Qe");function $t(e,t){if(en(e)){let r;try{r=Qe(e.styleSheet)||Qr(e)}catch{r=e.cssText}return e.styleSheet.href?De(r,e.styleSheet.href):r}else{let r=e.cssText;return tn(e)&&e.selectorText.includes(":")&&(r=Kr(r)),t?De(r,t):r}}c($t,"$t"),u($t,"$t"),o($t,"$t");function Kr(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}c(Kr,"Kr"),u(Kr,"Kr"),o(Kr,"Kr");function en(e){return"styleSheet"in e}c(en,"en"),u(en,"en"),o(en,"en");function tn(e){return"selectorText"in e}c(tn,"tn"),u(tn,"tn"),o(tn,"tn");var _e=class{static{c(this,"_e")}static{u(this,"_e")}static{o(this,"_e")}constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function rn(){return new _e}c(rn,"rn"),u(rn,"rn"),o(rn,"rn");function xe({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:i}){let l=s||"",d=n&&te(n);return(t[r.toLowerCase()]||d&&t[d])&&(i?l=i(l,e):l="*".repeat(l.length)),l}c(xe,"xe"),u(xe,"xe"),o(xe,"xe");function te(e){return e.toLowerCase()}c(te,"te"),u(te,"te"),o(te,"te");var Tt="__rrweb_original__";function nn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let i=t.getImageData,l=Tt in i?i[Tt]:i;if(new Uint32Array(l.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(d=>d!==0))return!1}return!0}c(nn,"nn"),u(nn,"nn"),o(nn,"nn");function Le(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?te(t):null}c(Le,"Le"),u(Le,"Le"),o(Le,"Le");function jt(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i;return r.pathname.match(n)?.[1]??null}c(jt,"jt"),u(jt,"jt"),o(jt,"jt");function sn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}c(sn,"sn"),u(sn,"sn"),o(sn,"sn");var on=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,an=/^(?:[a-z+]+:)?\/\//i,ln=/^www\..*/i,cn=/^(data:)([^,]*),(.*)/i;function De(e,t){return(e||"").replace(on,(r,n,s,i,l,d)=>{let a=s||l||d,f=n||i||"";if(!a)return r;if(an.test(a)||ln.test(a))return`url(${f}${a}${f})`;if(cn.test(a))return`url(${f}${a}${f})`;if(a[0]==="/")return`url(${f}${sn(t)+a}${f})`;let y=a.split("#")[0],h=a.substring(y.length),v=t.split("#")[0].split("/"),b=y.split("/");v.pop();for(let p of b)p!=="."&&(p===".."?v.pop():v.push(p));return`url(${f}${v.join("/")}${h}${f})`})}c(De,"De"),u(De,"De"),o(De,"De");var Gt="(?:/\\*[^*]*\\*/)|[\\s;]",un=new RegExp(`${Gt}|\\b(0)px?`,"g"),dn=new RegExp(Gt,"g");function ke(e,t=!1){return t?e.replace(dn,""):e.replace(un,"$1")}c(ke,"ke"),u(ke,"ke"),o(ke,"ke");function hn(e,t,r=!1){let n=Array.from(t.childNodes),s=[],i=0;if(n.length>1&&e&&typeof e=="string"){let l=ke(e,r),d=l.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let f=ke(n[a].textContent,r),y=100,h=3;for(;h<f.length&&(f[h].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,h),1)!==-1);h++);for(;h<f.length;h++){let v=f.substring(0,h),b=l.split(v),p=-1;if(b.length===2)p=b[0].length;else if(b.length>2&&b[0]===""&&n[a-1].textContent!=="")p=l.indexOf(v,1);else if(b.length===1){if(v=v.substring(0,v.length-1),b=l.split(v),b.length<=1)return s.push(e),s;h=y+1}else h===f.length-1&&(p=l.indexOf(v));if(b.length>=2&&h>y){let m=n[a-1].textContent;if(m&&typeof m=="string"){let w=ke(m).length;p=l.indexOf(v,w)}p===-1&&(p=b[0].length)}if(p!==-1){let m=Math.floor(p/d);for(;m>0&&m<e.length;){if(i+=1,i>50*n.length)return s.push(e),s;let w=ke(e.substring(0,m),r);if(w.length===p){s.push(e.substring(0,m)),e=e.substring(m),l=l.substring(p);break}else w.length<p?m+=Math.max(1,Math.floor((p-w.length)/d)):m-=Math.max(1,Math.floor((w.length-p)*d))}break}}}}return s.push(e),s}c(hn,"hn"),u(hn,"hn"),o(hn,"hn");function pn(e,t){return hn(e,t).join("/* rr_split */")}c(pn,"pn"),u(pn,"pn"),o(pn,"pn");var fn=1,mn=new RegExp("[^a-z0-9-_:]"),Pe=-2;function Vt(){return fn++}c(Vt,"Vt"),u(Vt,"Vt"),o(Vt,"Vt");function gn(e){if(e instanceof HTMLFormElement)return"form";let t=te(e.tagName);return mn.test(t)?"div":t}c(gn,"gn"),u(gn,"gn"),o(gn,"gn");var ae,At,yn=/^[^ \t\n\r\u000c]+/,bn=/^[, \t\n\r\u000c]+/;function Sn(e,t){if(t.trim()==="")return t;let r=0;function n(i){let l,d=i.exec(t.substring(r));return d?(l=d[0],r+=l.length,l):""}c(n,"n"),u(n,"n"),o(n,"n");let s=[];for(;n(bn),!(r>=t.length);){let i=n(yn);if(i.slice(-1)===",")i=ue(e,i.substring(0,i.length-1)),s.push(i);else{let l="";i=ue(e,i);let d=!1;for(;;){let a=t.charAt(r);if(a===""){s.push((i+l).trim());break}else if(d)a===")"&&(d=!1);else if(a===","){r+=1,s.push((i+l).trim());break}else a==="("&&(d=!0);l+=a,r+=1}}}return s.join(", ")}c(Sn,"Sn"),u(Sn,"Sn"),o(Sn,"Sn");var Nt=new WeakMap;function ue(e,t){return!t||t.trim()===""?t:dt(e,t)}c(ue,"ue"),u(ue,"ue"),o(ue,"ue");function wn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}c(wn,"wn"),u(wn,"wn"),o(wn,"wn");function dt(e,t){let r=Nt.get(e);if(r||(r=e.createElement("a"),Nt.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}c(dt,"dt"),u(dt,"dt"),o(dt,"dt");function qt(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?ue(e,n):r==="srcset"?Sn(e,n):r==="style"?De(n,dt(e)):t==="object"&&r==="data"?ue(e,n):n)}c(qt,"qt"),u(qt,"qt"),o(qt,"qt");function Xt(e,t,r){return["video","audio"].includes(e)&&te(t)==="autoplay"}c(Xt,"Xt"),u(Xt,"Xt"),o(Xt,"Xt");function vn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}c(vn,"vn"),u(vn,"vn"),o(vn,"vn");function Fe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Fe(S.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?Fe(S.parentNode(e),t,r):!1}c(Fe,"Fe"),u(Fe,"Fe"),o(Fe,"Fe");function Jt(e,t,r,n){let s;if(Ht(e)){if(s=e,!S.childNodes(s).length)return!1}else{if(S.parentElement(e)===null)return!1;s=S.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Fe(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}c(Jt,"Jt"),u(Jt,"Jt"),o(Jt,"Jt");function Cn(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let d=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(d),s=!0,t()});return}let l="about:blank";if(n.location.href!==l||e.src===l||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}c(Cn,"Cn"),u(Cn,"Cn"),o(Cn,"Cn");function In(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let i=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}c(In,"In"),u(In,"In"),o(In,"In");function Rn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:l,inlineStylesheet:d,maskInputOptions:a={},maskTextFn:f,maskInputFn:y,dataURLOptions:h={},inlineImages:v,recordCanvas:b,keepIframeSrcFn:p,newlyAddedElement:m=!1,cssCaptured:w=!1}=t,T=Mn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:e.compatMode}:{type:D.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:D.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return kn(e,{doc:r,blockClass:s,blockSelector:i,inlineStylesheet:d,maskInputOptions:a,maskInputFn:y,dataURLOptions:h,inlineImages:v,recordCanvas:b,keepIframeSrcFn:p,newlyAddedElement:m,rootId:T});case e.TEXT_NODE:return En(e,{doc:r,needsMask:l,maskTextFn:f,rootId:T,cssCaptured:w});case e.CDATA_SECTION_NODE:return{type:D.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return{type:D.Comment,textContent:S.textContent(e)||"",rootId:T};default:return!1}}c(Rn,"Rn"),u(Rn,"Rn"),o(Rn,"Rn");function Mn(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}c(Mn,"Mn"),u(Mn,"Mn"),o(Mn,"Mn");function En(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:i}=t,l=S.parentNode(e),d=l&&l.tagName,a="",f=d==="STYLE"?!0:void 0,y=d==="SCRIPT"?!0:void 0;return y?a="SCRIPT_PLACEHOLDER":i||(a=S.textContent(e),f&&a&&(a=De(a,dt(t.doc)))),!f&&!y&&a&&r&&(a=n?n(a,S.parentElement(e)):a.replace(/[\S]/g,"*")),{type:D.Text,textContent:a||"",rootId:s}}c(En,"En"),u(En,"En"),o(En,"En");function kn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:i,maskInputOptions:l={},maskInputFn:d,dataURLOptions:a={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:v=!1,rootId:b}=t,p=vn(e,n,s),m=gn(e),w={},T=e.attributes.length;for(let C=0;C<T;C++){let O=e.attributes[C];Xt(m,O.name,O.value)||(w[O.name]=qt(r,m,te(O.name),O.value))}if(m==="link"&&i){let C=Array.from(r.styleSheets).find($=>$.href===e.href),O=null;C&&(O=Qe(C)),O&&(delete w.rel,delete w.href,w._cssText=O)}if(m==="style"&&e.sheet){let C=Qe(e.sheet);C&&(e.childNodes.length>1&&(C=pn(C,e)),w._cssText=C)}if(["input","textarea","select"].includes(m)){let C=e.value,O=e.checked;w.type!=="radio"&&w.type!=="checkbox"&&w.type!=="submit"&&w.type!=="button"&&C?w.value=xe({element:e,type:Le(e),tagName:m,value:C,maskInputOptions:l,maskInputFn:d}):O&&(w.checked=O)}if(m==="option"&&(e.selected&&!l.select?w.selected=!0:delete w.selected),m==="dialog"&&e.open&&(w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&y){if(e.__context==="2d")nn(e)||(w.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let C=e.toDataURL(a.type,a.quality),O=r.createElement("canvas");O.width=e.width,O.height=e.height;let $=O.toDataURL(a.type,a.quality);C!==$&&(w.rr_dataURL=C)}}if(m==="img"&&f){ae||(ae=r.createElement("canvas"),At=ae.getContext("2d"));let C=e,O=C.currentSrc||C.getAttribute("src")||"<unknown-src>",$=C.crossOrigin,F=o(()=>{C.removeEventListener("load",F);try{ae.width=C.naturalWidth,ae.height=C.naturalHeight,At.drawImage(C,0,0),w.rr_dataURL=ae.toDataURL(a.type,a.quality)}catch(j){if(C.crossOrigin!=="anonymous"){C.crossOrigin="anonymous",C.complete&&C.naturalWidth!==0?F():C.addEventListener("load",F);return}else console.warn(`Cannot inline img src=${O}! Error: ${j}`)}C.crossOrigin==="anonymous"&&($?w.crossOrigin=$:C.removeAttribute("crossorigin"))},"O");C.complete&&C.naturalWidth!==0?F():C.addEventListener("load",F)}if(["audio","video"].includes(m)){let C=w;C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime,C.rr_mediaPlaybackRate=e.playbackRate,C.rr_mediaMuted=e.muted,C.rr_mediaLoop=e.loop,C.rr_mediaVolume=e.volume}if(v||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),p){let{width:C,height:O}=e.getBoundingClientRect();w={class:w.class,rr_width:`${C}px`,rr_height:`${O}px`}}m==="iframe"&&!h(w.src)&&(e.contentDocument||(w.rr_src=w.src),delete w.src);let k;try{customElements.get(m)&&(k=!0)}catch{}return{type:D.Element,tagName:m,attributes:w,childNodes:[],isSVG:wn(e)||void 0,needBlock:p,rootId:b,isCustom:k}}c(kn,"kn"),u(kn,"kn"),o(kn,"kn");function A(e){return e==null?"":e.toLowerCase()}c(A,"A"),u(A,"A"),o(A,"A");function Yt(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||{}}c(Yt,"Yt"),u(Yt,"Yt"),o(Yt,"Yt");function Tn(e,t){return!!(t.comment&&e.type===D.Comment||e.type===D.Element&&(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"&&jt(e.attributes.href)==="js")||t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(A(e.attributes.name).match(/^msapplication-tile(image|color)$/)||A(e.attributes.name)==="application-name"||A(e.attributes.rel)==="icon"||A(e.attributes.rel)==="apple-touch-icon"||A(e.attributes.rel)==="shortcut icon"))||e.tagName==="meta"&&(t.headMetaDescKeywords&&A(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(A(e.attributes.property).match(/^(og|twitter|fb):/)||A(e.attributes.name).match(/^(og|twitter):/)||A(e.attributes.name)==="pinterest")||t.headMetaRobots&&(A(e.attributes.name)==="robots"||A(e.attributes.name)==="googlebot"||A(e.attributes.name)==="bingbot")||t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0||t.headMetaAuthorship&&(A(e.attributes.name)==="author"||A(e.attributes.name)==="generator"||A(e.attributes.name)==="framework"||A(e.attributes.name)==="publisher"||A(e.attributes.name)==="progid"||A(e.attributes.property).match(/^article:/)||A(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(A(e.attributes.name)==="google-site-verification"||A(e.attributes.name)==="yandex-verification"||A(e.attributes.name)==="csrf-token"||A(e.attributes.name)==="p:domain_verify"||A(e.attributes.name)==="verify-v1"||A(e.attributes.name)==="verification"||A(e.attributes.name)==="shopify-checkout-api-token"))))}c(Tn,"Tn"),u(Tn,"Tn"),o(Tn,"Tn");function de(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,maskTextClass:l,maskTextSelector:d,skipChild:a=!1,inlineStylesheet:f=!0,maskInputOptions:y={},maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:w=!1,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C=5e3,onStylesheetLoad:O,stylesheetLoadTimeout:$=5e3,keepIframeSrcFn:F=o(()=>!1,"O"),newlyAddedElement:j=!1,cssCaptured:se=!1}=t,{needsMask:q}=t,{preserveWhiteSpace:Q=!0}=t;q||(q=Jt(e,l,d,q===void 0));let re=Rn(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,dataURLOptions:p,inlineImages:m,recordCanvas:w,keepIframeSrcFn:F,newlyAddedElement:j,cssCaptured:se});if(!re)return console.warn(e,"not serialized"),null;let ne;n.hasNode(e)?ne=n.getId(e):Tn(re,b)||!Q&&re.type===D.Text&&!re.textContent.replace(/^\s+|\s+$/gm,"").length?ne=Pe:ne=Vt();let E=Object.assign(re,{id:ne});if(n.add(e,E),ne===Pe)return null;T&&T(e);let Re=!a;if(E.type===D.Element){Re=Re&&!E.needBlock,delete E.needBlock;let B=S.shadowRoot(e);B&&Se(B)&&(E.isShadowHost=!0)}if((E.type===D.Document||E.type===D.Element)&&Re){b.headWhitespace&&E.type===D.Element&&E.tagName==="head"&&(Q=!1);let B={doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:a,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F,cssCaptured:!1};if(!(E.type===D.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===D.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(B.cssCaptured=!0);for(let me of Array.from(S.childNodes(e))){let Z=de(me,B);Z&&E.childNodes.push(Z)}}let G=null;if(Ht(e)&&(G=S.shadowRoot(e)))for(let me of Array.from(S.childNodes(G))){let Z=de(me,B);Z&&(Se(G)&&(Z.isShadow=!0),E.childNodes.push(Z))}}let qe=S.parentNode(e);return qe&&be(qe)&&Se(qe)&&(E.isShadow=!0),E.type===D.Element&&E.tagName==="iframe"&&Cn(e,()=>{let B=e.contentDocument;if(B&&k){let G=de(B,{doc:B,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F});G&&k(e,G)}},C),E.type===D.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&jt(E.attributes.href)==="css")&&In(e,()=>{if(O){let B=de(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:h,maskInputFn:v,slimDOMOptions:b,dataURLOptions:p,inlineImages:m,recordCanvas:w,preserveWhiteSpace:Q,onSerialize:T,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:$,keepIframeSrcFn:F});B&&O(e,B)}},$),E}c(de,"de"),u(de,"de"),o(de,"de");function An(e,t){let{mirror:r=new _e,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,inlineImages:a=!1,recordCanvas:f=!1,maskAllInputs:y=!1,maskTextFn:h,maskInputFn:v,slimDOM:b=!1,dataURLOptions:p,preserveWhiteSpace:m,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:O,keepIframeSrcFn:$=o(()=>!1,"N")}=t,F=y===!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}:y===!1?{password:!0}:y,j=Yt(b);return de(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:F,maskTextFn:h,maskInputFn:v,slimDOMOptions:j,dataURLOptions:p,inlineImages:a,recordCanvas:f,preserveWhiteSpace:m,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:O,keepIframeSrcFn:$,newlyAddedElement:!1})}c(An,"An"),u(An,"An"),o(An,"An");var Ke=class Ps{static{c(this,"Os")}static{u(this,"Or")}static{o(this,"e")}constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof Ps){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,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function U(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}c(U,"U"),u(U,"U"),o(U,"U");var ce=`Please stop import mirror directly. Instead of that,\r
|
|
23
|
+
*/var _r=Object.defineProperty,xr=o((t,e,r)=>e in t?_r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"xr"),g=o((t,e,r)=>xr(t,typeof e!="symbol"?e+"":e,r),"g"),Mt,M=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t[t.Asset=7]="Asset",t))(M||{}),I=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(I||{}),z=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(z||{}),K=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(K||{}),pe=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(pe||{}),le=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(le||{}),D=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(D||{}),Et={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},kt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ee={},Wt={},Lr=o(()=>!!globalThis.Zone,"Lr");function ut(t){if(Ee[t])return Ee[t];let e=globalThis[t],r=e.prototype,n=t in Et?Et[t]:void 0,s=!!(n&&n.every(c=>{var a,m;return!!((m=(a=Object.getOwnPropertyDescriptor(r,c))==null?void 0:a.get)!=null&&m.toString().includes("[native code]"))})),i=t in kt?kt[t]:void 0,l=!!(i&&i.every(c=>{var a;return typeof r[c]=="function"&&((a=r[c])==null?void 0:a.toString().includes("[native code]"))}));if(s&&l&&!Lr())return Ee[t]=e.prototype,e.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let a=c.contentWindow;if(!a)return e.prototype;let m=a[t].prototype;if(!m)return c.remove(),r;let f=navigator.userAgent;return f.includes("Safari")&&!f.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Wt[t]=()=>c.remove()):c.remove(),Ee[t]=m}catch{return r}}u(ut,"ut"),o(ut,"ut");var Xe={};function H(t,e,r){var n,s;let i=(n=Xe[t])==null?void 0:n[r];if(i)return i.call(e);let l=ut(t),c=(s=Object.getOwnPropertyDescriptor(l,r))==null?void 0:s.get;return c?((Xe[t]||(Xe[t]={}))[r]=c,c.call(e)):e[r]}u(H,"H"),o(H,"H");var Je={};function zt(t,e,r){let n=`${t}.${String(r)}`;if(Je[n])return Je[n].bind(e);let s=ut(t)[r];return typeof s!="function"?e[r]:(Je[n]=s,s.bind(e))}u(zt,"zt"),o(zt,"zt");function Dr(t){return H("Node",t,"ownerDocument")}u(Dr,"Dr"),o(Dr,"Dr");function Pr(t){return H("Node",t,"childNodes")}u(Pr,"Pr"),o(Pr,"Pr");function Fr(t){return H("Node",t,"parentNode")}u(Fr,"Fr"),o(Fr,"Fr");function Ur(t){return H("Node",t,"parentElement")}u(Ur,"Ur"),o(Ur,"Ur");function Wr(t){return H("Node",t,"textContent")}u(Wr,"Wr"),o(Wr,"Wr");function zr(t){return H("Node",t,"firstChild")}u(zr,"zr"),o(zr,"zr");function Br(t){return H("Node",t,"lastChild")}u(Br,"Br"),o(Br,"Br");function Hr(t){return H("Node",t,"nextSibling")}u(Hr,"Hr"),o(Hr,"Hr");function $r(t){return H("Node",t,"previousSibling")}u($r,"$r"),o($r,"$r");function jr(t,e){return zt("Node",t,"contains")(e)}u(jr,"jr"),o(jr,"jr");function Gr(t){return zt("Node",t,"getRootNode")()}u(Gr,"Gr"),o(Gr,"Gr");function Vr(t){return!t||!("host"in t)?null:H("ShadowRoot",t,"host")}u(Vr,"Vr"),o(Vr,"Vr");function qr(t){return t.styleSheets}u(qr,"qr"),o(qr,"qr");function Xr(t){return!t||!("shadowRoot"in t)?null:H("Element",t,"shadowRoot")}u(Xr,"Xr"),o(Xr,"Xr");function Jr(t,e){return H("Element",t,"querySelector")(e)}u(Jr,"Jr"),o(Jr,"Jr");function Yr(t,e){return H("Element",t,"querySelectorAll")(e)}u(Yr,"Yr"),o(Yr,"Yr");function Bt(){return[ut("MutationObserver").constructor,Wt.MutationObserver??(()=>{})]}u(Bt,"Bt"),o(Bt,"Bt");var ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ve=o(()=>new Date().getTime(),"ve"));function oe(t,e,r){try{if(!(e in t))return()=>{};let n=t[e],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=s,()=>{t[e]=n}}catch{return()=>{}}}u(oe,"oe"),o(oe,"oe");var S={ownerDocument:Dr,childNodes:Pr,parentNode:Fr,parentElement:Ur,textContent:Wr,firstChild:zr,lastChild:Br,nextSibling:Hr,previousSibling:$r,contains:jr,getRootNode:Gr,host:Vr,styleSheets:qr,shadowRoot:Xr,querySelector:Jr,querySelectorAll:Yr,nowTimestamp:ve,mutationObserverCtor:Bt,patch:oe};function Ht(t){return t.nodeType===t.ELEMENT_NODE}u(Ht,"Ht"),o(Ht,"Ht");function be(t){let e=t&&"host"in t&&"mode"in t&&S.host(t)||null;return!!(e&&"shadowRoot"in e&&S.shadowRoot(e)===t)}u(be,"be"),o(be,"be");function Se(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}u(Se,"Se"),o(Se,"Se");function Zr(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}u(Zr,"Zr"),o(Zr,"Zr");function Qr(t){let{cssText:e}=t;if(e.split('"').length<3)return e;let r=["@import",`url(${JSON.stringify(t.href)})`];return t.layerName===""?r.push("layer"):t.layerName&&r.push(`layer(${t.layerName})`),t.supportsText&&r.push(`supports(${t.supportsText})`),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}u(Qr,"Qr"),o(Qr,"Qr");function Qe(t){try{let e=t.rules||t.cssRules;if(!e)return null;let r=t.href;!r&&t.ownerNode&&(r=t.ownerNode.baseURI);let n=Array.from(e,s=>$t(s,r)).join("");return Zr(n)}catch{return null}}u(Qe,"Qe"),o(Qe,"Qe");function $t(t,e){if(en(t)){let r;try{r=Qe(t.styleSheet)||Qr(t)}catch{r=t.cssText}return t.styleSheet.href?De(r,t.styleSheet.href):r}else{let r=t.cssText;return tn(t)&&t.selectorText.includes(":")&&(r=Kr(r)),e?De(r,e):r}}u($t,"$t"),o($t,"$t");function Kr(t){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}u(Kr,"Kr"),o(Kr,"Kr");function en(t){return"styleSheet"in t}u(en,"en"),o(en,"en");function tn(t){return"selectorText"in t}u(tn,"tn"),o(tn,"tn");var _e=class{static{u(this,"_e")}static{o(this,"_e")}constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(t){var e;return t?((e=this.getMeta(t))==null?void 0:e.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 e=this.getId(t);this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){let r=e.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,e)}replace(t,e){let r=this.getNode(t);if(r){let n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(e,n)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function rn(){return new _e}u(rn,"rn"),o(rn,"rn");function xe({element:t,maskInputOptions:e,tagName:r,type:n,value:s,maskInputFn:i}){let l=s||"",c=n&&te(n);return(e[r.toLowerCase()]||c&&e[c])&&(i?l=i(l,t):l="*".repeat(l.length)),l}u(xe,"xe"),o(xe,"xe");function te(t){return t.toLowerCase()}u(te,"te"),o(te,"te");var Tt="__rrweb_original__";function nn(t){let e=t.getContext("2d");if(!e)return!0;let r=50;for(let n=0;n<t.width;n+=r)for(let s=0;s<t.height;s+=r){let i=e.getImageData,l=Tt in i?i[Tt]:i;if(new Uint32Array(l.call(e,n,s,Math.min(r,t.width-n),Math.min(r,t.height-s)).data.buffer).some(c=>c!==0))return!1}return!0}u(nn,"nn"),o(nn,"nn");function Le(t){let e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?te(e):null}u(Le,"Le"),o(Le,"Le");function jt(t,e){let r;try{r=new URL(t,e??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i;return r.pathname.match(n)?.[1]??null}u(jt,"jt"),o(jt,"jt");function sn(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}u(sn,"sn"),o(sn,"sn");var on=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,an=/^(?:[a-z+]+:)?\/\//i,ln=/^www\..*/i,cn=/^(data:)([^,]*),(.*)/i;function De(t,e){return(t||"").replace(on,(r,n,s,i,l,c)=>{let a=s||l||c,m=n||i||"";if(!a)return r;if(an.test(a)||ln.test(a))return`url(${m}${a}${m})`;if(cn.test(a))return`url(${m}${a}${m})`;if(a[0]==="/")return`url(${m}${sn(e)+a}${m})`;let f=a.split("#")[0],d=a.substring(f.length),b=e.split("#")[0].split("/"),y=f.split("/");b.pop();for(let h of y)h!=="."&&(h===".."?b.pop():b.push(h));return`url(${m}${b.join("/")}${d}${m})`})}u(De,"De"),o(De,"De");var Gt="(?:/\\*[^*]*\\*/)|[\\s;]",un=new RegExp(`${Gt}|\\b(0)px?`,"g"),dn=new RegExp(Gt,"g");function ke(t,e=!1){return e?t.replace(dn,""):t.replace(un,"$1")}u(ke,"ke"),o(ke,"ke");function hn(t,e,r=!1){let n=Array.from(e.childNodes),s=[],i=0;if(n.length>1&&t&&typeof t=="string"){let l=ke(t,r),c=l.length/t.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let m=ke(n[a].textContent,r),f=100,d=3;for(;d<m.length&&(m[d].match(/[a-zA-Z0-9]/)||m.indexOf(m.substring(0,d),1)!==-1);d++);for(;d<m.length;d++){let b=m.substring(0,d),y=l.split(b),h=-1;if(y.length===2)h=y[0].length;else if(y.length>2&&y[0]===""&&n[a-1].textContent!=="")h=l.indexOf(b,1);else if(y.length===1){if(b=b.substring(0,b.length-1),y=l.split(b),y.length<=1)return s.push(t),s;d=f+1}else d===m.length-1&&(h=l.indexOf(b));if(y.length>=2&&d>f){let p=n[a-1].textContent;if(p&&typeof p=="string"){let v=ke(p).length;h=l.indexOf(b,v)}h===-1&&(h=y[0].length)}if(h!==-1){let p=Math.floor(h/c);for(;p>0&&p<t.length;){if(i+=1,i>50*n.length)return s.push(t),s;let v=ke(t.substring(0,p),r);if(v.length===h){s.push(t.substring(0,p)),t=t.substring(p),l=l.substring(h);break}else v.length<h?p+=Math.max(1,Math.floor((h-v.length)/c)):p-=Math.max(1,Math.floor((v.length-h)*c))}break}}}}return s.push(t),s}u(hn,"hn"),o(hn,"hn");function pn(t,e){return hn(t,e).join("/* rr_split */")}u(pn,"pn"),o(pn,"pn");var fn=1,mn=new RegExp("[^a-z0-9-_:]"),Pe=-2;function Vt(){return fn++}u(Vt,"Vt"),o(Vt,"Vt");function gn(t){if(t instanceof HTMLFormElement)return"form";let e=te(t.tagName);return mn.test(e)?"div":e}u(gn,"gn"),o(gn,"gn");var ae,At,yn=/^[^ \t\n\r\u000c]+/,bn=/^[, \t\n\r\u000c]+/;function Sn(t,e){if(e.trim()==="")return e;let r=0;function n(i){let l,c=i.exec(e.substring(r));return c?(l=c[0],r+=l.length,l):""}u(n,"n"),o(n,"n");let s=[];for(;n(bn),!(r>=e.length);){let i=n(yn);if(i.slice(-1)===",")i=ue(t,i.substring(0,i.length-1)),s.push(i);else{let l="";i=ue(t,i);let c=!1;for(;;){let a=e.charAt(r);if(a===""){s.push((i+l).trim());break}else if(c)a===")"&&(c=!1);else if(a===","){r+=1,s.push((i+l).trim());break}else a==="("&&(c=!0);l+=a,r+=1}}}return s.join(", ")}u(Sn,"Sn"),o(Sn,"Sn");var Nt=new WeakMap;function ue(t,e){return!e||e.trim()===""?e:dt(t,e)}u(ue,"ue"),o(ue,"ue");function wn(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}u(wn,"wn"),o(wn,"wn");function dt(t,e){let r=Nt.get(t);if(r||(r=t.createElement("a"),Nt.set(t,r)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return r.setAttribute("href",e),r.href}u(dt,"dt"),o(dt,"dt");function qt(t,e,r,n){return n&&(r==="src"||r==="href"&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(e)?ue(t,n):r==="srcset"?Sn(t,n):r==="style"?De(n,dt(t)):e==="object"&&r==="data"?ue(t,n):n)}u(qt,"qt"),o(qt,"qt");function Xt(t,e,r){return["video","audio"].includes(t)&&te(e)==="autoplay"}u(Xt,"Xt"),o(Xt,"Xt");function vn(t,e,r){try{if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let n=t.classList.length;n--;){let s=t.classList[n];if(e.test(s))return!0}if(r)return t.matches(r)}catch{}return!1}u(vn,"vn"),o(vn,"vn");function Fe(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Fe(S.parentNode(t),e,r):!1;for(let n=t.classList.length;n--;){let s=t.classList[n];if(e.test(s))return!0}return r?Fe(S.parentNode(t),e,r):!1}u(Fe,"Fe"),o(Fe,"Fe");function Jt(t,e,r,n){let s;if(Ht(t)){if(s=t,!S.childNodes(s).length)return!1}else{if(S.parentElement(t)===null)return!1;s=S.parentElement(t)}try{if(typeof e=="string"){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(Fe(s,e,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}u(Jt,"Jt"),o(Jt,"Jt");function Cn(t,e,r){let n=t.contentWindow;if(!n)return;let s=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let c=setTimeout(()=>{s||(e(),s=!0)},r);t.addEventListener("load",()=>{clearTimeout(c),s=!0,e()});return}let l="about:blank";if(n.location.href!==l||t.src===l||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}u(Cn,"Cn"),o(Cn,"Cn");function In(t,e,r){let n=!1,s;try{s=t.sheet}catch{return}if(s)return;let i=setTimeout(()=>{n||(e(),n=!0)},r);t.addEventListener("load",()=>{clearTimeout(i),n=!0,e()})}u(In,"In"),o(In,"In");function Rn(t,e){let{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:l,inlineStylesheet:c,maskInputOptions:a={},maskTextFn:m,maskInputFn:f,dataURLOptions:d={},inlineImages:b,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:p=!1,cssCaptured:v=!1}=e,k=Mn(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:t.compatMode}:{type:D.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:D.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:k};case t.ELEMENT_NODE:return kn(t,{doc:r,blockClass:s,blockSelector:i,inlineStylesheet:c,maskInputOptions:a,maskInputFn:f,dataURLOptions:d,inlineImages:b,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:p,rootId:k});case t.TEXT_NODE:return En(t,{doc:r,needsMask:l,maskTextFn:m,rootId:k,cssCaptured:v});case t.CDATA_SECTION_NODE:return{type:D.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return{type:D.Comment,textContent:S.textContent(t)||"",rootId:k};default:return!1}}u(Rn,"Rn"),o(Rn,"Rn");function Mn(t,e){if(!e.hasNode(t))return;let r=e.getId(t);return r===1?void 0:r}u(Mn,"Mn"),o(Mn,"Mn");function En(t,e){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:i}=e,l=S.parentNode(t),c=l&&l.tagName,a="",m=c==="STYLE"?!0:void 0,f=c==="SCRIPT"?!0:void 0;return f?a="SCRIPT_PLACEHOLDER":i||(a=S.textContent(t),m&&a&&(a=De(a,dt(e.doc)))),!m&&!f&&a&&r&&(a=n?n(a,S.parentElement(t)):a.replace(/[\S]/g,"*")),{type:D.Text,textContent:a||"",rootId:s}}u(En,"En"),o(En,"En");function kn(t,e){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:i,maskInputOptions:l={},maskInputFn:c,dataURLOptions:a={},inlineImages:m,recordCanvas:f,keepIframeSrcFn:d,newlyAddedElement:b=!1,rootId:y}=e,h=vn(t,n,s),p=gn(t),v={},k=t.attributes.length;for(let w=0;w<k;w++){let T=t.attributes[w];Xt(p,T.name,T.value)||(v[T.name]=qt(r,p,te(T.name),T.value))}if(p==="link"&&i){let w=Array.from(r.styleSheets).find(P=>P.href===t.href),T=null;w&&(T=Qe(w)),T&&(delete v.rel,delete v.href,v._cssText=T)}if(p==="style"&&t.sheet){let w=Qe(t.sheet);w&&(t.childNodes.length>1&&(w=pn(w,t)),v._cssText=w)}if(["input","textarea","select"].includes(p)){let w=t.value,T=t.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&w?v.value=xe({element:t,type:Le(t),tagName:p,value:w,maskInputOptions:l,maskInputFn:c}):T&&(v.checked=T)}if(p==="option"&&(t.selected&&!l.select?v.selected=!0:delete v.selected),p==="dialog"&&t.open&&(v.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"),p==="canvas"&&f){if(t.__context==="2d")nn(t)||(v.rr_dataURL=t.toDataURL(a.type,a.quality));else if(!("__context"in t)){let w=t.toDataURL(a.type,a.quality),T=r.createElement("canvas");T.width=t.width,T.height=t.height;let P=T.toDataURL(a.type,a.quality);w!==P&&(v.rr_dataURL=w)}}if(p==="img"&&m){ae||(ae=r.createElement("canvas"),At=ae.getContext("2d"));let w=t,T=w.currentSrc||w.getAttribute("src")||"<unknown-src>",P=w.crossOrigin,N=o(()=>{w.removeEventListener("load",N);try{ae.width=w.naturalWidth,ae.height=w.naturalHeight,At.drawImage(w,0,0),v.rr_dataURL=ae.toDataURL(a.type,a.quality)}catch(B){if(w.crossOrigin!=="anonymous"){w.crossOrigin="anonymous",w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N);return}else console.warn(`Cannot inline img src=${T}! Error: ${B}`)}w.crossOrigin==="anonymous"&&(P?v.crossOrigin=P:w.removeAttribute("crossorigin"))},"O");w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N)}if(["audio","video"].includes(p)){let w=v;w.rr_mediaState=t.paused?"paused":"played",w.rr_mediaCurrentTime=t.currentTime,w.rr_mediaPlaybackRate=t.playbackRate,w.rr_mediaMuted=t.muted,w.rr_mediaLoop=t.loop,w.rr_mediaVolume=t.volume}if(b||(t.scrollLeft&&(v.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(v.rr_scrollTop=t.scrollTop)),h){let{width:w,height:T}=t.getBoundingClientRect();v={class:v.class,rr_width:`${w}px`,rr_height:`${T}px`}}p==="iframe"&&!d(v.src)&&(t.contentDocument||(v.rr_src=v.src),delete v.src);let C;try{customElements.get(p)&&(C=!0)}catch{}return{type:D.Element,tagName:p,attributes:v,childNodes:[],isSVG:wn(t)||void 0,needBlock:h,rootId:y,isCustom:C}}u(kn,"kn"),o(kn,"kn");function A(t){return t==null?"":t.toLowerCase()}u(A,"A"),o(A,"A");function Yt(t){return t===!0||t==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:t==="all",headMetaDescKeywords:t==="all",headTitleMutations:t==="all"}:t||{}}u(Yt,"Yt"),o(Yt,"Yt");function Tn(t,e){return!!(e.comment&&t.type===D.Comment||t.type===D.Element&&(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"&&t.attributes.as==="script"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&jt(t.attributes.href)==="js")||e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(A(t.attributes.name).match(/^msapplication-tile(image|color)$/)||A(t.attributes.name)==="application-name"||A(t.attributes.rel)==="icon"||A(t.attributes.rel)==="apple-touch-icon"||A(t.attributes.rel)==="shortcut icon"))||t.tagName==="meta"&&(e.headMetaDescKeywords&&A(t.attributes.name).match(/^description|keywords$/)||e.headMetaSocial&&(A(t.attributes.property).match(/^(og|twitter|fb):/)||A(t.attributes.name).match(/^(og|twitter):/)||A(t.attributes.name)==="pinterest")||e.headMetaRobots&&(A(t.attributes.name)==="robots"||A(t.attributes.name)==="googlebot"||A(t.attributes.name)==="bingbot")||e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0||e.headMetaAuthorship&&(A(t.attributes.name)==="author"||A(t.attributes.name)==="generator"||A(t.attributes.name)==="framework"||A(t.attributes.name)==="publisher"||A(t.attributes.name)==="progid"||A(t.attributes.property).match(/^article:/)||A(t.attributes.property).match(/^product:/))||e.headMetaVerification&&(A(t.attributes.name)==="google-site-verification"||A(t.attributes.name)==="yandex-verification"||A(t.attributes.name)==="csrf-token"||A(t.attributes.name)==="p:domain_verify"||A(t.attributes.name)==="verify-v1"||A(t.attributes.name)==="verification"||A(t.attributes.name)==="shopify-checkout-api-token"))))}u(Tn,"Tn"),o(Tn,"Tn");function de(t,e){let{doc:r,mirror:n,blockClass:s,blockSelector:i,maskTextClass:l,maskTextSelector:c,skipChild:a=!1,inlineStylesheet:m=!0,maskInputOptions:f={},maskTextFn:d,maskInputFn:b,slimDOMOptions:y,dataURLOptions:h={},inlineImages:p=!1,recordCanvas:v=!1,onSerialize:k,onIframeLoad:C,iframeLoadTimeout:w=5e3,onStylesheetLoad:T,stylesheetLoadTimeout:P=5e3,keepIframeSrcFn:N=o(()=>!1,"O"),newlyAddedElement:B=!1,cssCaptured:vt=!1}=e,{needsMask:q}=e,{preserveWhiteSpace:Y=!0}=e;q||(q=Jt(t,l,c,q===void 0));let Q=Rn(t,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,inlineStylesheet:m,maskInputOptions:f,maskTextFn:d,maskInputFn:b,dataURLOptions:h,inlineImages:p,recordCanvas:v,keepIframeSrcFn:N,newlyAddedElement:B,cssCaptured:vt});if(!Q)return console.warn(t,"not serialized"),null;let yt;n.hasNode(t)?yt=n.getId(t):Tn(Q,y)||!Y&&Q.type===D.Text&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?yt=Pe:yt=Vt();let O=Object.assign(Q,{id:yt});if(n.add(t,O),yt===Pe)return null;k&&k(t);let re=!a;if(O.type===D.Element){re=re&&!O.needBlock,delete O.needBlock;let $=S.shadowRoot(t);$&&Se($)&&(O.isShadowHost=!0)}if((O.type===D.Document||O.type===D.Element)&&re){y.headWhitespace&&O.type===D.Element&&O.tagName==="head"&&(Y=!1);let $={doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:c,skipChild:a,inlineStylesheet:m,maskInputOptions:f,maskTextFn:d,maskInputFn:b,slimDOMOptions:y,dataURLOptions:h,inlineImages:p,recordCanvas:v,preserveWhiteSpace:Y,onSerialize:k,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:T,stylesheetLoadTimeout:P,keepIframeSrcFn:N,cssCaptured:!1};if(!(O.type===D.Element&&O.tagName==="textarea"&&O.attributes.value!==void 0)){O.type===D.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText=="string"&&($.cssCaptured=!0);for(let Ct of Array.from(S.childNodes(t))){let Z=de(Ct,$);Z&&O.childNodes.push(Z)}}let V=null;if(Ht(t)&&(V=S.shadowRoot(t)))for(let Ct of Array.from(S.childNodes(V))){let Z=de(Ct,$);Z&&(Se(V)&&(Z.isShadow=!0),O.childNodes.push(Z))}}let ne=S.parentNode(t);return ne&&be(ne)&&Se(ne)&&(O.isShadow=!0),O.type===D.Element&&O.tagName==="iframe"&&Cn(t,()=>{let $=t.contentDocument;if($&&C){let V=de($,{doc:$,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:c,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskTextFn:d,maskInputFn:b,slimDOMOptions:y,dataURLOptions:h,inlineImages:p,recordCanvas:v,preserveWhiteSpace:Y,onSerialize:k,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:T,stylesheetLoadTimeout:P,keepIframeSrcFn:N});V&&C(t,V)}},w),O.type===D.Element&&O.tagName==="link"&&typeof O.attributes.rel=="string"&&(O.attributes.rel==="stylesheet"||O.attributes.rel==="preload"&&typeof O.attributes.href=="string"&&jt(O.attributes.href)==="css")&&In(t,()=>{if(T){let $=de(t,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:q,maskTextClass:l,maskTextSelector:c,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskTextFn:d,maskInputFn:b,slimDOMOptions:y,dataURLOptions:h,inlineImages:p,recordCanvas:v,preserveWhiteSpace:Y,onSerialize:k,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:T,stylesheetLoadTimeout:P,keepIframeSrcFn:N});$&&T(t,$)}},P),O}u(de,"de"),o(de,"de");function An(t,e){let{mirror:r=new _e,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:c=!0,inlineImages:a=!1,recordCanvas:m=!1,maskAllInputs:f=!1,maskTextFn:d,maskInputFn:b,slimDOM:y=!1,dataURLOptions:h,preserveWhiteSpace:p,onSerialize:v,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:T,keepIframeSrcFn:P=o(()=>!1,"N")}=e,N=f===!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}:f===!1?{password:!0}:f,B=Yt(y);return de(t,{doc:t,mirror:r,blockClass:n,blockSelector:s,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:c,maskInputOptions:N,maskTextFn:d,maskInputFn:b,slimDOMOptions:B,dataURLOptions:h,inlineImages:a,recordCanvas:m,preserveWhiteSpace:p,onSerialize:v,onIframeLoad:k,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:T,keepIframeSrcFn:P,newlyAddedElement:!1})}u(An,"An"),o(An,"An");var Ke=class Os{static{u(this,"Or")}static{o(this,"e")}constructor(...e){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType")}get childNodes(){let e=[],r=this.firstChild;for(;r;)e.push(r),r=r.nextSibling;return e}contains(e){if(e instanceof Os){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function U(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}u(U,"U"),o(U,"U");var ce=`Please stop import mirror directly. Instead of that,\r
|
|
24
24
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
25
|
-
or you can use record.mirror to access the mirror instance during recording.`,Ot={map:{},getId(){return console.error(ce),-1},getNode(){return console.error(ce),null},removeNodeFromMap(){console.error(ce)},has(){return console.error(ce),!1},reset(){console.error(ce)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ot=new Proxy(Ot,{get(e,t,r){return t==="map"&&console.error(ce),Reflect.get(e,t,r)}}));function Ce(e,t,r={}){let n=null,s=0;return function(...i){let l=Date.now();!s&&r.leading===!1&&(s=l);let d=t-(l-s),a=this;d<=0||d>t?(n&&(clearTimeout(n),n=null),s=l,e.apply(a,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(a,i)},d))}}c(Ce,"Ce"),u(Ce,"Ce"),o(Ce,"Ce");function Be(e,t,r,n,s=window){let i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(l){setTimeout(()=>{r.set.call(this,l)},0),i&&i.set&&i.set.call(this,l)}}),()=>Be(e,t,i||{},!0)}c(Be,"Be"),u(Be,"Be"),o(Be,"Be");function Zt(e){var t,r,n,s;let i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||i?.body&&((t=S.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=S.parentElement(i.body))==null?void 0:n.scrollTop)||((s=i?.body)==null?void 0:s.scrollTop)||0}}c(Zt,"Zt"),u(Zt,"Zt"),o(Zt,"Zt");function Qt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}c(Qt,"Qt"),u(Qt,"Qt"),o(Qt,"Qt");function Kt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}c(Kt,"Kt"),u(Kt,"Kt"),o(Kt,"Kt");function er(e){return e?e.nodeType===e.ELEMENT_NODE?e:S.parentElement(e):null}c(er,"er"),u(er,"er"),o(er,"er");function W(e,t,r,n){if(!e)return!1;let s=er(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(Fe(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}c(W,"W"),u(W,"W"),o(W,"W");function Nn(e,t){return t.getId(e)!==-1}c(Nn,"Nn"),u(Nn,"Nn"),o(Nn,"Nn");function Ye(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Pe}c(Ye,"Ye"),u(Ye,"Ye"),o(Ye,"Ye");function tr(e,t){if(be(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=S.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?tr(n,t):!0}c(tr,"tr"),u(tr,"tr"),o(tr,"tr");function et(e){return!!e.changedTouches}c(et,"et"),u(et,"et"),o(et,"et");function On(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)}c(On,"On"),u(On,"On"),o(On,"On");function rr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}c(rr,"rr"),u(rr,"rr"),o(rr,"rr");function nr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}c(nr,"nr"),u(nr,"nr"),o(nr,"nr");function tt(e){return e?e instanceof Ke&&"shadowRoot"in e?!!e.shadowRoot:!!S.shadowRoot(e):!1}c(tt,"tt"),u(tt,"tt"),o(tt,"tt");var rt=class{static{c(this,"rt")}static{u(this,"rt")}static{o(this,"rt")}constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function sr(e){var t;let r=null;return"getRootNode"in e&&((t=S.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&S.host(S.getRootNode(e))&&(r=S.host(S.getRootNode(e))),r}c(sr,"sr"),u(sr,"sr"),o(sr,"sr");function _n(e){let t=e,r;for(;r=sr(t);)t=r;return t}c(_n,"_n"),u(_n,"_n"),o(_n,"_n");function xn(e){let t=S.ownerDocument(e);if(!t)return!1;let r=_n(e);return S.contains(t,r)}c(xn,"xn"),u(xn,"xn"),o(xn,"xn");function ir(e){let t=S.ownerDocument(e);return t?S.contains(t,e)||xn(e):!1}c(ir,"ir"),u(ir,"ir"),o(ir,"ir");var _t=o((e,t)=>`${e}@${t}`,"_t"),nt=class{static{c(this,"nt")}static{u(this,"nt")}static{o(this,"nt")}constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let h of this.movedSet){let v=S.parentNode(h);this.removesSubTreeCache.has(v)&&!this.movedSet.has(v)||this.addedSet.add(h)}let r=null,n=null,s=-1,i=null,l=!1,d=new Set,a=this.addedSet.values(),f=a.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(S.previousSibling(r)))i=r,r=S.previousSibling(r);else{for(this.addedSet.has(f.value)||(f=a.next()),r=f.value;;){if(n=S.parentNode(r),this.addedSet.has(n)){r=n;continue}break}if(d.has(n))n=null;else if(n){if(ir(n)?(l=xt(this.droppedSet,n)||this.removesSubTreeCache.has(n),l&&xt(this.movedSet,r)&&(l=!1)):l=!0,this.addedSet.has(S.lastChild(n)))r=S.lastChild(n),i=null;else for(;;){if(i=S.nextSibling(r),this.addedSet.has(i)){r=i;continue}break}if(s=be(n)?this.mirror.getId(sr(r)):this.mirror.getId(n),s===-1&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let p=S.host(n);s=this.mirror.getId(p)}}}if(this.addedSet.delete(r),!n||s===-1){d.add(r);continue}else if(l){this.droppedSet.add(r);continue}let h=!1;if(r.nodeType===Node.TEXT_NODE){let p=n.tagName;if(p==="TEXTAREA")continue;p==="STYLE"&&t.has(s)&&(h=!0)}let v=i?this.mirror.getId(i):null;for(;v===Pe;)i=i&&S.nextSibling(i),v=i&&this.mirror.getId(i);if(v===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",i),r=null;continue}let b=de(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:o(p=>{rr(p,this.mirror)&&this.iframeManager.addIframe(p),nr(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),tt(r)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(r),this.doc)},"onSerialize"),onIframeLoad:o((p,m)=>{this.iframeManager.attachIframe(p,m),this.shadowDomManager.observeAttachShadow(p)},"onIframeLoad"),onStylesheetLoad:o((p,m)=>{this.stylesheetManager.attachLinkElement(p,m)},"onStylesheetLoad"),cssCaptured:h});b&&(e.push({parentId:s,nextId:v,node:b}),t.add(b.id))}let y={texts:this.texts.map(h=>{let v=h.node,b=S.parentNode(v);return b&&b.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b),{id:this.mirror.getId(v),value:h.value}}).filter(h=>!t.has(h.id)).filter(h=>this.mirror.has(h.id)),attributes:this.attributes.map(h=>{let{attributes:v}=h;if(typeof v.style=="string"){let b=JSON.stringify(h.styleDiff),p=JSON.stringify(h._unchangedStyles);b.length<v.style.length&&(b+p).split("var(").length===v.style.split("var(").length&&(v.style=h.styleDiff)}return{id:this.mirror.getId(h.node),attributes:v}}).filter(h=>!t.has(h.id)).filter(h=>this.mirror.has(h.id)),removes:this.removes,adds:e};!y.texts.length&&!y.attributes.length&&!y.removes.length&&!y.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(y))}),g(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(S.childNodes(e),n=>S.textContent(n)||"").join("");t.attributes.value=xe({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Le(e),value:r,maskInputFn:this.maskInputFn})}),g(this,"processMutation",e=>{if(!Ye(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=S.textContent(e.target);!W(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Jt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,er(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=te(t.tagName),n=e.attributeName,s=e.target.getAttribute(n);if(n==="value"){let l=Le(t);s=xe({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:l,value:s,maskInputFn:this.maskInputFn})}if(W(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let i=this.attributeMap.get(e.target);if(r==="iframe"&&n==="src"&&!this.keepIframeSrcFn(s))if(!t.contentDocument)n="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),n==="type"&&r==="input"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Xt(r,n))if(i.attributes[n]=qt(this.doc,r,te(n),s),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue);for(let d of Array.from(t.style)){let a=t.style.getPropertyValue(d),f=t.style.getPropertyPriority(d);a!==l.style.getPropertyValue(d)||f!==l.style.getPropertyPriority(d)?f===""?i.styleDiff[d]=a:i.styleDiff[d]=[a,f]:i._unchangedStyles[d]=[a,f]}for(let d of Array.from(l.style))t.style.getPropertyValue(d)===""&&(i.styleDiff[d]=!1)}else n==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(W(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),n=be(e.target)?this.mirror.getId(S.host(e.target)):this.mirror.getId(e.target);W(e.target,this.blockClass,this.blockSelector,!1)||Ye(t,this.mirror,this.slimDOMOptions)||!Nn(t,this.mirror)||(this.addedSet.has(t)?(st(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||tr(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[_t(r,n)]?st(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:be(e.target)&&Se(e.target)?!0:void 0}),Ln(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),g(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ye(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[_t(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);W(e,this.blockClass,this.blockSelector,!1)||(S.childNodes(e).forEach(r=>this.genAdds(r)),tt(e)&&S.childNodes(S.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function st(e,t){e.delete(t),S.childNodes(t).forEach(r=>st(e,r))}c(st,"st"),u(st,"st"),o(st,"st");function Ln(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),S.childNodes(n).forEach(s=>r.push(s)))}}c(Ln,"Ln"),u(Ln,"Ln"),o(Ln,"Ln");function xt(e,t){return e.size===0?!1:or(e,t)}c(xt,"xt"),u(xt,"xt"),o(xt,"xt");function or(e,t){if(e.has(t))return!0;let r=S.parentNode(t);return r?or(e,r):!1}c(or,"or"),u(or,"or"),o(or,"or");var we;function Dn(e){we=e}c(Dn,"Dn"),u(Dn,"Dn"),o(Dn,"Dn");function Pn(){we=void 0}c(Pn,"Pn"),u(Pn,"Pn"),o(Pn,"Pn");var R=o(e=>we?(...t)=>{try{return e(...t)}catch(r){if(we&&we(r)===!0)return;throw r}}:e,"R"),ie=[];function Ie(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}c(Ie,"Ie"),u(Ie,"Ie"),o(Ie,"Ie");function ar(e,t){let r=new nt;ie.push(r),r.init(e);let[n,s]=Bt(),i=new n(R(r.processMutations.bind(r)));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[i,s]}c(ar,"ar"),u(ar,"ar"),o(ar,"ar");function Fn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,l=[],d,a=Ce(R(h=>{let v=Date.now()-d;e(l.map(b=>(b.timeOffset-=v,b)),h),l=[],d=null}),i),f=R(Ce(R(h=>{let v=Ie(h),{clientX:b,clientY:p}=et(h)?h.changedTouches[0]:h;d||(d=ve()),l.push({x:b,y:p,id:n.getId(v),timeOffset:ve()-d}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),s,{trailing:!1})),y=[U("mousemove",f,r),U("touchmove",f,r),U("drag",f,r)];return R(()=>{y.forEach(h=>h())})}c(Fn,"Fn"),u(Fn,"Fn"),o(Fn,"Fn");function Un({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let l=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,d=[],a=null,f=o(y=>h=>{let v=Ie(h);if(W(v,n,s,!0))return;let b=null,p=y;if("pointerType"in h){switch(h.pointerType){case"mouse":b=K.Mouse;break;case"touch":b=K.Touch;break;case"pen":b=K.Pen;break}b===K.Touch?z[y]===z.MouseDown?p="TouchStart":z[y]===z.MouseUp&&(p="TouchEnd"):K.Pen}else et(h)&&(b=K.Touch);b!==null?(a=b,(p.startsWith("Touch")&&b===K.Touch||p.startsWith("Mouse")&&b===K.Mouse)&&(b=null)):z[y]===z.Click&&(b=a,a=null);let m=et(h)?h.changedTouches[0]:h;if(!m)return;let w=r.getId(v),{clientX:T,clientY:k}=m;R(e)({type:z[p],id:w,x:T,y:k,...b!==null&&{pointerType:b}})},"u");return Object.keys(z).filter(y=>Number.isNaN(Number(y))&&!y.endsWith("_Departed")&&l[y]!==!1).forEach(y=>{let h=te(y),v=f(y);if(window.PointerEvent)switch(z[y]){case z.MouseDown:case z.MouseUp:h=h.replace("mouse","pointer");break;case z.TouchStart:case z.TouchEnd:return}d.push(U(h,v,t))}),R(()=>{d.forEach(y=>y())})}c(Un,"Un"),u(Un,"Un"),o(Un,"Un");function lr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:i}){let l=R(Ce(R(d=>{let a=Ie(d);if(!a||W(a,n,s,!0))return;let f=r.getId(a);if(a===t&&t.defaultView){let y=Zt(t.defaultView);e({id:f,x:y.left,y:y.top})}else e({id:f,x:a.scrollLeft,y:a.scrollTop})}),i.scroll||100));return U("scroll",l,t)}c(lr,"lr"),u(lr,"lr"),o(lr,"lr");function Wn({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=R(Ce(R(()=>{let i=Qt(),l=Kt();(r!==i||n!==l)&&(e({width:Number(l),height:Number(i)}),r=i,n=l)}),200));return U("resize",s,t)}c(Wn,"Wn"),u(Wn,"Wn"),o(Wn,"Wn");var zn=["INPUT","TEXTAREA","SELECT"],Lt=new WeakMap;function Bn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:i,ignoreSelector:l,maskInputOptions:d,maskInputFn:a,sampling:f,userTriggeredOnInput:y}){function h(T){let k=Ie(T),C=T.isTrusted,O=k&&k.tagName;if(k&&O==="OPTION"&&(k=S.parentElement(k)),!k||!O||zn.indexOf(O)<0||W(k,n,s,!0)||k.classList.contains(i)||l&&k.matches(l))return;let $=k.value,F=!1,j=Le(k)||"";j==="radio"||j==="checkbox"?F=k.checked:(d[O.toLowerCase()]||d[j])&&($=xe({element:k,maskInputOptions:d,tagName:O,type:j,value:$,maskInputFn:a})),v(k,y?{text:$,isChecked:F,userTriggered:C}:{text:$,isChecked:F});let se=k.name;j==="radio"&&se&&F&&t.querySelectorAll(`input[type="radio"][name="${se}"]`).forEach(q=>{if(q!==k){let Q=q.value;v(q,y?{text:Q,isChecked:!F,userTriggered:!1}:{text:Q,isChecked:!F})}})}c(h,"d"),u(h,"c"),o(h,"h");function v(T,k){let C=Lt.get(T);if(!C||C.text!==k.text||C.isChecked!==k.isChecked){Lt.set(T,k);let O=r.getId(T);R(e)({...k,id:O})}}c(v,"b"),u(v,"y"),o(v,"f");let b=(f.input==="last"?["change"]:["input","change"]).map(T=>U(T,R(h),t)),p=t.defaultView;if(!p)return()=>{b.forEach(T=>T())};let m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),w=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&b.push(...w.map(T=>Be(T[0],T[1],{set(){R(h)({target:this,isTrusted:!1})}},!1,p))),R(()=>{b.forEach(T=>T())})}c(Bn,"Bn"),u(Bn,"Bn"),o(Bn,"Bn");function Ue(e){let t=[];function r(n,s){if(Te("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Te("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Te("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Te("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let i=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(i),r(n.parentRule,s)}else if(n.parentStyleSheet){let i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(i)}return s}return c(r,"r"),u(r,"r"),o(r,"r"),r(e,t)}c(Ue,"Ue"),u(Ue,"Ue"),o(Ue,"Ue");function ee(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}c(ee,"ee"),u(ee,"ee"),o(ee,"ee");function Hn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:R((y,h,v)=>{let[b,p]=v,{id:m,styleId:w}=ee(h,t,r.styleMirror);return(m&&m!==-1||w&&w!==-1)&&e({id:m,styleId:w,adds:[{rule:b,index:p}]}),y.apply(h,v)})}),n.CSSStyleSheet.prototype.addRule=function(y,h,v=this.cssRules.length){let b=`${y} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[b,v])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,removes:[{index:b}]}),y.apply(h,v)})}),n.CSSStyleSheet.prototype.removeRule=function(y){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[y])};let l;n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replace:b}),y.apply(h,v)})}));let d;n.CSSStyleSheet.prototype.replaceSync&&(d=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:R((y,h,v)=>{let[b]=v,{id:p,styleId:m}=ee(h,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replaceSync:b}),y.apply(h,v)})}));let a={};Ae("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(Ae("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),Ae("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),Ae("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(a).forEach(([y,h])=>{f[y]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(f[y].insertRule,{apply:R((v,b,p)=>{let[m,w]=p,{id:T,styleId:k}=ee(b.parentStyleSheet,t,r.styleMirror);return(T&&T!==-1||k&&k!==-1)&&e({id:T,styleId:k,adds:[{rule:m,index:[...Ue(b),w||0]}]}),v.apply(b,p)})}),h.prototype.deleteRule=new Proxy(f[y].deleteRule,{apply:R((v,b,p)=>{let[m]=p,{id:w,styleId:T}=ee(b.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||T&&T!==-1)&&e({id:w,styleId:T,removes:[{index:[...Ue(b),m]}]}),v.apply(b,p)})})}),R(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=i,l&&(n.CSSStyleSheet.prototype.replace=l),d&&(n.CSSStyleSheet.prototype.replaceSync=d),Object.entries(a).forEach(([y,h])=>{h.prototype.insertRule=f[y].insertRule,h.prototype.deleteRule=f[y].deleteRule})})}c(Hn,"Hn"),u(Hn,"Hn"),o(Hn,"Hn");function cr({mirror:e,stylesheetManager:t},r){var n,s,i;let l=null;r.nodeName==="#document"?l=e.getId(r):l=e.getId(S.host(r));let d=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:i.ShadowRoot,a=d?.prototype?Object.getOwnPropertyDescriptor(d?.prototype,"adoptedStyleSheets"):void 0;return l===null||l===-1||!d||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var f;return(f=a.get)==null?void 0:f.call(this)},set(f){var y;let h=(y=a.set)==null?void 0:y.call(this,f);if(l!==null&&l!==-1)try{t.adoptStyleSheets(f,l)}catch{}return h}}),R(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}c(cr,"cr"),u(cr,"cr"),o(cr,"cr");function $n({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:R((d,a,f)=>{var y;let[h,v,b]=f;if(r.has(h))return i.apply(a,[h,v,b]);let{id:p,styleId:m}=ee((y=a.parentRule)==null?void 0:y.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,set:{property:h,value:v,priority:b},index:Ue(a.parentRule)}),d.apply(a,f)})});let l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:R((d,a,f)=>{var y;let[h]=f;if(r.has(h))return l.apply(a,[h]);let{id:v,styleId:b}=ee((y=a.parentRule)==null?void 0:y.parentStyleSheet,t,n.styleMirror);return(v&&v!==-1||b&&b!==-1)&&e({id:v,styleId:b,remove:{property:h},index:Ue(a.parentRule)}),d.apply(a,f)})}),R(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=l})}c($n,"$n"),u($n,"$n"),o($n,"$n");function jn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:i}){let l=R(a=>Ce(R(f=>{let y=Ie(f);if(!y||W(y,t,r,!0))return;let{currentTime:h,volume:v,muted:b,playbackRate:p,loop:m}=y;e({type:a,id:n.getId(y),currentTime:h,volume:v,muted:b,playbackRate:p,loop:m})}),s.media||500)),d=[U("play",l(le.Play),i),U("pause",l(le.Pause),i),U("seeked",l(le.Seeked),i),U("volumechange",l(le.VolumeChange),i),U("ratechange",l(le.RateChange),i)];return R(()=>{d.forEach(a=>a())})}c(jn,"jn"),u(jn,"jn"),o(jn,"jn");function Gn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(d,a,f){let y=new i(d,a,f);return s.set(y,{family:d,buffer:typeof a!="string",descriptors:f,fontSource:typeof a=="string"?a:JSON.stringify(Array.from(new Uint8Array(a)))}),y};let l=oe(t.fonts,"add",function(d){return function(a){return setTimeout(R(()=>{let f=s.get(a);f&&(e(f),s.delete(a))}),0),d.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(l),R(()=>{n.forEach(d=>d())})}c(Gn,"Gn"),u(Gn,"Gn"),o(Gn,"Gn");function Vn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:i}=e,l=!0,d=R(()=>{let a=t.getSelection();if(!a||l&&a?.isCollapsed)return;l=a.isCollapsed||!1;let f=[],y=a.rangeCount||0;for(let h=0;h<y;h++){let v=a.getRangeAt(h),{startContainer:b,startOffset:p,endContainer:m,endOffset:w}=v;W(b,n,s,!0)||W(m,n,s,!0)||f.push({start:r.getId(b),startOffset:p,end:r.getId(m),endOffset:w})}i({ranges:f})});return d(),U("selectionchange",d)}c(Vn,"Vn"),u(Vn,"Vn"),o(Vn,"Vn");function qn({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(n){return function(s,i,l){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return n.apply(this,[s,i,l])}})}c(qn,"qn"),u(qn,"qn"),o(qn,"qn");function Xn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:l,inputCb:d,mediaInteractionCb:a,styleSheetRuleCb:f,styleDeclarationCb:y,canvasMutationCb:h,fontCb:v,selectionCb:b,customElementCb:p}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),s(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),i(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),l(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),d(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),a(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),f(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),y(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),h(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),v(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),b(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),p(...m)}}c(Xn,"Xn"),u(Xn,"Xn"),o(Xn,"Xn");function Jn(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};Xn(e,t);let n,s=o(()=>{},"s");e.recordDOM&&([n,s]=ar(e,e.doc));let i=Fn(e),l=Un(e),d=lr(e),a=Wn(e,{win:r}),f=Bn(e),y=jn(e),h=o(()=>{},"h"),v=o(()=>{},"f"),b=o(()=>{},"p"),p=o(()=>{},"m");e.recordDOM&&(h=Hn(e,{win:r}),v=cr(e,e.doc),b=$n(e,{win:r}),e.collectFonts&&(p=Gn(e)));let m=Vn(e),w=qn(e),T=[];for(let k of e.plugins)T.push(k.observer(k.callback,r,k.options));return R(()=>{ie.forEach(k=>k.reset()),n?.disconnect(),s(),i(),l(),d(),a(),f(),y(),h(),v(),b(),p(),m(),w(),T.forEach(k=>k())})}c(Jn,"Jn"),u(Jn,"Jn"),o(Jn,"Jn");function Te(e){return typeof window[e]<"u"}c(Te,"Te"),u(Te,"Te"),o(Te,"Te");function Ae(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}c(Ae,"Ae"),u(Ae,"Ae"),o(Ae,"Ae");var We=class{static{c(this,"We")}static{u(this,"We")}static{o(this,"We")}constructor(e){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){let s=r||this.getIdToRemoteIdMap(e),i=n||this.getRemoteIdToIdMap(e),l=s.get(t);return l||(l=this.generateIdFn(),s.set(t,l),i.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(s=>this.getId(e,s,r,n))}getRemoteId(e,t,r){let n=r||this.getRemoteIdToIdMap(e);return typeof t!="number"?t:n.get(t)||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(n=>this.getRemoteId(e,n,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},it=class{static{c(this,"it")}static{u(this,"it")}static{o(this,"it")}constructor(e){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new We(Vt)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new We(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let r=this.crossOriginIframeMap.get(e.source);if(!r)return;let n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case M.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:M.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return t;case M.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case M.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(n=>{this.replaceIds(n,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,e);let s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(n.node,s)}),t.data.removes.forEach(n=>{this.replaceIds(n,e,["parentId","id"])}),t.data.attributes.forEach(n=>{this.replaceIds(n,e,["id"])}),t.data.texts.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(n=>{this.replaceIds(n,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(n=>{this.replaceIds(n,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(n=>{this.replaceStyleIds(n,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(let s of n)!Array.isArray(t[s])&&typeof t[s]!="number"||(Array.isArray(t[s])?t[s]=e.getIds(r,t[s]):t[s]=e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==D.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},ot=class{static{c(this,"ot")}static{u(this,"ot")}static{o(this,"ot")}constructor(e){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Se(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[r]=ar({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(lr({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(S.host(e))),this.restoreHandlers.push(cr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(oe(e.prototype,"attachShadow",function(n){return function(s){let i=n.call(this,s),l=S.shadowRoot(this);return l&&ir(this)&&r.addShadowRoot(l,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ye=0;ye<he.length;ye++)Yn[he.charCodeAt(ye)]=ye;var ye,Zn=o(function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=he[t[r]>>2],s+=he[(t[r]&3)<<4|t[r+1]>>4],s+=he[(t[r+1]&15)<<2|t[r+2]>>6],s+=he[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},"Zn"),Dt=new Map;function Qn(e,t){let r=Dt.get(e);return r||(r=new Map,Dt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}c(Qn,"Qn"),u(Qn,"Qn"),o(Qn,"Qn");var ur=o((e,t,r)=>{if(!e||!(hr(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=Qn(r,n),i=s.indexOf(e);return i===-1&&(i=s.length,s.push(e)),i},"ur");function Ne(e,t,r){if(e instanceof Array)return e.map(n=>Ne(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=Zn(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Ne(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Ne(e.data,t,r),e.width,e.height]};if(hr(e,t)||typeof e=="object"){let n=e.constructor.name,s=ur(e,t,r);return{rr_type:n,index:s}}}}return e}c(Ne,"Ne"),u(Ne,"Ne"),o(Ne,"Ne");var dr=o((e,t,r)=>e.map(n=>Ne(n,t,r)),"dr"),hr=o((e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(r=>typeof t[r]=="function").find(r=>e instanceof t[r]),"hr");function Kn(e,t,r,n){let s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let l of i)try{if(typeof t.CanvasRenderingContext2D.prototype[l]!="function")continue;let d=oe(t.CanvasRenderingContext2D.prototype,l,function(a){return function(...f){return W(this.canvas,r,n,!0)||setTimeout(()=>{let y=dr(f,t,this);e(this.canvas,{type:pe["2D"],property:l,args:y})},0),a.apply(this,f)}});s.push(d)}catch{let d=Be(t.CanvasRenderingContext2D.prototype,l,{set(a){e(this.canvas,{type:pe["2D"],property:l,args:[a],setter:!0})}});s.push(d)}return()=>{s.forEach(l=>l())}}c(Kn,"Kn"),u(Kn,"Kn"),o(Kn,"Kn");function es(e){return e==="experimental-webgl"?"webgl":e}c(es,"es"),u(es,"es"),o(es,"es");function Pt(e,t,r,n){let s=[];try{let i=oe(e.HTMLCanvasElement.prototype,"getContext",function(l){return function(d,...a){if(!W(this,t,r,!0)){let f=es(d);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(a[0]&&typeof a[0]=="object"){let y=a[0];y.preserveDrawingBuffer||(y.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return l.apply(this,[d,...a])}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(i=>i())}}c(Pt,"Pt"),u(Pt,"Pt"),o(Pt,"Pt");function Ft(e,t,r,n,s,i){let l=[],d=Object.getOwnPropertyNames(e);for(let a of d)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let f=oe(e,a,function(y){return function(...h){let v=y.apply(this,h);if(ur(v,i,this),"tagName"in this.canvas&&!W(this.canvas,n,s,!0)){let b=dr(h,i,this),p={type:t,property:a,args:b};r(this.canvas,p)}return v}});l.push(f)}catch{let f=Be(e,a,{set(y){r(this.canvas,{type:t,property:a,args:[y],setter:!0})}});l.push(f)}return l}c(Ft,"Ft"),u(Ft,"Ft"),o(Ft,"Ft");function ts(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...Ft(t.WebGLRenderingContext.prototype,pe.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...Ft(t.WebGL2RenderingContext.prototype,pe.WebGL2,e,r,n,t)),()=>{s.forEach(i=>i())}}c(ts,"ts"),u(ts,"ts"),o(ts,"ts");var pr=`(function() {
|
|
25
|
+
or you can use record.mirror to access the mirror instance during recording.`,Ot={map:{},getId(){return console.error(ce),-1},getNode(){return console.error(ce),null},removeNodeFromMap(){console.error(ce)},has(){return console.error(ce),!1},reset(){console.error(ce)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ot=new Proxy(Ot,{get(t,e,r){return e==="map"&&console.error(ce),Reflect.get(t,e,r)}}));function Ce(t,e,r={}){let n=null,s=0;return function(...i){let l=Date.now();!s&&r.leading===!1&&(s=l);let c=e-(l-s),a=this;c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,t.apply(a,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,t.apply(a,i)},c))}}u(Ce,"Ce"),o(Ce,"Ce");function Be(t,e,r,n,s=window){let i=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,n?r:{set(l){setTimeout(()=>{r.set.call(this,l)},0),i&&i.set&&i.set.call(this,l)}}),()=>Be(t,e,i||{},!0)}u(Be,"Be"),o(Be,"Be");function Zt(t){var e,r,n,s;let i=t.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:i.documentElement.scrollLeft||i?.body&&((e=S.parentElement(i.body))==null?void 0:e.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=S.parentElement(i.body))==null?void 0:n.scrollTop)||((s=i?.body)==null?void 0:s.scrollTop)||0}}u(Zt,"Zt"),o(Zt,"Zt");function Qt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}u(Qt,"Qt"),o(Qt,"Qt");function Kt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}u(Kt,"Kt"),o(Kt,"Kt");function er(t){return t?t.nodeType===t.ELEMENT_NODE?t:S.parentElement(t):null}u(er,"er"),o(er,"er");function W(t,e,r,n){if(!t)return!1;let s=er(t);if(!s)return!1;try{if(typeof e=="string"){if(s.classList.contains(e)||n&&s.closest("."+e)!==null)return!0}else if(Fe(s,e,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}u(W,"W"),o(W,"W");function Nn(t,e){return e.getId(t)!==-1}u(Nn,"Nn"),o(Nn,"Nn");function Ye(t,e,r){return t.tagName==="TITLE"&&r.headTitleMutations?!0:e.getId(t)===Pe}u(Ye,"Ye"),o(Ye,"Ye");function tr(t,e){if(be(t))return!1;let r=e.getId(t);if(!e.has(r))return!0;let n=S.parentNode(t);return n&&n.nodeType===t.DOCUMENT_NODE?!1:n?tr(n,e):!0}u(tr,"tr"),o(tr,"tr");function et(t){return!!t.changedTouches}u(et,"et"),o(et,"et");function On(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach)}u(On,"On"),o(On,"On");function rr(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}u(rr,"rr"),o(rr,"rr");function nr(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}u(nr,"nr"),o(nr,"nr");function tt(t){return t?t instanceof Ke&&"shadowRoot"in t?!!t.shadowRoot:!!S.shadowRoot(t):!1}u(tt,"tt"),o(tt,"tt");var rt=class{static{u(this,"rt")}static{o(this,"rt")}constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let r;return e===void 0?r=this.id++:r=e,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 sr(t){var e;let r=null;return"getRootNode"in t&&((e=S.getRootNode(t))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&S.host(S.getRootNode(t))&&(r=S.host(S.getRootNode(t))),r}u(sr,"sr"),o(sr,"sr");function _n(t){let e=t,r;for(;r=sr(e);)e=r;return e}u(_n,"_n"),o(_n,"_n");function xn(t){let e=S.ownerDocument(t);if(!e)return!1;let r=_n(t);return S.contains(e,r)}u(xn,"xn"),o(xn,"xn");function ir(t){let e=S.ownerDocument(t);return e?S.contains(e,t)||xn(t):!1}u(ir,"ir"),o(ir,"ir");var _t=o((t,e)=>`${t}@${e}`,"_t"),nt=class{static{u(this,"nt")}static{o(this,"nt")}constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],e=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let d of this.movedSet){let b=S.parentNode(d);this.removesSubTreeCache.has(b)&&!this.movedSet.has(b)||this.addedSet.add(d)}let r=null,n=null,s=-1,i=null,l=!1,c=new Set,a=this.addedSet.values(),m=a.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(S.previousSibling(r)))i=r,r=S.previousSibling(r);else{for(this.addedSet.has(m.value)||(m=a.next()),r=m.value;;){if(n=S.parentNode(r),this.addedSet.has(n)){r=n;continue}break}if(c.has(n))n=null;else if(n){if(ir(n)?(l=xt(this.droppedSet,n)||this.removesSubTreeCache.has(n),l&&xt(this.movedSet,r)&&(l=!1)):l=!0,this.addedSet.has(S.lastChild(n)))r=S.lastChild(n),i=null;else for(;;){if(i=S.nextSibling(r),this.addedSet.has(i)){r=i;continue}break}if(s=be(n)?this.mirror.getId(sr(r)):this.mirror.getId(n),s===-1&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=S.host(n);s=this.mirror.getId(h)}}}if(this.addedSet.delete(r),!n||s===-1){c.add(r);continue}else if(l){this.droppedSet.add(r);continue}let d=!1;if(r.nodeType===Node.TEXT_NODE){let h=n.tagName;if(h==="TEXTAREA")continue;h==="STYLE"&&e.has(s)&&(d=!0)}let b=i?this.mirror.getId(i):null;for(;b===Pe;)i=i&&S.nextSibling(i),b=i&&this.mirror.getId(i);if(b===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",i),r=null;continue}let y=de(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:o(h=>{rr(h,this.mirror)&&this.iframeManager.addIframe(h),nr(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),tt(r)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(r),this.doc)},"onSerialize"),onIframeLoad:o((h,p)=>{this.iframeManager.attachIframe(h,p),this.shadowDomManager.observeAttachShadow(h)},"onIframeLoad"),onStylesheetLoad:o((h,p)=>{this.stylesheetManager.attachLinkElement(h,p)},"onStylesheetLoad"),cssCaptured:d});y&&(t.push({parentId:s,nextId:b,node:y}),e.add(y.id))}let f={texts:this.texts.map(d=>{let b=d.node,y=S.parentNode(b);return y&&y.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(y),{id:this.mirror.getId(b),value:d.value}}).filter(d=>!e.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{let{attributes:b}=d;if(typeof b.style=="string"){let y=JSON.stringify(d.styleDiff),h=JSON.stringify(d._unchangedStyles);y.length<b.style.length&&(y+h).split("var(").length===b.style.split("var(").length&&(b.style=d.styleDiff)}return{id:this.mirror.getId(d.node),attributes:b}}).filter(d=>!e.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:t};!f.texts.length&&!f.attributes.length&&!f.removes.length&&!f.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(f))}),g(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));let r=Array.from(S.childNodes(t),n=>S.textContent(n)||"").join("");e.attributes.value=xe({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Le(t),value:r,maskInputFn:this.maskInputFn})}),g(this,"processMutation",t=>{if(!Ye(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let e=S.textContent(t.target);!W(t.target,this.blockClass,this.blockSelector,!1)&&e!==t.oldValue&&this.texts.push({value:Jt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,er(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{let e=t.target,r=te(e.tagName),n=t.attributeName,s=t.target.getAttribute(n);if(n==="value"){let l=Le(e);s=xe({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:l,value:s,maskInputFn:this.maskInputFn})}if(W(t.target,this.blockClass,this.blockSelector,!1)||s===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r==="iframe"&&n==="src"&&!this.keepIframeSrcFn(s))if(!e.contentDocument)n="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),n==="type"&&r==="input"&&(t.oldValue||"").toLowerCase()==="password"&&e.setAttribute("data-rr-is-password","true"),!Xt(r,n))if(i.attributes[n]=qt(this.doc,r,te(n),s),n==="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 c of Array.from(e.style)){let a=e.style.getPropertyValue(c),m=e.style.getPropertyPriority(c);a!==l.style.getPropertyValue(c)||m!==l.style.getPropertyPriority(c)?m===""?i.styleDiff[c]=a:i.styleDiff[c]=[a,m]:i._unchangedStyles[c]=[a,m]}for(let c of Array.from(l.style))e.style.getPropertyValue(c)===""&&(i.styleDiff[c]=!1)}else n==="open"&&e.tagName==="DIALOG"&&(e.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(W(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{let r=this.mirror.getId(e),n=be(t.target)?this.mirror.getId(S.host(t.target)):this.mirror.getId(t.target);W(t.target,this.blockClass,this.blockSelector,!1)||Ye(e,this.mirror,this.slimDOMOptions)||!Nn(e,this.mirror)||(this.addedSet.has(e)?(st(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&r===-1||tr(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[_t(r,n)]?st(this.movedSet,e):(this.removes.push({parentId:n,id:r,isShadow:be(t.target)&&Se(t.target)?!0:void 0}),Ln(e,this.removesSubTreeCache))),this.mapRemoves.push(e))});break}}}),g(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ye(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&r!==-1&&(this.movedMap[_t(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);W(t,this.blockClass,this.blockSelector,!1)||(S.childNodes(t).forEach(r=>this.genAdds(r)),tt(t)&&S.childNodes(S.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","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function st(t,e){t.delete(e),S.childNodes(e).forEach(r=>st(t,r))}u(st,"st"),o(st,"st");function Ln(t,e){let r=[t];for(;r.length;){let n=r.pop();e.has(n)||(e.add(n),S.childNodes(n).forEach(s=>r.push(s)))}}u(Ln,"Ln"),o(Ln,"Ln");function xt(t,e){return t.size===0?!1:or(t,e)}u(xt,"xt"),o(xt,"xt");function or(t,e){if(t.has(e))return!0;let r=S.parentNode(e);return r?or(t,r):!1}u(or,"or"),o(or,"or");var we;function Dn(t){we=t}u(Dn,"Dn"),o(Dn,"Dn");function Pn(){we=void 0}u(Pn,"Pn"),o(Pn,"Pn");var R=o(t=>we?(...e)=>{try{return t(...e)}catch(r){if(we&&we(r)===!0)return;throw r}}:t,"R"),ie=[];function Ie(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}u(Ie,"Ie"),o(Ie,"Ie");function ar(t,e){let r=new nt;ie.push(r),r.init(t);let[n,s]=Bt(),i=new n(R(r.processMutations.bind(r)));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[i,s]}u(ar,"ar"),o(ar,"ar");function Fn({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===!1)return()=>{};let s=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,l=[],c,a=Ce(R(d=>{let b=Date.now()-c;t(l.map(y=>(y.timeOffset-=b,y)),d),l=[],c=null}),i),m=R(Ce(R(d=>{let b=Ie(d),{clientX:y,clientY:h}=et(d)?d.changedTouches[0]:d;c||(c=ve()),l.push({x:y,y:h,id:n.getId(b),timeOffset:ve()-c}),a(typeof DragEvent<"u"&&d instanceof DragEvent?I.Drag:d instanceof MouseEvent?I.MouseMove:I.TouchMove)}),s,{trailing:!1})),f=[U("mousemove",m,r),U("touchmove",m,r),U("drag",m,r)];return R(()=>{f.forEach(d=>d())})}u(Fn,"Fn"),o(Fn,"Fn");function Un({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:s,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let l=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,c=[],a=null,m=o(f=>d=>{let b=Ie(d);if(W(b,n,s,!0))return;let y=null,h=f;if("pointerType"in d){switch(d.pointerType){case"mouse":y=K.Mouse;break;case"touch":y=K.Touch;break;case"pen":y=K.Pen;break}y===K.Touch?z[f]===z.MouseDown?h="TouchStart":z[f]===z.MouseUp&&(h="TouchEnd"):K.Pen}else et(d)&&(y=K.Touch);y!==null?(a=y,(h.startsWith("Touch")&&y===K.Touch||h.startsWith("Mouse")&&y===K.Mouse)&&(y=null)):z[f]===z.Click&&(y=a,a=null);let p=et(d)?d.changedTouches[0]:d;if(!p)return;let v=r.getId(b),{clientX:k,clientY:C}=p;R(t)({type:z[h],id:v,x:k,y:C,...y!==null&&{pointerType:y}})},"u");return Object.keys(z).filter(f=>Number.isNaN(Number(f))&&!f.endsWith("_Departed")&&l[f]!==!1).forEach(f=>{let d=te(f),b=m(f);if(window.PointerEvent)switch(z[f]){case z.MouseDown:case z.MouseUp:d=d.replace("mouse","pointer");break;case z.TouchStart:case z.TouchEnd:return}c.push(U(d,b,e))}),R(()=>{c.forEach(f=>f())})}u(Un,"Un"),o(Un,"Un");function lr({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:s,sampling:i}){let l=R(Ce(R(c=>{let a=Ie(c);if(!a||W(a,n,s,!0))return;let m=r.getId(a);if(a===e&&e.defaultView){let f=Zt(e.defaultView);t({id:m,x:f.left,y:f.top})}else t({id:m,x:a.scrollLeft,y:a.scrollTop})}),i.scroll||100));return U("scroll",l,e)}u(lr,"lr"),o(lr,"lr");function Wn({viewportResizeCb:t},{win:e}){let r=-1,n=-1,s=R(Ce(R(()=>{let i=Qt(),l=Kt();(r!==i||n!==l)&&(t({width:Number(l),height:Number(i)}),r=i,n=l)}),200));return U("resize",s,e)}u(Wn,"Wn"),o(Wn,"Wn");var zn=["INPUT","TEXTAREA","SELECT"],Lt=new WeakMap;function Bn({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:s,ignoreClass:i,ignoreSelector:l,maskInputOptions:c,maskInputFn:a,sampling:m,userTriggeredOnInput:f}){function d(k){let C=Ie(k),w=k.isTrusted,T=C&&C.tagName;if(C&&T==="OPTION"&&(C=S.parentElement(C)),!C||!T||zn.indexOf(T)<0||W(C,n,s,!0)||C.classList.contains(i)||l&&C.matches(l))return;let P=C.value,N=!1,B=Le(C)||"";B==="radio"||B==="checkbox"?N=C.checked:(c[T.toLowerCase()]||c[B])&&(P=xe({element:C,maskInputOptions:c,tagName:T,type:B,value:P,maskInputFn:a})),b(C,f?{text:P,isChecked:N,userTriggered:w}:{text:P,isChecked:N});let vt=C.name;B==="radio"&&vt&&N&&e.querySelectorAll(`input[type="radio"][name="${vt}"]`).forEach(q=>{if(q!==C){let Y=q.value;b(q,f?{text:Y,isChecked:!N,userTriggered:!1}:{text:Y,isChecked:!N})}})}u(d,"c"),o(d,"h");function b(k,C){let w=Lt.get(k);if(!w||w.text!==C.text||w.isChecked!==C.isChecked){Lt.set(k,C);let T=r.getId(k);R(t)({...C,id:T})}}u(b,"y"),o(b,"f");let y=(m.input==="last"?["change"]:["input","change"]).map(k=>U(k,R(d),e)),h=e.defaultView;if(!h)return()=>{y.forEach(k=>k())};let p=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),v=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return p&&p.set&&y.push(...v.map(k=>Be(k[0],k[1],{set(){R(d)({target:this,isTrusted:!1})}},!1,h))),R(()=>{y.forEach(k=>k())})}u(Bn,"Bn"),o(Bn,"Bn");function Ue(t){let e=[];function r(n,s){if(Te("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Te("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Te("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Te("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let i=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(i),r(n.parentRule,s)}else if(n.parentStyleSheet){let i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(i)}return s}return u(r,"r"),o(r,"r"),r(t,e)}u(Ue,"Ue"),o(Ue,"Ue");function ee(t,e,r){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=r.getId(t),{styleId:s,id:n}):{}}u(ee,"ee"),o(ee,"ee");function Hn({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:R((f,d,b)=>{let[y,h]=b,{id:p,styleId:v}=ee(d,e,r.styleMirror);return(p&&p!==-1||v&&v!==-1)&&t({id:p,styleId:v,adds:[{rule:y,index:h}]}),f.apply(d,b)})}),n.CSSStyleSheet.prototype.addRule=function(f,d,b=this.cssRules.length){let y=`${f} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[y,b])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:R((f,d,b)=>{let[y]=b,{id:h,styleId:p}=ee(d,e,r.styleMirror);return(h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,removes:[{index:y}]}),f.apply(d,b)})}),n.CSSStyleSheet.prototype.removeRule=function(f){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[f])};let l;n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:R((f,d,b)=>{let[y]=b,{id:h,styleId:p}=ee(d,e,r.styleMirror);return(h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,replace:y}),f.apply(d,b)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:R((f,d,b)=>{let[y]=b,{id:h,styleId:p}=ee(d,e,r.styleMirror);return(h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,replaceSync:y}),f.apply(d,b)})}));let a={};Ae("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(Ae("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),Ae("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),Ae("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let m={};return Object.entries(a).forEach(([f,d])=>{m[f]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(m[f].insertRule,{apply:R((b,y,h)=>{let[p,v]=h,{id:k,styleId:C}=ee(y.parentStyleSheet,e,r.styleMirror);return(k&&k!==-1||C&&C!==-1)&&t({id:k,styleId:C,adds:[{rule:p,index:[...Ue(y),v||0]}]}),b.apply(y,h)})}),d.prototype.deleteRule=new Proxy(m[f].deleteRule,{apply:R((b,y,h)=>{let[p]=h,{id:v,styleId:k}=ee(y.parentStyleSheet,e,r.styleMirror);return(v&&v!==-1||k&&k!==-1)&&t({id:v,styleId:k,removes:[{index:[...Ue(y),p]}]}),b.apply(y,h)})})}),R(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=i,l&&(n.CSSStyleSheet.prototype.replace=l),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(a).forEach(([f,d])=>{d.prototype.insertRule=m[f].insertRule,d.prototype.deleteRule=m[f].deleteRule})})}u(Hn,"Hn"),o(Hn,"Hn");function cr({mirror:t,stylesheetManager:e},r){var n,s,i;let l=null;r.nodeName==="#document"?l=t.getId(r):l=t.getId(S.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:i.ShadowRoot,a=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return l===null||l===-1||!c||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var m;return(m=a.get)==null?void 0:m.call(this)},set(m){var f;let d=(f=a.set)==null?void 0:f.call(this,m);if(l!==null&&l!==-1)try{e.adoptStyleSheets(m,l)}catch{}return d}}),R(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}u(cr,"cr"),o(cr,"cr");function $n({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:R((c,a,m)=>{var f;let[d,b,y]=m;if(r.has(d))return i.apply(a,[d,b,y]);let{id:h,styleId:p}=ee((f=a.parentRule)==null?void 0:f.parentStyleSheet,e,n.styleMirror);return(h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,set:{property:d,value:b,priority:y},index:Ue(a.parentRule)}),c.apply(a,m)})});let l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:R((c,a,m)=>{var f;let[d]=m;if(r.has(d))return l.apply(a,[d]);let{id:b,styleId:y}=ee((f=a.parentRule)==null?void 0:f.parentStyleSheet,e,n.styleMirror);return(b&&b!==-1||y&&y!==-1)&&t({id:b,styleId:y,remove:{property:d},index:Ue(a.parentRule)}),c.apply(a,m)})}),R(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=l})}u($n,"$n"),o($n,"$n");function jn({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:s,doc:i}){let l=R(a=>Ce(R(m=>{let f=Ie(m);if(!f||W(f,e,r,!0))return;let{currentTime:d,volume:b,muted:y,playbackRate:h,loop:p}=f;t({type:a,id:n.getId(f),currentTime:d,volume:b,muted:y,playbackRate:h,loop:p})}),s.media||500)),c=[U("play",l(le.Play),i),U("pause",l(le.Pause),i),U("seeked",l(le.Seeked),i),U("volumechange",l(le.VolumeChange),i),U("ratechange",l(le.RateChange),i)];return R(()=>{c.forEach(a=>a())})}u(jn,"jn"),o(jn,"jn");function Gn({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(c,a,m){let f=new i(c,a,m);return s.set(f,{family:c,buffer:typeof a!="string",descriptors:m,fontSource:typeof a=="string"?a:JSON.stringify(Array.from(new Uint8Array(a)))}),f};let l=oe(e.fonts,"add",function(c){return function(a){return setTimeout(R(()=>{let m=s.get(a);m&&(t(m),s.delete(a))}),0),c.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(l),R(()=>{n.forEach(c=>c())})}u(Gn,"Gn"),o(Gn,"Gn");function Vn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:s,selectionCb:i}=t,l=!0,c=R(()=>{let a=e.getSelection();if(!a||l&&a?.isCollapsed)return;l=a.isCollapsed||!1;let m=[],f=a.rangeCount||0;for(let d=0;d<f;d++){let b=a.getRangeAt(d),{startContainer:y,startOffset:h,endContainer:p,endOffset:v}=b;W(y,n,s,!0)||W(p,n,s,!0)||m.push({start:r.getId(y),startOffset:h,end:r.getId(p),endOffset:v})}i({ranges:m})});return c(),U("selectionchange",c)}u(Vn,"Vn"),o(Vn,"Vn");function qn({doc:t,customElementCb:e}){let r=t.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(n){return function(s,i,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return n.apply(this,[s,i,l])}})}u(qn,"qn"),o(qn,"qn");function Xn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:l,inputCb:c,mediaInteractionCb:a,styleSheetRuleCb:m,styleDeclarationCb:f,canvasMutationCb:d,fontCb:b,selectionCb:y,customElementCb:h}=t;t.mutationCb=(...p)=>{e.mutation&&e.mutation(...p),r(...p)},t.mousemoveCb=(...p)=>{e.mousemove&&e.mousemove(...p),n(...p)},t.mouseInteractionCb=(...p)=>{e.mouseInteraction&&e.mouseInteraction(...p),s(...p)},t.scrollCb=(...p)=>{e.scroll&&e.scroll(...p),i(...p)},t.viewportResizeCb=(...p)=>{e.viewportResize&&e.viewportResize(...p),l(...p)},t.inputCb=(...p)=>{e.input&&e.input(...p),c(...p)},t.mediaInteractionCb=(...p)=>{e.mediaInteaction&&e.mediaInteaction(...p),a(...p)},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),m(...p)},t.styleDeclarationCb=(...p)=>{e.styleDeclaration&&e.styleDeclaration(...p),f(...p)},t.canvasMutationCb=(...p)=>{e.canvasMutation&&e.canvasMutation(...p),d(...p)},t.fontCb=(...p)=>{e.font&&e.font(...p),b(...p)},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),y(...p)},t.customElementCb=(...p)=>{e.customElement&&e.customElement(...p),h(...p)}}u(Xn,"Xn"),o(Xn,"Xn");function Jn(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};Xn(t,e);let n,s=o(()=>{},"s");t.recordDOM&&([n,s]=ar(t,t.doc));let i=Fn(t),l=Un(t),c=lr(t),a=Wn(t,{win:r}),m=Bn(t),f=jn(t),d=o(()=>{},"h"),b=o(()=>{},"f"),y=o(()=>{},"p"),h=o(()=>{},"m");t.recordDOM&&(d=Hn(t,{win:r}),b=cr(t,t.doc),y=$n(t,{win:r}),t.collectFonts&&(h=Gn(t)));let p=Vn(t),v=qn(t),k=[];for(let C of t.plugins)k.push(C.observer(C.callback,r,C.options));return R(()=>{ie.forEach(C=>C.reset()),n?.disconnect(),s(),i(),l(),c(),a(),m(),f(),d(),b(),y(),h(),p(),v(),k.forEach(C=>C())})}u(Jn,"Jn"),o(Jn,"Jn");function Te(t){return typeof window[t]<"u"}u(Te,"Te"),o(Te,"Te");function Ae(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}u(Ae,"Ae"),o(Ae,"Ae");var We=class{static{u(this,"We")}static{o(this,"We")}constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,n){let s=r||this.getIdToRemoteIdMap(t),i=n||this.getRemoteIdToIdMap(t),l=s.get(e);return l||(l=this.generateIdFn(),s.set(e,l),i.set(l,e)),l}getIds(t,e){let r=this.getIdToRemoteIdMap(t),n=this.getRemoteIdToIdMap(t);return e.map(s=>this.getId(t,s,r,n))}getRemoteId(t,e,r){let n=r||this.getRemoteIdToIdMap(t);return typeof e!="number"?e:n.get(e)||-1}getRemoteIds(t,e){let r=this.getRemoteIdToIdMap(t);return e.map(n=>this.getRemoteId(t,n,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 e=this.iframeIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeIdToRemoteIdMap.set(t,e)),e}getRemoteIdToIdMap(t){let e=this.iframeRemoteIdToIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToIdMap.set(t,e)),e}},it=class{static{u(this,"it")}static{o(this,"it")}constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new We(Vt)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new We(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,e){var r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let e=t;if(e.data.type!=="rrweb"||e.origin!==e.data.origin||!t.source)return;let r=this.crossOriginIframeMap.get(t.source);if(!r)return;let n=this.transformCrossOriginEvent(r,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){var r;switch(e.type){case M.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);let n=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(e.data.node,n),{timestamp:e.timestamp,type:M.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return e;case M.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case M.IncrementalSnapshot:switch(e.data.source){case I.Mutation:return e.data.adds.forEach(n=>{this.replaceIds(n,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(n.node,s)}),e.data.removes.forEach(n=>{this.replaceIds(n,t,["parentId","id"])}),e.data.attributes.forEach(n=>{this.replaceIds(n,t,["id"])}),e.data.texts.forEach(n=>{this.replaceIds(n,t,["id"])}),e;case I.Drag:case I.TouchMove:case I.MouseMove:return e.data.positions.forEach(n=>{this.replaceIds(n,t,["id"])}),e;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(e.data,t,["id"]),e;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case I.Font:return e;case I.Selection:return e.data.ranges.forEach(n=>{this.replaceIds(n,t,["start","end"])}),e;case I.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),(r=e.data.styles)==null||r.forEach(n=>{this.replaceStyleIds(n,t,["styleId"])}),e}}return!1}replace(t,e,r,n){for(let s of n)!Array.isArray(e[s])&&typeof e[s]!="number"||(Array.isArray(e[s])?e[s]=t.getIds(r,e[s]):e[s]=t.getId(r,e[s]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,e)})}patchRootIdOnNode(t,e){t.type!==D.Document&&!t.rootId&&(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,e)})}},ot=class{static{u(this,"ot")}static{o(this,"ot")}constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(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,e){if(!Se(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[r]=ar({...this.bypassOptions,doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(lr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(S.host(t))),this.restoreHandlers.push(cr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){let r=this;this.restoreHandlers.push(oe(t.prototype,"attachShadow",function(n){return function(s){let i=n.call(this,s),l=S.shadowRoot(this);return l&&ir(this)&&r.addShadowRoot(l,e),i}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},he="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ye=0;ye<he.length;ye++)Yn[he.charCodeAt(ye)]=ye;var ye,Zn=o(function(t){var e=new Uint8Array(t),r,n=e.length,s="";for(r=0;r<n;r+=3)s+=he[e[r]>>2],s+=he[(e[r]&3)<<4|e[r+1]>>4],s+=he[(e[r+1]&15)<<2|e[r+2]>>6],s+=he[e[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},"Zn"),Dt=new Map;function Qn(t,e){let r=Dt.get(t);return r||(r=new Map,Dt.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}u(Qn,"Qn"),o(Qn,"Qn");var ur=o((t,e,r)=>{if(!t||!(hr(t,e)||typeof t=="object"))return;let n=t.constructor.name,s=Qn(r,n),i=s.indexOf(t);return i===-1&&(i=s.length,s.push(t)),i},"ur");function Ne(t,e,r){if(t instanceof Array)return t.map(n=>Ne(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let n=t.constructor.name,s=Zn(t);return{rr_type:n,base64:s}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Ne(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:s}=t;return{rr_type:n,src:s}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",s=t.toDataURL();return{rr_type:n,src:s}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[Ne(t.data,e,r),t.width,t.height]};if(hr(t,e)||typeof t=="object"){let n=t.constructor.name,s=ur(t,e,r);return{rr_type:n,index:s}}}}return t}u(Ne,"Ne"),o(Ne,"Ne");var dr=o((t,e,r)=>t.map(n=>Ne(n,e,r)),"dr"),hr=o((t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(r=>typeof e[r]=="function").find(r=>t instanceof e[r]),"hr");function Kn(t,e,r,n){let s=[],i=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let l of i)try{if(typeof e.CanvasRenderingContext2D.prototype[l]!="function")continue;let c=oe(e.CanvasRenderingContext2D.prototype,l,function(a){return function(...m){return W(this.canvas,r,n,!0)||setTimeout(()=>{let f=dr(m,e,this);t(this.canvas,{type:pe["2D"],property:l,args:f})},0),a.apply(this,m)}});s.push(c)}catch{let c=Be(e.CanvasRenderingContext2D.prototype,l,{set(a){t(this.canvas,{type:pe["2D"],property:l,args:[a],setter:!0})}});s.push(c)}return()=>{s.forEach(l=>l())}}u(Kn,"Kn"),o(Kn,"Kn");function es(t){return t==="experimental-webgl"?"webgl":t}u(es,"es"),o(es,"es");function Pt(t,e,r,n){let s=[];try{let i=oe(t.HTMLCanvasElement.prototype,"getContext",function(l){return function(c,...a){if(!W(this,e,r,!0)){let m=es(c);if("__context"in this||(this.__context=m),n&&["webgl","webgl2"].includes(m))if(a[0]&&typeof a[0]=="object"){let f=a[0];f.preserveDrawingBuffer||(f.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return l.apply(this,[c,...a])}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(i=>i())}}u(Pt,"Pt"),o(Pt,"Pt");function Ft(t,e,r,n,s,i){let l=[],c=Object.getOwnPropertyNames(t);for(let a of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof t[a]!="function")continue;let m=oe(t,a,function(f){return function(...d){let b=f.apply(this,d);if(ur(b,i,this),"tagName"in this.canvas&&!W(this.canvas,n,s,!0)){let y=dr(d,i,this),h={type:e,property:a,args:y};r(this.canvas,h)}return b}});l.push(m)}catch{let m=Be(t,a,{set(f){r(this.canvas,{type:e,property:a,args:[f],setter:!0})}});l.push(m)}return l}u(Ft,"Ft"),o(Ft,"Ft");function ts(t,e,r,n){let s=[];return typeof e.WebGLRenderingContext<"u"&&s.push(...Ft(e.WebGLRenderingContext.prototype,pe.WebGL,t,r,n,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...Ft(e.WebGL2RenderingContext.prototype,pe.WebGL2,t,r,n,e)),()=>{s.forEach(i=>i())}}u(ts,"ts"),o(ts,"ts");var pr=`(function() {
|
|
26
26
|
"use strict";
|
|
27
27
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
28
28
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
@@ -97,4 +97,4 @@ or you can use record.mirror to access the mirror instance during recording.`,Ot
|
|
|
97
97
|
};
|
|
98
98
|
})();
|
|
99
99
|
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
100
|
-
`,Ut=typeof self<"u"&&self.Blob&&new Blob([pr],{type:"text/javascript;charset=utf-8"});function rs(e){let t;try{if(t=Ut&&(self.URL||self.webkitURL).createObjectURL(Ut),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(pr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}c(rs,"rs"),u(rs,"rs"),o(rs,"rs");var at=class{static{c(this,"at")}static{u(this,"at")}static{o(this,"at")}constructor(e){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(d,a)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(a)});let{sampling:t="all",win:r,blockClass:n,blockSelector:s,recordCanvas:i,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&t==="all"&&this.initCanvasMutationObserver(r,n,s),i&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,n,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(e,t,r,n,s){let i=Pt(t,r,n,!0),l=new Map,d=new rs;d.onmessage=b=>{let{id:p}=b.data;if(l.set(p,!1),!("base64"in b.data))return;let{base64:m,type:w,width:T,height:k}=b.data;this.mutationCb({id:p,type:pe["2D"],commands:[{property:"clearRect",args:[0,0,T,k]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:m}],type:w}]},0,0]}]})};let a=1e3/e,f=0,y,h=o(()=>{let b=[];return t.document.querySelectorAll("canvas").forEach(p=>{W(p,r,n,!0)||b.push(p)}),b},"f"),v=o(b=>{if(f&&b-f<a){y=requestAnimationFrame(v);return}f=b,h().forEach(async p=>{var m;let w=this.mirror.getId(p);if(l.get(w)||p.width===0||p.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(p.__context)){let k=p.getContext(p.__context);((m=k?.getContextAttributes())==null?void 0:m.preserveDrawingBuffer)===!1&&k.clear(k.COLOR_BUFFER_BIT)}let T=await createImageBitmap(p);d.postMessage({id:w,bitmap:T,width:p.width,height:p.height,dataURLOptions:s.dataURLOptions},[T])}),y=requestAnimationFrame(v)},"p");y=requestAnimationFrame(v),this.resetObservers=()=>{i(),cancelAnimationFrame(y)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=Pt(e,t,r,!1),s=Kn(this.processMutation.bind(this),e,t,r),i=ts(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=o(t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)},"t");requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let n=r.map(i=>{let{type:l,...d}=i;return d}),{type:s}=r[0];this.mutationCb({id:t,type:s,commands:n}),this.pendingCanvasMutations.delete(e)}},lt=class{static{c(this,"lt")}static{u(this,"lt")}static{o(this,"lt")}constructor(e){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new rt),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},n=[];for(let s of e){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),n.push({styleId:i,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:$t(l,s.href),index:d}))})),r.styleIds.push(i)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},ct=class{static{c(this,"ct")}static{u(this,"ct")}static{o(this,"ct")}constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(n=>n!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},L,Oe,Ze,ze=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Mt=e.contentWindow)==null?void 0:Mt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var X=rn();function fe(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:i=null,ignoreClass:l="rr-ignore",ignoreSelector:d=null,maskTextClass:a="rr-mask",maskTextSelector:f=null,inlineStylesheet:y=!0,maskAllInputs:h,maskInputOptions:v,slimDOMOptions:b,maskInputFn:p,maskTextFn:m,hooks:w,packFn:T,sampling:k={},dataURLOptions:C={},mousemoveWait:O,recordDOM:$=!0,recordCanvas:F=!1,recordCrossOriginIframes:j=!1,recordAfter:se=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:q=!1,collectFonts:Q=!1,inlineImages:re=!1,plugins:ne,keepIframeSrcFn:E=o(()=>!1,"E"),ignoreCSSAttributes:Re=new Set([]),errorHandler:qe}=e;Dn(qe);let B=j?window.parent===window:!0,G=!1;if(!B)try{window.parent.document&&(G=!1)}catch{G=!0}if(B&&!t)throw new Error("emit function is required");if(!B&&!G)return()=>{};O!==void 0&&k.mousemove===void 0&&(k.mousemove=O),X.reset();let me=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}:v!==void 0?v:{password:!0},Z=Yt(b);On();let It,yt=0,Rt=o(x=>{for(let Y of ne||[])Y.eventProcessor&&(x=Y.eventProcessor(x));return T&&!G&&(x=T(x)),x},"Ct");L=o((x,Y)=>{var _;let P=x;if(P.timestamp=ve(),(_=ie[0])!=null&&_.isFrozen()&&P.type!==M.FullSnapshot&&!(P.type===M.IncrementalSnapshot&&P.data.source===I.Mutation)&&ie.forEach(V=>V.unfreeze()),B)t?.(Rt(P),Y);else if(G){let V={type:"rrweb",event:Rt(P),origin:window.location.origin,isCheckout:Y};window.parent.postMessage(V,"*")}if(P.type===M.FullSnapshot)It=P,yt=0;else if(P.type===M.IncrementalSnapshot){if(P.data.source===I.Mutation&&P.data.isAttachIframe)return;yt++;let V=n&&yt>=n,N=r&&P.timestamp-It.timestamp>r;(V||N)&&Oe(!0)}},"L");let Ve=o(x=>{L({type:M.IncrementalSnapshot,data:{source:I.Mutation,...x}})},"Re"),Or=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.Scroll,...x}}),"It"),Os=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.CanvasMutation,...x}}),"Rt"),$s=o(x=>L({type:M.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...x}}),"Or"),ge=new lt({mutationCb:Ve,adoptedStyleSheetCb:$s}),Me=new it({mirror:X,mutationCb:Ve,stylesheetManager:ge,recordCrossOriginIframes:j,wrappedEmit:L});for(let x of ne||[])x.getMirror&&x.getMirror({nodeMirror:X,crossOriginIframeMirror:Me.crossOriginIframeMirror,crossOriginIframeStyleMirror:Me.crossOriginIframeStyleMirror});let vt=new ct;Ze=new at({recordCanvas:F,mutationCb:Os,win:window,blockClass:s,blockSelector:i,mirror:X,sampling:k.canvas,dataURLOptions:C});let Ge=new ot({mutationCb:Ve,scrollCb:Or,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:f,inlineStylesheet:y,maskInputOptions:me,dataURLOptions:C,maskTextFn:m,maskInputFn:p,recordCanvas:F,inlineImages:re,sampling:k,slimDOMOptions:Z,iframeManager:Me,stylesheetManager:ge,canvasManager:Ze,keepIframeSrcFn:E,processedNodeManager:vt},mirror:X});Oe=o((x=!1)=>{if(!$)return;L({type:M.Meta,data:{href:window.location.href,width:Kt(),height:Qt()}},x),ge.reset(),Ge.init(),ie.forEach(_=>_.lock());let Y=An(document,{mirror:X,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:f,inlineStylesheet:y,maskAllInputs:me,maskTextFn:m,maskInputFn:p,slimDOM:Z,dataURLOptions:C,recordCanvas:F,inlineImages:re,onSerialize:o(_=>{rr(_,X)&&Me.addIframe(_),nr(_,X)&&ge.trackLinkElement(_),tt(_)&&Ge.addShadowRoot(S.shadowRoot(_),document)},"onSerialize"),onIframeLoad:o((_,P)=>{Me.attachIframe(_,P),Ge.observeAttachShadow(_)},"onIframeLoad"),onStylesheetLoad:o((_,P)=>{ge.attachLinkElement(_,P)},"onStylesheetLoad"),keepIframeSrcFn:E});if(!Y)return console.warn("Failed to snapshot the document");L({type:M.FullSnapshot,data:{node:Y,initialOffset:Zt(window)}},x),ie.forEach(_=>_.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ge.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))},"Oe");try{let x=[],Y=o(P=>{var V;return R(Jn)({mutationCb:Ve,mousemoveCb:o((N,Ct)=>L({type:M.IncrementalSnapshot,data:{source:Ct,positions:N}}),"mousemoveCb"),mouseInteractionCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.MouseInteraction,...N}}),"mouseInteractionCb"),scrollCb:Or,viewportResizeCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.ViewportResize,...N}}),"viewportResizeCb"),inputCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.Input,...N}}),"inputCb"),mediaInteractionCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.MediaInteraction,...N}}),"mediaInteractionCb"),styleSheetRuleCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.StyleSheetRule,...N}}),"styleSheetRuleCb"),styleDeclarationCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.StyleDeclaration,...N}}),"styleDeclarationCb"),canvasMutationCb:Os,fontCb:o(N=>L({type:M.IncrementalSnapshot,data:{source:I.Font,...N}}),"fontCb"),selectionCb:o(N=>{L({type:M.IncrementalSnapshot,data:{source:I.Selection,...N}})},"selectionCb"),customElementCb:o(N=>{L({type:M.IncrementalSnapshot,data:{source:I.CustomElement,...N}})},"customElementCb"),blockClass:s,ignoreClass:l,ignoreSelector:d,maskTextClass:a,maskTextSelector:f,maskInputOptions:me,inlineStylesheet:y,sampling:k,recordDOM:$,recordCanvas:F,inlineImages:re,userTriggeredOnInput:q,collectFonts:Q,doc:P,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:E,blockSelector:i,slimDOMOptions:Z,dataURLOptions:C,mirror:X,iframeManager:Me,stylesheetManager:ge,shadowDomManager:Ge,processedNodeManager:vt,canvasManager:Ze,ignoreCSSAttributes:Re,plugins:((V=ne?.filter(N=>N.observer))==null?void 0:V.map(N=>({observer:N.observer,options:N.options,callback:o(Ct=>L({type:M.Plugin,data:{plugin:N.name,payload:Ct}}),"callback")})))||[]},w)},"q");Me.addLoadListener(P=>{try{x.push(Y(P.contentDocument))}catch(V){console.warn(V)}});let _=o(()=>{Oe(),x.push(Y(document)),ze=!0},"_");return["interactive","complete"].includes(document.readyState)?_():(x.push(U("DOMContentLoaded",()=>{L({type:M.DomContentLoaded,data:{}}),se==="DOMContentLoaded"&&_()})),x.push(U("load",()=>{L({type:M.Load,data:{}}),se==="load"&&_()},window))),()=>{x.forEach(P=>{try{P()}catch(V){String(V).toLowerCase().includes("cross-origin")||console.warn(V)}}),vt.destroy(),ze=!1,Pn()}}catch(x){console.warn(x)}}c(fe,"fe"),u(fe,"fe"),o(fe,"fe"),fe.addCustomEvent=(e,t)=>{if(!ze)throw new Error("please add custom event after start recording");L({type:M.Custom,data:{tag:e,payload:t}})},fe.freezePage=()=>{ie.forEach(e=>e.freeze())},fe.takeFullSnapshot=e=>{if(!ze)throw new Error("please take full snapshot after start recording");Oe(e)},fe.mirror=X;var fr="REDACTED",ns=["token","secret","password","passwd","apikey","credential","assertion","signature"],ss=new Set(["key","auth","authorization","jwt","code","sig","pwd","pass","session","sid","bearer","otp","cookie","set-cookie"]),is=/^(?:(?:prompt|completion|total|input|output|cache|cached|cacheread|cachewrite|reasoning|thinking|max|min|remaining|used|billed)tokens|tokens?(?:count|used|limit|remaining))$/;function os(e){let t=ht.get(e);if(t!==void 0)return t;let r=ls(e);return e.length<=64&&ht.size<as&&ht.set(e,r),r}c(os,"os"),u(os,"os"),o(os,"os");var as=4096,ht=new Map;function ls(e){let t=e.toLowerCase();if(is.test(t.replace(/[-_.]+/g,"")))return!1;if(ns.some(r=>t.includes(r)))return!0;for(let r of t.split(/[-_.]+/))if(r&&ss.has(r))return!0;return!1}c(ls,"ls"),u(ls,"ls"),o(ls,"ls");var cs=/^([a-z][a-z0-9+.-]*:\/\/)[^/?#@\s]*@/i,us=/([?&#])([^=&#\s]+)=([^&#\s]*)/g;function ds(e){return e&&e.replace(cs,`$1${fr}@`).replace(us,(t,r,n)=>os(n)?`${r}${n}=${fr}`:t)}c(ds,"ds"),u(ds,"ds"),o(ds,"ds");function mr(e){return e&&hs(ds(e),1024)}c(mr,"mr"),u(mr,"mr"),o(mr,"mr");function hs(e,t){return e.length<=t?e:`${e.slice(0,t)}\u2026[lensmcp truncated: ${e.length-t} more chars]`}c(hs,"hs"),u(hs,"hs"),o(hs,"hs");var pt=String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][\w$]*)`,ft=String.raw`${pt}(?:\s*\.\s*${pt})*`,ps=String.raw`(?:=|<>|!=|<=|>=|<|>|(?:NOT\s+)?I?LIKE|IS\s+(?:NOT\s+)?DISTINCT\s+FROM)`,_s=new RegExp(String.raw`(${ft})\s*${ps}\s*(?:[A-Za-z_]\w*\s*\(\s*)?\$(\d+)`,"gi"),xs=new RegExp(String.raw`(${ft})\s+(?:NOT\s+)?IN\s*\(([^()]*)\)`,"gi"),Ls=new RegExp(String.raw`\bINSERT\s+INTO\s+${ft}\s*\(([^()]*)\)\s*VALUES\s*`,"gi"),Ds=new RegExp(pt,"g"),fs=["lens/session","lens/flow","lens/target","lens/request","lens/response","lens/visit","lens/nav","lens/hmr","lens/error","lens/gap"],ms=new Set(fs);function gs(e){return typeof e=="string"&&ms.has(e)}c(gs,"gs"),u(gs,"gs"),o(gs,"gs");var gr=512,ys=20,bs=3,Ss=new Set(["url","to","from"]);function yr(e,t){if(!(!gs(e)||!t||typeof t!="object"||Array.isArray(t)))return mt(t,0,void 0)}c(yr,"yr"),u(yr,"yr"),o(yr,"yr");function mt(e,t,r){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string"){let s=r&&Ss.has(r)?mr(e):e;return s.length>gr?`${s.slice(0,gr-1)}\u2026`:s}if(typeof e!="object"||t>=bs)return;if(Array.isArray(e))return e.slice(0,ys).map(s=>mt(s,t+1,void 0));let n={};for(let[s,i]of Object.entries(e)){let l=mt(i,t+1,s);l!==void 0&&(n[s]=l)}return n}c(mt,"mt"),u(mt,"mt"),o(mt,"mt");function br(e,t){return e==="lens/flow"&&typeof t.flowId=="string"?[`f:${t.flowId}`]:(e==="lens/request"||e==="lens/response")&&typeof t.requestId=="string"?[`r:${t.requestId}`]:e==="lens/visit"&&typeof t.visitId=="string"?[`v:${t.visitId}`]:[]}c(br,"br"),u(br,"br"),o(br,"br");var Sr="\0lens-blob:";async function wr(e,t){let r=await e.digest("SHA-256",new TextEncoder().encode(t)),n="";for(let s of new Uint8Array(r))n+=s.toString(16).padStart(2,"0");return n}c(wr,"wr"),u(wr,"wr"),o(wr,"wr");async function vr(e,t){let r=[],n=new Map,s,i=0;for(let a of e){let f=t.perf();if(!t.subtle||a.type!==2&&a.type!==3){r.push(JSON.stringify(a)),i+=t.perf()-f;continue}if(a.type===2&&t.isBase(a)){let v=a.data,b=JSON.stringify(v.node);i+=t.perf()-f;let p=await wr(t.subtle,b);f=t.perf(),n.set(p,b),s=p,r.push(gt(a,JSON.stringify({...v,node:Sr+p}))),i+=t.perf()-f;continue}let y=JSON.stringify(a.data);if(y.length<t.blobMinChars){r.push(gt(a,y)),i+=t.perf()-f;continue}i+=t.perf()-f;let h=await wr(t.subtle,y);f=t.perf(),n.set(h,y),r.push(gt(a,JSON.stringify(Sr+h))),i+=t.perf()-f}let l=t.perf(),d=`[${r.join(",")}]`;return i+=t.perf()-l,{json:d,blobs:n,...s?{base:s}:{},ms:i}}c(vr,"vr"),u(vr,"vr"),o(vr,"vr");function gt(e,t){let r=e.delay;return`{"type":${e.type},"data":${t},"timestamp":${e.timestamp}${r!==void 0?`,"delay":${r}`:""}}`}c(gt,"gt"),u(gt,"gt"),o(gt,"gt");var He=class{static{c(this,"He")}static{u(this,"He")}static{o(this,"He")}constructor(e,t,r="lensmcp:replay:blobs"){this.max=e,this.storage=t,this.key=r,this.set=new Set;try{let n=t?.getItem(r),s=n?JSON.parse(n):[];if(Array.isArray(s))for(let i of s.slice(-e))typeof i=="string"&&/^[0-9a-f]{64}$/.test(i)&&this.set.add(i)}catch{}}has(e){return this.set.has(e)}add(e){for(this.set.delete(e),this.set.add(e);this.set.size>this.max;)this.set.delete(this.set.values().next().value);this.save()}forget(e){this.set.delete(e)&&this.save()}save(){try{this.storage?.setItem(this.key,JSON.stringify([...this.set]))}catch{}}},ws="a,button,input,select,textarea,label,summary,option,[role],[data-testid],[onclick],[tabindex]",vs=o(e=>!!e&&typeof e.closest=="function"&&typeof e.getAttribute=="function"&&typeof e.tagName=="string","vs");function Cr(e,t,r){if(!vs(e))return;let n=e.closest(ws)??e,s=o(w=>n.getAttribute(w)??void 0,"s"),i=(n.textContent??"").replace(/\s+/g," ").trim(),l=n.closest("[data-agent-source]"),d=n.closest("[data-agent-component]"),a=-1;try{a=r(n)}catch{}let f={kind:t,id:a,tag:n.tagName.toLowerCase()},y=s("role");y&&(f.role=y),i&&(f.text=i.length>80?`${i.slice(0,79)}\u2026`:i);let h=s("aria-label")??s("title")??s("placeholder")??s("name")??s("alt");h&&(f.label=h);let v=s("data-testid")??s("data-test")??s("data-cy");v&&(f.testId=v);let b=n.tagName==="INPUT"?s("type"):void 0;b&&(f.inputType=b);let p=l?.getAttribute("data-agent-source");p&&(f.source=p);let m=d?.getAttribute("data-agent-component");return m&&(f.component=m),f}c(Cr,"Cr"),u(Cr,"Cr"),o(Cr,"Cr");var Ir="2.1.7",Rr={maskAllInputs:!1,blockSelector:"[data-lens-private]"},Mr={flushMs:2e3,flushChars:256*1024,flushEvents:2e3,checkoutEveryMs:18e4,pendingChars:8*1024*1024,blobMinChars:8*1024,beaconMaxBytes:6e4,retryMaxMs:1e4,noChannelAfter:4,budgetMsPerSecond:50,budgetSeconds:5,knownHashes:2e3},Cs=4e3;async function bt(e){if(!(typeof CompressionStream!="function"||typeof Blob!="function"||typeof Response!="function"))try{let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}c(bt,"bt"),u(bt,"bt"),o(bt,"bt");var $e=class{static{c(this,"$e")}static{u(this,"$e")}static{o(this,"$e")}constructor(e){this.o=e,this.queue=[],this.busy=!1,this.queued=0,this.answered=!1,this.networkFailures=0,this.disabled=!1}get pendingSize(){return this.queued}enqueue(e){this.disabled||(this.queue.push(e),this.queued+=e.size,this.pump())}drop(){let e=this.queue[0]?.summary.seq;for(let t of this.queue.splice(0))this.queued-=t.size;return e}beaconQueued(){for(let e of this.queue.splice(0))this.queued-=e.size,[...e.blobs.keys()].every(t=>this.o.known.has(t))&&this.beacon(e.summary,e.body,e.enc)}beacon(e,t,r){let n=this.o.env.sendBeacon,s=typeof t=="string"?t.length:t.byteLength;if(this.disabled||!n||s>this.o.beaconMaxBytes)return!1;try{return n(this.url("/replay",this.params(e,r,[])),new Blob([t],{type:"text/plain"}))}catch{return!1}}async pump(){if(!this.busy){this.busy=!0;try{for(;!this.disabled&&this.queue.length;){let e=this.queue.shift(),t=await this.send(e);this.queued-=e.size,t==="refused"&&(this.disabled=!0),this.o.onOutcome(e,t)}}finally{this.busy=!1}}}async send(e){for(let t=0;!this.disabled;t++){t>0&&await this.sleep(Math.min(this.o.retryMaxMs,500*2**(t-1)));try{for(let[s,i]of e.blobs){if(this.o.known.has(s))continue;let l=await bt(i),d=await this.post("/replay/blob",{sha:s,enc:l?"gzip":"identity"},l??i);if(d.status>=200&&d.status<300){this.o.known.add(s);continue}let a=Er(d.status);if(a)return a;throw new Error(`blob ${d.status}`)}let r=await this.post("/replay",this.params(e.summary,e.enc,[...e.blobs.keys()]),e.body);if(r.status>=200&&r.status<300)return this.answered=!0,"ok";if(r.status===409){let s=await Is(r);for(let i of s.length?s:e.blobs.keys())this.o.known.forget(i);continue}let n=Er(r.status);if(n)return n}catch{if(!this.answered&&++this.networkFailures>=this.o.noChannelAfter)return"refused"}}return"refused"}params(e,t,r){let n={v:String(1),load:this.o.loadId,tab:this.o.tabId,seq:String(e.seq),t0:String(e.t0),t1:String(e.t1),n:String(e.n),full:e.full?"1":"0",enc:t};if(this.o.app&&(n.app=this.o.app),e.base&&(n.base=e.base),e.anchors.length){let s="";for(let i of e.anchors){if(s.length+i.length+1>Cs){n.am="1";break}s+=(s?",":"")+i}n.a=s}return r.length&&(n.b=r.join(",")),n}url(e,t){let r=new URLSearchParams(this.o.token?{token:this.o.token,...t}:t);return`${this.o.endpoint}${e}?${r.toString()}`}async post(e,t,r){let n=await this.o.env.fetch(this.url(e,t),{method:"POST",headers:{"content-type":"text/plain"},body:r,credentials:"omit",keepalive:(typeof r=="string"?r.length:r.byteLength)<=this.o.beaconMaxBytes}),s=await n.text().catch(()=>"");return{status:n.status,text:o(async()=>s,"text")}}sleep(e){return new Promise(t=>this.o.env.setTimeout(t,e))}};function Er(e){if(e===413)return"too-big";if(e===400||e===401||e===403||e===404||e===405||e===426)return"refused"}c(Er,"Er"),u(Er,"Er"),o(Er,"Er");async function Is(e){try{let t=JSON.parse(await e.text());return Array.isArray(t.missing)?t.missing.filter(r=>typeof r=="string"):[]}catch{return[]}}c(Is,"Is"),u(Is,"Is"),o(Is,"Is");var St=2,Rs=3,kr=4,Ms=5,Es=0;function ks(e){if(e.type===St)return 64*1024;if(e.type===Rs){let t=e.data;if(t.source===Es)return 64+160*(t.adds?.length??0)+60*(t.attributes?.length??0)+80*(t.texts?.length??0)+24*(t.removes?.length??0)}return 120}c(ks,"ks"),u(ks,"ks"),o(ks,"ks");var Ts=o(()=>`load-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,"Ts"),je=class{static{c(this,"je")}static{u(this,"je")}static{o(this,"je")}constructor(e,t){this.cfg=e,this.env=t,this.loadId=Ts(),this.state="idle",this.seq=0,this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.awaitingCheckout=!1,this.checkoutPending=!1,this.processing=Promise.resolve(),this.costWindowStart=0,this.costSpent=0,this.overSeconds=0,this.limits={...Mr,...e.limits},this.privacy={...Rr,...e.privacy},this.record=e.record,this.uploader=new $e({endpoint:e.endpoint.replace(/\/+$/,""),...e.token?{token:e.token}:{},tabId:e.tabId,loadId:this.loadId,...e.app?{app:e.app}:{},env:t,known:new He(this.limits.knownHashes,t.storage),retryMaxMs:this.limits.retryMaxMs,noChannelAfter:this.limits.noChannelAfter,beaconMaxBytes:this.limits.beaconMaxBytes,onOutcome:o((r,n)=>this.onOutcome(r,n),"onOutcome")})}get status(){return this.state}start(){this.state==="idle"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.begin(),this.mark("lens/session",{tabId:this.cfg.tabId,loadId:this.loadId,...this.cfg.app?{app:this.cfg.app}:{},url:this.env.href(),wire:1,rrweb:Ir,viewport:this.env.viewport()}))}mark(e,t){if(e==="lens/nav"&&this.state==="paused"&&this.resume(),this.state!=="recording")return;let r=yr(e,t);if(r)try{this.record.addCustomEvent(e,r)}catch{}}target(e,t){if(this.state!=="recording")return;let r=Cr(e,t,n=>this.record.mirror.getId(n));r&&this.mark("lens/target",r)}checkpoint(){this.state!=="recording"||this.checkoutPending||this.awaitingCheckout||(this.checkoutPending=!0,this.env.idle(()=>{this.checkoutPending=!1,this.checkoutNow()||this.env.idle(()=>this.checkoutNow())}))}pagehide(){if(this.state!=="recording"&&this.state!=="paused"||(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),this.uploader.beaconQueued(),!this.buffer.length||this.awaitingCheckout))return;let e=this.buffer,t=this.takeSummary(e);try{this.uploader.beacon(t,JSON.stringify(e),"identity")}catch{}}stop(){this.state!=="stopped"&&(this.state==="recording"&&this.cut(),this.halt())}begin(){let e=this.privacy;try{this.stopRecord=this.record({emit:o(t=>this.onEmit(t),"emit"),checkoutEveryNms:this.limits.checkoutEveryMs,maskAllInputs:e.maskAllInputs,...e.maskAllInputs?{}:{maskInputOptions:{password:!1}},...e.maskTextSelector?{maskTextSelector:e.maskTextSelector}:{},...e.blockSelector?{blockSelector:e.blockSelector}:{},slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,collectFonts:!1,errorHandler:o(()=>!0,"errorHandler")})}catch{this.halt()}}onEmit(e){if(this.state!=="recording"||this.awaitingCheckout)return;let t=this.env.perf();if(e.type===kr&&this.buffer.length&&this.cut(),e.type===St&&!this.base&&(this.base=e),this.buffer.push(e),this.bufferChars+=ks(e),e.type===Ms){let r=e.data;typeof r.tag=="string"&&r.payload&&typeof r.payload=="object"&&this.bufferAnchors.push(...br(r.tag,r.payload))}this.buffer.length>=this.limits.flushEvents||this.bufferChars>=this.limits.flushChars?this.cut():this.timer===void 0&&(this.timer=this.env.setTimeout(()=>{this.timer=void 0,this.cut()},this.limits.flushMs)),this.spend(this.env.perf()-t)}takeSummary(e){let t={seq:this.seq++,t0:e[0]?.timestamp??0,t1:e[e.length-1]?.timestamp??0,n:e.length,full:e[0]?.type===kr&&e.some(r=>r.type===St),anchors:[...new Set(this.bufferAnchors)]};return this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],t}cut(){if(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),!this.buffer.length)return;let e=this.buffer,t=this.takeSummary(e);this.processing=this.processing.then(()=>this.prepare(t,e)).catch(()=>{})}async prepare(e,t){if(this.uploader.disabled||this.state==="stopped")return;let r=await vr(t,{...this.env.subtle?{subtle:this.env.subtle}:{},blobMinChars:this.limits.blobMinChars,isBase:o(d=>d===this.base,"isBase"),perf:o(()=>this.env.perf(),"perf")});this.spend(r.ms);let n=await bt(r.json),s=n??r.json,i=typeof s=="string"?s.length:s.byteLength;for(let d of r.blobs.values())i+=d.length;let l={summary:r.base?{...e,base:r.base}:e,body:s,enc:n?"gzip":"identity",blobs:r.blobs,size:i};this.uploader.enqueue(l),this.uploader.pendingSize>this.limits.pendingChars&&this.gap("overflow")}onOutcome(e,t){if(t==="refused"){this.halt();return}if(t==="too-big"){this.gap("too-big",e.summary.seq);return}this.awaitingCheckout&&(this.awaitingCheckout=!1,this.checkoutNow())}gap(e,t){if(this.state!=="recording"||this.awaitingCheckout)return;let r=this.uploader.drop();this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.mark("lens/gap",{fromSeq:t??r??this.seq,reason:e}),this.cut(),this.awaitingCheckout=!0,this.publish("replay-gap",`session replay lost a stretch of this page (${e})`,{reason:e,fromSeq:t??r??this.seq})}checkoutNow(){if(this.state!=="recording")return!0;let e=this.env.perf();try{return this.record.takeFullSnapshot(!0),!0}catch{return!1}finally{this.spend(this.env.perf()-e)}}spend(e){let t=this.env.perf();if(t-this.costWindowStart>=1e3&&(this.overSeconds=this.costSpent>this.limits.budgetMsPerSecond?this.overSeconds+1:0,this.costSpent=0,this.costWindowStart=t,this.overSeconds>=this.limits.budgetSeconds)){this.pause();return}this.costSpent+=e}pause(){if(this.state==="recording"){this.mark("lens/gap",{fromSeq:this.seq,reason:"budget"}),this.cut();try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.state="paused",this.overSeconds=0,this.publish("replay-paused",`session replay paused: its own work stayed over ${this.limits.budgetMsPerSecond} ms a second for ${this.limits.budgetSeconds} s`,{})}}resume(){this.state==="paused"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.costSpent=0,this.begin())}halt(){this.state="stopped",this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0);try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.uploader.drop(),this.buffer=[]}publish(e,t,r){try{this.env.publish?.({source:"client-runtime",category:"runtime",severity:"info",title:t,fingerprint:`replay:${e}:${this.loadId}`,raw:{kind:e,loadId:this.loadId,tabId:this.cfg.tabId,...r}})}catch{}}},wt="__LENSMCP_REPLAY__",As=["click","submit","change"];function Tr(e){if(typeof window>"u"||typeof document>"u")return;let t=globalThis;if(t[wt]===!1)return;let r=t[wt];if(r)return r;let n=new je(e,Ns(e.env)),s={loadId:n.loadId,mark:o((i,l)=>n.mark(i,l),"mark"),checkpoint:o(()=>n.checkpoint(),"checkpoint"),stop:o(()=>n.stop(),"stop")};t[wt]=s,n.start();for(let i of As)document.addEventListener(i,l=>n.target(l.target,i),{capture:!0,passive:!0});return window.addEventListener("pagehide",()=>n.pagehide()),s}c(Tr,"Tr"),u(Tr,"Tr"),o(Tr,"Tr");function Ns(e={}){let t=window,r;try{r=t.localStorage}catch{}let n=t.isSecureContext&&t.crypto?.subtle?t.crypto.subtle:void 0,s=typeof t.fetch=="function"?t.fetch.bind(t):void 0;return{fetch:o((i,l)=>s?s(i,l):Promise.reject(new Error("no fetch")),"fetch"),...typeof navigator<"u"&&typeof navigator.sendBeacon=="function"?{sendBeacon:o((i,l)=>navigator.sendBeacon(i,l),"sendBeacon")}:{},now:o(()=>Date.now(),"now"),perf:o(()=>typeof performance<"u"?performance.now():Date.now(),"perf"),setTimeout:o((i,l)=>t.setTimeout(i,l),"setTimeout"),clearTimeout:o(i=>t.clearTimeout(i),"clearTimeout"),idle:o(i=>{typeof t.requestIdleCallback=="function"?t.requestIdleCallback(i,{timeout:2e3}):t.setTimeout(i,50)},"idle"),...r?{storage:r}:{},...n?{subtle:n}:{},href:o(()=>t.location.href,"href"),viewport:o(()=>({width:t.innerWidth,height:t.innerHeight}),"viewport"),publish:o(i=>{let l=t.__LENSMCP_PUBLISH__;typeof l=="function"&&l(i)},"publish"),...e}}c(Ns,"Ns"),u(Ns,"Ns"),o(Ns,"Ns");var Ar="__LENSMCP_REPLAY_BOOT__",Nr=globalThis,J=Nr[Ar];if(J&&typeof J.endpoint=="string"&&typeof J.tabId=="string"){delete Nr[Ar];try{Tr({endpoint:J.endpoint,...J.token?{token:J.token}:{},tabId:J.tabId,...J.app?{app:J.app}:{},record:fe,...J.fetch?{env:{fetch:J.fetch}}:{}})}catch{}}
|
|
100
|
+
`,Ut=typeof self<"u"&&self.Blob&&new Blob([pr],{type:"text/javascript;charset=utf-8"});function rs(t){let e;try{if(e=Ut&&(self.URL||self.webkitURL).createObjectURL(Ut),!e)throw"";let r=new Worker(e,{name:t?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(pr),{name:t?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}u(rs,"rs"),o(rs,"rs");var at=class{static{u(this,"at")}static{o(this,"at")}constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(c,a)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(a)});let{sampling:e="all",win:r,blockClass:n,blockSelector:s,recordCanvas:i,dataURLOptions:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,i&&e==="all"&&this.initCanvasMutationObserver(r,n,s),i&&typeof e=="number"&&this.initCanvasFPSObserver(e,r,n,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,e,r,n,s){let i=Pt(e,r,n,!0),l=new Map,c=new rs;c.onmessage=y=>{let{id:h}=y.data;if(l.set(h,!1),!("base64"in y.data))return;let{base64:p,type:v,width:k,height:C}=y.data;this.mutationCb({id:h,type:pe["2D"],commands:[{property:"clearRect",args:[0,0,k,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:p}],type:v}]},0,0]}]})};let a=1e3/t,m=0,f,d=o(()=>{let y=[];return e.document.querySelectorAll("canvas").forEach(h=>{W(h,r,n,!0)||y.push(h)}),y},"f"),b=o(y=>{if(m&&y-m<a){f=requestAnimationFrame(b);return}m=y,d().forEach(async h=>{var p;let v=this.mirror.getId(h);if(l.get(v)||h.width===0||h.height===0)return;if(l.set(v,!0),["webgl","webgl2"].includes(h.__context)){let C=h.getContext(h.__context);((p=C?.getContextAttributes())==null?void 0:p.preserveDrawingBuffer)===!1&&C.clear(C.COLOR_BUFFER_BIT)}let k=await createImageBitmap(h);c.postMessage({id:v,bitmap:k,width:h.width,height:h.height,dataURLOptions:s.dataURLOptions},[k])}),f=requestAnimationFrame(b)},"p");f=requestAnimationFrame(b),this.resetObservers=()=>{i(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,e,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=Pt(t,e,r,!1),s=Kn(this.processMutation.bind(this),t,e,r),i=ts(this.processMutation.bind(this),t,e,r);this.resetObservers=()=>{n(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=o(e=>{this.rafStamps.latestId=e,requestAnimationFrame(t)},"t");requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{let r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||e===-1)return;let n=r.map(i=>{let{type:l,...c}=i;return c}),{type:s}=r[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},lt=class{static{u(this,"lt")}static{o(this,"lt")}constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new rt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(t.length===0)return;let r={id:e,styleIds:[]},n=[];for(let s of t){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),n.push({styleId:i,rules:Array.from(s.rules||CSSRule,(l,c)=>({rule:$t(l,s.href),index:c}))})),r.styleIds.push(i)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},ct=class{static{u(this,"ct")}static{o(this,"ct")}constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(t,e){let r=this.nodeMap.get(t);return r&&Array.from(r).some(n=>n!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},L,Oe,Ze,ze=!1;try{if(Array.from([1],t=>t*2)[0]!==2){let t=document.createElement("iframe");document.body.appendChild(t),Array.from=((Mt=t.contentWindow)==null?void 0:Mt.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var X=rn();function fe(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:i=null,ignoreClass:l="rr-ignore",ignoreSelector:c=null,maskTextClass:a="rr-mask",maskTextSelector:m=null,inlineStylesheet:f=!0,maskAllInputs:d,maskInputOptions:b,slimDOMOptions:y,maskInputFn:h,maskTextFn:p,hooks:v,packFn:k,sampling:C={},dataURLOptions:w={},mousemoveWait:T,recordDOM:P=!0,recordCanvas:N=!1,recordCrossOriginIframes:B=!1,recordAfter:vt=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:q=!1,collectFonts:Y=!1,inlineImages:Q=!1,plugins:yt,keepIframeSrcFn:O=o(()=>!1,"E"),ignoreCSSAttributes:re=new Set([]),errorHandler:ne}=t;Dn(ne);let $=B?window.parent===window:!0,V=!1;if(!$)try{window.parent.document&&(V=!1)}catch{V=!0}if($&&!e)throw new Error("emit function is required");if(!$&&!V)return()=>{};T!==void 0&&C.mousemove===void 0&&(C.mousemove=T),X.reset();let Ct=d===!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}:b!==void 0?b:{password:!0},Z=Yt(y);On();let qe,ge=0,Ve=o(E=>{for(let G of yt||[])G.eventProcessor&&(E=G.eventProcessor(E));return k&&!V&&(E=k(E)),E},"Ct");L=o((E,G)=>{var F;let _=E;if(_.timestamp=ve(),(F=ie[0])!=null&&F.isFrozen()&&_.type!==M.FullSnapshot&&!(_.type===M.IncrementalSnapshot&&_.data.source===I.Mutation)&&ie.forEach(j=>j.unfreeze()),$)e?.(Ve(_),G);else if(V){let j={type:"rrweb",event:Ve(_),origin:window.location.origin,isCheckout:G};window.parent.postMessage(j,"*")}if(_.type===M.FullSnapshot)qe=_,ge=0;else if(_.type===M.IncrementalSnapshot){if(_.data.source===I.Mutation&&_.data.isAttachIframe)return;ge++;let j=n&&ge>=n,x=r&&_.timestamp-qe.timestamp>r;(j||x)&&Oe(!0)}},"L");let se=o(E=>{L({type:M.IncrementalSnapshot,data:{source:I.Mutation,...E}})},"Re"),Ge=o(E=>L({type:M.IncrementalSnapshot,data:{source:I.Scroll,...E}}),"It"),Or=o(E=>L({type:M.IncrementalSnapshot,data:{source:I.CanvasMutation,...E}}),"Rt"),Ps=o(E=>L({type:M.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...E}}),"Or"),It=new lt({mutationCb:se,adoptedStyleSheetCb:Ps}),Rt=new it({mirror:X,mutationCb:se,stylesheetManager:It,recordCrossOriginIframes:B,wrappedEmit:L});for(let E of yt||[])E.getMirror&&E.getMirror({nodeMirror:X,crossOriginIframeMirror:Rt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Rt.crossOriginIframeStyleMirror});let Me=new ct;Ze=new at({recordCanvas:N,mutationCb:Or,win:window,blockClass:s,blockSelector:i,mirror:X,sampling:C.canvas,dataURLOptions:w});let me=new ot({mutationCb:se,scrollCb:Ge,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:m,inlineStylesheet:f,maskInputOptions:Ct,dataURLOptions:w,maskTextFn:p,maskInputFn:h,recordCanvas:N,inlineImages:Q,sampling:C,slimDOMOptions:Z,iframeManager:Rt,stylesheetManager:It,canvasManager:Ze,keepIframeSrcFn:O,processedNodeManager:Me},mirror:X});Oe=o((E=!1)=>{if(!P)return;L({type:M.Meta,data:{href:window.location.href,width:Kt(),height:Qt()}},E),It.reset(),me.init(),ie.forEach(F=>F.lock());let G=An(document,{mirror:X,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:m,inlineStylesheet:f,maskAllInputs:Ct,maskTextFn:p,maskInputFn:h,slimDOM:Z,dataURLOptions:w,recordCanvas:N,inlineImages:Q,onSerialize:o(F=>{rr(F,X)&&Rt.addIframe(F),nr(F,X)&&It.trackLinkElement(F),tt(F)&&me.addShadowRoot(S.shadowRoot(F),document)},"onSerialize"),onIframeLoad:o((F,_)=>{Rt.attachIframe(F,_),me.observeAttachShadow(F)},"onIframeLoad"),onStylesheetLoad:o((F,_)=>{It.attachLinkElement(F,_)},"onStylesheetLoad"),keepIframeSrcFn:O});if(!G)return console.warn("Failed to snapshot the document");L({type:M.FullSnapshot,data:{node:G,initialOffset:Zt(window)}},E),ie.forEach(F=>F.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&It.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))},"Oe");try{let E=[],G=o(_=>{var j;return R(Jn)({mutationCb:se,mousemoveCb:o((x,Re)=>L({type:M.IncrementalSnapshot,data:{source:Re,positions:x}}),"mousemoveCb"),mouseInteractionCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.MouseInteraction,...x}}),"mouseInteractionCb"),scrollCb:Ge,viewportResizeCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.ViewportResize,...x}}),"viewportResizeCb"),inputCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.Input,...x}}),"inputCb"),mediaInteractionCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.MediaInteraction,...x}}),"mediaInteractionCb"),styleSheetRuleCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.StyleSheetRule,...x}}),"styleSheetRuleCb"),styleDeclarationCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.StyleDeclaration,...x}}),"styleDeclarationCb"),canvasMutationCb:Or,fontCb:o(x=>L({type:M.IncrementalSnapshot,data:{source:I.Font,...x}}),"fontCb"),selectionCb:o(x=>{L({type:M.IncrementalSnapshot,data:{source:I.Selection,...x}})},"selectionCb"),customElementCb:o(x=>{L({type:M.IncrementalSnapshot,data:{source:I.CustomElement,...x}})},"customElementCb"),blockClass:s,ignoreClass:l,ignoreSelector:c,maskTextClass:a,maskTextSelector:m,maskInputOptions:Ct,inlineStylesheet:f,sampling:C,recordDOM:P,recordCanvas:N,inlineImages:Q,userTriggeredOnInput:q,collectFonts:Y,doc:_,maskInputFn:h,maskTextFn:p,keepIframeSrcFn:O,blockSelector:i,slimDOMOptions:Z,dataURLOptions:w,mirror:X,iframeManager:Rt,stylesheetManager:It,shadowDomManager:me,processedNodeManager:Me,canvasManager:Ze,ignoreCSSAttributes:re,plugins:((j=yt?.filter(x=>x.observer))==null?void 0:j.map(x=>({observer:x.observer,options:x.options,callback:o(Re=>L({type:M.Plugin,data:{plugin:x.name,payload:Re}}),"callback")})))||[]},v)},"q");Rt.addLoadListener(_=>{try{E.push(G(_.contentDocument))}catch(j){console.warn(j)}});let F=o(()=>{Oe(),E.push(G(document)),ze=!0},"_");return["interactive","complete"].includes(document.readyState)?F():(E.push(U("DOMContentLoaded",()=>{L({type:M.DomContentLoaded,data:{}}),vt==="DOMContentLoaded"&&F()})),E.push(U("load",()=>{L({type:M.Load,data:{}}),vt==="load"&&F()},window))),()=>{E.forEach(_=>{try{_()}catch(j){String(j).toLowerCase().includes("cross-origin")||console.warn(j)}}),Me.destroy(),ze=!1,Pn()}}catch(E){console.warn(E)}}u(fe,"fe"),o(fe,"fe"),fe.addCustomEvent=(t,e)=>{if(!ze)throw new Error("please add custom event after start recording");L({type:M.Custom,data:{tag:t,payload:e}})},fe.freezePage=()=>{ie.forEach(t=>t.freeze())},fe.takeFullSnapshot=t=>{if(!ze)throw new Error("please take full snapshot after start recording");Oe(t)},fe.mirror=X;var fr="REDACTED",ns=["token","secret","password","passwd","apikey","credential","assertion","signature"],ss=new Set(["key","auth","authorization","jwt","code","sig","pwd","pass","session","sid","bearer","otp","cookie","set-cookie"]),is=/^(?:(?:prompt|completion|total|input|output|cache|cached|cacheread|cachewrite|reasoning|thinking|max|min|remaining|used|billed)tokens|tokens?(?:count|used|limit|remaining))$/;function os(t){let e=ht.get(t);if(e!==void 0)return e;let r=ls(t);return t.length<=64&&ht.size<as&&ht.set(t,r),r}u(os,"os"),o(os,"os");var as=4096,ht=new Map;function ls(t){let e=t.toLowerCase();if(is.test(e.replace(/[-_.]+/g,"")))return!1;if(ns.some(r=>e.includes(r)))return!0;for(let r of e.split(/[-_.]+/))if(r&&ss.has(r))return!0;return!1}u(ls,"ls"),o(ls,"ls");var cs=/^([a-z][a-z0-9+.-]*:\/\/)[^/?#@\s]*@/i,us=/([?&#])([^=&#\s]+)=([^&#\s]*)/g;function ds(t){return t&&t.replace(cs,`$1${fr}@`).replace(us,(e,r,n)=>os(n)?`${r}${n}=${fr}`:e)}u(ds,"ds"),o(ds,"ds");function mr(t){return t&&hs(ds(t),1024)}u(mr,"mr"),o(mr,"mr");function hs(t,e){return t.length<=e?t:`${t.slice(0,e)}\u2026[lensmcp truncated: ${t.length-e} more chars]`}u(hs,"hs"),o(hs,"hs");var pt=String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][\w$]*)`,ft=String.raw`${pt}(?:\s*\.\s*${pt})*`,ps=String.raw`(?:=|<>|!=|<=|>=|<|>|(?:NOT\s+)?I?LIKE|IS\s+(?:NOT\s+)?DISTINCT\s+FROM)`,_s=new RegExp(String.raw`(${ft})\s*${ps}\s*(?:[A-Za-z_]\w*\s*\(\s*)?\$(\d+)`,"gi"),xs=new RegExp(String.raw`(${ft})\s+(?:NOT\s+)?IN\s*\(([^()]*)\)`,"gi"),Ls=new RegExp(String.raw`\bINSERT\s+INTO\s+${ft}\s*\(([^()]*)\)\s*VALUES\s*`,"gi"),Ds=new RegExp(pt,"g"),fs=["lens/session","lens/flow","lens/target","lens/request","lens/response","lens/visit","lens/nav","lens/hmr","lens/error","lens/gap"],ms=new Set(fs);function gs(t){return typeof t=="string"&&ms.has(t)}u(gs,"gs"),o(gs,"gs");var gr=512,ys=20,bs=3,Ss=new Set(["url","to","from"]);function yr(t,e){if(!(!gs(t)||!e||typeof e!="object"||Array.isArray(e)))return mt(e,0,void 0)}u(yr,"yr"),o(yr,"yr");function mt(t,e,r){if(t===null||typeof t=="boolean")return t;if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"){let s=r&&Ss.has(r)?mr(t):t;return s.length>gr?`${s.slice(0,gr-1)}\u2026`:s}if(typeof t!="object"||e>=bs)return;if(Array.isArray(t))return t.slice(0,ys).map(s=>mt(s,e+1,void 0));let n={};for(let[s,i]of Object.entries(t)){let l=mt(i,e+1,s);l!==void 0&&(n[s]=l)}return n}u(mt,"mt"),o(mt,"mt");function br(t,e){return t==="lens/flow"&&typeof e.flowId=="string"?[`f:${e.flowId}`]:(t==="lens/request"||t==="lens/response")&&typeof e.requestId=="string"?[`r:${e.requestId}`]:t==="lens/visit"&&typeof e.visitId=="string"?[`v:${e.visitId}`]:[]}u(br,"br"),o(br,"br");var Sr="\0lens-blob:";async function wr(t,e){let r=await t.digest("SHA-256",new TextEncoder().encode(e)),n="";for(let s of new Uint8Array(r))n+=s.toString(16).padStart(2,"0");return n}u(wr,"wr"),o(wr,"wr");async function vr(t,e){let r=[],n=new Map,s,i=0;for(let a of t){let m=e.perf();if(!e.subtle||a.type!==2&&a.type!==3){r.push(JSON.stringify(a)),i+=e.perf()-m;continue}if(a.type===2&&e.isBase(a)){let b=a.data,y=JSON.stringify(b.node);i+=e.perf()-m;let h=await wr(e.subtle,y);m=e.perf(),n.set(h,y),s=h,r.push(gt(a,JSON.stringify({...b,node:Sr+h}))),i+=e.perf()-m;continue}let f=JSON.stringify(a.data);if(f.length<e.blobMinChars){r.push(gt(a,f)),i+=e.perf()-m;continue}i+=e.perf()-m;let d=await wr(e.subtle,f);m=e.perf(),n.set(d,f),r.push(gt(a,JSON.stringify(Sr+d))),i+=e.perf()-m}let l=e.perf(),c=`[${r.join(",")}]`;return i+=e.perf()-l,{json:c,blobs:n,...s?{base:s}:{},ms:i}}u(vr,"vr"),o(vr,"vr");function gt(t,e){let r=t.delay;return`{"type":${t.type},"data":${e},"timestamp":${t.timestamp}${r!==void 0?`,"delay":${r}`:""}}`}u(gt,"gt"),o(gt,"gt");var He=class{static{u(this,"He")}static{o(this,"He")}constructor(t,e,r="lensmcp:replay:blobs"){this.max=t,this.storage=e,this.key=r,this.set=new Set;try{let n=e?.getItem(r),s=n?JSON.parse(n):[];if(Array.isArray(s))for(let i of s.slice(-t))typeof i=="string"&&/^[0-9a-f]{64}$/.test(i)&&this.set.add(i)}catch{}}has(t){return this.set.has(t)}add(t){for(this.set.delete(t),this.set.add(t);this.set.size>this.max;)this.set.delete(this.set.values().next().value);this.save()}forget(t){this.set.delete(t)&&this.save()}save(){try{this.storage?.setItem(this.key,JSON.stringify([...this.set]))}catch{}}},ws="a,button,input,select,textarea,label,summary,option,[role],[data-testid],[onclick],[tabindex]",vs=o(t=>!!t&&typeof t.closest=="function"&&typeof t.getAttribute=="function"&&typeof t.tagName=="string","vs");function Cr(t,e,r){if(!vs(t))return;let n=t.closest(ws)??t,s=o(v=>n.getAttribute(v)??void 0,"s"),i=(n.textContent??"").replace(/\s+/g," ").trim(),l=n.closest("[data-agent-source]"),c=n.closest("[data-agent-component]"),a=-1;try{a=r(n)}catch{}let m={kind:e,id:a,tag:n.tagName.toLowerCase()},f=s("role");f&&(m.role=f),i&&(m.text=i.length>80?`${i.slice(0,79)}\u2026`:i);let d=s("aria-label")??s("title")??s("placeholder")??s("name")??s("alt");d&&(m.label=d);let b=s("data-testid")??s("data-test")??s("data-cy");b&&(m.testId=b);let y=n.tagName==="INPUT"?s("type"):void 0;y&&(m.inputType=y);let h=l?.getAttribute("data-agent-source");h&&(m.source=h);let p=c?.getAttribute("data-agent-component");return p&&(m.component=p),m}u(Cr,"Cr"),o(Cr,"Cr");var Ir="2.1.7",Rr={maskAllInputs:!1,blockSelector:"[data-lens-private]"},Mr={flushMs:2e3,flushChars:256*1024,flushEvents:2e3,checkoutEveryMs:18e4,pendingChars:8*1024*1024,blobMinChars:8*1024,beaconMaxBytes:6e4,retryMaxMs:1e4,noChannelAfter:4,budgetMsPerSecond:50,budgetSeconds:5,knownHashes:2e3},Cs=4e3;async function bt(t){if(!(typeof CompressionStream!="function"||typeof Blob!="function"||typeof Response!="function"))try{let e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}catch{return}}u(bt,"bt"),o(bt,"bt");var $e=class{static{u(this,"$e")}static{o(this,"$e")}constructor(t){this.o=t,this.queue=[],this.busy=!1,this.queued=0,this.answered=!1,this.networkFailures=0,this.disabled=!1}get pendingSize(){return this.queued}enqueue(t){this.disabled||(this.queue.push(t),this.queued+=t.size,this.pump())}drop(){let t=this.queue[0]?.summary.seq;for(let e of this.queue.splice(0))this.queued-=e.size;return t}beaconQueued(){for(let t of this.queue.splice(0))this.queued-=t.size,[...t.blobs.keys()].every(e=>this.o.known.has(e))&&this.beacon(t.summary,t.body,t.enc)}beacon(t,e,r){let n=this.o.env.sendBeacon,s=typeof e=="string"?e.length:e.byteLength;if(this.disabled||!n||s>this.o.beaconMaxBytes)return!1;try{return n(this.url("/replay",this.params(t,r,[])),new Blob([e],{type:"text/plain"}))}catch{return!1}}async pump(){if(!this.busy){this.busy=!0;try{for(;!this.disabled&&this.queue.length;){let t=this.queue.shift(),e=await this.send(t);this.queued-=t.size,e==="refused"&&(this.disabled=!0),this.o.onOutcome(t,e)}}finally{this.busy=!1}}}async send(t){for(let e=0;!this.disabled;e++){e>0&&await this.sleep(Math.min(this.o.retryMaxMs,500*2**(e-1)));try{for(let[s,i]of t.blobs){if(this.o.known.has(s))continue;let l=await bt(i),c=await this.post("/replay/blob",{sha:s,enc:l?"gzip":"identity"},l??i);if(c.status>=200&&c.status<300){this.o.known.add(s);continue}let a=Er(c.status);if(a)return a;throw new Error(`blob ${c.status}`)}let r=await this.post("/replay",this.params(t.summary,t.enc,[...t.blobs.keys()]),t.body);if(r.status>=200&&r.status<300)return this.answered=!0,"ok";if(r.status===409){let s=await Is(r);for(let i of s.length?s:t.blobs.keys())this.o.known.forget(i);continue}let n=Er(r.status);if(n)return n}catch{if(!this.answered&&++this.networkFailures>=this.o.noChannelAfter)return"refused"}}return"refused"}params(t,e,r){let n={v:String(1),load:this.o.loadId,tab:this.o.tabId,seq:String(t.seq),t0:String(t.t0),t1:String(t.t1),n:String(t.n),full:t.full?"1":"0",enc:e};if(this.o.app&&(n.app=this.o.app),t.base&&(n.base=t.base),t.anchors.length){let s="";for(let i of t.anchors){if(s.length+i.length+1>Cs){n.am="1";break}s+=(s?",":"")+i}n.a=s}return r.length&&(n.b=r.join(",")),n}url(t,e){let r=new URLSearchParams(this.o.token?{token:this.o.token,...e}:e);return`${this.o.endpoint}${t}?${r.toString()}`}async post(t,e,r){let n=await this.o.env.fetch(this.url(t,e),{method:"POST",headers:{"content-type":"text/plain"},body:r,credentials:"omit",keepalive:(typeof r=="string"?r.length:r.byteLength)<=this.o.beaconMaxBytes}),s=await n.text().catch(()=>"");return{status:n.status,text:o(async()=>s,"text")}}sleep(t){return new Promise(e=>this.o.env.setTimeout(e,t))}};function Er(t){if(t===413)return"too-big";if(t===400||t===401||t===403||t===404||t===405||t===426)return"refused"}u(Er,"Er"),o(Er,"Er");async function Is(t){try{let e=JSON.parse(await t.text());return Array.isArray(e.missing)?e.missing.filter(r=>typeof r=="string"):[]}catch{return[]}}u(Is,"Is"),o(Is,"Is");var St=2,Rs=3,kr=4,Ms=5,Es=0;function ks(t){if(t.type===St)return 64*1024;if(t.type===Rs){let e=t.data;if(e.source===Es)return 64+160*(e.adds?.length??0)+60*(e.attributes?.length??0)+80*(e.texts?.length??0)+24*(e.removes?.length??0)}return 120}u(ks,"ks"),o(ks,"ks");var Ts=o(()=>`load-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,"Ts"),je=class{static{u(this,"je")}static{o(this,"je")}constructor(t,e){this.cfg=t,this.env=e,this.loadId=Ts(),this.state="idle",this.seq=0,this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.awaitingCheckout=!1,this.checkoutPending=!1,this.processing=Promise.resolve(),this.costWindowStart=0,this.costSpent=0,this.overSeconds=0,this.limits={...Mr,...t.limits},this.privacy={...Rr,...t.privacy},this.record=t.record,this.uploader=new $e({endpoint:t.endpoint.replace(/\/+$/,""),...t.token?{token:t.token}:{},tabId:t.tabId,loadId:this.loadId,...t.app?{app:t.app}:{},env:e,known:new He(this.limits.knownHashes,e.storage),retryMaxMs:this.limits.retryMaxMs,noChannelAfter:this.limits.noChannelAfter,beaconMaxBytes:this.limits.beaconMaxBytes,onOutcome:o((r,n)=>this.onOutcome(r,n),"onOutcome")})}get status(){return this.state}start(){this.state==="idle"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.begin(),this.mark("lens/session",{tabId:this.cfg.tabId,loadId:this.loadId,...this.cfg.app?{app:this.cfg.app}:{},url:this.env.href(),wire:1,rrweb:Ir,viewport:this.env.viewport()}))}mark(t,e){if(t==="lens/nav"&&this.state==="paused"&&this.resume(),this.state!=="recording")return;let r=yr(t,e);if(r)try{this.record.addCustomEvent(t,r)}catch{}}target(t,e){if(this.state!=="recording")return;let r=Cr(t,e,n=>this.record.mirror.getId(n));r&&this.mark("lens/target",r)}checkpoint(){this.state!=="recording"||this.checkoutPending||this.awaitingCheckout||(this.checkoutPending=!0,this.env.idle(()=>{this.checkoutPending=!1,this.checkoutNow()||this.env.idle(()=>this.checkoutNow())}))}pagehide(){if(this.state!=="recording"&&this.state!=="paused"||(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),this.uploader.beaconQueued(),!this.buffer.length||this.awaitingCheckout))return;let t=this.buffer,e=this.takeSummary(t);try{this.uploader.beacon(e,JSON.stringify(t),"identity")}catch{}}stop(){this.state!=="stopped"&&(this.state==="recording"&&this.cut(),this.halt())}begin(){let t=this.privacy;try{this.stopRecord=this.record({emit:o(e=>this.onEmit(e),"emit"),checkoutEveryNms:this.limits.checkoutEveryMs,maskAllInputs:t.maskAllInputs,...t.maskAllInputs?{}:{maskInputOptions:{password:!1}},...t.maskTextSelector?{maskTextSelector:t.maskTextSelector}:{},...t.blockSelector?{blockSelector:t.blockSelector}:{},slimDOMOptions:"all",sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,collectFonts:!1,errorHandler:o(()=>!0,"errorHandler")})}catch{this.halt()}}onEmit(t){if(this.state!=="recording"||this.awaitingCheckout)return;let e=this.env.perf();if(t.type===kr&&this.buffer.length&&this.cut(),t.type===St&&!this.base&&(this.base=t),this.buffer.push(t),this.bufferChars+=ks(t),t.type===Ms){let r=t.data;typeof r.tag=="string"&&r.payload&&typeof r.payload=="object"&&this.bufferAnchors.push(...br(r.tag,r.payload))}this.buffer.length>=this.limits.flushEvents||this.bufferChars>=this.limits.flushChars?this.cut():this.timer===void 0&&(this.timer=this.env.setTimeout(()=>{this.timer=void 0,this.cut()},this.limits.flushMs)),this.spend(this.env.perf()-e)}takeSummary(t){let e={seq:this.seq++,t0:t[0]?.timestamp??0,t1:t[t.length-1]?.timestamp??0,n:t.length,full:t[0]?.type===kr&&t.some(r=>r.type===St),anchors:[...new Set(this.bufferAnchors)]};return this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],e}cut(){if(this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0),!this.buffer.length)return;let t=this.buffer,e=this.takeSummary(t);this.processing=this.processing.then(()=>this.prepare(e,t)).catch(()=>{})}async prepare(t,e){if(this.uploader.disabled||this.state==="stopped")return;let r=await vr(e,{...this.env.subtle?{subtle:this.env.subtle}:{},blobMinChars:this.limits.blobMinChars,isBase:o(c=>c===this.base,"isBase"),perf:o(()=>this.env.perf(),"perf")});this.spend(r.ms);let n=await bt(r.json),s=n??r.json,i=typeof s=="string"?s.length:s.byteLength;for(let c of r.blobs.values())i+=c.length;let l={summary:r.base?{...t,base:r.base}:t,body:s,enc:n?"gzip":"identity",blobs:r.blobs,size:i};this.uploader.enqueue(l),this.uploader.pendingSize>this.limits.pendingChars&&this.gap("overflow")}onOutcome(t,e){if(e==="refused"){this.halt();return}if(e==="too-big"){this.gap("too-big",t.summary.seq);return}this.awaitingCheckout&&(this.awaitingCheckout=!1,this.checkoutNow())}gap(t,e){if(this.state!=="recording"||this.awaitingCheckout)return;let r=this.uploader.drop();this.buffer=[],this.bufferChars=0,this.bufferAnchors=[],this.mark("lens/gap",{fromSeq:e??r??this.seq,reason:t}),this.cut(),this.awaitingCheckout=!0,this.publish("replay-gap",`session replay lost a stretch of this page (${t})`,{reason:t,fromSeq:e??r??this.seq})}checkoutNow(){if(this.state!=="recording")return!0;let t=this.env.perf();try{return this.record.takeFullSnapshot(!0),!0}catch{return!1}finally{this.spend(this.env.perf()-t)}}spend(t){let e=this.env.perf();if(e-this.costWindowStart>=1e3&&(this.overSeconds=this.costSpent>this.limits.budgetMsPerSecond?this.overSeconds+1:0,this.costSpent=0,this.costWindowStart=e,this.overSeconds>=this.limits.budgetSeconds)){this.pause();return}this.costSpent+=t}pause(){if(this.state==="recording"){this.mark("lens/gap",{fromSeq:this.seq,reason:"budget"}),this.cut();try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.state="paused",this.overSeconds=0,this.publish("replay-paused",`session replay paused: its own work stayed over ${this.limits.budgetMsPerSecond} ms a second for ${this.limits.budgetSeconds} s`,{})}}resume(){this.state==="paused"&&(this.state="recording",this.costWindowStart=this.env.perf(),this.costSpent=0,this.begin())}halt(){this.state="stopped",this.timer!==void 0&&(this.env.clearTimeout(this.timer),this.timer=void 0);try{this.stopRecord?.()}catch{}this.stopRecord=void 0,this.uploader.drop(),this.buffer=[]}publish(t,e,r){try{this.env.publish?.({source:"client-runtime",category:"runtime",severity:"info",title:e,fingerprint:`replay:${t}:${this.loadId}`,raw:{kind:t,loadId:this.loadId,tabId:this.cfg.tabId,...r}})}catch{}}},wt="__LENSMCP_REPLAY__",As=["click","submit","change"];function Tr(t){if(typeof window>"u"||typeof document>"u")return;let e=globalThis;if(e[wt]===!1)return;let r=e[wt];if(r)return r;let n=new je(t,Ns(t.env)),s={loadId:n.loadId,mark:o((i,l)=>n.mark(i,l),"mark"),checkpoint:o(()=>n.checkpoint(),"checkpoint"),stop:o(()=>n.stop(),"stop")};e[wt]=s,n.start();for(let i of As)document.addEventListener(i,l=>n.target(l.target,i),{capture:!0,passive:!0});return window.addEventListener("pagehide",()=>n.pagehide()),s}u(Tr,"Tr"),o(Tr,"Tr");function Ns(t={}){let e=window,r;try{r=e.localStorage}catch{}let n=e.isSecureContext&&e.crypto?.subtle?e.crypto.subtle:void 0,s=typeof e.fetch=="function"?e.fetch.bind(e):void 0;return{fetch:o((i,l)=>s?s(i,l):Promise.reject(new Error("no fetch")),"fetch"),...typeof navigator<"u"&&typeof navigator.sendBeacon=="function"?{sendBeacon:o((i,l)=>navigator.sendBeacon(i,l),"sendBeacon")}:{},now:o(()=>Date.now(),"now"),perf:o(()=>typeof performance<"u"?performance.now():Date.now(),"perf"),setTimeout:o((i,l)=>e.setTimeout(i,l),"setTimeout"),clearTimeout:o(i=>e.clearTimeout(i),"clearTimeout"),idle:o(i=>{typeof e.requestIdleCallback=="function"?e.requestIdleCallback(i,{timeout:2e3}):e.setTimeout(i,50)},"idle"),...r?{storage:r}:{},...n?{subtle:n}:{},href:o(()=>e.location.href,"href"),viewport:o(()=>({width:e.innerWidth,height:e.innerHeight}),"viewport"),publish:o(i=>{let l=e.__LENSMCP_PUBLISH__;typeof l=="function"&&l(i)},"publish"),...t}}u(Ns,"Ns"),o(Ns,"Ns");var Ar="__LENSMCP_REPLAY_BOOT__",Nr=globalThis,J=Nr[Ar];if(J&&typeof J.endpoint=="string"&&typeof J.tabId=="string"){delete Nr[Ar];try{Tr({endpoint:J.endpoint,...J.token?{token:J.token}:{},tabId:J.tabId,...J.app?{app:J.app}:{},record:fe,...J.fetch?{env:{fetch:J.fetch}}:{}})}catch{}}
|
package/replay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var a=Object.defineProperty,p=t((r,e)=>a(r,"name",{value:e,configurable:!0}),"t");import{record as c}from"@rrweb/record";import{startReplay as f}from"./lib/replay/start.js";export function startReplay(r){return f({...r,record:r.record??c})}t(startReplay,"startReplay"),p(startReplay,"startReplay");export{DEFAULT_LIMITS,DEV_PRIVACY}from"./lib/replay/types.js";export*from"./replay-format.js";
|