sentiero 1.0.0.alpha1 → 1.0.0.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -13
  3. data/lib/sentiero/analytics/analyzer.rb +16 -4
  4. data/lib/sentiero/analytics/browser_event_discovery.rb +2 -2
  5. data/lib/sentiero/analytics/conversion_analyzer.rb +1 -1
  6. data/lib/sentiero/analytics/engagement_analyzer.rb +1 -1
  7. data/lib/sentiero/analytics/error_discovery.rb +9 -2
  8. data/lib/sentiero/analytics/exporter.rb +1 -1
  9. data/lib/sentiero/analytics/frustration_analyzer.rb +1 -1
  10. data/lib/sentiero/analytics/funnel_analyzer.rb +2 -2
  11. data/lib/sentiero/analytics/heatmap_analyzer.rb +3 -3
  12. data/lib/sentiero/analytics/page_report_analyzer.rb +2 -2
  13. data/lib/sentiero/analytics/scroll_depth_analyzer.rb +1 -1
  14. data/lib/sentiero/analytics/segmenter.rb +16 -2
  15. data/lib/sentiero/analytics/stats_aggregator/result_builder.rb +2 -0
  16. data/lib/sentiero/analytics/stats_aggregator.rb +45 -6
  17. data/lib/sentiero/analytics/web_vitals_analyzer.rb +2 -2
  18. data/lib/sentiero/configuration.rb +29 -0
  19. data/lib/sentiero/fingerprint/config.rb +40 -0
  20. data/lib/sentiero/fingerprint.rb +45 -11
  21. data/lib/sentiero/geo.rb +86 -0
  22. data/lib/sentiero/reporter.rb +2 -1
  23. data/lib/sentiero/store/session_store.rb +62 -3
  24. data/lib/sentiero/store.rb +7 -0
  25. data/lib/sentiero/stores/file.rb +5 -1
  26. data/lib/sentiero/stores/memory.rb +15 -3
  27. data/lib/sentiero/stores/redis.rb +17 -5
  28. data/lib/sentiero/stores/sqlite/payload_codec.rb +42 -0
  29. data/lib/sentiero/stores/sqlite/schema.rb +72 -6
  30. data/lib/sentiero/stores/sqlite.rb +216 -101
  31. data/lib/sentiero/version.rb +1 -1
  32. data/lib/sentiero/web/analytics_app.rb +10 -0
  33. data/lib/sentiero/web/assets/dashboard-YINQE5ZH.js +3 -0
  34. data/lib/sentiero/web/assets/manifest.json +4 -4
  35. data/lib/sentiero/web/assets/recorder-W2RCU5VM.js +78 -0
  36. data/lib/sentiero/web/assets/rrweb-player-d522d74c.js +201 -0
  37. data/lib/sentiero/web/assets/{style-d71e72fd.css → style-80e536e6.css} +1 -1
  38. data/lib/sentiero/web/body_reader.rb +21 -10
  39. data/lib/sentiero/web/dashboard_app.rb +77 -5
  40. data/lib/sentiero/web/errors_app.rb +14 -1
  41. data/lib/sentiero/web/events_app.rb +6 -1
  42. data/lib/sentiero/web/ingest_app.rb +1 -1
  43. data/lib/sentiero/web/templates/client_error_show.html.erb +6 -1
  44. data/lib/sentiero/web/templates/dashboard.html.erb +7 -0
  45. data/lib/sentiero/web/templates/maintenance.html.erb +50 -0
  46. data/lib/sentiero/web/templates/segments.html.erb +9 -0
  47. data/lib/sentiero/web/templates/sessions_index.html.erb +12 -4
  48. data/lib/sentiero/web/views/analytics_index_view.rb +7 -1
  49. data/lib/sentiero/web/views/client_error_show_view.rb +1 -1
  50. data/lib/sentiero/web/views/maintenance_view.rb +27 -0
  51. data/lib/sentiero/web/views/segments_view.rb +3 -2
  52. data/lib/sentiero/web/views/sessions_index_view.rb +6 -2
  53. data/lib/sentiero/web/views.rb +1 -0
  54. data/lib/sentiero.rb +1 -0
  55. metadata +10 -5
  56. data/lib/sentiero/web/assets/dashboard-JFYNHZZV.js +0 -3
  57. data/lib/sentiero/web/assets/recorder-SLLXSUUX.js +0 -71
  58. data/lib/sentiero/web/assets/rrweb-player-cd435a95.js +0 -126
@@ -102,6 +102,7 @@ module Sentiero
102
102
  filters: filters,
103
103
  browser_options: BROWSER_OPTIONS,
104
104
  device_options: DEVICE_OPTIONS,
105
+ country_options: result[:countries],
105
106
  sessions: result[:sessions],
106
107
  page: page,
107
108
  per_page: per_page,
@@ -322,6 +323,7 @@ module Sentiero
322
323
  {
323
324
  browser: allowed(params["browser"], BROWSER_OPTIONS),
324
325
  device: allowed(params["device"], DEVICE_OPTIONS),
326
+ country: clean_country(params["country"]),
325
327
  url_pattern: clean_text(params["url_pattern"]),
326
328
  metadata_key: clean_text(params["metadata_key"]),
327
329
  metadata_value: clean_text(params["metadata_value"]),
@@ -342,6 +344,7 @@ module Sentiero
342
344
  query = {
343
345
  "browser" => filters[:browser],
344
346
  "device" => filters[:device],
347
+ "country" => filters[:country],
345
348
  "url_pattern" => filters[:url_pattern],
346
349
  "metadata_key" => filters[:metadata_key],
347
350
  "metadata_value" => filters[:metadata_value],
@@ -366,6 +369,13 @@ module Sentiero
366
369
  stripped[0, MAX_FILTER_LENGTH]
367
370
  end
368
371
 
372
+ # Two-letter ISO code only (what Cloudflare sends); anything else is
373
+ # dropped rather than echoed back into the form.
374
+ def clean_country(value)
375
+ text = clean_text(value)
376
+ text&.match?(/\A[A-Za-z]{2}\z/) ? text.upcase : nil
377
+ end
378
+
369
379
  # The form takes durations in whole seconds; the Segmenter works in ms.
370
380
  def parse_duration_seconds(value)
371
381
  return nil unless value.is_a?(String) && value.match?(/\A\d+\z/)
@@ -0,0 +1,3 @@
1
+ (()=>{var C={navigation:{label:"Navigation",color:"#198754"},click:{label:"Click",color:"#dc3545"},input:{label:"Input",color:"#0d6efd"},error:{label:"Error",color:"#ff0000"},custom:{label:"Custom",color:"#6f42c1"},frustration:{label:"Frustration",color:"#ff6b6b"},server_exception:{label:"Server Exception",color:"#b91c1c"},server_event:{label:"Server Event",color:"#7c3aed"}},k=5e3,it=3;function lt(t){if(t.length<2)return 0;let e=0,r=t[0].timestamp,n=t[0].timestamp;for(let a=1;a<t.length;a++){let o=t[a].timestamp;o-n>k&&(e+=n-r,r=o),n=o}return e+=n-r,e}function S(t){let e=Math.round(t/1e3);if(e<60)return`${e}s`;if(e<3600){let a=Math.floor(e/60),o=e%60;return o>0?`${a}m ${o}s`:`${a}m`}let r=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${r}h ${n}m`:`${r}h`}function M(t){let e=Math.floor(t/1e3),r=Math.floor(e/3600),n=Math.floor(e%3600/60),a=e%60,o=i=>(i<10?"0":"")+i;return r>0?`${r}:${o(n)}:${o(a)}`:`${n}:${o(a)}`}function _(t,e){return t.length<=e?t:t.substring(0,e-3)+"..."}function ct(t){for(let e=0;e<t.length;e++)if(t[e].type===4&&t[e].data){let r=t[e].data.width,n=t[e].data.height;if(r&&n)return`${r}x${n}`}return null}function Bt(t){return!!(t&&t.type===3&&t.data&&t.data.source===5&&typeof t.data.id=="number")}function Ht(t){return!!t&&typeof t.isChecked=="boolean"}function W(t){if(!Array.isArray(t))return[];let e=new Map;for(let n=0;n<t.length;n++){let a=t[n];if(!Bt(a))continue;let o=a.data.id,i=e.get(o);i||(i={nodeId:o,fillCount:0,isToggle:!1,firstTimestamp:a.timestamp,lastTimestamp:a.timestamp},e.set(o,i)),i.fillCount+=1,i.lastTimestamp=a.timestamp,Ht(a.data)&&(i.isToggle=!0)}let r=Array.from(e.values()).sort((n,a)=>n.firstTimestamp-a.firstTimestamp);return r.forEach((n,a)=>{n.order=a+1,n.label=`Field ${a+1}`}),r}function D(t){let e=W(t),r={},n=[];for(let a=0;a<e.length;a++){let o=e[a],i=e[a+1];o.nextFieldOffset=i?i.firstTimestamp-o.firstTimestamp:null,r[o.nodeId]=o,n.push(o.label)}return{totalFields:e.length,sequence:n,byNodeId:r}}function Gt(t){return t<1e3?`${Math.round(t/100)*100}ms`:`${(Math.round(t/100)/10).toFixed(1)}s`}function st(t,e){if(!t||t.category!=="input")return[];if(!e||!e.byNodeId)return[];let r=t.event&&t.event.data;if(!r||typeof r.id!="number")return[];let n=e.byNodeId[r.id];if(!n)return[];let a=[`Field ${n.order} of ${e.totalFields}`];return n.isToggle?n.fillCount>1&&a.push(`Toggled: ${n.fillCount} times`):n.fillCount>1&&a.push(`Re-filled: ${n.fillCount} times`),n.nextFieldOffset!=null&&n.nextFieldOffset>0&&n.nextFieldOffset<=k&&a.push(`Time to next field: ${Gt(n.nextFieldOffset)}`),a}function F(t,e){let r=[],n=t;function a(){fetch(n).then(o=>{if(!o.ok)throw new Error(`Failed to fetch events: ${o.status}`);return o.json()}).then(o=>{if(!Array.isArray(o)||o.length===0){e(null,r);return}r=r.concat(o);let i=o[o.length-1];if(i&&i.timestamp){let s=t.indexOf("?")===-1?"?":"&";n=`${t}${s}after=${i.timestamp}`,a()}else e(null,r)}).catch(o=>{r.length>0?e(null,r):e(o,[])})}a()}var j=null;function w(){return j}function Vt(t){if(t.type===4&&t.data&&t.data.href)return"navigation";if(t.type===3&&t.data){if(t.data.source===2){let e=t.data.type;return e===2||e===4||e===3||e===7?"click":null}if(t.data.source===5)return"input"}return t.type===5?t.data&&t.data.tag==="error"?"error":t.data&&t.data.tag==="navigation"?"navigation":"custom":null}function Yt(t){if(!t||t.length<2)return{map:()=>0,gaps:[]};let e=t[0].timestamp,r=t[t.length-1].timestamp,n=r-e;if(n<=0)return{map:()=>0,gaps:[]};let a=[],o=[],i=e;for(let l=1;l<t.length;l++){let c=t[l].timestamp-t[l-1].timestamp;c>k&&(o.push({start:i,end:t[l-1].timestamp}),a.push({start:t[l-1].timestamp,end:t[l].timestamp,duration:c}),i=t[l].timestamp)}if(o.push({start:i,end:r}),a.length===0)return{map:l=>(l-e)/n,gaps:[]};let s=0;for(let l=0;l<o.length;l++)s+=o[l].end-o[l].start;let f=a.length*it;f>40&&(f=40);let u=f/a.length,m=100-f,p=[],d=0;for(let l=0;l<o.length;l++){let c=o[l].end-o[l].start,h=s>0?c/s*m:0;p.push({type:"active",start:o[l].start,end:o[l].end,posStart:d,posEnd:d+h}),d+=h,l<a.length&&(p.push({type:"gap",start:a[l].start,end:a[l].end,duration:a[l].duration,posStart:d,posEnd:d+u}),d+=u)}function g(l){for(let c=0;c<p.length;c++){let h=p[c];if(h.type==="active"&&l>=h.start&&l<=h.end){let v=h.end-h.start,V=v>0?(l-h.start)/v:0;return(h.posStart+V*(h.posEnd-h.posStart))/100}}for(let c=0;c<p.length;c++)if(p[c].type==="gap"&&l>=p[c].start&&l<=p[c].end)return p[c].posStart/100;return l<=e?0:1}let y=p.filter(l=>l.type==="gap");return{map:g,gaps:y}}function ut(t){if(!t||t.length===0)return[];let e=t[0].timestamp;j=Yt(t);let r=D(t),n=0,a=[];for(let o=0;o<t.length;o++){let i=Vt(t[o]);if(!i)continue;let s={index:o,timestamp:t[o].timestamp,offset:t[o].timestamp-e,position:j.map(t[o].timestamp),category:i,event:t[o]};i==="navigation"&&t[o].type===4&&(n++,s.metaIndex=n),i==="input"&&(s.formContext=r),a.push(s)}return a}function mt(t){return Array.isArray(t)?t.map(e=>({offset:e.offset_ms||0,category:e.kind==="exception"?"server_exception":"server_event",kind:e.kind,label:e.label||"",level:e.level||"",href:e.href||null,isServerMarker:!0})):[]}function q(t){return typeof t.isChecked=="boolean"}function R(t){if(t.isServerMarker)return t.label||(t.category==="server_exception"?"Server exception":"Server event");if(t.category==="navigation"&&t.event.data&&t.event.data.href){let r=t.event.data.href;try{let n=_(new URL(r).pathname,40);return t.metaIndex===1?`Page loaded: ${n}`:`Navigated to: ${n}`}catch{return t.metaIndex===1?"Page loaded":"Page navigation"}}if(t.category==="navigation"&&t.event.data&&t.event.data.payload){let r=t.event.data.payload,n=r.url||"",a=r.external?"Leaving to: ":"Navigating to: ";try{let o=new URL(n),i=r.external?o.hostname+o.pathname:o.pathname;return a+_(i,40)}catch{return a+_(n,40)}}if(t.category==="click"&&t.event.data){let r=t.event.data.type,n="Click";return r===4?n="Double Click":r===3?n="Right Click":r===7&&(n="Touch"),t.event.data.x!=null&&t.event.data.y!=null&&(n+=` (${Math.round(t.event.data.x)}, ${Math.round(t.event.data.y)})`),n}if(t.category==="input"&&t.event.data){let r=t.event.data;return typeof r.text=="string"&&r.text.length>0&&!q(r)?`Input: ${_(r.text,20)}`:q(r)?r.isChecked?"Checkbox checked":"Checkbox unchecked":"Input cleared"}if(t.category==="frustration"){let r=t.x!=null&&t.y!=null?` (${Math.round(t.x)}, ${Math.round(t.y)})`:"";return t.subtype==="rage_click"?`Rage click${r}`:`Dead click${r}`}if(t.category==="error"&&t.event.data&&t.event.data.payload){let r=t.event.data.payload.message||"Error";return _(r,50)}if(t.category==="custom"&&t.event.data&&t.event.data.tag)return t.event.data.tag;let e=C[t.category];return e?e.label:"Event"}function yt(t){if(t.isServerMarker){let n=[];return t.level&&n.push(`Level: ${t.level}`),t.href&&n.push(`Details: ${t.href}`),n}let e=[],r=t.event.data||{};if(t.category==="frustration")return t.x!=null&&t.y!=null&&e.push(`Position: (${Math.round(t.x)}, ${Math.round(t.y)})`),t.subtype==="rage_click"?e.push(`Clicks: ${t.count}`):e.push(`No response within ${t.elapsed||500}ms`),e;if(t.category==="navigation")return r.href?(e.push(`URL: ${r.href}`),r.width&&r.height&&e.push(`Viewport: ${r.width}x${r.height}`)):r.payload&&(r.payload.url&&e.push(`URL: ${r.payload.url}`),r.payload.text&&e.push(`Link text: ${r.payload.text}`),r.payload.external&&e.push("External link")),e;if(t.category==="click")r.x!=null&&r.y!=null&&e.push(`Position: (${Math.round(r.x)}, ${Math.round(r.y)})`);else if(t.category==="input")typeof r.text=="string"&&r.text.length>0&&e.push(`Value: ${r.text}`),q(r)&&e.push(`Checked: ${r.isChecked}`),st(t,t.formContext).forEach(n=>e.push(n));else if(t.category==="error"&&r.payload){let n=r.payload;if(n.message&&e.push(`Message: ${n.message}`),n.source){let a=n.source;n.lineno&&(a+=`:${n.lineno}`),n.colno&&(a+=`:${n.colno}`),e.push(`Source: ${a}`)}n.type&&e.push(`Type: ${n.type}`),n.stack&&e.push(`Stack:
2
+ ${n.stack}`)}else if(t.category==="custom"&&r.payload)try{e.push(`Payload: ${JSON.stringify(r.payload,null,2)}`)}catch{e.push("Payload: [object]")}return e}var Wt=1.5,ht=!1,X=null,gt=0;function jt(t){if(t.length===0)return[];let e=[],r={events:[t[0]],position:t[0].position*100};for(let n=1;n<t.length;n++){let a=t[n].position*100;Math.abs(a-r.position)<=Wt?r.events.push(t[n]):(e.push(r),r={events:[t[n]],position:a})}return e.push(r),e}function J(){let t=document.querySelectorAll(".marker-dropdown");for(let e=0;e<t.length;e++)t[e].parentNode.removeChild(t[e])}function Et(t){if(!X)return;let e=w();if(!e)return;let r=e.map(gt+t)*100;X.style.left=`${Math.max(0,Math.min(100,r))}%`}function xt(t,e){let r=document.getElementById("event-markers");if(!r)return;if(t.length===0){r.style.display="none";return}e&&e.length>0&&(gt=e[0].timestamp),r.innerHTML="";let n=document.createElement("div");n.className="marker-legend",Object.keys(C).forEach(m=>{let p=C[m],d=document.createElement("span");d.className="marker-legend-item";let g=document.createElement("span");g.className="marker-legend-dot",g.style.backgroundColor=p.color,d.appendChild(g),d.appendChild(document.createTextNode(p.label)),n.appendChild(d)}),r.appendChild(n);let a=document.createElement("div");a.className="marker-bar";let o=document.createElement("div");o.className="marker-track",a.appendChild(o);let i=document.createElement("div");i.className="marker-playhead",i.style.left="0%",a.appendChild(i),X=i;let s=t;s.length>500&&(s=t.filter(m=>m.category!=="input")),jt(s).forEach(m=>{let p=`${Math.max(1,Math.min(99,m.position))}%`;if(m.events.length===1){let d=m.events[0],g=C[d.category];if(!g)return;let y=document.createElement("div");y.className=`event-marker${d.category==="error"?" error-marker":""}`,y.style.left=p,y.style.backgroundColor=g.color,y.title=`${R(d)} at ${M(d.offset)}`,y.addEventListener("click",()=>P(d.offset)),a.appendChild(y)}else{let d=m.events.some(c=>c.category==="error"),g=document.createElement("div");g.className="marker-group",g.style.left=p;let y=document.createElement("div");y.className=`event-marker marker-group-dot${d?" error-marker":""}`,y.style.backgroundColor=d?"#ff0000":"#6c757d",y.title=`${m.events.length} events at ${M(m.events[0].offset)}`;let l=document.createElement("span");l.className="marker-group-count",l.textContent=m.events.length,g.appendChild(y),g.appendChild(l),g.addEventListener("click",c=>{c.stopPropagation(),J();let h=document.createElement("div");h.className="marker-dropdown",m.events.forEach(v=>{let V=C[v.category]||{},N=document.createElement("div");N.className=`marker-dropdown-item${v.category==="error"?" error-entry":""}`;let Y=document.createElement("span");Y.className="activity-dot",Y.style.backgroundColor=V.color||"#6c757d";let ot=document.createElement("span");ot.textContent=`${M(v.offset)} ${R(v)}`,N.appendChild(Y),N.appendChild(ot),N.addEventListener("click",Ft=>{Ft.stopPropagation(),J(),P(v.offset)}),h.appendChild(N)}),g.appendChild(h)}),a.appendChild(g)}});let u=w();u&&u.gaps.length>0&&u.gaps.forEach(m=>{let p=document.createElement("div");p.className="marker-gap",p.style.left=`${m.posStart}%`,p.style.width=`${m.posEnd-m.posStart}%`,p.title=`Inactive: ${S(m.duration)}`,a.appendChild(p)}),ht||(ht=!0,document.addEventListener("click",J)),r.appendChild(a),r.style.display=""}var B=null,z=[];function Ct(t){let e=document.getElementById("activity-sidebar"),r=document.getElementById("activity-list"),n=document.getElementById("activity-count");if(!(!e||!r)){if(t.length===0){e.style.display="none";return}z=t,e.style.display="",n&&(n.textContent=t.length),r.innerHTML="",t.forEach((a,o)=>{let i=C[a.category];if(!i)return;if(o>0){let y=t[o-1].offset,l=a.offset-y;if(l>k){let c=document.createElement("div");c.className="activity-gap",c.textContent=`${S(l)} inactive`,r.appendChild(c)}}let s=document.createElement("div");s.className="activity-wrapper";let f=document.createElement("div"),u="activity-entry";a.category==="error"?u+=" error-entry":a.category==="navigation"?u+=" navigation-entry":a.category==="frustration"?u+=" frustration-entry":a.category==="server_exception"?u+=" server-exception-entry":a.category==="server_event"&&(u+=" server-event-entry"),f.className=u,f.setAttribute("data-offset",a.offset),f.setAttribute("data-index",o);let m=document.createElement("span");m.className="activity-time",m.textContent=M(a.offset);let p=document.createElement("span");p.className="activity-dot",p.style.backgroundColor=i.color;let d;a.isServerMarker&&a.href?(d=document.createElement("a"),d.href=a.href,d.className="activity-label activity-label-link",d.addEventListener("click",y=>y.stopPropagation())):(d=document.createElement("span"),d.className="activity-label"),d.textContent=R(a),f.appendChild(m),f.appendChild(p),f.appendChild(d),f.addEventListener("click",()=>P(a.offset)),s.appendChild(f);let g=yt(a);if(g.length>0){let y=document.createElement("div");y.className="activity-detail",g.forEach(l=>{let c=document.createElement("div");if(c.className="activity-detail-line",l.indexOf(`
3
+ `)!==-1){let h=document.createElement("pre");h.className="activity-detail-pre",h.textContent=l,c.appendChild(h)}else c.textContent=l;y.appendChild(c)}),s.appendChild(y)}r.appendChild(s)}),qt()}}function Q(){B&&(clearInterval(B),B=null)}function qt(){Q(),B=setInterval(()=>{let t=A();if(t)try{let r=t.getReplayer().getCurrentTime();Kt(r),Et(r)}catch{}},250)}function Kt(t){let e=document.querySelectorAll(".activity-wrapper");if(e.length===0)return;let r=-1;for(let n=z.length-1;n>=0;n--)if(z[n].offset<=t){r=n;break}for(let n=0;n<e.length;n++){let a=e[n].querySelector(".activity-entry");a&&(n===r?a.classList.contains("active")||(a.classList.add("active"),e[n].scrollIntoView({block:"nearest",behavior:"smooth"})):a.classList.remove("active"))}}var Jt=["LCP","CLS","INP"];function Xt(t){let e=Object.create(null);if(!Array.isArray(t))return e;for(let r of t)if(r&&r.type===5&&r.data&&r.data.tag==="__perf"&&r.data.payload){let n=r.data.payload;typeof n.metric=="string"&&typeof n.value=="number"&&(e[n.metric]={value:n.value,rating:n.rating})}return e}function zt(t,e){return t==="CLS"?e.toFixed(3):`${Math.round(e)} ms`}function Qt(t){return t==="good"?"badge-success":t==="needs-improvement"?"badge-warning":t==="poor"?"badge-danger":"badge-neutral"}function vt(t,e){if(!e)return;let r=Xt(t);e.innerHTML="";let n=!1;for(let a of Jt){let o=r[a];if(!o)continue;n=!0;let i=document.createElement("span");i.className=`badge ${Qt(o.rating)} shrink-0`,i.textContent=`${a} ${zt(a,o.value)}`,o.rating&&(i.title=o.rating),e.appendChild(i)}e.style.display=n?"inline-flex":"none"}function te(t){let e=0;if(!Array.isArray(t))return e;for(let r=0;r<t.length;r++){let n=t[r];n&&n.type===3&&n.data&&n.data.source===3&&typeof n.data.y=="number"&&n.data.y>e&&(e=n.data.y)}return e}function ee(t){if(!Array.isArray(t))return null;for(let e=0;e<t.length;e++){let r=t[e];if(r&&r.type===4&&r.data&&r.data.height)return r.data.height}return null}function Z(t){let e=Math.round(te(t));if(e<=0)return null;let r=ee(t),n=r&&r>0?Math.round((e+r)/r*10)/10:null;return{y:e,viewports:n}}function Tt(t,e){if(!e)return;let r=Z(t);if(!r){e.style.display="none",e.textContent="";return}let n=r.viewports!=null?` (~${r.viewports}\xD7 viewport)`:"";e.textContent=`Max Scroll: ${r.y}px${n}`,e.style.display="inline"}var bt=6,kt=1e3,b=!1,I=null;function re(t){let e=[];if(!Array.isArray(t))return e;for(let r=0;r<t.length;r++){let n=t[r];n&&n.type===3&&n.data&&n.data.source===2&&n.data.type===2&&typeof n.data.x=="number"&&typeof n.data.y=="number"&&e.push({x:n.data.x,y:n.data.y})}return e}function ne(t){if(!Array.isArray(t))return null;for(let e=0;e<t.length;e++){let r=t[e];if(r&&r.type===4&&r.data&&r.data.width&&r.data.height)return{width:r.data.width,height:r.data.height}}return null}function ae(t,e,r){let n=e&&e.width>0?r.width/e.width:1,a=e&&e.height>0?r.height/e.height:1,o=Math.max(0,Math.min(r.width,t.x*n)),i=Math.max(0,Math.min(r.height,t.y*a));return{x:o,y:i}}function oe(){let t=document.getElementById("replayer");return t?t.querySelector(".replayer-wrapper")||t.querySelector(".rr-player__frame")||t:null}function tt(){I&&I.parentNode&&I.parentNode.removeChild(I),I=null}function ie(){tt();let t=oe();if(!t)return;let e=U(),r=ne(e),n=re(e);if(n.length>kt){let i=Math.ceil(n.length/kt);n=n.filter((s,f)=>f%i===0)}let a={width:t.clientWidth||(r?r.width:0),height:t.clientHeight||(r?r.height:0)},o=document.createElement("div");o.className="click-overlay-container",n.forEach(i=>{let{x:s,y:f}=ae(i,r,a),u=document.createElement("div");u.className="click-dot",u.style.left=`${s-bt}px`,u.style.top=`${f-bt}px`,o.appendChild(u)}),getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(o),I=o}function St(){b=!1,tt();let t=document.getElementById("toggle-clicks-btn");t&&(t.setAttribute("aria-pressed","false"),t.classList.remove("btn-active"))}function H(){if(!A())return b;b=!b,b?ie():tt();let t=document.getElementById("toggle-clicks-btn");return t&&(t.setAttribute("aria-pressed",b?"true":"false"),t.classList.toggle("btn-active",b)),b}var Mt=500,_t=10,At=3,It=500;function Nt(t){return!!(t&&t.type===3&&t.data&&t.data.source===2&&t.data.type===2&&typeof t.data.x=="number"&&typeof t.data.y=="number")}function ce(t){return!t||!t.data?!1:t.type===4?!0:t.type===3?t.data.source===0||t.data.source===5:!1}function se(t){if(!Array.isArray(t))return[];let e=[];for(let a=0;a<t.length;a++)Nt(t[a])&&e.push(t[a]);if(e.length<At)return[];let r=[],n=0;for(let a=1;a<=e.length;a++){let o=e[a-1],i=e[a],s=e[n];if(!(i&&i.timestamp-o.timestamp<=Mt&&i.timestamp-s.timestamp<=Mt&&Math.abs(i.data.x-s.data.x)<=_t&&Math.abs(i.data.y-s.data.y)<=_t)){let u=a-n;if(u>=At){let m=[];for(let p=n;p<a;p++)m.push(e[p].timestamp);r.push({subtype:"rage_click",timestamp:s.timestamp,count:u,x:s.data.x,y:s.data.y,memberTimestamps:m,event:s})}n=a}}return r}function pe(t){if(!Array.isArray(t))return[];let e=[];for(let r=0;r<t.length;r++){if(!Nt(t[r]))continue;let n=t[r].timestamp,a=n+It,o=!1;for(let i=r+1;i<t.length;i++){let s=t[i].timestamp;if(s>a)break;if(s>n&&ce(t[i])){o=!0;break}}o||e.push({subtype:"dead_click",timestamp:n,x:t[r].data.x,y:t[r].data.y,elapsed:It,event:t[r]})}return e}function G(t){if(!Array.isArray(t)||t.length===0)return[];let e=t[0].timestamp,r=se(t),n=pe(t),a=new Set;r.forEach(i=>(i.memberTimestamps||[i.timestamp]).forEach(s=>a.add(s)));let o=[];return r.forEach(i=>o.push(i)),n.forEach(i=>{a.has(i.timestamp)||o.push(i)}),o.map(i=>({category:"frustration",subtype:i.subtype,timestamp:i.timestamp,offset:i.timestamp-e,count:i.count,elapsed:i.elapsed,x:i.x,y:i.y,event:i.event})).sort((i,s)=>i.offset-s.offset)}var de=1e4,fe=1e3;function ue(t){return t.type===3&&t.data&&t.data.source>=1&&t.data.source<=5}function me(t,e=de){if(!Array.isArray(t)||t.length===0)return[];let r=t[0].timestamp,n=[0],a=!1;for(let i of t)ue(i)&&(n.push(i.timestamp-r),a=!0);if(!a)return[];n.push(t[t.length-1].timestamp-r);let o=[];for(let i=1;i<n.length;i++)n[i]-n[i-1]>e&&o.push({start:n[i-1],end:n[i]});return o}function ye(t,e,r=fe){for(let n of t){let a=n.end-r;if(e>=n.start&&e<a)return a}return null}function Lt(t,e){let r=me(e);if(r.length===0)return;let n=!1;t.addEventListener("ui-update-player-state",a=>{n=a.payload==="playing"}),t.addEventListener("ui-update-current-time",a=>{if(!n)return;let o;try{o=t.getReplayer().config.skipInactive!==!1}catch{return}if(!o)return;let i=ye(r,a.payload);i!==null&&t.goto(i,!0)})}var x=null,Pt=[],Ot=[1,2,4,8,16],et=0,$t=!1;function A(){return x}function U(){return Pt}function he(t){let e=document.getElementById("active-time");if(!e)return;let r=lt(t);if(r>0){let n=t[t.length-1].timestamp-t[0].timestamp,a=n>0?Math.round(r/n*100):100;e.textContent=`(active: ${S(r)} / ${a}%)`,e.style.display="inline"}}function ge(t){let e=document.getElementById("viewport-info");if(!e)return;let r=ct(t);r&&(e.textContent=`Viewport: ${r}`,e.style.display="inline")}function Ee(t){if(t.length===0)return null;let r=new URLSearchParams(window.location.search).get("t");if(r!==null&&r!==""){let n=parseInt(r,10);if(!isNaN(n)){let a=n-t[0].timestamp;return a>=0?t[0].timestamp+a:null}}return null}function P(t){if(x)try{let e=x.getReplayer();e&&(e.play(t),e.pause())}catch(e){console.warn("Sentiero: seek failed",e)}}function wt(t,e){try{let r=t.getMetaData(),n=t.getCurrentTime(),a=Math.max(0,Math.min(n+e,r.totalTime));t.play(a),t.pause()}catch(r){console.warn("Sentiero: seek failed",r)}}function Rt(t){et=Math.max(0,Math.min(Ot.length-1,et+t));try{let e=x.getReplayer();e&&e.setConfig&&e.setConfig({speed:Ot[et]})}catch(e){console.warn("Sentiero: speed change failed",e)}}function xe(){$t||($t=!0,document.addEventListener("keydown",t=>{if(!x||t.target.tagName==="INPUT"||t.target.tagName==="TEXTAREA")return;let e;try{e=x.getReplayer()}catch{return}if(e)switch(t.key){case" ":t.preventDefault();try{x.$$?.ctx?.[0]?x.toggle():e.play()}catch{try{e.play()}catch{}}break;case"ArrowLeft":t.preventDefault(),wt(e,-5e3);break;case"ArrowRight":t.preventDefault(),wt(e,5e3);break;case"ArrowUp":t.preventDefault(),Rt(1);break;case"ArrowDown":t.preventDefault(),Rt(-1);break}}))}function rt(t,e,r=[]){if(!e){console.error("Sentiero: player container not found");return}F(t,(n,a)=>{if(n){console.error("Sentiero: failed to load events",n),e.innerHTML="";let c=document.createElement("div");c.className="alert alert-danger",c.textContent=`Failed to load session events: ${n.message}`,e.appendChild(c);return}if(a.length===0){e.innerHTML='<p class="text-muted">No events recorded for this window.</p>';return}Pt=a,he(a),ge(a),Tt(a,document.getElementById("scroll-depth-info")),vt(a,document.getElementById("web-vitals-badges"));let o=ut(a),i=w(),s=a[0].timestamp,f=G(a);f.forEach(c=>{c.position=i?i.map(c.timestamp):0});let u=Array.isArray(r)?r:[];u.forEach(c=>{c.position=i?i.map(s+c.offset):0});let m=o.concat(f).concat(u).sort((c,h)=>c.offset-h.offset);xt(m,a),Ct(m);let p=e.closest(".player-frame")||e.parentElement,d=p?p.clientWidth:1024,g=Math.min(2048,d),y=rrwebPlayer.default||rrwebPlayer;x=new y({target:e,props:{events:a,showController:!0,autoPlay:!1,skipInactive:!0,width:g}});let l=Ee(a);if(l)try{let c=x.getReplayer();c&&setTimeout(()=>{c.play(l-a[0].timestamp),c.pause()},100)}catch(c){console.warn("Sentiero: could not seek to timestamp",c)}Lt(x,a),St(),xe()})}function nt(){let t=A(),e=U();if(!(!t||e.length===0))try{let n=t.getReplayer().getCurrentTime(),a=new URL(window.location.href);a.searchParams.set("t",Math.round(n)),navigator.clipboard.writeText(a.toString()).then(()=>{let o=document.getElementById("copy-link-btn");if(o){let i=o.textContent;o.textContent="Copied!",setTimeout(()=>{o.textContent=i},2e3)}})}catch(r){console.warn("Sentiero: copy link failed",r)}}function at(){let t=U();if(t.length!==0)try{let e=JSON.stringify(t,null,2),r=new Blob([e],{type:"application/json"}),n=URL.createObjectURL(r),a=document.createElement("a");a.href=n,a.download="sentiero-session-events.json",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}catch(e){console.warn("Sentiero: download failed",e)}}function Ut(){document.addEventListener("click",t=>{let e=t.target.closest("[data-action]");if(!e)return;let r=e.getAttribute("data-action");if(r==="copy-link")nt();else if(r==="toggle-clicks")H();else if(r==="download-json")at();else if(r==="confirm-delete"){let n=e.getAttribute("data-confirm")||"Are you sure?";confirm(n)||t.preventDefault()}})}function Ce(t,e,r){return!(e!=="all"&&t.dataset.activityKind!==e||r&&t.dataset.activityLevel!==r)}function Dt(){let t=document.getElementById("server-activity");if(!t)return;let e=Array.from(t.querySelectorAll("[data-activity-row]"));if(e.length===0)return;let r=t.querySelector("[data-activity-filter-type]"),n=t.querySelector("[data-activity-filter-level]");if(!r&&!n)return;let a="all",o="";function i(){e.forEach(s=>{let f=Ce(s,a,o);s.style.display=f?"":"none"})}r&&r.addEventListener("click",s=>{let f=s.target.closest("[data-filter-type]");f&&(a=f.dataset.filterType,Array.from(r.querySelectorAll("[data-filter-type]")).forEach(u=>{u.classList.toggle("btn-active",u===f),u.classList.toggle("btn-secondary",u!==f)}),i())}),n&&n.addEventListener("change",()=>{o=n.value,i()})}window.SentieroDashboard={initPlayer:rt,fetchAllEvents:F,copyLink:nt,downloadJSON:at,toggleClickOverlay:H,computeScrollDepth:Z,detectFrustrationEvents:G,analyzeFormInteractions:W,buildFormContext:D};function ve(){let t=document.getElementById("server-activity-markers");if(!t)return[];try{return mt(JSON.parse(t.textContent))}catch(e){return console.warn("Sentiero: failed to parse server-activity markers",e),[]}}document.addEventListener("DOMContentLoaded",()=>{let t=document.getElementById("sentiero-player-config");if(t)try{let e=JSON.parse(t.textContent),r=document.getElementById("replayer");if(e.eventsUrl&&r){let n=ve();rt(e.eventsUrl,r,n)}}catch(e){console.error("Sentiero: failed to parse player config",e)}Ut(),Dt(),window.addEventListener("pagehide",Q)});})();
@@ -1,11 +1,11 @@
1
1
  {
2
- "recorder": "recorder-SLLXSUUX.js",
3
- "dashboard": "dashboard-JFYNHZZV.js",
2
+ "recorder": "recorder-W2RCU5VM.js",
3
+ "dashboard": "dashboard-YINQE5ZH.js",
4
4
  "sessions_index": "sessions_index-2RAGTEZM.js",
5
5
  "analytics": "analytics-RH24EOLD.js",
6
6
  "heatmap": "heatmap-EBKFWSKN.js",
7
7
  "import": "import-HIMBJJ4S.js",
8
- "style": "style-d71e72fd.css",
9
- "rrweb-player": "rrweb-player-cd435a95.js",
8
+ "style": "style-80e536e6.css",
9
+ "rrweb-player": "rrweb-player-d522d74c.js",
10
10
  "rrweb-player-css": "rrweb-player-css-ce5e9629.css"
11
11
  }
@@ -0,0 +1,78 @@
1
+ (()=>{var fi=Object.defineProperty;var hi=(t,e)=>()=>(t&&(e=t(t=0)),e);var di=(t,e)=>{for(var r in e)fi(t,r,{get:e[r],enumerable:!0})};var li={};di(li,{CLSThresholds:()=>gr,FCPThresholds:()=>mr,FIDThresholds:()=>br,INPThresholds:()=>vr,LCPThresholds:()=>yr,TTFBThresholds:()=>Sr,onCLS:()=>vs,onFCP:()=>ei,onFID:()=>_s,onINP:()=>Is,onLCP:()=>Ms,onTTFB:()=>Es});var pr,bt,Qt,Qn,_e,ti,Tt,wr,Oe,ot,zt,st,Cr,te,Ne,Ft,Xn,Re,Jn,gs,Ir,ee,mr,ei,gr,vs,ri,hr,Te,ys,ni,Ss,ht,ke,ii,bs,ws,Cs,oi,vr,Is,yr,dr,Ms,Sr,xs,Es,Kt,Ts,Kn,si,ks,ai,br,_s,ui=hi(()=>{ti=-1,Tt=function(t){addEventListener("pageshow",function(e){e.persisted&&(ti=e.timeStamp,t(e))},!0)},wr=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Oe=function(){var t=wr();return t&&t.activationStart||0},ot=function(t,e){var r=wr(),n="navigate";return ti>=0?n="back-forward-cache":r&&(document.prerendering||Oe()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:t,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},zt=function(t,e,r){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){e(i.getEntries())})});return n.observe(Object.assign({type:t,buffered:!0},r||{})),n}}catch{}},st=function(t,e,r,n){var i,o;return function(a){e.value>=0&&(a||n)&&((o=e.value-(i||0))||i===void 0)&&(i=e.value,e.delta=o,e.rating=function(l,s){return l>s[1]?"poor":l>s[0]?"needs-improvement":"good"}(e.value,r),t(e))}},Cr=function(t){requestAnimationFrame(function(){return requestAnimationFrame(function(){return t()})})},te=function(t){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&t()})},Ne=function(t){var e=!1;return function(){e||(t(),e=!0)}},Ft=-1,Xn=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Re=function(t){document.visibilityState==="hidden"&&Ft>-1&&(Ft=t.type==="visibilitychange"?t.timeStamp:0,gs())},Jn=function(){addEventListener("visibilitychange",Re,!0),addEventListener("prerenderingchange",Re,!0)},gs=function(){removeEventListener("visibilitychange",Re,!0),removeEventListener("prerenderingchange",Re,!0)},Ir=function(){return Ft<0&&(Ft=Xn(),Jn(),Tt(function(){setTimeout(function(){Ft=Xn(),Jn()},0)})),{get firstHiddenTime(){return Ft}}},ee=function(t){document.prerendering?addEventListener("prerenderingchange",function(){return t()},!0):t()},mr=[1800,3e3],ei=function(t,e){e=e||{},ee(function(){var r,n=Ir(),i=ot("FCP"),o=zt("paint",function(a){a.forEach(function(l){l.name==="first-contentful-paint"&&(o.disconnect(),l.startTime<n.firstHiddenTime&&(i.value=Math.max(l.startTime-Oe(),0),i.entries.push(l),r(!0)))})});o&&(r=st(t,i,mr,e.reportAllChanges),Tt(function(a){i=ot("FCP"),r=st(t,i,mr,e.reportAllChanges),Cr(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})},gr=[.1,.25],vs=function(t,e){e=e||{},ei(Ne(function(){var r,n=ot("CLS",0),i=0,o=[],a=function(s){s.forEach(function(c){if(!c.hadRecentInput){var u=o[0],h=o[o.length-1];i&&c.startTime-h.startTime<1e3&&c.startTime-u.startTime<5e3?(i+=c.value,o.push(c)):(i=c.value,o=[c])}}),i>n.value&&(n.value=i,n.entries=o,r())},l=zt("layout-shift",a);l&&(r=st(t,n,gr,e.reportAllChanges),te(function(){a(l.takeRecords()),r(!0)}),Tt(function(){i=0,n=ot("CLS",0),r=st(t,n,gr,e.reportAllChanges),Cr(function(){return r()})}),setTimeout(r,0))}))},ri=0,hr=1/0,Te=0,ys=function(t){t.forEach(function(e){e.interactionId&&(hr=Math.min(hr,e.interactionId),Te=Math.max(Te,e.interactionId),ri=Te?(Te-hr)/7+1:0)})},ni=function(){return pr?ri:performance.interactionCount||0},Ss=function(){"interactionCount"in performance||pr||(pr=zt("event",ys,{type:"event",buffered:!0,durationThreshold:0}))},ht=[],ke=new Map,ii=0,bs=function(){var t=Math.min(ht.length-1,Math.floor((ni()-ii)/50));return ht[t]},ws=[],Cs=function(t){if(ws.forEach(function(i){return i(t)}),t.interactionId||t.entryType==="first-input"){var e=ht[ht.length-1],r=ke.get(t.interactionId);if(r||ht.length<10||t.duration>e.latency){if(r)t.duration>r.latency?(r.entries=[t],r.latency=t.duration):t.duration===r.latency&&t.startTime===r.entries[0].startTime&&r.entries.push(t);else{var n={id:t.interactionId,latency:t.duration,entries:[t]};ke.set(n.id,n),ht.push(n)}ht.sort(function(i,o){return o.latency-i.latency}),ht.length>10&&ht.splice(10).forEach(function(i){return ke.delete(i.id)})}}},oi=function(t){var e=self.requestIdleCallback||self.setTimeout,r=-1;return t=Ne(t),document.visibilityState==="hidden"?t():(r=e(t),te(t)),r},vr=[200,500],Is=function(t,e){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(e=e||{},ee(function(){var r;Ss();var n,i=ot("INP"),o=function(l){oi(function(){l.forEach(Cs);var s=bs();s&&s.latency!==i.value&&(i.value=s.latency,i.entries=s.entries,n())})},a=zt("event",o,{durationThreshold:(r=e.durationThreshold)!==null&&r!==void 0?r:40});n=st(t,i,vr,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),te(function(){o(a.takeRecords()),n(!0)}),Tt(function(){ii=ni(),ht.length=0,ke.clear(),i=ot("INP"),n=st(t,i,vr,e.reportAllChanges)}))}))},yr=[2500,4e3],dr={},Ms=function(t,e){e=e||{},ee(function(){var r,n=Ir(),i=ot("LCP"),o=function(s){e.reportAllChanges||(s=s.slice(-1)),s.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-Oe(),0),i.entries=[c],r())})},a=zt("largest-contentful-paint",o);if(a){r=st(t,i,yr,e.reportAllChanges);var l=Ne(function(){dr[i.id]||(o(a.takeRecords()),a.disconnect(),dr[i.id]=!0,r(!0))});["keydown","click"].forEach(function(s){addEventListener(s,function(){return oi(l)},{once:!0,capture:!0})}),te(l),Tt(function(s){i=ot("LCP"),r=st(t,i,yr,e.reportAllChanges),Cr(function(){i.value=performance.now()-s.timeStamp,dr[i.id]=!0,r(!0)})})}})},Sr=[800,1800],xs=function t(e){document.prerendering?ee(function(){return t(e)}):document.readyState!=="complete"?addEventListener("load",function(){return t(e)},!0):setTimeout(e,0)},Es=function(t,e){e=e||{};var r=ot("TTFB"),n=st(t,r,Sr,e.reportAllChanges);xs(function(){var i=wr();i&&(r.value=Math.max(i.responseStart-Oe(),0),r.entries=[i],n(!0),Tt(function(){r=ot("TTFB",0),(n=st(t,r,Sr,e.reportAllChanges))(!0)}))})},Kt={passive:!0,capture:!0},Ts=new Date,Kn=function(t,e){bt||(bt=e,Qt=t,Qn=new Date,ai(removeEventListener),si())},si=function(){if(Qt>=0&&Qt<Qn-Ts){var t={entryType:"first-input",name:bt.type,target:bt.target,cancelable:bt.cancelable,startTime:bt.timeStamp,processingStart:bt.timeStamp+Qt};_e.forEach(function(e){e(t)}),_e=[]}},ks=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;t.type=="pointerdown"?function(r,n){var i=function(){Kn(r,n),a()},o=function(){a()},a=function(){removeEventListener("pointerup",i,Kt),removeEventListener("pointercancel",o,Kt)};addEventListener("pointerup",i,Kt),addEventListener("pointercancel",o,Kt)}(e,t):Kn(e,t)}},ai=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach(function(e){return t(e,ks,Kt)})},br=[100,300],_s=function(t,e){e=e||{},ee(function(){var r,n=Ir(),i=ot("FID"),o=function(s){s.startTime<n.firstHiddenTime&&(i.value=s.processingStart-s.startTime,i.entries.push(s),r(!0))},a=function(s){s.forEach(o)},l=zt("first-input",a);r=st(t,i,br,e.reportAllChanges),l&&(te(Ne(function(){a(l.takeRecords()),l.disconnect()})),Tt(function(){var s;i=ot("FID"),r=st(t,i,br,e.reportAllChanges),_e=[],Qt=-1,bt=null,ai(addEventListener),s=o,_e.push(s),si()}))})}});var pi=Object.defineProperty,mi=(t,e,r)=>e in t?pi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e,r)=>mi(t,typeof e!="symbol"?e+"":e,r),Mr,O=(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))(O||{}),T=(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))(T||{}),tt=(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))(tt||{}),dt=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(dt||{}),Dt=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Dt||{}),Rt=(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))(Rt||{}),G=(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))(G||{}),xr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Er={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},re={},Br={},gi=()=>!!globalThis.Zone;function Je(t){if(re[t])return re[t];let e=globalThis[t],r=e.prototype,n=t in xr?xr[t]:void 0,i=!!(n&&n.every(l=>{var s,c;return!!((c=(s=Object.getOwnPropertyDescriptor(r,l))==null?void 0:s.get)!=null&&c.toString().includes("[native code]"))})),o=t in Er?Er[t]:void 0,a=!!(o&&o.every(l=>{var s;return typeof r[l]=="function"&&((s=r[l])==null?void 0:s.toString().includes("[native code]"))}));if(i&&a&&!gi())return re[t]=e.prototype,e.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let s=l.contentWindow;if(!s)return e.prototype;let c=s[t].prototype;if(!c)return l.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),Br[t]=()=>l.remove()):l.remove(),re[t]=c}catch{return r}}var Le={};function pt(t,e,r){var n;let i=`${t}.${String(r)}`;if(Le[i])return Le[i].call(e);let o=Je(t),a=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return a?(Le[i]=a,a.call(e)):e[r]}var De={};function Wr(t,e,r){let n=`${t}.${String(r)}`;if(De[n])return De[n].bind(e);let o=Je(t)[r];return typeof o!="function"?e[r]:(De[n]=o,o.bind(e))}function vi(t){return pt("Node",t,"ownerDocument")}function yi(t){return pt("Node",t,"childNodes")}function Si(t){return pt("Node",t,"parentNode")}function bi(t){return pt("Node",t,"parentElement")}function wi(t){return pt("Node",t,"textContent")}function Ci(t,e){return Wr("Node",t,"contains")(e)}function Ii(t){return Wr("Node",t,"getRootNode")()}function Mi(t){return!t||!("host"in t)?null:pt("ShadowRoot",t,"host")}function xi(t){return t.styleSheets}function Ei(t){return!t||!("shadowRoot"in t)?null:pt("Element",t,"shadowRoot")}function Ti(t,e){return pt("Element",t,"querySelector")(e)}function ki(t,e){return pt("Element",t,"querySelectorAll")(e)}function Hr(){return[Je("MutationObserver").constructor,Br.MutationObserver??(()=>{})]}var Gt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Gt=()=>new Date().getTime());function Mt(t,e,r){try{if(!(e in t))return()=>{};let n=t[e],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=i,()=>{t[e]=n}}catch{return()=>{}}}var b={ownerDocument:vi,childNodes:yi,parentNode:Si,parentElement:bi,textContent:wi,contains:Ci,getRootNode:Ii,host:Mi,styleSheets:xi,shadowRoot:Ei,querySelector:Ti,querySelectorAll:ki,nowTimestamp:Gt,mutationObserverCtor:Hr,patch:Mt};function Gr(t){return t.nodeType===t.ELEMENT_NODE}function Bt(t){let e=t&&"host"in t&&"mode"in t&&b.host(t)||null;return!!(e&&"shadowRoot"in e&&b.shadowRoot(e)===t)}function Wt(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function _i(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}function Ri(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(" ")+";"}function Pe(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,i=>jr(i,r)).join("");return _i(n)}catch{return null}}function jr(t,e){if(Ni(t)){let r;try{r=Pe(t.styleSheet)||Ri(t)}catch{r=t.cssText}return t.styleSheet.href?fe(r,t.styleSheet.href):r}else{let r=t.cssText;return Ai(t)&&t.selectorText.includes(":")&&(r=Oi(r)),e?fe(r,e):r}}function Oi(t){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function Ni(t){return"styleSheet"in t}function Ai(t){return"selectorText"in t}var le=class{constructor(){v(this,"idNodeMap",new Map),v(this,"nodeMetaMap",new WeakMap)}getId(e){var r;return e?((r=this.getMeta(e))==null?void 0:r.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 r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,r){let n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)}replace(e,r){let n=this.getNode(e);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(e,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Li(){return new le}function ue({element:t,maskInputOptions:e,tagName:r,type:n,value:i,maskInputFn:o}){let a=i||"",l=n&&It(n);return(e[r.toLowerCase()]||l&&e[l])&&(o?a=o(a,t):a="*".repeat(a.length)),a}function It(t){return t.toLowerCase()}var Tr="__rrweb_original__";function Di(t){let e=t.getContext("2d");if(!e)return!0;let r=50;for(let n=0;n<t.width;n+=r)for(let i=0;i<t.height;i+=r){let o=e.getImageData,a=Tr in o?o[Tr]:o;if(new Uint32Array(a.call(e,n,i,Math.min(r,t.width-n),Math.min(r,t.height-i)).data.buffer).some(s=>s!==0))return!1}return!0}function ce(t){let e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?It(e):null}function $r(t,e){let r;try{r=new URL(t,e??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function Fi(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var zi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Pi=/^(?:[a-z+]+:)?\/\//i,Ui=/^www\..*/i,Bi=/^(data:)([^,]*),(.*)/i;function fe(t,e){return(t||"").replace(zi,(r,n,i,o,a,l)=>{let s=i||a||l,c=n||o||"";if(!s)return r;if(Pi.test(s)||Ui.test(s))return`url(${c}${s}${c})`;if(Bi.test(s))return`url(${c}${s}${c})`;if(s[0]==="/")return`url(${c}${Fi(e)+s}${c})`;let u=s.split("#")[0],h=s.substring(u.length),m=e.split("#")[0].split("/"),p=u.split("/");m.pop();for(let d of p)d!=="."&&(d===".."?m.pop():m.push(d));return`url(${c}${m.join("/")}${h}${c})`})}function ne(t,e=!1){return e?t.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):t.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Wi(t,e,r=!1){let n=Array.from(e.childNodes),i=[],o=0;if(n.length>1&&t&&typeof t=="string"){let a=ne(t,r),l=a.length/t.length;for(let s=1;s<n.length;s++)if(n[s].textContent&&typeof n[s].textContent=="string"){let c=ne(n[s].textContent,r),u=100,h=3;for(;h<c.length&&(c[h].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,h),1)!==-1);h++);for(;h<c.length;h++){let m=c.substring(0,h),p=a.split(m),d=-1;if(p.length===2)d=p[0].length;else if(p.length>2&&p[0]===""&&n[s-1].textContent!=="")d=a.indexOf(m,1);else if(p.length===1){if(m=m.substring(0,m.length-1),p=a.split(m),p.length<=1)return i.push(t),i;h=u+1}else h===c.length-1&&(d=a.indexOf(m));if(p.length>=2&&h>u){let f=n[s-1].textContent;if(f&&typeof f=="string"){let y=ne(f).length;d=a.indexOf(m,y)}d===-1&&(d=p[0].length)}if(d!==-1){let f=Math.floor(d/l);for(;f>0&&f<t.length;){if(o+=1,o>50*n.length)return i.push(t),i;let y=ne(t.substring(0,f),r);if(y.length===d){i.push(t.substring(0,f)),t=t.substring(f),a=a.substring(d);break}else y.length<d?f+=Math.max(1,Math.floor((d-y.length)/l)):f-=Math.max(1,Math.floor((y.length-d)*l))}break}}}}return i.push(t),i}function Hi(t,e){return Wi(t,e).join("/* rr_split */")}var Gi=1,ji=new RegExp("[^a-z0-9-_:]"),jt=-2;function Vr(){return Gi++}function $i(t){if(t instanceof HTMLFormElement)return"form";let e=It(t.tagName);return ji.test(e)?"div":e}var _t,kr,Vi=/^[^ \t\n\r\u000c]+/,qi=/^[, \t\n\r\u000c]+/;function Zi(t,e){if(e.trim()==="")return e;let r=0;function n(o){let a,l=o.exec(e.substring(r));return l?(a=l[0],r+=a.length,a):""}let i=[];for(;n(qi),!(r>=e.length);){let o=n(Vi);if(o.slice(-1)===",")o=Nt(t,o.substring(0,o.length-1)),i.push(o);else{let a="";o=Nt(t,o);let l=!1;for(;;){let s=e.charAt(r);if(s===""){i.push((o+a).trim());break}else if(l)s===")"&&(l=!1);else if(s===","){r+=1,i.push((o+a).trim());break}else s==="("&&(l=!0);a+=s,r+=1}}}return i.join(", ")}var _r=new WeakMap;function Nt(t,e){return!e||e.trim()===""?e:Ke(t,e)}function Yi(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function Ke(t,e){let r=_r.get(t);if(r||(r=t.createElement("a"),_r.set(t,r)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return r.setAttribute("href",e),r.href}function qr(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)?Nt(t,n):r==="srcset"?Zi(t,n):r==="style"?fe(n,Ke(t)):e==="object"&&r==="data"?Nt(t,n):n)}function Zr(t,e,r){return["video","audio"].includes(t)&&e==="autoplay"}function Xi(t,e,r){try{if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let n=t.classList.length;n--;){let i=t.classList[n];if(e.test(i))return!0}if(r)return t.matches(r)}catch{}return!1}function he(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?he(b.parentNode(t),e,r):!1;for(let n=t.classList.length;n--;){let i=t.classList[n];if(e.test(i))return!0}return r?he(b.parentNode(t),e,r):!1}function Yr(t,e,r,n){let i;if(Gr(t)){if(i=t,!b.childNodes(i).length)return!1}else{if(b.parentElement(t)===null)return!1;i=b.parentElement(t)}try{if(typeof e=="string"){if(n){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(he(i,e,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function Ji(t,e,r){let n=t.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let l=setTimeout(()=>{i||(e(),i=!0)},r);t.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}let a="about:blank";if(n.location.href!==a||t.src===a||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function Ki(t,e,r){let n=!1,i;try{i=t.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(e(),n=!0)},r);t.addEventListener("load",()=>{clearTimeout(o),n=!0,e()})}function Qi(t,e){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:a,inlineStylesheet:l,maskInputOptions:s={},maskTextFn:c,maskInputFn:u,dataURLOptions:h={},inlineImages:m,recordCanvas:p,keepIframeSrcFn:d,newlyAddedElement:f=!1,cssCaptured:y=!1}=e,C=to(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:G.Document,childNodes:[],compatMode:t.compatMode}:{type:G.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:G.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:C};case t.ELEMENT_NODE:return ro(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:l,maskInputOptions:s,maskInputFn:u,dataURLOptions:h,inlineImages:m,recordCanvas:p,keepIframeSrcFn:d,newlyAddedElement:f,rootId:C});case t.TEXT_NODE:return eo(t,{doc:r,needsMask:a,maskTextFn:c,rootId:C,cssCaptured:y});case t.CDATA_SECTION_NODE:return{type:G.CDATA,textContent:"",rootId:C};case t.COMMENT_NODE:return{type:G.Comment,textContent:b.textContent(t)||"",rootId:C};default:return!1}}function to(t,e){if(!e.hasNode(t))return;let r=e.getId(t);return r===1?void 0:r}function eo(t,e){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=e,a=b.parentNode(t),l=a&&a.tagName,s="",c=l==="STYLE"?!0:void 0,u=l==="SCRIPT"?!0:void 0;return u?s="SCRIPT_PLACEHOLDER":o||(s=b.textContent(t),c&&s&&(s=fe(s,Ke(e.doc)))),!c&&!u&&s&&r&&(s=n?n(s,b.parentElement(t)):s.replace(/[\S]/g,"*")),{type:G.Text,textContent:s||"",rootId:i}}function ro(t,e){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:l,dataURLOptions:s={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:h,newlyAddedElement:m=!1,rootId:p}=e,d=Xi(t,n,i),f=$i(t),y={},C=t.attributes.length;for(let g=0;g<C;g++){let w=t.attributes[g];Zr(f,w.name,w.value)||(y[w.name]=qr(r,f,It(w.name),w.value))}if(f==="link"&&o){let g=Array.from(r.styleSheets).find(E=>E.href===t.href),w=null;g&&(w=Pe(g)),w&&(delete y.rel,delete y.href,y._cssText=w)}if(f==="style"&&t.sheet){let g=Pe(t.sheet);g&&(t.childNodes.length>1&&(g=Hi(g,t)),y._cssText=g)}if(["input","textarea","select"].includes(f)){let g=t.value,w=t.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=ue({element:t,type:ce(t),tagName:f,value:g,maskInputOptions:a,maskInputFn:l}):w&&(y.checked=w)}if(f==="option"&&(t.selected&&!a.select?y.selected=!0:delete y.selected),f==="dialog"&&t.open&&(y.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"),f==="canvas"&&u){if(t.__context==="2d")Di(t)||(y.rr_dataURL=t.toDataURL(s.type,s.quality));else if(!("__context"in t)){let g=t.toDataURL(s.type,s.quality),w=r.createElement("canvas");w.width=t.width,w.height=t.height;let E=w.toDataURL(s.type,s.quality);g!==E&&(y.rr_dataURL=g)}}if(f==="img"&&c){_t||(_t=r.createElement("canvas"),kr=_t.getContext("2d"));let g=t,w=g.currentSrc||g.getAttribute("src")||"<unknown-src>",E=g.crossOrigin,k=()=>{g.removeEventListener("load",k);try{_t.width=g.naturalWidth,_t.height=g.naturalHeight,kr.drawImage(g,0,0),y.rr_dataURL=_t.toDataURL(s.type,s.quality)}catch(A){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?k():g.addEventListener("load",k);return}else console.warn(`Cannot inline img src=${w}! Error: ${A}`)}g.crossOrigin==="anonymous"&&(E?y.crossOrigin=E:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?k():g.addEventListener("load",k)}if(["audio","video"].includes(f)){let g=y;g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime,g.rr_mediaPlaybackRate=t.playbackRate,g.rr_mediaMuted=t.muted,g.rr_mediaLoop=t.loop,g.rr_mediaVolume=t.volume}if(m||(t.scrollLeft&&(y.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(y.rr_scrollTop=t.scrollTop)),d){let{width:g,height:w}=t.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${w}px`}}f==="iframe"&&!h(y.src)&&(t.contentDocument||(y.rr_src=y.src),delete y.src);let S;try{customElements.get(f)&&(S=!0)}catch{}return{type:G.Element,tagName:f,attributes:y,childNodes:[],isSVG:Yi(t)||void 0,needBlock:d,rootId:p,isCustom:S}}function U(t){return t==null?"":t.toLowerCase()}function Xr(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||{}}function no(t,e){if(e.comment&&t.type===G.Comment)return!0;if(t.type===G.Element){if(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"&&$r(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(U(t.attributes.name).match(/^msapplication-tile(image|color)$/)||U(t.attributes.name)==="application-name"||U(t.attributes.rel)==="icon"||U(t.attributes.rel)==="apple-touch-icon"||U(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&U(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(U(t.attributes.property).match(/^(og|twitter|fb):/)||U(t.attributes.name).match(/^(og|twitter):/)||U(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(U(t.attributes.name)==="robots"||U(t.attributes.name)==="googlebot"||U(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(U(t.attributes.name)==="author"||U(t.attributes.name)==="generator"||U(t.attributes.name)==="framework"||U(t.attributes.name)==="publisher"||U(t.attributes.name)==="progid"||U(t.attributes.property).match(/^article:/)||U(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(U(t.attributes.name)==="google-site-verification"||U(t.attributes.name)==="yandex-verification"||U(t.attributes.name)==="csrf-token"||U(t.attributes.name)==="p:domain_verify"||U(t.attributes.name)==="verify-v1"||U(t.attributes.name)==="verification"||U(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function At(t,e){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:l,skipChild:s=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d={},inlineImages:f=!1,recordCanvas:y=!1,onSerialize:C,onIframeLoad:S,iframeLoadTimeout:g=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:A=!1,cssCaptured:x=!1}=e,{needsMask:I}=e,{preserveWhiteSpace:B=!0}=e;I||(I=Yr(t,a,l,I===void 0));let j=Qi(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:I,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:m,dataURLOptions:d,inlineImages:f,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:A,cssCaptured:x});if(!j)return console.warn(t,"not serialized"),null;let W;n.hasNode(t)?W=n.getId(t):no(j,p)||!B&&j.type===G.Text&&!j.textContent.replace(/^\s+|\s+$/gm,"").length?W=jt:W=Vr();let M=Object.assign(j,{id:W});if(n.add(t,M),W===jt)return null;C&&C(t);let Z=!s;if(M.type===G.Element){Z=Z&&!M.needBlock,delete M.needBlock;let L=b.shadowRoot(t);L&&Wt(L)&&(M.isShadowHost=!0)}if((M.type===G.Document||M.type===G.Element)&&Z){p.headWhitespace&&M.type===G.Element&&M.tagName==="head"&&(B=!1);let L={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:a,maskTextSelector:l,skipChild:s,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:f,recordCanvas:y,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:S,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:k,cssCaptured:!1};if(!(M.type===G.Element&&M.tagName==="textarea"&&M.attributes.value!==void 0)){M.type===G.Element&&M.attributes._cssText!==void 0&&typeof M.attributes._cssText=="string"&&(L.cssCaptured=!0);for(let $ of Array.from(b.childNodes(t))){let V=At($,L);V&&M.childNodes.push(V)}}let D=null;if(Gr(t)&&(D=b.shadowRoot(t)))for(let $ of Array.from(b.childNodes(D))){let V=At($,L);V&&(Wt(D)&&(V.isShadow=!0),M.childNodes.push(V))}}let Y=b.parentNode(t);return Y&&Bt(Y)&&Wt(Y)&&(M.isShadow=!0),M.type===G.Element&&M.tagName==="iframe"&&Ji(t,()=>{let L=t.contentDocument;if(L&&S){let D=At(L,{doc:L,mirror:n,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:f,recordCanvas:y,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:S,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:k});D&&S(t,D)}},g),M.type===G.Element&&M.tagName==="link"&&typeof M.attributes.rel=="string"&&(M.attributes.rel==="stylesheet"||M.attributes.rel==="preload"&&typeof M.attributes.href=="string"&&$r(M.attributes.href)==="css")&&Ki(t,()=>{if(w){let L=At(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:f,recordCanvas:y,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:S,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:k});L&&w(t,L)}},E),M}function io(t,e){let{mirror:r=new le,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:s=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:h,maskInputFn:m,slimDOM:p=!1,dataURLOptions:d,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:C,iframeLoadTimeout:S,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:E=()=>!1}=e,k=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,A=Xr(p);return At(t,{doc:t,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:k,maskTextFn:h,maskInputFn:m,slimDOMOptions:A,dataURLOptions:d,inlineImages:s,recordCanvas:c,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:C,iframeLoadTimeout:S,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:E,newlyAddedElement:!1})}var Ue=class t{constructor(...e){v(this,"parentElement",null),v(this,"parentNode",null),v(this,"ownerDocument"),v(this,"firstChild",null),v(this,"lastChild",null),v(this,"previousSibling",null),v(this,"nextSibling",null),v(this,"ELEMENT_NODE",1),v(this,"TEXT_NODE",3),v(this,"nodeType"),v(this,"nodeName"),v(this,"RRNodeType")}get childNodes(){let e=[],r=this.firstChild;for(;r;)e.push(r),r=r.nextSibling;return e}contains(e){if(e instanceof t){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 X(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Ot=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`,Rr={map:{},getId(){return console.error(Ot),-1},getNode(){return console.error(Ot),null},removeNodeFromMap(){console.error(Ot)},has(){return console.error(Ot),!1},reset(){console.error(Ot)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Rr=new Proxy(Rr,{get(t,e,r){return e==="map"&&console.error(Ot),Reflect.get(t,e,r)}}));function $t(t,e,r={}){let n=null,i=0;return function(...o){let a=Date.now();!i&&r.leading===!1&&(i=a);let l=e-(a-i),s=this;l<=0||l>e?(n&&(clearTimeout(n),n=null),i=a,t.apply(s,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,t.apply(s,o)},l))}}function ge(t,e,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>ge(t,e,o||{},!0)}function Jr(t){var e,r,n,i;let o=t.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:o.documentElement.scrollLeft||o?.body&&((e=b.parentElement(o.body))==null?void 0:e.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=b.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Kr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Qr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function tn(t){return t?t.nodeType===t.ELEMENT_NODE?t:b.parentElement(t):null}function J(t,e,r,n){if(!t)return!1;let i=tn(t);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||n&&i.closest("."+e)!==null)return!0}else if(he(i,e,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function oo(t,e){return e.getId(t)!==-1}function Fe(t,e,r){return t.tagName==="TITLE"&&r.headTitleMutations?!0:e.getId(t)===jt}function en(t,e){if(Bt(t))return!1;let r=e.getId(t);if(!e.has(r))return!0;let n=b.parentNode(t);return n&&n.nodeType===t.DOCUMENT_NODE?!1:n?en(n,e):!0}function Be(t){return!!t.changedTouches}function so(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)}function rn(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function nn(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function We(t){return t?t instanceof Ue&&"shadowRoot"in t?!!t.shadowRoot:!!b.shadowRoot(t):!1}var He=class{constructor(){v(this,"id",1),v(this,"styleIDMap",new WeakMap),v(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}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 on(t){var e;let r=null;return"getRootNode"in t&&((e=b.getRootNode(t))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&b.host(b.getRootNode(t))&&(r=b.host(b.getRootNode(t))),r}function ao(t){let e=t,r;for(;r=on(e);)e=r;return e}function lo(t){let e=b.ownerDocument(t);if(!e)return!1;let r=ao(t);return b.contains(e,r)}function sn(t){let e=b.ownerDocument(t);return e?b.contains(e,t)||lo(t):!1}function Or(t){return"__ln"in t}var Ge=class{constructor(){v(this,"length",0),v(this,"head",null),v(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<e;n++)r=r?.next||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&Or(e.previousSibling)){let n=e.previousSibling.__ln.next;r.next=n,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(e.nextSibling&&Or(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;r.previous=n,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(e){let r=e.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Nr=(t,e)=>`${t}@${e}`,je=class{constructor(){v(this,"frozen",!1),v(this,"locked",!1),v(this,"texts",[]),v(this,"attributes",[]),v(this,"attributeMap",new WeakMap),v(this,"removes",[]),v(this,"mapRemoves",[]),v(this,"movedMap",{}),v(this,"addedSet",new Set),v(this,"movedSet",new Set),v(this,"droppedSet",new Set),v(this,"removesSubTreeCache",new Set),v(this,"mutationCb"),v(this,"blockClass"),v(this,"blockSelector"),v(this,"maskTextClass"),v(this,"maskTextSelector"),v(this,"inlineStylesheet"),v(this,"maskInputOptions"),v(this,"maskTextFn"),v(this,"maskInputFn"),v(this,"keepIframeSrcFn"),v(this,"recordCanvas"),v(this,"inlineImages"),v(this,"slimDOMOptions"),v(this,"dataURLOptions"),v(this,"doc"),v(this,"mirror"),v(this,"iframeManager"),v(this,"stylesheetManager"),v(this,"shadowDomManager"),v(this,"canvasManager"),v(this,"processedNodeManager"),v(this,"unattachedDoc"),v(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),v(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],r=new Set,n=new Ge,i=s=>{let c=s,u=jt;for(;u===jt;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=s=>{let c=b.parentNode(s);if(!c||!sn(s))return;let u=!1;if(s.nodeType===Node.TEXT_NODE){let d=c.tagName;if(d==="TEXTAREA")return;d==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let h=Bt(c)?this.mirror.getId(on(s)):this.mirror.getId(c),m=i(s);if(h===-1||m===-1)return n.addNode(s);let p=At(s,{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:d=>{rn(d,this.mirror)&&this.iframeManager.addIframe(d),nn(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),We(s)&&this.shadowDomManager.addShadowRoot(b.shadowRoot(s),this.doc)},onIframeLoad:(d,f)=>{this.iframeManager.attachIframe(d,f),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,f)=>{this.stylesheetManager.attachLinkElement(d,f)},cssCaptured:u});p&&(e.push({parentId:h,nextId:m,node:p}),r.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of this.movedSet)Ar(this.removesSubTreeCache,s,this.mirror)&&!this.movedSet.has(b.parentNode(s))||o(s);for(let s of this.addedSet)!Lr(this.droppedSet,s)&&!Ar(this.removesSubTreeCache,s,this.mirror)||Lr(this.movedSet,s)?o(s):this.droppedSet.add(s);let a=null;for(;n.length;){let s=null;if(a){let c=this.mirror.getId(b.parentNode(a.value)),u=i(a.value);c!==-1&&u!==-1&&(s=a)}if(!s){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let h=this.mirror.getId(b.parentNode(u.value));if(i(u.value)===-1)continue;if(h!==-1){s=u;break}else{let p=u.value,d=b.parentNode(p);if(d&&d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=b.host(d);if(this.mirror.getId(f)!==-1){s=u;break}}}}}}if(!s){for(;n.head;)n.removeNode(n.head.value);break}a=s.previous,n.removeNode(s.value),o(s.value)}let l={texts:this.texts.map(s=>{let c=s.node,u=b.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:s.value}}).filter(s=>!r.has(s.id)).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>{let{attributes:c}=s;if(typeof c.style=="string"){let u=JSON.stringify(s.styleDiff),h=JSON.stringify(s._unchangedStyles);u.length<c.style.length&&(u+h).split("var(").length===c.style.split("var(").length&&(c.style=s.styleDiff)}return{id:this.mirror.getId(s.node),attributes:c}}).filter(s=>!r.has(s.id)).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),v(this,"genTextAreaValueMutation",e=>{let r=this.attributeMap.get(e);r||(r={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e,r));let n=Array.from(b.childNodes(e),i=>b.textContent(i)||"").join("");r.attributes.value=ue({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ce(e),value:n,maskInputFn:this.maskInputFn})}),v(this,"processMutation",e=>{if(!Fe(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let r=b.textContent(e.target);!J(e.target,this.blockClass,this.blockSelector,!1)&&r!==e.oldValue&&this.texts.push({value:Yr(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,tn(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break}case"attributes":{let r=e.target,n=e.attributeName,i=e.target.getAttribute(n);if(n==="value"){let a=ce(r);i=ue({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:i,maskInputFn:this.maskInputFn})}if(J(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let o=this.attributeMap.get(e.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),n==="type"&&r.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Zr(r.tagName,n))if(o.attributes[n]=qr(this.doc,It(r.tagName),It(n),i),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(let l of Array.from(r.style)){let s=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);s!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?c===""?o.styleDiff[l]=s:o.styleDiff[l]=[s,c]:o._unchangedStyles[l]=[s,c]}for(let l of Array.from(a.style))r.style.getPropertyValue(l)===""&&(o.styleDiff[l]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(J(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=Bt(e.target)?this.mirror.getId(b.host(e.target)):this.mirror.getId(e.target);J(e.target,this.blockClass,this.blockSelector,!1)||Fe(r,this.mirror,this.slimDOMOptions)||!oo(r,this.mirror)||(this.addedSet.has(r)?($e(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||en(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Nr(n,i)]?$e(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:Bt(e.target)&&Wt(e.target)?!0:void 0}),uo(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),v(this,"genAdds",(e,r)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fe(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Nr(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);J(e,this.blockClass,this.blockSelector,!1)||(b.childNodes(e).forEach(n=>this.genAdds(n)),We(e)&&b.childNodes(b.shadowRoot(e)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=e[r]})}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 $e(t,e){t.delete(e),b.childNodes(e).forEach(r=>$e(t,r))}function uo(t,e){let r=[t];for(;r.length;){let n=r.pop();e.has(n)||(e.add(n),b.childNodes(n).forEach(i=>r.push(i)))}}function Ar(t,e,r){return t.size===0?!1:co(t,e)}function co(t,e,r){let n=b.parentNode(e);return n?t.has(n):!1}function Lr(t,e){return t.size===0?!1:an(t,e)}function an(t,e){let r=b.parentNode(e);return r?t.has(r)?!0:an(t,r):!1}var Ht;function fo(t){Ht=t}function ho(){Ht=void 0}var _=t=>Ht?(...r)=>{try{return t(...r)}catch(n){if(Ht&&Ht(n)===!0)return;throw n}}:t,Ct=[];function Vt(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}function ln(t,e){let r=new je;Ct.push(r),r.init(t);let[n,i]=Hr(),o=new n(_(r.processMutations.bind(r)));return o.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[o,i]}function po({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],l,s=$t(_(h=>{let m=Date.now()-l;t(a.map(p=>(p.timeOffset-=m,p)),h),a=[],l=null}),o),c=_($t(_(h=>{let m=Vt(h),{clientX:p,clientY:d}=Be(h)?h.changedTouches[0]:h;l||(l=Gt()),a.push({x:p,y:d,id:n.getId(m),timeOffset:Gt()-l}),s(typeof DragEvent<"u"&&h instanceof DragEvent?T.Drag:h instanceof MouseEvent?T.MouseMove:T.TouchMove)}),i,{trailing:!1})),u=[X("mousemove",c,r),X("touchmove",c,r),X("drag",c,r)];return _(()=>{u.forEach(h=>h())})}function mo({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[],s=null,c=u=>h=>{let m=Vt(h);if(J(m,n,i,!0))return;let p=null,d=u;if("pointerType"in h){switch(h.pointerType){case"mouse":p=dt.Mouse;break;case"touch":p=dt.Touch;break;case"pen":p=dt.Pen;break}p===dt.Touch?tt[u]===tt.MouseDown?d="TouchStart":tt[u]===tt.MouseUp&&(d="TouchEnd"):dt.Pen}else Be(h)&&(p=dt.Touch);p!==null?(s=p,(d.startsWith("Touch")&&p===dt.Touch||d.startsWith("Mouse")&&p===dt.Mouse)&&(p=null)):tt[u]===tt.Click&&(p=s,s=null);let f=Be(h)?h.changedTouches[0]:h;if(!f)return;let y=r.getId(m),{clientX:C,clientY:S}=f;_(t)({type:tt[d],id:y,x:C,y:S,...p!==null&&{pointerType:p}})};return Object.keys(tt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let h=It(u),m=c(u);if(window.PointerEvent)switch(tt[u]){case tt.MouseDown:case tt.MouseUp:h=h.replace("mouse","pointer");break;case tt.TouchStart:case tt.TouchEnd:return}l.push(X(h,m,e))}),_(()=>{l.forEach(u=>u())})}function un({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let a=_($t(_(l=>{let s=Vt(l);if(!s||J(s,n,i,!0))return;let c=r.getId(s);if(s===e&&e.defaultView){let u=Jr(e.defaultView);t({id:c,x:u.left,y:u.top})}else t({id:c,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100));return X("scroll",a,e)}function go({viewportResizeCb:t},{win:e}){let r=-1,n=-1,i=_($t(_(()=>{let o=Kr(),a=Qr();(r!==o||n!==a)&&(t({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return X("resize",i,e)}var vo=["INPUT","TEXTAREA","SELECT"],Dr=new WeakMap;function yo({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:s,sampling:c,userTriggeredOnInput:u}){function h(S){let g=Vt(S),w=S.isTrusted,E=g&&g.tagName;if(g&&E==="OPTION"&&(g=b.parentElement(g)),!g||!E||vo.indexOf(E)<0||J(g,n,i,!0)||g.classList.contains(o)||a&&g.matches(a))return;let k=g.value,A=!1,x=ce(g)||"";x==="radio"||x==="checkbox"?A=g.checked:(l[E.toLowerCase()]||l[x])&&(k=ue({element:g,maskInputOptions:l,tagName:E,type:x,value:k,maskInputFn:s})),m(g,u?{text:k,isChecked:A,userTriggered:w}:{text:k,isChecked:A});let I=g.name;x==="radio"&&I&&A&&e.querySelectorAll(`input[type="radio"][name="${I}"]`).forEach(B=>{if(B!==g){let j=B.value;m(B,u?{text:j,isChecked:!A,userTriggered:!1}:{text:j,isChecked:!A})}})}function m(S,g){let w=Dr.get(S);if(!w||w.text!==g.text||w.isChecked!==g.isChecked){Dr.set(S,g);let E=r.getId(S);_(t)({...g,id:E})}}let d=(c.input==="last"?["change"]:["input","change"]).map(S=>X(S,_(h),e)),f=e.defaultView;if(!f)return()=>{d.forEach(S=>S())};let y=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),C=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&d.push(...C.map(S=>ge(S[0],S[1],{set(){_(h)({target:this,isTrusted:!1})}},!1,f))),_(()=>{d.forEach(S=>S())})}function de(t){let e=[];function r(n,i){if(ie("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||ie("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||ie("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||ie("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(a),r(n.parentRule,i)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(a)}return i}return r(t,e)}function St(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function So({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_((u,h,m)=>{let[p,d]=m,{id:f,styleId:y}=St(h,e,r.styleMirror);return(f&&f!==-1||y&&y!==-1)&&t({id:f,styleId:y,adds:[{rule:p,index:d}]}),u.apply(h,m)})}),n.CSSStyleSheet.prototype.addRule=function(u,h,m=this.cssRules.length){let p=`${u} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,m])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_((u,h,m)=>{let[p]=m,{id:d,styleId:f}=St(h,e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,removes:[{index:p}]}),u.apply(h,m)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:_((u,h,m)=>{let[p]=m,{id:d,styleId:f}=St(h,e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,replace:p}),u.apply(h,m)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:_((u,h,m)=>{let[p]=m,{id:d,styleId:f}=St(h,e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,replaceSync:p}),u.apply(h,m)})}));let s={};oe("CSSGroupingRule")?s.CSSGroupingRule=n.CSSGroupingRule:(oe("CSSMediaRule")&&(s.CSSMediaRule=n.CSSMediaRule),oe("CSSConditionRule")&&(s.CSSConditionRule=n.CSSConditionRule),oe("CSSSupportsRule")&&(s.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(s).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:_((m,p,d)=>{let[f,y]=d,{id:C,styleId:S}=St(p.parentStyleSheet,e,r.styleMirror);return(C&&C!==-1||S&&S!==-1)&&t({id:C,styleId:S,adds:[{rule:f,index:[...de(p),y||0]}]}),m.apply(p,d)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:_((m,p,d)=>{let[f]=d,{id:y,styleId:C}=St(p.parentStyleSheet,e,r.styleMirror);return(y&&y!==-1||C&&C!==-1)&&t({id:y,styleId:C,removes:[{index:[...de(p),f]}]}),m.apply(p,d)})})}),_(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(s).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function cn({mirror:t,stylesheetManager:e},r){var n,i,o;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(b.host(r));let l=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,s=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!s?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){var c;return(c=s.get)==null?void 0:c.call(this)},set(c){var u;let h=(u=s.set)==null?void 0:u.call(this,c);if(a!==null&&a!==-1)try{e.adoptStyleSheets(c,a)}catch{}return h}}),_(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function bo({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_((l,s,c)=>{var u;let[h,m,p]=c;if(r.has(h))return o.apply(s,[h,m,p]);let{id:d,styleId:f}=St((u=s.parentRule)==null?void 0:u.parentStyleSheet,e,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&t({id:d,styleId:f,set:{property:h,value:m,priority:p},index:de(s.parentRule)}),l.apply(s,c)})});let a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:_((l,s,c)=>{var u;let[h]=c;if(r.has(h))return a.apply(s,[h]);let{id:m,styleId:p}=St((u=s.parentRule)==null?void 0:u.parentStyleSheet,e,n.styleMirror);return(m&&m!==-1||p&&p!==-1)&&t({id:m,styleId:p,remove:{property:h},index:de(s.parentRule)}),l.apply(s,c)})}),_(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function wo({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i,doc:o}){let a=_(s=>$t(_(c=>{let u=Vt(c);if(!u||J(u,e,r,!0))return;let{currentTime:h,volume:m,muted:p,playbackRate:d,loop:f}=u;t({type:s,id:n.getId(u),currentTime:h,volume:m,muted:p,playbackRate:d,loop:f})}),i.media||500)),l=[X("play",a(Rt.Play),o),X("pause",a(Rt.Pause),o),X("seeked",a(Rt.Seeked),o),X("volumechange",a(Rt.VolumeChange),o),X("ratechange",a(Rt.RateChange),o)];return _(()=>{l.forEach(s=>s())})}function Co({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(s,c,u){let h=new o(s,c,u);return i.set(h,{family:s,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};let a=Mt(e.fonts,"add",function(l){return function(s){return setTimeout(_(()=>{let c=i.get(s);c&&(t(c),i.delete(s))}),0),l.apply(this,[s])}});return n.push(()=>{r.FontFace=o}),n.push(a),_(()=>{n.forEach(l=>l())})}function Io(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,a=!0,l=_(()=>{let s=e.getSelection();if(!s||a&&s?.isCollapsed)return;a=s.isCollapsed||!1;let c=[],u=s.rangeCount||0;for(let h=0;h<u;h++){let m=s.getRangeAt(h),{startContainer:p,startOffset:d,endContainer:f,endOffset:y}=m;J(p,n,i,!0)||J(f,n,i,!0)||c.push({start:r.getId(p),startOffset:d,end:r.getId(f),endOffset:y})}o({ranges:c})});return l(),X("selectionchange",l)}function Mo({doc:t,customElementCb:e}){let r=t.defaultView;return!r||!r.customElements?()=>{}:Mt(r.customElements,"define",function(i){return function(o,a,l){try{e({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,a,l])}})}function xo(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:l,mediaInteractionCb:s,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:m,selectionCb:p,customElementCb:d}=t;t.mutationCb=(...f)=>{e.mutation&&e.mutation(...f),r(...f)},t.mousemoveCb=(...f)=>{e.mousemove&&e.mousemove(...f),n(...f)},t.mouseInteractionCb=(...f)=>{e.mouseInteraction&&e.mouseInteraction(...f),i(...f)},t.scrollCb=(...f)=>{e.scroll&&e.scroll(...f),o(...f)},t.viewportResizeCb=(...f)=>{e.viewportResize&&e.viewportResize(...f),a(...f)},t.inputCb=(...f)=>{e.input&&e.input(...f),l(...f)},t.mediaInteractionCb=(...f)=>{e.mediaInteaction&&e.mediaInteaction(...f),s(...f)},t.styleSheetRuleCb=(...f)=>{e.styleSheetRule&&e.styleSheetRule(...f),c(...f)},t.styleDeclarationCb=(...f)=>{e.styleDeclaration&&e.styleDeclaration(...f),u(...f)},t.canvasMutationCb=(...f)=>{e.canvasMutation&&e.canvasMutation(...f),h(...f)},t.fontCb=(...f)=>{e.font&&e.font(...f),m(...f)},t.selectionCb=(...f)=>{e.selection&&e.selection(...f),p(...f)},t.customElementCb=(...f)=>{e.customElement&&e.customElement(...f),d(...f)}}function Eo(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};xo(t,e);let n,i=()=>{};t.recordDOM&&([n,i]=ln(t,t.doc));let o=po(t),a=mo(t),l=un(t),s=go(t,{win:r}),c=yo(t),u=wo(t),h=()=>{},m=()=>{},p=()=>{},d=()=>{};t.recordDOM&&(h=So(t,{win:r}),m=cn(t,t.doc),p=bo(t,{win:r}),t.collectFonts&&(d=Co(t)));let f=Io(t),y=Mo(t),C=[];for(let S of t.plugins)C.push(S.observer(S.callback,r,S.options));return _(()=>{Ct.forEach(S=>S.reset()),n?.disconnect(),i(),o(),a(),l(),s(),c(),u(),h(),m(),p(),d(),f(),y(),C.forEach(S=>S())})}function ie(t){return typeof window[t]<"u"}function oe(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var pe=class{constructor(e){v(this,"iframeIdToRemoteIdMap",new WeakMap),v(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,r,n,i){let o=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e),l=o.get(r);return l||(l=this.generateIdFn(),o.set(r,l),a.set(l,r)),l}getIds(e,r){let n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return r.map(o=>this.getId(e,o,n,i))}getRemoteId(e,r,n){let i=n||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(e,r){let n=this.getRemoteIdToIdMap(e);return r.map(i=>this.getRemoteId(e,i,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}},Ve=class{constructor(e){v(this,"iframes",new WeakMap),v(this,"crossOriginIframeMap",new WeakMap),v(this,"crossOriginIframeMirror",new pe(Vr)),v(this,"crossOriginIframeStyleMirror"),v(this,"crossOriginIframeRootIdMap",new WeakMap),v(this,"mirror"),v(this,"mutationCb"),v(this,"wrappedEmit"),v(this,"loadListener"),v(this,"stylesheetManager"),v(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new pe(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,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=e.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let r=e;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(e,r){var n;switch(r.type){case O.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:O.IncrementalSnapshot,data:{source:T.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return r;case O.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case O.IncrementalSnapshot:switch(r.data.source){case T.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let o=this.crossOriginIframeRootIdMap.get(e);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case T.Drag:case T.TouchMove:case T.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case T.ViewportResize:return!1;case T.MediaInteraction:case T.MouseInteraction:case T.Scroll:case T.CanvasMutation:case T.Input:return this.replaceIds(r.data,e,["id"]),r;case T.StyleSheetRule:case T.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case T.Font:return r;case T.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),r;case T.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),r}}return!1}replace(e,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=e.getIds(n,r[o]):r[o]=e.getId(n,r[o]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(e,r){e.type!==G.Document&&!e.rootId&&(e.rootId=r),"childNodes"in e&&e.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},qe=class{constructor(e){v(this,"shadowDoms",new WeakSet),v(this,"mutationCb"),v(this,"scrollCb"),v(this,"bypassOptions"),v(this,"mirror"),v(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,r){if(!Wt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[n]=ln({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(un({...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(b.host(e))),this.restoreHandlers.push(cn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,r){let n=this;this.restoreHandlers.push(Mt(e.prototype,"attachShadow",function(i){return function(o){let a=i.call(this,o),l=b.shadowRoot(this);return l&&sn(this)&&n.addShadowRoot(l,r),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",To=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ut=0;Ut<Lt.length;Ut++)To[Lt.charCodeAt(Ut)]=Ut;var Ut,ko=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=Lt[e[r]>>2],i+=Lt[(e[r]&3)<<4|e[r+1]>>4],i+=Lt[(e[r+1]&15)<<2|e[r+2]>>6],i+=Lt[e[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Fr=new Map;function _o(t,e){let r=Fr.get(t);return r||(r=new Map,Fr.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var fn=(t,e,r)=>{if(!t||!(dn(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=_o(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function se(t,e,r){if(t instanceof Array)return t.map(n=>se(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,i=ko(t);return{rr_type:n,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[se(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:i}=t;return{rr_type:n,src:i}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",i=t.toDataURL();return{rr_type:n,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[se(t.data,e,r),t.width,t.height]};if(dn(t,e)||typeof t=="object"){let n=t.constructor.name,i=fn(t,e,r);return{rr_type:n,index:i}}}}return t}var hn=(t,e,r)=>t.map(n=>se(n,e,r)),dn=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function Ro(t,e,r,n){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let l=Mt(e.CanvasRenderingContext2D.prototype,a,function(s){return function(...c){return J(this.canvas,r,n,!0)||setTimeout(()=>{let u=hn(c,e,this);t(this.canvas,{type:Dt["2D"],property:a,args:u})},0),s.apply(this,c)}});i.push(l)}catch{let l=ge(e.CanvasRenderingContext2D.prototype,a,{set(s){t(this.canvas,{type:Dt["2D"],property:a,args:[s],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function Oo(t){return t==="experimental-webgl"?"webgl":t}function zr(t,e,r,n){let i=[];try{let o=Mt(t.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...s){if(!J(this,e,r,!0)){let c=Oo(l);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(s[0]&&typeof s[0]=="object"){let u=s[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...s])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Pr(t,e,r,n,i,o){let a=[],l=Object.getOwnPropertyNames(t);for(let s of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if(typeof t[s]!="function")continue;let c=Mt(t,s,function(u){return function(...h){let m=u.apply(this,h);if(fn(m,o,this),"tagName"in this.canvas&&!J(this.canvas,n,i,!0)){let p=hn(h,o,this),d={type:e,property:s,args:p};r(this.canvas,d)}return m}});a.push(c)}catch{let c=ge(t,s,{set(u){r(this.canvas,{type:e,property:s,args:[u],setter:!0})}});a.push(c)}return a}function No(t,e,r,n){let i=[];return typeof e.WebGLRenderingContext<"u"&&i.push(...Pr(e.WebGLRenderingContext.prototype,Dt.WebGL,t,r,n,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...Pr(e.WebGL2RenderingContext.prototype,Dt.WebGL2,t,r,n,e)),()=>{i.forEach(o=>o())}}var pn=`(function() {
4
+ "use strict";
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
7
+ for (var i = 0; i < chars.length; i++) {
8
+ lookup[chars.charCodeAt(i)] = i;
9
+ }
10
+ var encode = function(arraybuffer) {
11
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
12
+ for (i2 = 0; i2 < len; i2 += 3) {
13
+ base64 += chars[bytes[i2] >> 2];
14
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
15
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
16
+ base64 += chars[bytes[i2 + 2] & 63];
17
+ }
18
+ if (len % 3 === 2) {
19
+ base64 = base64.substring(0, base64.length - 1) + "=";
20
+ } else if (len % 3 === 1) {
21
+ base64 = base64.substring(0, base64.length - 2) + "==";
22
+ }
23
+ return base64;
24
+ };
25
+ const lastBlobMap = /* @__PURE__ */ new Map();
26
+ const transparentBlobMap = /* @__PURE__ */ new Map();
27
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
28
+ const id = \`\${width}-\${height}\`;
29
+ if ("OffscreenCanvas" in globalThis) {
30
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
31
+ const offscreen = new OffscreenCanvas(width, height);
32
+ offscreen.getContext("2d");
33
+ const blob = await offscreen.convertToBlob(dataURLOptions);
34
+ const arrayBuffer = await blob.arrayBuffer();
35
+ const base64 = encode(arrayBuffer);
36
+ transparentBlobMap.set(id, base64);
37
+ return base64;
38
+ } else {
39
+ return "";
40
+ }
41
+ }
42
+ const worker = self;
43
+ worker.onmessage = async function(e) {
44
+ if ("OffscreenCanvas" in globalThis) {
45
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
46
+ const transparentBase64 = getTransparentBlobFor(
47
+ width,
48
+ height,
49
+ dataURLOptions
50
+ );
51
+ const offscreen = new OffscreenCanvas(width, height);
52
+ const ctx = offscreen.getContext("2d");
53
+ ctx.drawImage(bitmap, 0, 0);
54
+ bitmap.close();
55
+ const blob = await offscreen.convertToBlob(dataURLOptions);
56
+ const type = blob.type;
57
+ const arrayBuffer = await blob.arrayBuffer();
58
+ const base64 = encode(arrayBuffer);
59
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
60
+ lastBlobMap.set(id, base64);
61
+ return worker.postMessage({ id });
62
+ }
63
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
64
+ worker.postMessage({
65
+ id,
66
+ type,
67
+ base64,
68
+ width,
69
+ height
70
+ });
71
+ lastBlobMap.set(id, base64);
72
+ } else {
73
+ return worker.postMessage({ id: e.data.id });
74
+ }
75
+ };
76
+ })();
77
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
78
+ `,Ur=typeof self<"u"&&self.Blob&&new Blob([pn],{type:"text/javascript;charset=utf-8"});function Ao(t){let e;try{if(e=Ur&&(self.URL||self.webkitURL).createObjectURL(Ur),!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(pn),{name:t?.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var Ze=class{constructor(e){v(this,"pendingCanvasMutations",new Map),v(this,"rafStamps",{latestId:0,invokeId:null}),v(this,"mirror"),v(this,"mutationCb"),v(this,"resetObservers"),v(this,"frozen",!1),v(this,"locked",!1),v(this,"processMutation",(s,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(c)});let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,i,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{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,r,n,i,o){let a=zr(r,n,i,!0),l=new Map,s=new Ao;s.onmessage=d=>{let{id:f}=d.data;if(l.set(f,!1),!("base64"in d.data))return;let{base64:y,type:C,width:S,height:g}=d.data;this.mutationCb({id:f,type:Dt["2D"],commands:[{property:"clearRect",args:[0,0,S,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:C}]},0,0]}]})};let c=1e3/e,u=0,h,m=()=>{let d=[];return r.document.querySelectorAll("canvas").forEach(f=>{J(f,n,i,!0)||d.push(f)}),d},p=d=>{if(u&&d-u<c){h=requestAnimationFrame(p);return}u=d,m().forEach(async f=>{var y;let C=this.mirror.getId(f);if(l.get(C)||f.width===0||f.height===0)return;if(l.set(C,!0),["webgl","webgl2"].includes(f.__context)){let g=f.getContext(f.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let S=await createImageBitmap(f);s.postMessage({id:C,bitmap:S,width:f.width,height:f.height,dataURLOptions:o.dataURLOptions},[S])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=zr(e,r,n,!1),o=Ro(this.processMutation.bind(this),e,r,n),a=No(this.processMutation.bind(this),e,r,n);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;let i=n.map(a=>{let{type:l,...s}=a;return s}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}},Ye=class{constructor(e){v(this,"trackedLinkElements",new WeakSet),v(this,"mutationCb"),v(this,"adoptedStyleSheetCb"),v(this,"styleMirror",new He),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(e.length===0)return;let n={id:r,styleIds:[]},i=[];for(let o of e){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),i.push({styleId:a,rules:Array.from(o.rules||CSSRule,(l,s)=>({rule:jr(l,o.href),index:s}))})),n.styleIds.push(a)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Xe=class{constructor(){v(this,"nodeMap",new WeakMap),v(this,"active",!1)}inOtherBuffer(e,r){let n=this.nodeMap.get(e);return n&&Array.from(n).some(i=>i!==r)}add(e,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(r))}destroy(){}},H,ae,ze,me=!1;try{if(Array.from([1],t=>t*2)[0]!==2){let t=document.createElement("iframe");document.body.appendChild(t),Array.from=((Mr=t.contentWindow)==null?void 0:Mr.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var ut=Li();function et(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:m,slimDOMOptions:p,maskInputFn:d,maskTextFn:f,hooks:y,packFn:C,sampling:S={},dataURLOptions:g={},mousemoveWait:w,recordDOM:E=!0,recordCanvas:k=!1,recordCrossOriginIframes:A=!1,recordAfter:x=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:I=!1,collectFonts:B=!1,inlineImages:j=!1,plugins:W,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:Z=new Set([]),errorHandler:Y}=t;fo(Y);let L=A?window.parent===window:!0,D=!1;if(!L)try{window.parent.document&&(D=!1)}catch{D=!0}if(L&&!e)throw new Error("emit function is required");if(!L&&!D)return()=>{};w!==void 0&&S.mousemove===void 0&&(S.mousemove=w),ut.reset();let $=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m!==void 0?m:{password:!0},V=Xr(p);so();let kt,K=0,vt=R=>{for(let Q of W||[])Q.eventProcessor&&(R=Q.eventProcessor(R));return C&&!D&&(R=C(R)),R};H=(R,Q)=>{var z;let P=R;if(P.timestamp=Gt(),(z=Ct[0])!=null&&z.isFrozen()&&P.type!==O.FullSnapshot&&!(P.type===O.IncrementalSnapshot&&P.data.source===T.Mutation)&&Ct.forEach(nt=>nt.unfreeze()),L)e?.(vt(P),Q);else if(D){let nt={type:"rrweb",event:vt(P),origin:window.location.origin,isCheckout:Q};window.parent.postMessage(nt,"*")}if(P.type===O.FullSnapshot)kt=P,K=0;else if(P.type===O.IncrementalSnapshot){if(P.data.source===T.Mutation&&P.data.isAttachIframe)return;K++;let nt=n&&K>=n,F=r&&P.timestamp-kt.timestamp>r;(nt||F)&&ae(!0)}};let at=R=>{H({type:O.IncrementalSnapshot,data:{source:T.Mutation,...R}})},rt=R=>H({type:O.IncrementalSnapshot,data:{source:T.Scroll,...R}}),q=R=>H({type:O.IncrementalSnapshot,data:{source:T.CanvasMutation,...R}}),yt=R=>H({type:O.IncrementalSnapshot,data:{source:T.AdoptedStyleSheet,...R}}),ft=new Ye({mutationCb:at,adoptedStyleSheetCb:yt}),lt=new Ve({mirror:ut,mutationCb:at,stylesheetManager:ft,recordCrossOriginIframes:A,wrappedEmit:H});for(let R of W||[])R.getMirror&&R.getMirror({nodeMirror:ut,crossOriginIframeMirror:lt.crossOriginIframeMirror,crossOriginIframeStyleMirror:lt.crossOriginIframeStyleMirror});let Pt=new Xe;ze=new Ze({recordCanvas:k,mutationCb:q,win:window,blockClass:i,blockSelector:o,mirror:ut,sampling:S.canvas,dataURLOptions:g});let wt=new qe({mutationCb:at,scrollCb:rt,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:$,dataURLOptions:g,maskTextFn:f,maskInputFn:d,recordCanvas:k,inlineImages:j,sampling:S,slimDOMOptions:V,iframeManager:lt,stylesheetManager:ft,canvasManager:ze,keepIframeSrcFn:M,processedNodeManager:Pt},mirror:ut});ae=(R=!1)=>{if(!E)return;H({type:O.Meta,data:{href:window.location.href,width:Qr(),height:Kr()}},R),ft.reset(),wt.init(),Ct.forEach(z=>z.lock());let Q=io(document,{mirror:ut,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:$,maskTextFn:f,maskInputFn:d,slimDOM:V,dataURLOptions:g,recordCanvas:k,inlineImages:j,onSerialize:z=>{rn(z,ut)&&lt.addIframe(z),nn(z,ut)&&ft.trackLinkElement(z),We(z)&&wt.addShadowRoot(b.shadowRoot(z),document)},onIframeLoad:(z,P)=>{lt.attachIframe(z,P),wt.observeAttachShadow(z)},onStylesheetLoad:(z,P)=>{ft.attachLinkElement(z,P)},keepIframeSrcFn:M});if(!Q)return console.warn("Failed to snapshot the document");H({type:O.FullSnapshot,data:{node:Q,initialOffset:Jr(window)}},R),Ct.forEach(z=>z.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ft.adoptStyleSheets(document.adoptedStyleSheets,ut.getId(document))};try{let R=[],Q=P=>{var nt;return _(Eo)({mutationCb:at,mousemoveCb:(F,Ae)=>H({type:O.IncrementalSnapshot,data:{source:Ae,positions:F}}),mouseInteractionCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.MouseInteraction,...F}}),scrollCb:rt,viewportResizeCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.ViewportResize,...F}}),inputCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.Input,...F}}),mediaInteractionCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.MediaInteraction,...F}}),styleSheetRuleCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.StyleSheetRule,...F}}),styleDeclarationCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.StyleDeclaration,...F}}),canvasMutationCb:q,fontCb:F=>H({type:O.IncrementalSnapshot,data:{source:T.Font,...F}}),selectionCb:F=>{H({type:O.IncrementalSnapshot,data:{source:T.Selection,...F}})},customElementCb:F=>{H({type:O.IncrementalSnapshot,data:{source:T.CustomElement,...F}})},blockClass:i,ignoreClass:a,ignoreSelector:l,maskTextClass:s,maskTextSelector:c,maskInputOptions:$,inlineStylesheet:u,sampling:S,recordDOM:E,recordCanvas:k,inlineImages:j,userTriggeredOnInput:I,collectFonts:B,doc:P,maskInputFn:d,maskTextFn:f,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:V,dataURLOptions:g,mirror:ut,iframeManager:lt,stylesheetManager:ft,shadowDomManager:wt,processedNodeManager:Pt,canvasManager:ze,ignoreCSSAttributes:Z,plugins:((nt=W?.filter(F=>F.observer))==null?void 0:nt.map(F=>({observer:F.observer,options:F.options,callback:Ae=>H({type:O.Plugin,data:{plugin:F.name,payload:Ae}})})))||[]},y)};lt.addLoadListener(P=>{try{R.push(Q(P.contentDocument))}catch(nt){console.warn(nt)}});let z=()=>{ae(),R.push(Q(document)),me=!0};return["interactive","complete"].includes(document.readyState)?z():(R.push(X("DOMContentLoaded",()=>{H({type:O.DomContentLoaded,data:{}}),x==="DOMContentLoaded"&&z()})),R.push(X("load",()=>{H({type:O.Load,data:{}}),x==="load"&&z()},window))),()=>{R.forEach(P=>{try{P()}catch(nt){String(nt).toLowerCase().includes("cross-origin")||console.warn(nt)}}),Pt.destroy(),me=!1,ho()}}catch(R){console.warn(R)}}et.addCustomEvent=(t,e)=>{if(!me)throw new Error("please add custom event after start recording");H({type:O.Custom,data:{tag:t,payload:e}})};et.freezePage=()=>{Ct.forEach(t=>t.freeze())};et.takeFullSnapshot=t=>{if(!me)throw new Error("please take full snapshot after start recording");ae(t)};et.mirror=ut;var mn={maskAllInputs:!0,maskInputOptions:{password:!0},blockSelector:"[data-rr-block]",maskTextSelector:"[data-rr-mask]",ignoreSelector:"[data-rr-ignore]",sampling:{scroll:150,input:"last"}};function gn(t){return t?t.closest?.("[data-sentiero-unmask]")!==null:!1}function Lo(t){return!!t&&t.tagName==="INPUT"&&t.type==="password"}function vn(t={}){let e={...mn,...t};if(e.maskInputOptions={...t.maskInputOptions||{},password:!0},t.sampling&&(e.sampling={...mn.sampling,...t.sampling}),e.maskAllInputs){let r=t.maskInputFn;e.maskInputFn=(n,i)=>e.maskInputOptions.password&&Lo(i)?"*".repeat(n.length):r?r(n,i):gn(i)?n:"*".repeat(n.length)}return e.maskTextFn||(e.maskTextFn=(r,n)=>gn(n)?r:r.replace(/\S/g,"*")),e}var ct=Uint8Array,it=Uint16Array,ir=Int32Array,or=new ct([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sr=new ct([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yn=new ct([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cn=function(t,e){for(var r=new it(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var i=new ir(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},In=Cn(or,2),Do=In.b,tr=In.r;Do[28]=258,tr[258]=28;var Mn=Cn(sr,0),$s=Mn.b,Sn=Mn.r,er=new it(32768);for(N=0;N<32768;++N)mt=(N&43690)>>1|(N&21845)<<1,mt=(mt&52428)>>2|(mt&13107)<<2,mt=(mt&61680)>>4|(mt&3855)<<4,er[N]=((mt&65280)>>8|(mt&255)<<8)>>1;var mt,N,Yt=function(t,e,r){for(var n=t.length,i=0,o=new it(e);i<n;++i)t[i]&&++o[t[i]-1];var a=new it(e);for(i=1;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;var l;if(r){l=new it(1<<e);var s=15-e;for(i=0;i<n;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],h=a[t[i]-1]++<<u,m=h|(1<<u)-1;h<=m;++h)l[er[h]>>s]=c}else for(l=new it(n),i=0;i<n;++i)t[i]&&(l[i]=er[a[t[i]-1]++]>>15-t[i]);return l},xt=new ct(288);for(N=0;N<144;++N)xt[N]=8;var N;for(N=144;N<256;++N)xt[N]=9;var N;for(N=256;N<280;++N)xt[N]=7;var N;for(N=280;N<288;++N)xt[N]=8;var N,ve=new ct(32);for(N=0;N<32;++N)ve[N]=5;var N,Fo=Yt(xt,9,0);var zo=Yt(ve,5,0);var xn=function(t){return(t+7)/8|0},Po=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new ct(t.subarray(e,r))};var gt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},qt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8,t[n+2]|=r>>16},Qe=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var i=r.length,o=r.slice();if(!i)return{t:Tn,l:0};if(i==1){var a=new ct(r[0].s+1);return a[r[0].s]=1,{t:a,l:1}}r.sort(function(E,k){return E.f-k.f}),r.push({s:-1,f:25001});var l=r[0],s=r[1],c=0,u=1,h=2;for(r[0]={s:-1,f:l.f+s.f,l,r:s};u!=i-1;)l=r[r[c].f<r[h].f?c++:h++],s=r[c!=u&&r[c].f<r[h].f?c++:h++],r[u++]={s:-1,f:l.f+s.f,l,r:s};for(var m=o[0].s,n=1;n<i;++n)o[n].s>m&&(m=o[n].s);var p=new it(m+1),d=rr(r[u-1],p,0);if(d>e){var n=0,f=0,y=d-e,C=1<<y;for(o.sort(function(k,A){return p[A.s]-p[k.s]||k.f-A.f});n<i;++n){var S=o[n].s;if(p[S]>e)f+=C-(1<<d-p[S]),p[S]=e;else break}for(f>>=y;f>0;){var g=o[n].s;p[g]<e?f-=1<<e-p[g]++-1:++n}for(;n>=0&&f;--n){var w=o[n].s;p[w]==e&&(--p[w],++f)}d=e}return{t:new ct(p),l:d}},rr=function(t,e,r){return t.s==-1?Math.max(rr(t.l,e,r+1),rr(t.r,e,r+1)):e[t.s]=r},bn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new it(++e),n=0,i=t[0],o=1,a=function(s){r[n++]=s},l=1;l<=e;++l)if(t[l]==i&&l!=e)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=t[l]}return{c:r.subarray(0,n),n:e}},Zt=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},En=function(t,e,r){var n=r.length,i=xn(e+2);t[i]=n&255,t[i+1]=n>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var o=0;o<n;++o)t[i+o+4]=r[o];return(i+4+n)*8},wn=function(t,e,r,n,i,o,a,l,s,c,u){gt(e,u++,r),++i[256];for(var h=Qe(i,15),m=h.t,p=h.l,d=Qe(o,15),f=d.t,y=d.l,C=bn(m),S=C.c,g=C.n,w=bn(f),E=w.c,k=w.n,A=new it(19),x=0;x<S.length;++x)++A[S[x]&31];for(var x=0;x<E.length;++x)++A[E[x]&31];for(var I=Qe(A,7),B=I.t,j=I.l,W=19;W>4&&!B[yn[W-1]];--W);var M=c+5<<3,Z=Zt(i,xt)+Zt(o,ve)+a,Y=Zt(i,m)+Zt(o,f)+a+14+3*W+Zt(A,B)+2*A[16]+3*A[17]+7*A[18];if(s>=0&&M<=Z&&M<=Y)return En(e,u,t.subarray(s,s+c));var L,D,$,V;if(gt(e,u,1+(Y<Z)),u+=2,Y<Z){L=Yt(m,p,0),D=m,$=Yt(f,y,0),V=f;var kt=Yt(B,j,0);gt(e,u,g-257),gt(e,u+5,k-1),gt(e,u+10,W-4),u+=14;for(var x=0;x<W;++x)gt(e,u+3*x,B[yn[x]]);u+=3*W;for(var K=[S,E],vt=0;vt<2;++vt)for(var at=K[vt],x=0;x<at.length;++x){var rt=at[x]&31;gt(e,u,kt[rt]),u+=B[rt],rt>15&&(gt(e,u,at[x]>>5&127),u+=at[x]>>12)}}else L=Fo,D=xt,$=zo,V=ve;for(var x=0;x<l;++x){var q=n[x];if(q>255){var rt=q>>18&31;qt(e,u,L[rt+257]),u+=D[rt+257],rt>7&&(gt(e,u,q>>23&31),u+=or[rt]);var yt=q&31;qt(e,u,$[yt]),u+=V[yt],yt>3&&(qt(e,u,q>>5&8191),u+=sr[yt])}else qt(e,u,L[q]),u+=D[q]}return qt(e,u,L[256]),u+D[256]},Uo=new ir([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tn=new ct(0),Bo=function(t,e,r,n,i,o){var a=o.z||t.length,l=new ct(n+a+5*(1+Math.ceil(a/7e3))+i),s=l.subarray(n,l.length-i),c=o.l,u=(o.r||0)&7;if(e){u&&(s[0]=o.r>>3);for(var h=Uo[e-1],m=h>>13,p=h&8191,d=(1<<r)-1,f=o.p||new it(32768),y=o.h||new it(d+1),C=Math.ceil(r/3),S=2*C,g=function(P){return(t[P]^t[P+1]<<C^t[P+2]<<S)&d},w=new ir(25e3),E=new it(288),k=new it(32),A=0,x=0,I=o.i||0,B=0,j=o.w||0,W=0;I+2<a;++I){var M=g(I),Z=I&32767,Y=y[M];if(f[Z]=Y,y[M]=Z,j<=I){var L=a-I;if((A>7e3||B>24576)&&(L>423||!c)){u=wn(t,s,0,w,E,k,x,B,W,I-W,u),B=A=x=0,W=I;for(var D=0;D<286;++D)E[D]=0;for(var D=0;D<30;++D)k[D]=0}var $=2,V=0,kt=p,K=Z-Y&32767;if(L>2&&M==g(I-K))for(var vt=Math.min(m,L)-1,at=Math.min(32767,I),rt=Math.min(258,L);K<=at&&--kt&&Z!=Y;){if(t[I+$]==t[I+$-K]){for(var q=0;q<rt&&t[I+q]==t[I+q-K];++q);if(q>$){if($=q,V=K,q>vt)break;for(var yt=Math.min(K,q-2),ft=0,D=0;D<yt;++D){var lt=I-K+D&32767,Pt=f[lt],wt=lt-Pt&32767;wt>ft&&(ft=wt,Y=lt)}}}Z=Y,Y=f[Z],K+=Z-Y&32767}if(V){w[B++]=268435456|tr[$]<<18|Sn[V];var R=tr[$]&31,Q=Sn[V]&31;x+=or[R]+sr[Q],++E[257+R],++k[Q],j=I+$,++A}else w[B++]=t[I],++E[t[I]]}}for(I=Math.max(I,j);I<a;++I)w[B++]=t[I],++E[t[I]];u=wn(t,s,c,w,E,k,x,B,W,I-W,u),c||(o.r=u&7|s[u/8|0]<<3,u-=7,o.h=y,o.p=f,o.i=I,o.w=j)}else{for(var I=o.w||0;I<a+c;I+=65535){var z=I+65535;z>=a&&(s[u/8|0]=c,z=a),u=En(s,u+1,t.subarray(I,z))}o.i=a}return Po(l,0,n+xn(u)+i)},Wo=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var r=e,n=9;--n;)r=(r&1&&-306674912)^r>>>1;t[e]=r}return t}(),Ho=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=Wo[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}};var Go=function(t,e,r,n,i){if(!i&&(i={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new ct(o.length+t.length);a.set(o),a.set(t,o.length),t=a,i.w=o.length}return Bo(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,r,n,i)};var nr=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},jo=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&nr(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var n=0;n<=r.length;++n)t[n+10]=r.charCodeAt(n)}};var $o=function(t){return 10+(t.filename?t.filename.length+1:0)};function ar(t,e){e||(e={});var r=Ho(),n=t.length;r.p(t);var i=Go(t,e,$o(e),8),o=i.length;return jo(i,e),nr(i,o-8,r.d()),nr(i,o-4,n),i}var Vo=typeof TextDecoder<"u"&&new TextDecoder,qo=0;try{Vo.decode(Tn,{stream:!0}),qo=1}catch{}function kn(t,e){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:e}function ye(){let t={};try{let e=globalThis.document?.getElementById?.("sentiero-config");e&&(t=JSON.parse(e.textContent)||{})}catch{t={}}return{idleTimeoutMs:kn(t.sessionIdleTimeoutMs,216e5),maxAgeMs:kn(t.sessionMaxAgeMs,6048e5)}}var ur="sentiero_session_id",On="sentiero_window_id",cr="sentiero_session_created_at",Se="sentiero_session_last_seen",be="sentiero_entry_url",we="sentiero_entry_referrer",Zo=[ur,On,cr,Se,be,we],lr={value:null},Yo={value:null},Ce=null;function Xo(t,e,r){try{let n=t.getItem(e);return n||(n=crypto.randomUUID(),t.setItem(e,n)),n}catch{return r.value||(r.value=crypto.randomUUID()),r.value}}function _n(t,e){let r=Number(t.getItem(e));return Number.isFinite(r)&&r>0?r:null}function fr(t,e,r){t.setItem(e,String(r))}function Nn(t=!0){let e=t?localStorage:sessionStorage,{idleTimeoutMs:r,maxAgeMs:n}=ye();try{let i=Date.now(),o=e.getItem(ur),a=_n(e,cr),l=_n(e,Se),s=!o||a===null||l===null||i-l>r||i-a>n,c=o;return s&&(c=crypto.randomUUID(),e.setItem(ur,c),fr(e,cr,i),e.removeItem(be),e.removeItem(we)),fr(e,Se,i),Ce=e,c}catch{return lr.value||(lr.value=crypto.randomUUID()),lr.value}}function An(){return Xo(sessionStorage,On,Yo)}function Jo(){if(Ce)try{fr(Ce,Se,Date.now())}catch{}}typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("pagehide",Jo);function Rn(t){if(!t)return"";try{let e=new URL(t);return e.origin+e.pathname}catch{let e=t.search(/[?#]/);return e===-1?t:t.slice(0,e)}}function Ln(t=!0){let e=t?localStorage:sessionStorage;try{let r=e.getItem(be);if(r===null){let n=Rn(globalThis.location?.href||""),i=Rn(globalThis.document?.referrer||"");return e.setItem(be,n),e.setItem(we,i),{entry_url:n,entry_referrer:i}}return{entry_url:r,entry_referrer:e.getItem(we)||""}}catch{return{}}}function Dn(){for(let t of[globalThis.localStorage,globalThis.sessionStorage])if(t)for(let e of Zo)try{t.removeItem(e)}catch{}Ce=null}var Fn="[redacted]",Ko=["url","jwt","email","long_hex","card"],Qo={jwt:/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,email:/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,long_hex:/\b[0-9a-fA-F]{32,}\b/g,card:/\b\d(?:[ -]?\d){12,18}\b/g},ts=/https?:\/\/\S+/g,es=["token","access_token","refresh_token","id_token","password","passwd","pwd","secret","api_key","apikey","key","sig","signature","code","auth","session","sessionid","otp"];function Ie(t={}){return{urlMode:t.urlMode||"strip",allowlist:(t.urlParamAllowlist||[]).map(e=>e.toLowerCase()),denylist:[...es,...(t.urlParamDenylist||[]).map(e=>e.toLowerCase())],disabled:t.disabledPatterns||[],customRegexes:(t.customPatterns||[]).flatMap(e=>{try{return[new RegExp(e,"g")]}catch{return console.warn(`[Sentiero] skipping invalid custom redaction pattern: ${e}`),[]}})}}function zn(t){let e=t.indexOf("?"),r=t.indexOf("#");return e<0&&(e=t.length),r>=0&&r<e&&(e=r),t.slice(0,e)}function rs(t,e){return e==="url"?t.replace(ts,r=>zn(r)):t.replace(Qo[e],Fn)}function Me(t,e){if(typeof t!="string")return t;let r=t;for(let n of Ko)e.disabled.includes(n)||(r=rs(r,n));for(let n of e.customRegexes)r=r.replace(n,Fn);return r}function ns(t){let e=t,r="",n=e.indexOf("#");n>=0&&(r=e.slice(n+1),e=e.slice(0,n));let i="",o=e.indexOf("?");return o>=0&&(i=e.slice(o+1),e=e.slice(0,o)),{base:e,query:i,frag:r}}function is(t){try{return decodeURIComponent(t)}catch{return t}}function os(t,e){let r=t.indexOf("="),n=(r>=0?t.slice(0,r):t).toLowerCase();if(e.denylist.includes(n))return null;if(e.allowlist.includes(n)||r<0)return t;let i=t.slice(r+1),o=is(i),a=Me(o,e);return a===o?t:t.slice(0,r)+"="+a}function Jt(t,e){if(typeof t!="string"||e.urlMode==="keepAll")return t;if(e.urlMode!=="keepFiltered")return zn(t);let{base:r,query:n,frag:i}=ns(t),o=n?n.split("&").map(l=>os(l,e)).filter(l=>l!==null):[],a=r;return o.length&&(a+="?"+o.join("&")),i&&(a+="#"+Me(i,e)),a}var ss=5,as=4,ls=["url","referrer","entry_url","entry_referrer"],us={navigation:{url:"url",text:"text"},__form_submit:{url:"url"},error:{message:"text",stack:"text",source:"url"},__click:{selector:"text"}};function Xt(t,e){if(typeof t=="string")return Me(t,e);if(Array.isArray(t))return t.map(r=>Xt(r,e));if(t&&typeof t=="object"){let r={};for(let[n,i]of Object.entries(t))r[Xt(n,e)]=Xt(i,e);return r}return t}function Et(t,e,r){if(e==null||typeof e!="object")return e;let n=us[t],i={};for(let[o,a]of Object.entries(e))n&&n[o]==="url"?i[o]=Jt(a,r):n&&n[o]==="text"?i[o]=Me(a,r):i[o]=Xt(a,r);return i}function Pn(t,e){return t&&t.type===ss&&t.data&&typeof t.data=="object"?{...t,data:{...t.data,payload:Et(t.data.tag,t.data.payload,e)}}:t&&t.type===as&&t.data&&typeof t.data=="object"&&"href"in t.data?{...t,data:{...t.data,href:Jt(t.data.href,e)}}:t}function xe(t,e){if(t==null||typeof t!="object")return t;let r={};for(let[n,i]of Object.entries(t))r[n]=ls.includes(n)?Jt(i,e):Xt(i,e);return r}var cs=64e3,Ee=class{constructor({eventsUrl:e,flushIntervalMs:r=1e4,flushEventThreshold:n=50,maxBufferSize:i=5e3,crossTabSessions:o=!0,captureMetadata:a=!1,redactionCfg:l=null}){this.eventsUrl=e,this.flushIntervalMs=r,this.flushEventThreshold=n,this.maxBufferSize=i,this.buffer=[],this._stopped=!1,this._crossTabSessions=o,this.sessionId=Nn(o),this.windowId=An(),this._intervalId=null,this._flushing=!1,this._retryCount=0,this._maxRetries=10,this._baseBackoffMs=1e3,this._maxBackoffMs=3e4,this._lastFailureTime=null,this._batchCap=null,this._captureMetadata=a,this._metadataSent=!1,this._customMetadata={},this._redactionCfg=l||Ie({})}start(){this._intervalId=setInterval(()=>this.flush(),this.flushIntervalMs)}setMetadata(e){e&&typeof e=="object"&&Object.assign(this._customMetadata,e)}addEvent(e){if(this.buffer.push(Pn(e,this._redactionCfg)),this.buffer.length>this.maxBufferSize){let r=this.buffer.length-this.maxBufferSize;this.buffer.splice(0,r),console.warn(`[Sentiero] buffer overflow, dropped ${r} oldest events`)}this.buffer.length>=this.flushEventThreshold&&this.flush()}_collectMetadata(){let e={};try{e.url=window.location.href,e.referrer=document.referrer||"",e.userAgent=navigator.userAgent,e.viewport=`${window.innerWidth}x${window.innerHeight}`,Object.assign(e,Ln(this._crossTabSessions))}catch{}return xe(e,this._redactionCfg)}_buildPayload(e,r){let n={sessionId:this.sessionId,windowId:this.windowId,events:e};return this._captureMetadata&&!this._metadataSent?(n.metadata=xe({...this._collectMetadata(),...r},this._redactionCfg),this._metadataSent=!0):Object.keys(r).length>0&&(n.metadata=xe({...r},this._redactionCfg)),JSON.stringify(n)}_handleFlushFailure(e,r,n,i){this._flushing=!1,this._retryCount++,this._lastFailureTime=Date.now(),console.warn(n,i),this.buffer=e.concat(this.buffer),this._customMetadata={...r,...this._customMetadata},this._metadataSent=!1}flush(){if(this._stopped||this.buffer.length===0||this._flushing)return;if(this._retryCount>0){let i=Math.min(this._baseBackoffMs*2**(this._retryCount-1),this._maxBackoffMs);if(!this._lastFailureTime||Date.now()-this._lastFailureTime<i)return}if(this._retryCount>=this._maxRetries){console.warn(`[Sentiero] max retries (${this._maxRetries}) exceeded, dropping ${this.buffer.length} events`),this.buffer.length=0,this._retryCount=0,this._lastFailureTime=null;return}let e;this._batchCap&&this.buffer.length>this._batchCap?(e=this.buffer.slice(0,this._batchCap),this.buffer=this.buffer.slice(this._batchCap)):(e=this.buffer,this.buffer=[]);let r=this._customMetadata;this._customMetadata={},this._flushing=!0;let n=this._buildPayload(e,r);try{let i=new TextEncoder().encode(n),o=ar(i);fetch(this.eventsUrl,{method:"POST",headers:{"Content-Type":"application/json","Content-Encoding":"gzip"},body:o}).then(a=>{this._flushing=!1,a.ok?(this._retryCount=0,this._lastFailureTime=null,this._batchCap&&(this._batchCap=this._batchCap>=this.maxBufferSize?null:this._batchCap*2,this.buffer.length>0&&this._resendAfterSplit())):a.status===413?this._handleOversizedPayload(e,r,i.length):this._handleFlushFailure(e,r,"[Sentiero] server rejected events:",a.status)}).catch(a=>{this._handleFlushFailure(e,r,"[Sentiero] flush failed, re-queuing events:",a)})}catch(i){this._handleFlushFailure(e,r,"[Sentiero] compression failed, re-queuing events:",i)}}_handleOversizedPayload(e,r,n){if(e.length===1){console.warn(`[Sentiero] dropping event: ${n} bytes uncompressed exceeds the server body cap; raise config.max_body_size if payloads this large are expected`),this._customMetadata={...r,...this._customMetadata},this._metadataSent=!1,this._retryCount++,this._lastFailureTime=Date.now();return}this._batchCap=Math.max(1,Math.floor(e.length/2)),this.buffer=e.concat(this.buffer),this._customMetadata={...r,...this._customMetadata},this._metadataSent=!1,this._resendAfterSplit()}_resendAfterSplit(){typeof document<"u"&&document.visibilityState==="hidden"?this.flushBeacon():this.flush()}flushBeacon(){if(this._stopped||this.buffer.length===0)return;let e=this.buffer;this.buffer=[];let r=this._customMetadata;this._customMetadata={},this._sendBeaconChunk(e,r)}_sendBeaconChunk(e,r){if(e.length===0)return;let n=this._buildPayload(e,r),i;try{i=new Blob([ar(new TextEncoder().encode(n))],{type:"text/plain"})}catch(o){console.warn("[Sentiero] beacon failed:",o);return}if(i.size>cs&&e.length>1){let o=Math.floor(e.length/2);this._sendBeaconChunk(e.slice(0,o),r),this._sendBeaconChunk(e.slice(o),{});return}navigator.sendBeacon(this.eventsUrl,i)||console.warn("[Sentiero] beacon rejected (quota exhausted), events may be lost")}stop(){this._intervalId!==null&&(clearInterval(this._intervalId),this._intervalId=null),this.flushBeacon()}discard(){this._stopped=!0,this._intervalId!==null&&(clearInterval(this._intervalId),this._intervalId=null),this.buffer.length=0}};var Un=t=>t!=null&&t!==""&&t!=="0"&&t!=="false";function fs(t,e){let r=(e.cookie||"").split(";");for(let n of r){let i=n.indexOf("=");if((i===-1?n:n.slice(0,i)).trim()===t)return decodeURIComponent(n.slice(i+1).trim())}return null}function hs(t,e){try{return e.getItem(t)}catch{return null}}function Bn(t,e=globalThis.document,r=globalThis.localStorage){return t?Un(fs(t,e))||Un(hs(t,r)):!1}function Wn(t,e=globalThis.document,r=globalThis.localStorage){if(t){e.cookie=`${t}=1; path=/; max-age=31536000; SameSite=Lax`;try{r.setItem(t,"1")}catch{}}}function Hn(t,e=globalThis.document,r=globalThis.localStorage){if(t){e.cookie=`${t}=; path=/; max-age=0; SameSite=Lax`;try{r.removeItem(t)}catch{}}}function Gn(t,e=globalThis.navigator){return!(Bn(t?.optOutCookieName)||t?.respectGpc&&e?.globalPrivacyControl)}var $n="sentiero_sid",Vn="sentiero_wid";function jn(t,e,r,n,i){let o=`${e}=${encodeURIComponent(r)}; path=/; max-age=${i}; SameSite=Lax`;n&&(o+="; Secure"),t.cookie=o}function qn(t,e,{doc:r=globalThis.document,secure:n=globalThis.location?.protocol==="https:"}={}){if(!r||!t)return;let i=Math.round(ye().maxAgeMs/1e3);try{jn(r,$n,t,n,i),e&&jn(r,Vn,e,n,i)}catch{}}function Zn({doc:t=globalThis.document}={}){if(t)try{t.cookie=`${$n}=; path=/; max-age=0; SameSite=Lax`,t.cookie=`${Vn}=; path=/; max-age=0; SameSite=Lax`}catch{}}var ds="__form_submit";function ps(t){if(!t||typeof t.getAttribute!="function")return{};let e={},r=t.getAttribute("name"),n=t.getAttribute("id");return r&&(e.name=r),n&&(e.id=n),e}function ms(t,e){return{...ps(t),url:e}}function Yn(t,e,r){t.addEventListener("submit",n=>{let i=n.target;if(!(!i||typeof i.getAttribute!="function"))try{e(ds,ms(i,r()))}catch{}},!0)}function Rs(){let t=document.getElementById("sentiero-config");if(t)try{return JSON.parse(t.textContent)}catch(e){console.warn("[Sentiero] failed to parse config element:",e)}if(document.currentScript&&document.currentScript.src){let e=new URL(document.currentScript.src),r=e.pathname.split("/");return r[r.length-1]="events",e.pathname=r.join("/"),{eventsUrl:e.toString()}}return console.warn("[Sentiero] no config found, recording disabled"),null}function Os({href:t,text:e,external:r},n){let i={url:t};return e&&(i.text=e),r&&(i.external=!0),Et("navigation",i,n)}function ci({message:t,stack:e,source:r,...n},i){let o={...n,message:t,stack:e||""};return r!==void 0&&(o.source=r),Et("error",o,i)}function Ns(t){window.addEventListener("error",e=>{try{et.addCustomEvent("error",ci({message:e.message||"Unknown error",source:e.filename||"",lineno:e.lineno||0,colno:e.colno||0,stack:e.error?.stack||""},t))}catch{}}),window.addEventListener("unhandledrejection",e=>{try{let r="Unhandled Promise rejection",n="";e.reason instanceof Error?(r=e.reason.message,n=e.reason.stack||""):typeof e.reason=="string"&&(r=e.reason),et.addCustomEvent("error",ci({message:r,type:"unhandledrejection",stack:n},t))}catch{}})}function As(){Promise.resolve().then(()=>(ui(),li)).then(({onLCP:t,onCLS:e,onINP:r})=>{let n=i=>{try{et.addCustomEvent("__perf",{metric:i.name,value:i.value,rating:i.rating})}catch{}};t(n),e(n),r(n)}).catch(t=>{console.warn("[Sentiero] web-vitals failed to load:",t)})}function Ls(t){document.addEventListener("click",e=>{let r=e.target.closest("a[href]");if(!r)return;let n=r.href;if(!n||n.startsWith("javascript:")||n==="#")return;try{let a=new URL(n,window.location.href);if(a.origin===window.location.origin&&a.pathname===window.location.pathname&&a.hash)return}catch{return}let i=(r.textContent||"").trim().substring(0,100),o=(()=>{try{return new URL(n,window.location.href).origin!==window.location.origin}catch{return!1}})();try{et.addCustomEvent("navigation",Os({href:n,text:i,external:o},t))}catch{}},!0)}function Ds(t){let e=t;for(let i=0;e&&i<3&&!(e.nodeType===1&&e.tagName);i++)e=e.parentElement;if(!e||e.nodeType!==1)return null;let r=e.tagName.toLowerCase();if(e.id)return`${r}#${e.id}`;let n=(e.getAttribute("class")||"").split(/\s+/).filter(Boolean).slice(0,2);return n.length?`${r}.${n.join(".")}`:r}function Fs(t){document.addEventListener("click",e=>{let r=Ds(e.target);if(r)try{et.addCustomEvent("__click",Et("__click",{selector:r},t))}catch{}},!0)}var zs=["click","change","submit","focus","blur"],Ps=/^[a-zA-Z0-9_.\-]{1,100}$/,Us=4096;function Bs(t){for(let e of zs)document.addEventListener(e,r=>{let n=`data-sentiero-track-${e}`,i=r.target.closest(`[${n}]`);if(!i)return;let o=i.getAttribute(n);if(!o||!Ps.test(o))return;let a={},l=i.getAttribute("data-sentiero-data");if(l){if(l.length>Us)return;try{a=JSON.parse(l)}catch{return}}try{et.addCustomEvent(o,Et(o,a,t))}catch{}},!0)}function Ws(){let t=Rs();if(!t?.eventsUrl)return;let e=Ie(t.redaction),r=t.optOutCookieName,n=null,i=null;if(window.Sentiero=window.Sentiero||{},window.Sentiero.optOut=()=>{if(Wn(r),Zn(),Dn(),i){try{i()}catch{}i=null}n&&(n.discard(),n=null)},window.Sentiero.optIn=()=>Hn(r),!Gn(t))return;n=new Ee({eventsUrl:t.eventsUrl,flushIntervalMs:t.flushIntervalMs,flushEventThreshold:t.flushEventThreshold,crossTabSessions:t.crossTabSessions!==!1,captureMetadata:t.captureMetadata===!0,redactionCfg:e}),qn(n.sessionId,n.windowId),window.Sentiero.setMetadata=a=>n.setMetadata(a),window.Sentiero.addCustomEvent=(a,l)=>{try{et.addCustomEvent(a,Et(a,l,e))}catch(s){console.warn("[Sentiero] addCustomEvent failed:",s)}};let o=vn(t.recorderOptions||{});try{i=et({...o,emit:a=>n.addEvent(a)})}catch(a){console.error("[Sentiero] rrweb recording failed to start:",a),n.stop();return}t.captureErrors===!0&&Ns(e),t.trackNavigation===!0&&Ls(e),t.trackCustomEvents===!0&&Bs(e),t.captureWebVitals===!0&&As(),t.captureClicks===!0&&Fs(e),t.trackForms===!0&&Yn(document,(a,l)=>et.addCustomEvent(a,l),()=>Jt(window.location.href,e)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&n?.flushBeacon()}),document.addEventListener("pagehide",()=>{n?.flushBeacon()}),n.start()}typeof window<"u"&&Ws();})();