@lucida-analytics/browser 0.1.0 → 0.1.2

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 (108) hide show
  1. package/README.md +7 -3
  2. package/dist/autocapture.d.ts +1 -1
  3. package/dist/autocapture.js +1 -1
  4. package/dist/{banner-CGEWCIGP.js → banner-2TSKJ4WK.js} +1 -1
  5. package/dist/{static/v0.1.0/chunk-GVYMMTQM.js → chunk-32K5P5GN.js} +1 -1
  6. package/dist/{static/v0.1.0/chunk-MCWQHOEV.js → chunk-FUE3SDQU.js} +1 -1
  7. package/dist/chunk-NIDQQHZJ.js +1 -0
  8. package/dist/chunk-O4W7SZ2X.js +1 -0
  9. package/dist/{client-ts5YMCoB.d.ts → client-B20ZY8rd.d.ts} +3 -3
  10. package/dist/consent.d.ts +14 -3
  11. package/dist/consent.js +1 -1
  12. package/dist/core.d.ts +3 -3
  13. package/dist/core.js +3 -3
  14. package/dist/correlate.d.ts +1 -1
  15. package/dist/early-access.d.ts +1 -1
  16. package/dist/experiments.d.ts +1 -1
  17. package/dist/flags.d.ts +1 -1
  18. package/dist/flags.js +2 -2
  19. package/dist/forms.d.ts +1 -1
  20. package/dist/forms.js +1 -1
  21. package/dist/guides.d.ts +41 -3
  22. package/dist/guides.js +1 -1
  23. package/dist/heatmaps.d.ts +4 -2
  24. package/dist/heatmaps.js +1 -1
  25. package/dist/host-headers.d.ts +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +2 -2
  28. package/dist/inspector.d.ts +1 -1
  29. package/dist/lucida.js +2 -2
  30. package/dist/{persistent-XLGNSZQR.js → persistent-SLVINN5A.js} +1 -1
  31. package/dist/recommendations.d.ts +1 -1
  32. package/dist/recorder-3YIZ6OKD.js +78 -0
  33. package/dist/replay.d.ts +2 -2
  34. package/dist/replay.js +1 -1
  35. package/dist/static/v0/autocapture.js +1 -1
  36. package/dist/static/v0/{banner-CGEWCIGP.js → banner-2TSKJ4WK.js} +1 -1
  37. package/dist/{chunk-GVYMMTQM.js → static/v0/chunk-32K5P5GN.js} +1 -1
  38. package/dist/{chunk-MCWQHOEV.js → static/v0/chunk-FUE3SDQU.js} +1 -1
  39. package/dist/static/v0/chunk-NIDQQHZJ.js +1 -0
  40. package/dist/static/v0/chunk-O4W7SZ2X.js +1 -0
  41. package/dist/static/v0/consent.js +1 -1
  42. package/dist/static/v0/core.js +3 -3
  43. package/dist/static/v0/flags.js +2 -2
  44. package/dist/static/v0/forms.js +1 -1
  45. package/dist/static/v0/guides.js +1 -1
  46. package/dist/static/v0/heatmaps.js +1 -1
  47. package/dist/static/v0/index.js +2 -2
  48. package/dist/static/v0/lucida.js +2 -2
  49. package/dist/static/v0/{persistent-XLGNSZQR.js → persistent-SLVINN5A.js} +1 -1
  50. package/dist/static/v0/recorder-3YIZ6OKD.js +78 -0
  51. package/dist/static/v0/replay.js +1 -1
  52. package/dist/static/v0/toolbar.js +4 -4
  53. package/dist/static/v0/{validation-ENITEP6V.js → validation-HGJXZ553.js} +1 -1
  54. package/dist/static/v0.1.2/autocapture.js +1 -0
  55. package/dist/static/{v0.1.0/banner-CGEWCIGP.js → v0.1.2/banner-2TSKJ4WK.js} +1 -1
  56. package/dist/static/{v0/chunk-GVYMMTQM.js → v0.1.2/chunk-32K5P5GN.js} +1 -1
  57. package/dist/static/{v0/chunk-MCWQHOEV.js → v0.1.2/chunk-FUE3SDQU.js} +1 -1
  58. package/dist/static/v0.1.2/chunk-NIDQQHZJ.js +1 -0
  59. package/dist/static/v0.1.2/chunk-O4W7SZ2X.js +1 -0
  60. package/dist/static/v0.1.2/consent.js +1 -0
  61. package/dist/static/v0.1.2/core.js +3 -0
  62. package/dist/static/v0.1.2/flags.js +3 -0
  63. package/dist/static/{v0.1.0 → v0.1.2}/forms.js +1 -1
  64. package/dist/static/v0.1.2/guides.js +1 -0
  65. package/dist/static/{v0.1.0 → v0.1.2}/heatmaps.js +1 -1
  66. package/dist/static/v0.1.2/index.js +3 -0
  67. package/dist/static/v0.1.2/integrity.json +30 -0
  68. package/dist/static/v0.1.2/lucida.js +3 -0
  69. package/dist/static/{v0.1.0/persistent-XLGNSZQR.js → v0.1.2/persistent-SLVINN5A.js} +1 -1
  70. package/dist/static/v0.1.2/recorder-3YIZ6OKD.js +78 -0
  71. package/dist/static/v0.1.2/replay.js +1 -0
  72. package/dist/static/v0.1.2/toolbar.js +4 -0
  73. package/dist/static/{v0.1.0/validation-ENITEP6V.js → v0.1.2/validation-HGJXZ553.js} +1 -1
  74. package/dist/toolbar.d.ts +1 -1
  75. package/dist/toolbar.js +4 -4
  76. package/dist/{types-Cv4pBbPu.d.ts → types-BtvrrgrR.d.ts} +38 -4
  77. package/dist/{types-BWd9sbCh.d.ts → types-CLEZS45j.d.ts} +42 -4
  78. package/dist/{validation-ENITEP6V.js → validation-HGJXZ553.js} +1 -1
  79. package/dist/webmcp.d.ts +1 -1
  80. package/package.json +4 -3
  81. package/dist/chunk-3PWTJFHH.js +0 -1
  82. package/dist/chunk-MI35SSIT.js +0 -1
  83. package/dist/recorder-LFUTDRP4.js +0 -78
  84. package/dist/static/v0/chunk-3PWTJFHH.js +0 -1
  85. package/dist/static/v0/chunk-MI35SSIT.js +0 -1
  86. package/dist/static/v0/recorder-LFUTDRP4.js +0 -78
  87. package/dist/static/v0.1.0/autocapture.js +0 -1
  88. package/dist/static/v0.1.0/chunk-3PWTJFHH.js +0 -1
  89. package/dist/static/v0.1.0/chunk-MI35SSIT.js +0 -1
  90. package/dist/static/v0.1.0/consent.js +0 -1
  91. package/dist/static/v0.1.0/core.js +0 -3
  92. package/dist/static/v0.1.0/flags.js +0 -3
  93. package/dist/static/v0.1.0/guides.js +0 -1
  94. package/dist/static/v0.1.0/index.js +0 -3
  95. package/dist/static/v0.1.0/integrity.json +0 -30
  96. package/dist/static/v0.1.0/lucida.js +0 -3
  97. package/dist/static/v0.1.0/recorder-LFUTDRP4.js +0 -78
  98. package/dist/static/v0.1.0/replay.js +0 -1
  99. package/dist/static/v0.1.0/toolbar.js +0 -4
  100. /package/dist/static/{v0.1.0 → v0.1.2}/chunk-AWIQCFGN.js +0 -0
  101. /package/dist/static/{v0.1.0 → v0.1.2}/correlate.js +0 -0
  102. /package/dist/static/{v0.1.0 → v0.1.2}/early-access.js +0 -0
  103. /package/dist/static/{v0.1.0 → v0.1.2}/experiments.js +0 -0
  104. /package/dist/static/{v0.1.0 → v0.1.2}/host-headers.js +0 -0
  105. /package/dist/static/{v0.1.0 → v0.1.2}/inspector.js +0 -0
  106. /package/dist/static/{v0.1.0 → v0.1.2}/modules-FANMZRDJ.js +0 -0
  107. /package/dist/static/{v0.1.0 → v0.1.2}/recommendations.js +0 -0
  108. /package/dist/static/{v0.1.0 → v0.1.2}/webmcp.js +0 -0
@@ -1,78 +0,0 @@
1
- import{b as Wt,d as Ht,h as Gt,i as jt,j as ft}from"./chunk-3PWTJFHH.js";import{b as $t,c as qt}from"./chunk-MI35SSIT.js";var dn=Object.defineProperty,hn=(e,t,r)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>hn(e,typeof t!="symbol"?t+"":t,r),Vt,A=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(A||{}),D=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(D||{}),se=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(se||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),Fe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Fe||{}),Oe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Oe||{}),J=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(J||{}),Xt={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Zt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ue={},gt={},Yt=0,pn=()=>!!globalThis.Zone;function Ot(e){if(Ue[e])return Ue[e];let t=globalThis[e],r=t.prototype,n=e in Xt?Xt[e]:void 0,i=!!(n&&n.every(a=>{var l,f;return!!((f=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&f.toString().includes("[native code]"))})),o=e in Zt?Zt[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!pn())return Ue[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let f=l[e].prototype;if(!f)return a.remove(),r;let c=navigator.userAgent;return c.includes("Safari")&&!c.includes("Chrome")?(a.classList.add("rr-block"),a.setAttribute("__rrwebUntaintedMutationObserver",""),gt[e]=()=>a.remove()):a.remove(),Ue[e]=f}catch{return r}}var dt={};function ue(e,t,r){var n,i;let o=(n=dt[e])==null?void 0:n[r];if(o)return o.call(t);let s=Ot(e),a=(i=Object.getOwnPropertyDescriptor(s,r))==null?void 0:i.get;return a?((dt[e]||(dt[e]={}))[r]=a,a.call(t)):t[r]}var ht={};function lr(e,t,r){let n=`${e}.${String(r)}`;if(ht[n])return ht[n].bind(t);let o=Ot(e)[r];return typeof o!="function"?t[r]:(ht[n]=o,o.bind(t))}function mn(e){return ue("Node",e,"ownerDocument")}function gn(e){return ue("Node",e,"childNodes")}function vn(e){return ue("Node",e,"parentNode")}function yn(e){return ue("Node",e,"parentElement")}function bn(e){return ue("Node",e,"textContent")}function Sn(e){return ue("Node",e,"firstChild")}function wn(e){return ue("Node",e,"lastChild")}function Cn(e){return ue("Node",e,"nextSibling")}function Mn(e){return ue("Node",e,"previousSibling")}function In(e,t){return lr("Node",e,"contains")(t)}function xn(e){return lr("Node",e,"getRootNode")()}function Rn(e){return!e||!("host"in e)?null:ue("ShadowRoot",e,"host")}function kn(e){return e.styleSheets}function En(e){return!e||!("shadowRoot"in e)?null:ue("Element",e,"shadowRoot")}function Tn(e,t){return ue("Element",e,"querySelector")(t)}function On(e,t){return ue("Element",e,"querySelectorAll")(t)}function ur(){let e=Ot("MutationObserver");Yt++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--Yt!==0))return;let r=gt.MutationObserver;if(r)try{r()}finally{delete Ue.MutationObserver,delete gt.MutationObserver}}]}var He=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(He=()=>new Date().getTime());function ke(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var w={ownerDocument:mn,childNodes:gn,parentNode:vn,parentElement:yn,textContent:bn,firstChild:Sn,lastChild:wn,nextSibling:Cn,previousSibling:Mn,contains:In,getRootNode:xn,host:Rn,styleSheets:kn,shadowRoot:En,querySelector:Tn,querySelectorAll:On,nowTimestamp:He,mutationObserverCtor:ur,patch:ke};function cr(e){return e.nodeType===e.ELEMENT_NODE}function Pe(e){let t=e&&"host"in e&&"mode"in e&&w.host(e)||null;return!!(t&&"shadowRoot"in t&&w.shadowRoot(t)===e)}function Be(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Nn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function An(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function vt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>fr(i,r)).join("");return Nn(n)}catch{return null}}function fr(e,t){if(Ln(e)){let r;try{r=vt(e.styleSheet)||An(e)}catch{r=e.cssText}return e.styleSheet.href?nt(r,e.styleSheet.href):r}else{let r=e.cssText;return _n(e)&&e.selectorText.includes(":")&&(r=Dn(r)),t?nt(r,t):r}}function Dn(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Ln(e){return"styleSheet"in e}function _n(e){return"selectorText"in e}var et=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i));let n=w.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Fn(){return new et}function tt({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&Re(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function Re(e){return e.toLowerCase()}var Jt="__rrweb_original__";function zn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let o=t.getImageData,s=Jt in o?o[Jt]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function rt(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Re(t):null}function dr(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function Un(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Pn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Bn=/^(?:[a-z+]+:)?\/\//i,Wn=/^www\..*/i,Hn=/^(data:)([^,]*),(.*)/i;function nt(e,t){return(e||"").replace(Pn,(r,n,i,o,s,a)=>{let l=i||s||a,f=n||o||"";if(!l)return r;if(Bn.test(l)||Wn.test(l))return`url(${f}${l}${f})`;if(Hn.test(l))return`url(${f}${l}${f})`;if(l[0]==="/")return`url(${f}${Un(t)+l}${f})`;let c=l.split("#")[0],d=l.substring(c.length),m=t.split("#")[0].split("/"),h=c.split("/");m.pop();for(let p of h)p!=="."&&(p===".."?m.pop():m.push(p));return`url(${f}${m.join("/")}${d}${f})`})}var hr="(?:/\\*[^*]*\\*/)|[\\s;]",Gn=new RegExp(`${hr}|\\b(0)px?`,"g"),jn=new RegExp(hr,"g");function Ze(e,t=!1){return t?e.replace(jn,""):e.replace(Gn,"$1")}function $n(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=Ze(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let f=Ze(n[l].textContent,r),c=100,d=3;for(;d<f.length&&(f[d].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,d),1)!==-1);d++);for(;d<f.length;d++){let m=f.substring(0,d),h=s.split(m),p=-1;if(h.length===2)p=h[0].length;else if(h.length>2&&h[0]===""&&n[l-1].textContent!=="")p=s.indexOf(m,1);else if(h.length===1){if(m=m.substring(0,m.length-1),h=s.split(m),h.length<=1)return i.push(e),i;d=c+1}else d===f.length-1&&(p=s.indexOf(m));if(h.length>=2&&d>c){let u=n[l-1].textContent;if(u&&typeof u=="string"){let g=Ze(u).length;p=s.indexOf(m,g)}p===-1&&(p=h[0].length)}if(p!==-1){let u=Math.floor(p/a);for(;u>0&&u<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;let g=Ze(e.substring(0,u),r);if(g.length===p){i.push(e.substring(0,u)),e=e.substring(u),s=s.substring(p);break}else g.length<p?u+=Math.max(1,Math.floor((p-g.length)/a)):u-=Math.max(1,Math.floor((g.length-p)*a))}break}}}}return i.push(e),i}function qn(e,t){return $n(e,t).join("/* rr_split */")}var Vn=1,Xn=new RegExp("[^a-z0-9-_:]"),it=-2;function pr(){return Vn++}function Zn(e){if(e instanceof HTMLFormElement)return"form";let t=Re(e.tagName);return Xn.test(t)?"div":t}var Te,Kt,Yn=/^[^ \t\n\r\u000c]+/,Jn=/^[, \t\n\r\u000c]+/;function Kn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s,a=o.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let i=[];for(;n(Jn),!(r>=t.length);){let o=n(Yn);if(o.slice(-1)===",")o=Ae(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=Ae(e,o);let a=!1;for(;;){let l=t.charAt(r);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return i.join(", ")}var Qt=new WeakMap;function Ae(e,t){return!t||t.trim()===""?t:Nt(e,t)}function Qn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Nt(e,t){let r=Qt.get(e);if(r||(r=e.createElement("a"),Qt.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function mr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Ae(e,n):r==="srcset"?Kn(e,n):r==="style"?nt(n,Nt(e)):t==="object"&&r==="data"?Ae(e,n):n)}function gr(e,t,r){return["video","audio"].includes(e)&&Re(t)==="autoplay"}function ei(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function ot(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ot(w.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}return r?ot(w.parentNode(e),t,r):!1}function vr(e,t,r,n){let i;if(cr(e)){if(i=e,!w.childNodes(i).length)return!1}else{if(w.parentElement(e)===null)return!1;i=w.parentElement(e)}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(ot(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function ti(e,t,r){let n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function ri(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function ni(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:f,maskInputFn:c,dataURLOptions:d={},inlineImages:m,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:u=!1,cssCaptured:g=!1}=t,b=ii(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:J.Document,childNodes:[],compatMode:e.compatMode}:{type:J.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:J.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return si(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:m,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:u,rootId:b});case e.TEXT_NODE:return oi(e,{doc:r,needsMask:s,maskTextFn:f,rootId:b,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:J.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:J.Comment,textContent:w.textContent(e)||"",rootId:b};default:return!1}}function ii(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function oi(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=w.parentNode(e),a=s&&s.tagName,l="",f=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":o||(l=w.textContent(e),f&&l&&(l=nt(l,Nt(t.doc)))),!f&&!c&&l&&r&&(l=n?n(l,w.parentElement(e)):l.replace(/[\S]/g,"*")),{type:J.Text,textContent:l||"",rootId:i}}function si(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:f,recordCanvas:c,keepIframeSrcFn:d,newlyAddedElement:m=!1,rootId:h}=t,p=ei(e,n,i),u=Zn(e),g={},b=e.attributes.length;for(let v=0;v<b;v++){let C=e.attributes[v];gr(u,C.name,C.value)||(g[C.name]=mr(r,u,Re(C.name),C.value))}if(u==="link"&&o){let v=Array.from(r.styleSheets).find(I=>I.href===e.href),C=null;v&&(C=vt(v)),C&&(delete g.rel,delete g.href,g._cssText=C)}if(u==="style"&&e.sheet){let v=vt(e.sheet);v&&(e.childNodes.length>1&&(v=qn(v,e)),g._cssText=v)}if(["input","textarea","select"].includes(u)){let v=e.value,C=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&v?g.value=tt({element:e,type:rt(e),tagName:u,value:v,maskInputOptions:s,maskInputFn:a}):C&&(g.checked=C)}if(u==="option"&&(e.selected&&!s.select?g.selected=!0:delete g.selected),u==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),u==="canvas"&&c){if(e.__context==="2d")zn(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let v=e.toDataURL(l.type,l.quality),C=r.createElement("canvas");C.width=e.width,C.height=e.height;let I=C.toDataURL(l.type,l.quality);v!==I&&(g.rr_dataURL=v)}}if(u==="img"&&f){Te||(Te=r.createElement("canvas"),Kt=Te.getContext("2d"));let v=e,C=v.currentSrc||v.getAttribute("src")||"<unknown-src>",I=v.crossOrigin,T=()=>{v.removeEventListener("load",T);try{Te.width=v.naturalWidth,Te.height=v.naturalHeight,Kt.drawImage(v,0,0),g.rr_dataURL=Te.toDataURL(l.type,l.quality)}catch(L){if(v.crossOrigin!=="anonymous"){v.crossOrigin="anonymous",v.complete&&v.naturalWidth!==0?T():v.addEventListener("load",T);return}else console.warn(`Cannot inline img src=${C}! Error: ${L}`)}v.crossOrigin==="anonymous"&&(I?g.crossOrigin=I:v.removeAttribute("crossorigin"))};v.complete&&v.naturalWidth!==0?T():v.addEventListener("load",T)}if(["audio","video"].includes(u)){let v=g;v.rr_mediaState=e.paused?"paused":"played",v.rr_mediaCurrentTime=e.currentTime,v.rr_mediaPlaybackRate=e.playbackRate,v.rr_mediaMuted=e.muted,v.rr_mediaLoop=e.loop,v.rr_mediaVolume=e.volume}if(m||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),p){let{width:v,height:C}=e.getBoundingClientRect();g={class:g.class,rr_width:`${v}px`,rr_height:`${C}px`}}u==="iframe"&&!d(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let S;try{customElements.get(u)&&(S=!0)}catch{}return{type:J.Element,tagName:u,attributes:g,childNodes:[],isSVG:Qn(e)||void 0,needBlock:p,rootId:h,isCustom:S}}function W(e){return e==null?"":e.toLowerCase()}function yr(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function ai(e,t){if(t.comment&&e.type===J.Comment)return!0;if(e.type===J.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&dr(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(W(e.attributes.name).match(/^msapplication-tile(image|color)$/)||W(e.attributes.name)==="application-name"||W(e.attributes.rel)==="icon"||W(e.attributes.rel)==="apple-touch-icon"||W(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&W(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(W(e.attributes.property).match(/^(og|twitter|fb):/)||W(e.attributes.name).match(/^(og|twitter):/)||W(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(W(e.attributes.name)==="robots"||W(e.attributes.name)==="googlebot"||W(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(W(e.attributes.name)==="author"||W(e.attributes.name)==="generator"||W(e.attributes.name)==="framework"||W(e.attributes.name)==="publisher"||W(e.attributes.name)==="progid"||W(e.attributes.property).match(/^article:/)||W(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(W(e.attributes.name)==="google-site-verification"||W(e.attributes.name)==="yandex-verification"||W(e.attributes.name)==="csrf-token"||W(e.attributes.name)==="p:domain_verify"||W(e.attributes.name)==="verify-v1"||W(e.attributes.name)==="verification"||W(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function De(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:f=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:m,slimDOMOptions:h,dataURLOptions:p={},inlineImages:u=!1,recordCanvas:g=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:v=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:L=!1,cssCaptured:k=!1}=t,{needsMask:M}=t,{preserveWhiteSpace:U=!0}=t;M||(M=vr(e,s,a,M===void 0));let H=ni(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:M,inlineStylesheet:f,maskInputOptions:c,maskTextFn:d,maskInputFn:m,dataURLOptions:p,inlineImages:u,recordCanvas:g,keepIframeSrcFn:T,newlyAddedElement:L,cssCaptured:k});if(!H)return console.warn(e,"not serialized"),null;let P;n.hasNode(e)?P=n.getId(e):ai(H,h)||!U&&H.type===J.Text&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?P=it:P=pr();let E=Object.assign(H,{id:P});if(n.add(e,E),P===it)return null;b&&b(e);let Z=!l;if(E.type===J.Element){Z=Z&&!E.needBlock,delete E.needBlock;let F=w.shadowRoot(e);F&&Be(F)&&(E.isShadowHost=!0)}if((E.type===J.Document||E.type===J.Element)&&Z){h.headWhitespace&&E.type===J.Element&&E.tagName==="head"&&(U=!1);let F={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:f,maskInputOptions:c,maskTextFn:d,maskInputFn:m,slimDOMOptions:h,dataURLOptions:p,inlineImages:u,recordCanvas:g,preserveWhiteSpace:U,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:v,onStylesheetLoad:C,stylesheetLoadTimeout:I,keepIframeSrcFn:T,cssCaptured:!1};if(!(E.type===J.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===J.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(F.cssCaptured=!0);for(let $ of Array.from(w.childNodes(e))){let q=De($,F);q&&E.childNodes.push(q)}}let N=null;if(cr(e)&&(N=w.shadowRoot(e)))for(let $ of Array.from(w.childNodes(N))){let q=De($,F);q&&(Be(N)&&(q.isShadow=!0),E.childNodes.push(q))}}let j=w.parentNode(e);return j&&Pe(j)&&Be(j)&&(E.isShadow=!0),E.type===J.Element&&E.tagName==="iframe"&&ti(e,()=>{let F=e.contentDocument;if(F&&S){let N=De(F,{doc:F,mirror:n,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:f,maskInputOptions:c,maskTextFn:d,maskInputFn:m,slimDOMOptions:h,dataURLOptions:p,inlineImages:u,recordCanvas:g,preserveWhiteSpace:U,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:v,onStylesheetLoad:C,stylesheetLoadTimeout:I,keepIframeSrcFn:T});N&&S(e,N)}},v),E.type===J.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&dr(E.attributes.href)==="css")&&ri(e,()=>{if(C){let F=De(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:M,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:f,maskInputOptions:c,maskTextFn:d,maskInputFn:m,slimDOMOptions:h,dataURLOptions:p,inlineImages:u,recordCanvas:g,preserveWhiteSpace:U,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:v,onStylesheetLoad:C,stylesheetLoadTimeout:I,keepIframeSrcFn:T});F&&C(e,F)}},I),E}function li(e,t){let{mirror:r=new et,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:f=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:m,slimDOM:h=!1,dataURLOptions:p,preserveWhiteSpace:u,onSerialize:g,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:I=()=>!1}=t,T=c===!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}:c===!1?{password:!0}:c,L=yr(h);return De(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:T,maskTextFn:d,maskInputFn:m,slimDOMOptions:L,dataURLOptions:p,inlineImages:l,recordCanvas:f,preserveWhiteSpace:u,onSerialize:g,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:I,newlyAddedElement:!1})}var yt=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function ee(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Ne=`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.`,er={map:{},getId(){return console.error(Ne),-1},getNode(){return console.error(Ne),null},removeNodeFromMap(){console.error(Ne)},has(){return console.error(Ne),!1},reset(){console.error(Ne)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(er=new Proxy(er,{get(e,t,r){return t==="map"&&console.error(Ne),Reflect.get(e,t,r)}}));function Ge(e,t,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},a))}}function lt(e,t,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>lt(e,t,o||{},!0)}function br(e){var t,r,n,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=w.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=w.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Sr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function wr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Cr(e){return e?e.nodeType===e.ELEMENT_NODE?e:w.parentElement(e):null}function ie(e,t,r,n){if(!e)return!1;let i=Cr(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(ot(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function ui(e,t){return t.getId(e)!==-1}function pt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===it}function Mr(e,t){if(Pe(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=w.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Mr(n,t):!0}function bt(e){return!!e.changedTouches}function ci(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Ir(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function xr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function St(e){return e?e instanceof yt&&"shadowRoot"in e?!!e.shadowRoot:!!w.shadowRoot(e):!1}var wt=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Rr(e){var t;let r=null;return"getRootNode"in e&&((t=w.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&w.host(w.getRootNode(e))&&(r=w.host(w.getRootNode(e))),r}function fi(e){let t=e,r;for(;r=Rr(t);)t=r;return t}function di(e){let t=w.ownerDocument(e);if(!t)return!1;let r=fi(e);return w.contains(t,r)}function Ct(e){let t=w.ownerDocument(e);return t?w.contains(t,e)||di(e):!1}var tr=(e,t)=>`${e}@${t}`,Mt=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let m of this.movedSet){let h=w.parentNode(m);this.removesSubTreeCache.has(h)&&!this.movedSet.has(h)||this.addedSet.add(m)}let n=null,i=null,o=-1,s=null,a=!1,l=new Set,f=this.addedSet.values(),c=f.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(w.previousSibling(n)))s=n,n=w.previousSibling(n);else{for(this.addedSet.has(c.value)||(c=f.next()),n=c.value;;){if(i=w.parentNode(n),this.addedSet.has(i)){n=i;continue}break}if(l.has(i))i=null;else if(i){if(Ct(i)?(a=rr(this.droppedSet,i)||this.removesSubTreeCache.has(i),a&&rr(this.movedSet,n)&&(a=!1)):a=!0,this.addedSet.has(w.lastChild(i)))n=w.lastChild(i),s=null;else for(;;){if(s=w.nextSibling(n),this.addedSet.has(s)){n=s;continue}break}if(o=Pe(i)?this.mirror.getId(Rr(n)):this.mirror.getId(i),o===-1&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let u=w.host(i);o=this.mirror.getId(u)}}}if(this.addedSet.delete(n),!i||o===-1){l.add(n);continue}else if(a){this.droppedSet.add(n);continue}let m=!1;if(n.nodeType===Node.TEXT_NODE){let u=i.tagName;if(u==="TEXTAREA")continue;u==="STYLE"&&r.has(o)&&(m=!0)}let h=s?this.mirror.getId(s):null;for(;h===it;)s=s&&w.nextSibling(s),h=s&&this.mirror.getId(s);if(h===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",s),n=null;continue}let p=De(n,{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:u=>{Ir(u,this.mirror)&&this.iframeManager.addIframe(u),xr(u,this.mirror)&&this.stylesheetManager.trackLinkElement(u),St(n)&&this.shadowDomManager.addShadowRoot(w.shadowRoot(n),this.doc)},onIframeLoad:(u,g)=>{this.iframeManager.attachIframe(u,g),this.shadowDomManager.observeAttachShadow(u)},onStylesheetLoad:(u,g)=>{this.stylesheetManager.attachLinkElement(u,g)},cssCaptured:m});p&&(t.push({parentId:o,nextId:h,node:p}),r.add(p.id))}let d={texts:this.texts.map(m=>{let h=m.node,p=w.parentNode(h);return p&&p.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p),{id:this.mirror.getId(h),value:m.value}}).filter(m=>!r.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{let{attributes:h}=m;if(typeof h.style=="string"){let p=JSON.stringify(m.styleDiff),u=JSON.stringify(m._unchangedStyles);p.length<h.style.length&&(p+u).split("var(").length===h.style.split("var(").length&&(h.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:h}}).filter(m=>!r.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(d))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(w.childNodes(t),i=>w.textContent(i)||"").join("");r.attributes.value=tt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:rt(t),value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!pt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=w.textContent(t.target);!ie(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:vr(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Cr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=Re(r.tagName),i=t.attributeName,o=t.target.getAttribute(i);if(i==="value"){let a=rt(r);o=tt({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(ie(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let s=this.attributeMap.get(t.target);if(n==="iframe"&&i==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)i="rr_src";else return;if(s||(s={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(t.target,s)),i==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!gr(n,i))if(s.attributes[i]=mr(this.doc,n,Re(i),o),i==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let a=this.unattachedDoc.createElement("span");t.oldValue&&a.setAttribute("style",t.oldValue);for(let l of Array.from(r.style)){let f=r.style.getPropertyValue(l),c=r.style.getPropertyPriority(l);f!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?c===""?s.styleDiff[l]=f:s.styleDiff[l]=[f,c]:s._unchangedStyles[l]=[f,c]}for(let l of Array.from(a.style))r.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}else i==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?s.attributes.rr_open_mode="modal":s.attributes.rr_open_mode="non-modal");break}case"childList":{if(ie(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{Ct(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),i=Pe(t.target)?this.mirror.getId(w.host(t.target)):this.mirror.getId(t.target);ie(t.target,this.blockClass,this.blockSelector,!1)||pt(r,this.mirror,this.slimDOMOptions)||!ui(r,this.mirror)||(this.addedSet.has(r)?(It(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Mr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[tr(n,i)]?It(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:Pe(t.target)&&Be(t.target)?!0:void 0}),hi(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(pt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[tr(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ie(t,this.blockClass,this.blockSelector,!1)||(w.childNodes(t).forEach(n=>this.genAdds(n)),St(t)&&w.childNodes(w.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function It(e,t){e.delete(t),w.childNodes(t).forEach(r=>It(e,r))}function hi(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),w.childNodes(n).forEach(i=>r.push(i)))}}function rr(e,t){return e.size===0?!1:kr(e,t)}function kr(e,t){if(e.has(t))return!0;let r=w.parentNode(t);return r?kr(e,r):!1}var We;function pi(e){We=e}function mi(){We=void 0}var _=e=>We?(...r)=>{try{return e(...r)}catch(n){if(We&&We(n)===!0)return;throw n}}:e,_e=new Set;function $e(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Er(e,t){let r=new Mt;_e.add(r),r.init(e);let[n,i]=ur(),o=new n(_(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{o.disconnect(),_e.delete(r),i()}}function gi({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=Ge(_(d=>{let m=Date.now()-a;e(s.map(h=>(h.timeOffset-=m,h)),d),s=[],a=null}),o),f=_(Ge(_(d=>{let m=$e(d),{clientX:h,clientY:p}=bt(d)?d.changedTouches[0]:d;a||(a=He()),s.push({x:h,y:p,id:n.getId(m),timeOffset:He()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?D.Drag:d instanceof MouseEvent?D.MouseMove:D.TouchMove)}),i,{trailing:!1})),c=[ee("mousemove",f,r),ee("touchmove",f,r),ee("drag",f,r)];return _(()=>{c.forEach(d=>d())})}function vi({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,f=c=>d=>{let m=$e(d);if(ie(m,n,i,!0))return;let h=null,p=c;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Se.Mouse;break;case"touch":h=Se.Touch;break;case"pen":h=Se.Pen;break}h===Se.Touch?se[c]===se.MouseDown?p="TouchStart":se[c]===se.MouseUp&&(p="TouchEnd"):Se.Pen}else bt(d)&&(h=Se.Touch);h!==null?(l=h,(p.startsWith("Touch")&&h===Se.Touch||p.startsWith("Mouse")&&h===Se.Mouse)&&(h=null)):se[c]===se.Click&&(h=l,l=null);let u=bt(d)?d.changedTouches[0]:d;if(!u)return;let g=r.getId(m),{clientX:b,clientY:S}=u;_(e)({type:se[p],id:g,x:b,y:S,...h!==null&&{pointerType:h}})};return Object.keys(se).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&s[c]!==!1).forEach(c=>{let d=Re(c),m=f(c);if(window.PointerEvent)switch(se[c]){case se.MouseDown:case se.MouseUp:d=d.replace("mouse","pointer");break;case se.TouchStart:case se.TouchEnd:return}a.push(ee(d,m,t))}),_(()=>{a.forEach(c=>c())})}function Tr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=_(Ge(_(a=>{let l=$e(a);if(!l||ie(l,n,i,!0))return;let f=r.getId(l);if(l===t&&t.defaultView){let c=br(t.defaultView);e({id:f,x:c.left,y:c.top})}else e({id:f,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return ee("scroll",s,t)}function yi({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=_(Ge(_(()=>{let o=Sr(),s=wr();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return ee("resize",i,t)}var bi=["INPUT","TEXTAREA","SELECT"],nr=new WeakMap;function Si({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:f,userTriggeredOnInput:c}){function d(S){let v=$e(S),C=S.isTrusted,I=v&&v.tagName;if(v&&I==="OPTION"&&(v=w.parentElement(v)),!v||!I||bi.indexOf(I)<0||ie(v,n,i,!0)||v.classList.contains(o)||s&&v.matches(s))return;let T=v.value,L=!1,k=rt(v)||"";k==="radio"||k==="checkbox"?L=v.checked:(a[I.toLowerCase()]||a[k])&&(T=tt({element:v,maskInputOptions:a,tagName:I,type:k,value:T,maskInputFn:l})),m(v,c?{text:T,isChecked:L,userTriggered:C}:{text:T,isChecked:L});let M=v.name;k==="radio"&&M&&L&&t.querySelectorAll(`input[type="radio"][name="${M}"]`).forEach(U=>{if(U!==v){let H=U.value;m(U,c?{text:H,isChecked:!L,userTriggered:!1}:{text:H,isChecked:!L})}})}function m(S,v){let C=nr.get(S);if(!C||C.text!==v.text||C.isChecked!==v.isChecked){nr.set(S,v);let I=r.getId(S);_(e)({...v,id:I})}}let p=(f.input==="last"?["change"]:["input","change"]).map(S=>ee(S,_(d),t)),u=t.defaultView;if(!u)return()=>{p.forEach(S=>S())};let g=u.Object.getOwnPropertyDescriptor(u.HTMLInputElement.prototype,"value"),b=[[u.HTMLInputElement.prototype,"value"],[u.HTMLInputElement.prototype,"checked"],[u.HTMLSelectElement.prototype,"value"],[u.HTMLTextAreaElement.prototype,"value"],[u.HTMLSelectElement.prototype,"selectedIndex"],[u.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...b.map(S=>lt(S[0],S[1],{set(){_(d)({target:this,isTrusted:!1})}},!1,u))),_(()=>{p.forEach(S=>S())})}function st(e){let t=[];function r(n,i){if(Ye("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ye("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ye("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ye("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(s),r(n.parentRule,i)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function xe(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function wi({styleSheetRuleCb:e,mirror:t,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:_((c,d,m)=>{let[h,p]=m,{id:u,styleId:g}=xe(d,t,r.styleMirror);return(u&&u!==-1||g&&g!==-1)&&e({id:u,styleId:g,adds:[{rule:h,index:p}]}),c.apply(d,m)})}),n.CSSStyleSheet.prototype.addRule=function(c,d,m=this.cssRules.length){let h=`${c} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[h,m])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_((c,d,m)=>{let[h]=m,{id:p,styleId:u}=xe(d,t,r.styleMirror);return(p&&p!==-1||u&&u!==-1)&&e({id:p,styleId:u,removes:[{index:h}]}),c.apply(d,m)})}),n.CSSStyleSheet.prototype.removeRule=function(c){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:_((c,d,m)=>{let[h]=m,{id:p,styleId:u}=xe(d,t,r.styleMirror);return(p&&p!==-1||u&&u!==-1)&&e({id:p,styleId:u,replace:h}),c.apply(d,m)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:_((c,d,m)=>{let[h]=m,{id:p,styleId:u}=xe(d,t,r.styleMirror);return(p&&p!==-1||u&&u!==-1)&&e({id:p,styleId:u,replaceSync:h}),c.apply(d,m)})}));let l={};Je("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Je("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Je("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Je("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(l).forEach(([c,d])=>{f[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(f[c].insertRule,{apply:_((m,h,p)=>{let[u,g]=p,{id:b,styleId:S}=xe(h.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||S&&S!==-1)&&e({id:b,styleId:S,adds:[{rule:u,index:[...st(h),g||0]}]}),m.apply(h,p)})}),d.prototype.deleteRule=new Proxy(f[c].deleteRule,{apply:_((m,h,p)=>{let[u]=p,{id:g,styleId:b}=xe(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||b&&b!==-1)&&e({id:g,styleId:b,removes:[{index:[...st(h),u]}]}),m.apply(h,p)})})}),_(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=f[c].insertRule,d.prototype.deleteRule=f[c].deleteRule})})}function Or({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(w.host(r));let a=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,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var f;return(f=l.get)==null?void 0:f.call(this)},set(f){var c;let d=(c=l.set)==null?void 0:c.call(this,f);if(s!==null&&s!==-1)try{t.adoptStyleSheets(f,s)}catch{}return d}}),_(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function Ci({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_((a,l,f)=>{var c;let[d,m,h]=f;if(r.has(d))return o.apply(l,[d,m,h]);let{id:p,styleId:u}=xe((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||u&&u!==-1)&&e({id:p,styleId:u,set:{property:d,value:m,priority:h},index:st(l.parentRule)}),a.apply(l,f)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:_((a,l,f)=>{var c;let[d]=f;if(r.has(d))return s.apply(l,[d]);let{id:m,styleId:h}=xe((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,remove:{property:d},index:st(l.parentRule)}),a.apply(l,f)})}),_(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function Mi({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=_(l=>Ge(_(f=>{let c=$e(f);if(!c||ie(c,t,r,!0))return;let{currentTime:d,volume:m,muted:h,playbackRate:p,loop:u}=c;e({type:l,id:n.getId(c),currentTime:d,volume:m,muted:h,playbackRate:p,loop:u})}),i.media||500)),a=[ee("play",s(Oe.Play),o),ee("pause",s(Oe.Pause),o),ee("seeked",s(Oe.Seeked),o),ee("volumechange",s(Oe.VolumeChange),o),ee("ratechange",s(Oe.RateChange),o)];return _(()=>{a.forEach(l=>l())})}function Ii({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(l,f,c){let d=new o(l,f,c);return i.set(d,{family:l,buffer:typeof f!="string",descriptors:c,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),d};let s=ke(t.fonts,"add",function(a){return function(l){return setTimeout(_(()=>{let f=i.get(l);f&&(e(f),i.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=o}),n.push(s),_(()=>{n.forEach(a=>a())})}function xi(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=_(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let f=[],c=l.rangeCount||0;for(let d=0;d<c;d++){let m=l.getRangeAt(d),{startContainer:h,startOffset:p,endContainer:u,endOffset:g}=m;ie(h,n,i,!0)||ie(u,n,i,!0)||f.push({start:r.getId(h),startOffset:p,end:r.getId(u),endOffset:g})}o({ranges:f})});return a(),ee("selectionchange",a)}function Ri({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:ke(r.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function ki(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:f,styleDeclarationCb:c,canvasMutationCb:d,fontCb:m,selectionCb:h,customElementCb:p}=e;e.mutationCb=(...u)=>{t.mutation&&t.mutation(...u),r(...u)},e.mousemoveCb=(...u)=>{t.mousemove&&t.mousemove(...u),n(...u)},e.mouseInteractionCb=(...u)=>{t.mouseInteraction&&t.mouseInteraction(...u),i(...u)},e.scrollCb=(...u)=>{t.scroll&&t.scroll(...u),o(...u)},e.viewportResizeCb=(...u)=>{t.viewportResize&&t.viewportResize(...u),s(...u)},e.inputCb=(...u)=>{t.input&&t.input(...u),a(...u)},e.mediaInteractionCb=(...u)=>{t.mediaInteaction&&t.mediaInteaction(...u),l(...u)},e.styleSheetRuleCb=(...u)=>{t.styleSheetRule&&t.styleSheetRule(...u),f(...u)},e.styleDeclarationCb=(...u)=>{t.styleDeclaration&&t.styleDeclaration(...u),c(...u)},e.canvasMutationCb=(...u)=>{t.canvasMutation&&t.canvasMutation(...u),d(...u)},e.fontCb=(...u)=>{t.font&&t.font(...u),m(...u)},e.selectionCb=(...u)=>{t.selection&&t.selection(...u),h(...u)},e.customElementCb=(...u)=>{t.customElement&&t.customElement(...u),p(...u)}}function Ei(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};ki(e,t);let n;e.recordDOM&&(n=Er(e,e.doc));let i=gi(e),o=vi(e),s=Tr(e),a=yi(e,{win:r}),l=Si(e),f=Mi(e),c=()=>{},d=()=>{},m=()=>{},h=()=>{};e.recordDOM&&(c=wi(e,{win:r}),d=Or(e,e.doc),m=Ci(e,{win:r}),e.collectFonts&&(h=Ii(e)));let p=xi(e),u=Ri(e),g=[];for(let b of e.plugins)g.push(b.observer(b.callback,r,b.options));return _(()=>{n?.(),i(),o(),s(),a(),l(),f(),c(),d(),m(),h(),p(),u(),g.forEach(b=>b())})}function Ye(e){return typeof window[e]<"u"}function Je(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var at=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,i){let o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},xt=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new at(pr)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"unloadListener"),y(this,"attachedWindows",new Map),y(this,"messageHandler",r=>this.handleMessage(r)),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],i=()=>{this.attachedWindows.delete(r),n.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(r,i),this.recordCrossOriginIframes&&n.push(ee("message",this.messageHandler,r)),n.push(ee("pagehide",o=>{var s;if(o.persisted)return;let a=r.document;i(),(s=this.unloadListener)==null||s.call(this,a)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case A.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:A.IncrementalSnapshot,data:{source:D.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case A.Meta:case A.Load:case A.DomContentLoaded:return!1;case A.Annotation:case A.Plugin:return r;case A.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case A.IncrementalSnapshot:switch(r.data.source){case D.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case D.Drag:case D.TouchMove:case D.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case D.ViewportResize:return!1;case D.MediaInteraction:case D.MouseInteraction:case D.Scroll:case D.CanvasMutation:case D.Input:return this.replaceIds(r.data,t,["id"]),r;case D.StyleSheetRule:case D.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case D.Font:return r;case D.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case D.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==J.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Rt=class{constructor(t){y(this,"shadowDoms",new Map),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Be(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let i=Er({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(i),n.push(Tr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(w.host(t))),n.push(Or({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=w.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),w.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(mt)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(ke(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=w.shadowRoot(this);return a&&Ct(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(mt),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(mt))}};function mt(e){try{e()}catch{}}var Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ti=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ze=0;ze<Le.length;ze++)Ti[Le.charCodeAt(ze)]=ze;var ze,Oi=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Le[t[r]>>2],i+=Le[(t[r]&3)<<4|t[r+1]>>4],i+=Le[(t[r+1]&15)<<2|t[r+2]>>6],i+=Le[t[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},ir=new Map;function Ni(e,t){let r=ir.get(e);return r||(r=new Map,ir.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Nr=(e,t,r)=>{if(!e||!(Dr(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=Ni(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Ke(e,t,r){if(e instanceof Array)return e.map(n=>Ke(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=Oi(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Ke(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Ke(e.data,t,r),e.width,e.height]};if(Dr(e,t)||typeof e=="object"){let n=e.constructor.name,i=Nr(e,t,r);return{rr_type:n,index:i}}}}return e}var Ar=(e,t,r)=>e.map(n=>Ke(n,t,r)),Dr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Ai(e,t,r,n){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=ke(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...f){return ie(this.canvas,r,n,!0)||setTimeout(()=>{let c=Ar(f,t,this);e(this.canvas,{type:Fe["2D"],property:s,args:c})},0),l.apply(this,f)}});i.push(a)}catch{let a=lt(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Fe["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function Di(e){return e==="experimental-webgl"?"webgl":e}function or(e,t,r,n){let i=[];try{let o=ke(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!ie(this,t,r,!0)){let f=Di(a);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(l[0]&&typeof l[0]=="object"){let c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function sr(e,t,r,n,i,o){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let f=ke(e,l,function(c){return function(...d){let m=c.apply(this,d);if(Nr(m,o,this),"tagName"in this.canvas&&!ie(this.canvas,n,i,!0)){let h=Ar(d,o,this),p={type:t,property:l,args:h};r(this.canvas,p)}return m}});s.push(f)}catch{let f=lt(e,l,{set(c){r(this.canvas,{type:t,property:l,args:[c],setter:!0})}});s.push(f)}return s}function Li(e,t,r,n){let i=[];return typeof t.WebGLRenderingContext<"u"&&i.push(...sr(t.WebGLRenderingContext.prototype,Fe.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...sr(t.WebGL2RenderingContext.prototype,Fe.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var Lr=`(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
- `,ar=typeof self<"u"&&self.Blob&&new Blob([Lr],{type:"text/javascript;charset=utf-8"});function _i(e){let t;try{if(t=ar&&(self.URL||self.webkitURL).createObjectURL(ar),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Lr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var kt=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(l,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(f)});let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,i,o){let s=or(r,n,i,!0),a=new Map,l=new _i;l.onmessage=p=>{let{id:u}=p.data;if(a.set(u,!1),!("base64"in p.data))return;let{base64:g,type:b,width:S,height:v}=p.data;this.mutationCb({id:u,type:Fe["2D"],commands:[{property:"clearRect",args:[0,0,S,v]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:b}]},0,0]}]})};let f=1e3/t,c=0,d,m=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(u=>{ie(u,n,i,!0)||p.push(u)}),p},h=p=>{if(c&&p-c<f){d=requestAnimationFrame(h);return}c=p,m().forEach(async u=>{var g;let b=this.mirror.getId(u);if(a.get(b)||u.width===0||u.height===0)return;if(a.set(b,!0),["webgl","webgl2"].includes(u.__context)){let v=u.getContext(u.__context);((g=v?.getContextAttributes())==null?void 0:g.preserveDrawingBuffer)===!1&&v.clear(v.COLOR_BUFFER_BIT)}let S=await createImageBitmap(u);l.postMessage({id:b,bitmap:S,width:u.width,height:u.height,dataURLOptions:o.dataURLOptions},[S])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=or(t,r,n,!1),o=Ai(this.processMutation.bind(this),t,r,n),s=Li(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(s=>{let{type:a,...l}=s;return l}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Et=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new wt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:fr(a,o.href),index:l}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Tt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},V,Qe,Ie,je=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Vt=e.contentWindow)==null?void 0:Vt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var pe=Fn();function ce(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:f=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:m,slimDOMOptions:h,maskInputFn:p,maskTextFn:u,hooks:g,packFn:b,sampling:S={},dataURLOptions:v={},mousemoveWait:C,recordDOM:I=!0,recordCanvas:T=!1,recordCrossOriginIframes:L=!1,recordAfter:k=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:M=!1,collectFonts:U=!1,inlineImages:H=!1,plugins:P,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:Z=new Set([]),errorHandler:j}=e;pi(j);let F=L?window.parent===window:!0,N=!1;if(!F)try{window.parent.document&&(N=!1)}catch{N=!0}if(F&&!t)throw new Error("emit function is required");if(!F&&!N)return()=>{};C!==void 0&&S.mousemove===void 0&&(S.mousemove=C),pe.reset();let $=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m!==void 0?m:{password:!0},q=yr(h);ci();let ye,Y=0,me=O=>{for(let K of P||[])K.eventProcessor&&(O=K.eventProcessor(O));return b&&!N&&(O=b(O)),O};V=(O,K)=>{let R=O;if(R.timestamp=He(),R.type!==A.FullSnapshot&&!(R.type===A.IncrementalSnapshot&&R.data.source===D.Mutation)){Ie.unfreeze();for(let X of _e)if(X.isFrozen())X.unfreeze();else break}if(F)t?.(me(R),K);else if(N){let X={type:"rrweb",event:me(R),origin:window.location.origin,isCheckout:K};window.parent.postMessage(X,"*")}if(R.type===A.FullSnapshot)ye=R,Y=0;else if(R.type===A.IncrementalSnapshot){if(R.data.source===D.Mutation&&R.data.isAttachIframe)return;Y++;let X=n&&Y>=n,oe=r&&R.timestamp-ye.timestamp>r;(X||oe)&&Qe(!0)}};let le=O=>{V({type:A.IncrementalSnapshot,data:{source:D.Mutation,...O}})},ne=O=>V({type:A.IncrementalSnapshot,data:{source:D.Scroll,...O}}),G=O=>V({type:A.IncrementalSnapshot,data:{source:D.CanvasMutation,...O}}),ve=O=>V({type:A.IncrementalSnapshot,data:{source:D.AdoptedStyleSheet,...O}}),te=new Et({mutationCb:le,adoptedStyleSheetCb:ve}),re=new xt({mirror:pe,mutationCb:le,stylesheetManager:te,recordCrossOriginIframes:L,wrappedEmit:V});for(let O of P||[])O.getMirror&&O.getMirror({nodeMirror:pe,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});let be=new Tt;Ie=new kt({recordCanvas:T,mutationCb:G,win:window,blockClass:i,blockSelector:o,mirror:pe,sampling:S.canvas,dataURLOptions:v});let de=new Rt({mutationCb:le,scrollCb:ne,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:f,inlineStylesheet:c,maskInputOptions:$,dataURLOptions:v,maskTextFn:u,maskInputFn:p,recordCanvas:T,inlineImages:H,sampling:S,slimDOMOptions:q,iframeManager:re,stylesheetManager:te,canvasManager:Ie,keepIframeSrcFn:E,processedNodeManager:be},mirror:pe});Qe=(O=!1)=>{if(!I)return;V({type:A.Meta,data:{href:window.location.href,width:wr(),height:Sr()}},O),te.reset(),de.init(),Ie.lock(),_e.forEach(R=>R.lock());let K=li(document,{mirror:pe,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:f,inlineStylesheet:c,maskAllInputs:$,maskTextFn:u,maskInputFn:p,slimDOM:q,dataURLOptions:v,recordCanvas:T,inlineImages:H,onSerialize:R=>{Ir(R,pe)&&re.addIframe(R),xr(R,pe)&&te.trackLinkElement(R),St(R)&&de.addShadowRoot(w.shadowRoot(R),document)},onIframeLoad:(R,X)=>{re.attachIframe(R,X),de.observeAttachShadow(R)},onStylesheetLoad:(R,X)=>{te.attachLinkElement(R,X)},keepIframeSrcFn:E});if(!K)return console.warn("Failed to snapshot the document");V({type:A.FullSnapshot,data:{node:K,initialOffset:br(window)}},O),Ie.unlock(),_e.forEach(R=>R.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&te.adoptStyleSheets(document.adoptedStyleSheets,pe.getId(document))};try{let O=[],K=oe=>{var Q;return _(Ei)({mutationCb:le,mousemoveCb:(B,x)=>V({type:A.IncrementalSnapshot,data:{source:x,positions:B}}),mouseInteractionCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.MouseInteraction,...B}}),scrollCb:ne,viewportResizeCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.ViewportResize,...B}}),inputCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.Input,...B}}),mediaInteractionCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.MediaInteraction,...B}}),styleSheetRuleCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.StyleSheetRule,...B}}),styleDeclarationCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.StyleDeclaration,...B}}),canvasMutationCb:G,fontCb:B=>V({type:A.IncrementalSnapshot,data:{source:D.Font,...B}}),selectionCb:B=>{V({type:A.IncrementalSnapshot,data:{source:D.Selection,...B}})},customElementCb:B=>{V({type:A.IncrementalSnapshot,data:{source:D.CustomElement,...B}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:f,maskInputOptions:$,inlineStylesheet:c,sampling:S,recordDOM:I,recordCanvas:T,inlineImages:H,userTriggeredOnInput:M,collectFonts:U,doc:oe,maskInputFn:p,maskTextFn:u,keepIframeSrcFn:E,blockSelector:o,slimDOMOptions:q,dataURLOptions:v,mirror:pe,iframeManager:re,stylesheetManager:te,shadowDomManager:de,processedNodeManager:be,canvasManager:Ie,ignoreCSSAttributes:Z,plugins:((Q=P?.filter(B=>B.observer))==null?void 0:Q.map(B=>({observer:B.observer,options:B.options,callback:x=>V({type:A.Plugin,data:{plugin:B.name,payload:x}})})))||[]},g)},R=new Map;re.addLoadListener(oe=>{try{let Q=oe.contentDocument;if(R.has(Q))return;R.set(Q,K(Q))}catch(Q){console.warn(Q)}}),re.addUnloadListener(oe=>{let Q=R.get(oe);Q&&(R.delete(oe),Q(),de.removeShadowRootsIn(oe),pe.removeNodeFromMap(oe))});let X=()=>{Qe(),O.push(K(document)),je=!0};return["interactive","complete"].includes(document.readyState)?X():(O.push(ee("DOMContentLoaded",()=>{V({type:A.DomContentLoaded,data:{}}),k==="DOMContentLoaded"&&X()})),O.push(ee("load",()=>{V({type:A.Load,data:{}}),k==="load"&&X()},window))),()=>{[...O,...R.values()].forEach(oe=>{try{oe()}catch(Q){String(Q).toLowerCase().includes("cross-origin")||console.warn(Q)}}),R.clear(),re.destroy(),be.destroy(),de.reset(),Ie.reset(),je=!1,mi()}}catch(O){console.warn(O)}}ce.addCustomEvent=(e,t)=>{if(!je)throw new Error("please add custom event after start recording");V({type:A.Custom,data:{tag:e,payload:t}})};ce.addAnnotation=e=>{if(!je)throw new Error("please add annotation after recording started");V({type:A.Annotation,data:e})};ce.freezePage=()=>{Ie.freeze(),_e.forEach(e=>e.freeze())};ce.takeFullSnapshot=e=>{if(!je)throw new Error("please take full snapshot after start recording");Qe(e)};ce.mirror=pe;var ae=Uint8Array,fe=Uint16Array,zt=Int32Array,Ut=new ae([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]),Pt=new ae([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]),_r=new ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Br=function(e,t){for(var r=new fe(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new zt(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}},Wr=Br(Ut,2),Fi=Wr.b,Dt=Wr.r;Fi[28]=258,Dt[258]=28;var Hr=Br(Pt,0),lo=Hr.b,Fr=Hr.r,Lt=new fe(32768);for(z=0;z<32768;++z)we=(z&43690)>>1|(z&21845)<<1,we=(we&52428)>>2|(we&13107)<<2,we=(we&61680)>>4|(we&3855)<<4,Lt[z]=((we&65280)>>8|(we&255)<<8)>>1;var we,z,Xe=(function(e,t,r){for(var n=e.length,i=0,o=new fe(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new fe(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new fe(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var f=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,m=d|(1<<c)-1;d<=m;++d)a[Lt[d]>>l]=f}else for(a=new fe(n),i=0;i<n;++i)e[i]&&(a[i]=Lt[s[e[i]-1]++]>>15-e[i]);return a}),Ee=new ae(288);for(z=0;z<144;++z)Ee[z]=8;var z;for(z=144;z<256;++z)Ee[z]=9;var z;for(z=256;z<280;++z)Ee[z]=7;var z;for(z=280;z<288;++z)Ee[z]=8;var z,ut=new ae(32);for(z=0;z<32;++z)ut[z]=5;var z,zi=Xe(Ee,9,0);var Ui=Xe(ut,5,0);var Gr=function(e){return(e+7)/8|0},jr=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new ae(e.subarray(t,r))};var Ce=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},qe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},At=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return{t:qr,l:0};if(i==1){var s=new ae(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(I,T){return I.f-T.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],f=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=i-1;)a=r[r[f].f<r[d].f?f++:d++],l=r[f!=c&&r[f].f<r[d].f?f++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var m=o[0].s,n=1;n<i;++n)o[n].s>m&&(m=o[n].s);var h=new fe(m+1),p=_t(r[c-1],h,0);if(p>t){var n=0,u=0,g=p-t,b=1<<g;for(o.sort(function(T,L){return h[L.s]-h[T.s]||T.f-L.f});n<i;++n){var S=o[n].s;if(h[S]>t)u+=b-(1<<p-h[S]),h[S]=t;else break}for(u>>=g;u>0;){var v=o[n].s;h[v]<t?u-=1<<t-h[v]++-1:++n}for(;n>=0&&u;--n){var C=o[n].s;h[C]==t&&(--h[C],++u)}p=t}return{t:new ae(h),l:p}},_t=function(e,t,r){return e.s==-1?Math.max(_t(e.l,t,r+1),_t(e.r,t,r+1)):t[e.s]=r},zr=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new fe(++t),n=0,i=e[0],o=1,s=function(l){r[n++]=l},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return{c:r.subarray(0,n),n:t}},Ve=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},$r=function(e,t,r){var n=r.length,i=Gr(t+2);e[i]=n&255,e[i+1]=n>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var o=0;o<n;++o)e[i+o+4]=r[o];return(i+4+n)*8},Ur=function(e,t,r,n,i,o,s,a,l,f,c){Ce(t,c++,r),++i[256];for(var d=At(i,15),m=d.t,h=d.l,p=At(o,15),u=p.t,g=p.l,b=zr(m),S=b.c,v=b.n,C=zr(u),I=C.c,T=C.n,L=new fe(19),k=0;k<S.length;++k)++L[S[k]&31];for(var k=0;k<I.length;++k)++L[I[k]&31];for(var M=At(L,7),U=M.t,H=M.l,P=19;P>4&&!U[_r[P-1]];--P);var E=f+5<<3,Z=Ve(i,Ee)+Ve(o,ut)+s,j=Ve(i,m)+Ve(o,u)+s+14+3*P+Ve(L,U)+2*L[16]+3*L[17]+7*L[18];if(l>=0&&E<=Z&&E<=j)return $r(t,c,e.subarray(l,l+f));var F,N,$,q;if(Ce(t,c,1+(j<Z)),c+=2,j<Z){F=Xe(m,h,0),N=m,$=Xe(u,g,0),q=u;var ye=Xe(U,H,0);Ce(t,c,v-257),Ce(t,c+5,T-1),Ce(t,c+10,P-4),c+=14;for(var k=0;k<P;++k)Ce(t,c+3*k,U[_r[k]]);c+=3*P;for(var Y=[S,I],me=0;me<2;++me)for(var le=Y[me],k=0;k<le.length;++k){var ne=le[k]&31;Ce(t,c,ye[ne]),c+=U[ne],ne>15&&(Ce(t,c,le[k]>>5&127),c+=le[k]>>12)}}else F=zi,N=Ee,$=Ui,q=ut;for(var k=0;k<a;++k){var G=n[k];if(G>255){var ne=G>>18&31;qe(t,c,F[ne+257]),c+=N[ne+257],ne>7&&(Ce(t,c,G>>23&31),c+=Ut[ne]);var ve=G&31;qe(t,c,$[ve]),c+=q[ve],ve>3&&(qe(t,c,G>>5&8191),c+=Pt[ve])}else qe(t,c,F[G]),c+=N[G]}return qe(t,c,F[256]),c+N[256]},Pi=new zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new ae(0),Bi=function(e,t,r,n,i,o){var s=o.z||e.length,a=new ae(n+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(n,a.length-i),f=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var d=Pi[t-1],m=d>>13,h=d&8191,p=(1<<r)-1,u=o.p||new fe(32768),g=o.h||new fe(p+1),b=Math.ceil(r/3),S=2*b,v=function(X){return(e[X]^e[X+1]<<b^e[X+2]<<S)&p},C=new zt(25e3),I=new fe(288),T=new fe(32),L=0,k=0,M=o.i||0,U=0,H=o.w||0,P=0;M+2<s;++M){var E=v(M),Z=M&32767,j=g[E];if(u[Z]=j,g[E]=Z,H<=M){var F=s-M;if((L>7e3||U>24576)&&(F>423||!f)){c=Ur(e,l,0,C,I,T,k,U,P,M-P,c),U=L=k=0,P=M;for(var N=0;N<286;++N)I[N]=0;for(var N=0;N<30;++N)T[N]=0}var $=2,q=0,ye=h,Y=Z-j&32767;if(F>2&&E==v(M-Y))for(var me=Math.min(m,F)-1,le=Math.min(32767,M),ne=Math.min(258,F);Y<=le&&--ye&&Z!=j;){if(e[M+$]==e[M+$-Y]){for(var G=0;G<ne&&e[M+G]==e[M+G-Y];++G);if(G>$){if($=G,q=Y,G>me)break;for(var ve=Math.min(Y,G-2),te=0,N=0;N<ve;++N){var re=M-Y+N&32767,be=u[re],de=re-be&32767;de>te&&(te=de,j=re)}}}Z=j,j=u[Z],Y+=Z-j&32767}if(q){C[U++]=268435456|Dt[$]<<18|Fr[q];var O=Dt[$]&31,K=Fr[q]&31;k+=Ut[O]+Pt[K],++I[257+O],++T[K],H=M+$,++L}else C[U++]=e[M],++I[e[M]]}}for(M=Math.max(M,H);M<s;++M)C[U++]=e[M],++I[e[M]];c=Ur(e,l,f,C,I,T,k,U,P,M-P,c),f||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=g,o.p=u,o.i=M,o.w=H)}else{for(var M=o.w||0;M<s+f;M+=65535){var R=M+65535;R>=s&&(l[c/8|0]=f,R=s),c=$r(l,c+1,e.subarray(M,R))}o.i=s}return jr(a,0,n+Gr(c)+i)},Wi=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r}return e})(),Hi=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Wi[r&255^t[n]]^r>>>8;e=r},d:function(){return~e}}};var Gi=function(e,t,r,n,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ae(o.length+e.length);s.set(o),s.set(e,o.length),e=s,i.w=o.length}return Bi(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,i)};var Ft=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},ji=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Ft(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}};var $i=function(e){return 10+(e.filename?e.filename.length+1:0)};function Vr(e,t){t||(t={});var r=Hi(),n=e.length;r.p(e);var i=Gi(e,t,$i(t),8),o=i.length;return ji(i,t),Ft(i,o-8,r.d()),Ft(i,o-4,n),i}var Pr=typeof TextEncoder<"u"&&new TextEncoder,qi=typeof TextDecoder<"u"&&new TextDecoder,Vi=0;try{qi.decode(qr,{stream:!0}),Vi=1}catch{}function Xr(e,t){if(t){for(var r=new ae(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Pr)return Pr.encode(e);for(var i=e.length,o=new ae(e.length+(e.length>>1)),s=0,a=function(c){o[s++]=c},n=0;n<i;++n){if(s+5>o.length){var l=new ae(s+8+(i-n<<1));l.set(o),o=l}var f=e.charCodeAt(n);f<128||t?a(f):f<2048?(a(192|f>>6),a(128|f&63)):f>55295&&f<57344?(f=65536+(f&1047552)|e.charCodeAt(++n)&1023,a(240|f>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|f&63)):(a(224|f>>12),a(128|f>>6&63),a(128|f&63))}return jr(o,0,s)}async function Zr(e){if(typeof CompressionStream<"u"&&typeof Response<"u")try{let t=new Response(e).body?.pipeThrough(new CompressionStream("gzip"));if(t)return new Uint8Array(await new Response(t).arrayBuffer())}catch{}return Bt(e)}function Bt(e){return Vr(Xr(e))}var Xi=8e6,Zi=6e4;function Yr(e){let t=[],r=0,n=0,i,o=!!e.hold,s=!1,a,l,f=[],c=()=>f.reduce((g,b)=>g+b.json.length,0),d=()=>{if(!t.length)return;let{sessionId:g,windowId:b}=e.ids();i&&i!==g&&(n=0,e.onSessionChange?.()),i=g;let S=`{"api_key":${JSON.stringify(e.apiKey)},"session_id":${JSON.stringify(g)},"window_id":${JSON.stringify(b)},"seq":${n},"events":[${t.join(",")}]}`;f.push({json:S,session:g,seq:n++,tries:0}),t=[],r=0},m=async g=>{try{let b=await Zr(g.json);return(await e.fetch(`${e.url}?compression=gzip`,{method:"POST",body:b,headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:b.length<Zi})).status}catch{return 0}},h=()=>o||s?Promise.resolve():(l??=(async()=>{for(;f.length&&!o&&!s;){let g=f[0],b=await m(g);b>=200&&b<300?(f.shift(),e.onSent?.(g.session,g.json.length)):!qt(b)||++g.tries>(e.maxRetries??5)?(e.log?.("replay chunk dropped",g.seq,b),f.shift()):await new Promise(S=>setTimeout(S,$t(g.tries-1,e.backoff)))}})().finally(()=>{l=void 0}),l),p=()=>{a??=setTimeout(()=>{a=void 0,u()},e.flushMs)},u=()=>(a!==void 0&&clearTimeout(a),a=void 0,d(),o&&c()>Xi&&(o=!1),h());return{add(g){if(s)return;let b=JSON.stringify(g);if(b.length>Wt-4096)return e.log?.("replay event too large",b.length);r&&r+b.length>e.chunkBytes&&u(),t.push(b),r+=b.length+1,r>=e.chunkBytes?u():p()},flush:u,beacon(){if(!(o||s)){d();for(let g of f.splice(0)){let b=Bt(g.json);navigator.sendBeacon?.(`${e.url}?compression=gzip`,new Blob([b],{type:"text/plain"}))}}},release(){o=!1,u()},discard(){s=!0,t=[],f.length=0,a!==void 0&&clearTimeout(a)},get unsent(){return r+c()},get seq(){return n},get held(){return o}}}var Jr=(e,t)=>{let r=e(t);return r&&r.nodeType===1?r:null};function ct(e,t,r){let n=i=>{i&&(i.type===2&&i.attributes&&r(i.attributes,(i.tagName??"").toLowerCase(),Jr(t,i.id)),i.childNodes?.forEach(n))};if(e.type===2&&n(e.data?.node),!(e.type!==3||e.data?.source!==0)){e.data.adds?.forEach(i=>n(i.node));for(let i of e.data.attributes??[]){let o=Jr(t,i.id);r(i.attributes,o?.tagName.toLowerCase()??"",o)}}}var Yi=["title","alt","placeholder","aria-label","aria-description","aria-placeholder","aria-roledescription","aria-valuetext"],Ji=new Set(["input","textarea","select"]),Kr=e=>e.replace(/\S/g,"*");function Qr(e,t){let r=i=>{try{return!!i?.closest(t)&&!i.closest(e)}catch{return!1}},n=(i,o,s)=>{if(!r(s))for(let a of Object.keys(i)){let l=i[a];(Yi.includes(a)||a==="value"&&!Ji.has(o))&&typeof l=="string"&&(i[a]=Kr(l))}};return{maskTextFn:(i,o)=>r(o)?i:Kr(i),scrub:(i,o)=>ct(i,o,n)}}var en=()=>window.parent!==window;function Ki(){let e=location.ancestorOrigins;if(e?.length)return e[0];try{return document.referrer?new URL(document.referrer).origin:void 0}catch{return}}var tn=e=>{let t=Ki();return!!t&&e.includes(t)};function rn(e){let t=r=>{let n=r.data;n&&typeof n=="object"&&n.type==="rrweb"&&!e.includes(r.origin)&&r.stopImmediatePropagation()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}function nn(e,t=1e3){let r=0,n,i=()=>{n=void 0;let s=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0);s>0&&s!==r&&(r=s,e(s))},o=()=>{n??=setTimeout(i,t)};return window.addEventListener("load",o),window.addEventListener("resize",o),{schedule:o,reset(){r=0,n!==void 0&&clearTimeout(n),i()},stop(){window.removeEventListener("load",o),window.removeEventListener("resize",o),n!==void 0&&clearTimeout(n)}}}function on(){let e=[[]];return{push(t,r){r&&(e=[e[e.length-1],[]]),e[e.length-1].push(t)},drain(){let t=e.flat();return e=[[]],t},get size(){return e.reduce((t,r)=>t+r.length,0)}}}function sn(e,t,r){if(!e)return null;let n=null;try{let i=e.proxy&&new URL(e.proxy.url,location.href);i&&/^https?:$/.test(i.protocol)&&r.includes(i.origin)&&e.proxy?.origins.length&&(n={url:i.toString(),origins:[...e.proxy.origins]})}catch{}return{inlineImages:!!e.inlineImages&&!t,maxInlineBytes:e.maxInlineBytes??256*1024,collectFonts:!!e.collectFonts,proxy:n}}var Qi=new Set(["img","source","video","audio","track","image","input"]),eo=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g;function an(e){let t=o=>{if(!e.proxy||o.startsWith("data:"))return o;try{let s=new URL(o,location.href);return e.proxy.origins.includes(s.origin)?`${e.proxy.url}${e.proxy.url.includes("?")?"&":"?"}url=${encodeURIComponent(s.toString())}`:o}catch{return o}},r=o=>o.replace(eo,(s,a,l)=>{let f=t(l.trim());return f===l.trim()?s:`url(${a}${f}${a})`}),n=o=>o.split(",").map(s=>{let[a,...l]=s.trim().split(/\s+/);return a?[t(a),...l].join(" "):s}).join(", "),i=(o,s)=>{if(s==="img"&&typeof o.rr_dataURL=="string"&&o.rr_dataURL.length>e.maxInlineBytes&&delete o.rr_dataURL,!!e.proxy)for(let[a,l]of Object.entries(o))typeof l=="string"&&(a==="_cssText"||a==="style"?o[a]=r(l):a==="srcset"?o[a]=n(l):(a==="poster"||a==="src"&&Qi.has(s)||a==="href"&&s==="link"||a==="xlink:href"&&s==="image")&&(o[a]=t(l)))};return{scrub(o,s){if(ct(o,s,i),e.proxy&&o.type===3&&o.data?.source===8)for(let a of o.data.adds??[])typeof a.rule=="string"&&(a.rule=r(a.rule))}}}function to(e,t,r){let n={x:0,y:0,width:e.width,height:e.height},i=[];try{i=r?.(e)??[]}catch{i=[n]}let o=t.flatMap(s=>{try{return e.matches(s.selector)?s.regions??[n]:[]}catch{return[n]}});return[...i,...o]}function ln(e){let t=new Map,r=document.createElement("canvas"),n=()=>{for(let o of Array.from(document.querySelectorAll("canvas"))){let s=e.idOf(o);if(!(s<=0||!o.width||!o.height||o.closest(e.skip)))try{r.width=o.width,r.height=o.height;let a=r.getContext("2d");if(!a)return;a.drawImage(o,0,0),a.fillStyle="#000";for(let d of to(o,e.rules,e.regionsFn))a.fillRect(d.x,d.y,d.width,d.height);let l=r.toDataURL("image/jpeg",e.quality),f=l.slice(l.indexOf(",")+1);if(!f||t.get(s)===f)continue;t.set(s,f);let c={rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:"image/jpeg"};e.emit({type:3,timestamp:Date.now(),data:{source:9,id:s,type:0,commands:[{property:"clearRect",args:[0,0,o.width,o.height]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[c]},0,0]}]}})}catch{}}},i=setInterval(n,Math.round(1e3/e.fps));return{reset:()=>t.clear(),tick:n,stop:()=>clearInterval(i)}}function un(e,t=Date.now){let r=e.eventsPerSecond??10,n=e.burst??100,i=n,o=t();return()=>{let s=t();return i=Math.min(n,i+(s-o)/1e3*r),o=s,i<1?!1:(i-=1,!0)}}var ro=1e4;function cn(e,t=Date.now){let r=new Map,n=0;return{allow(i){let o=i.data;return i.type!==3||o?.source!==0||!o.attributes?.length?!0:(r.size>ro&&r.clear(),o.attributes=o.attributes.filter(s=>{let a=r.get(s.id);return a||r.set(s.id,a=un({burst:e.burst??100,eventsPerSecond:e.perSecond??10},t)),a()?!0:(n++,!1)}),!!(o.attributes.length||o.adds?.length||o.removes?.length||o.texts?.length))},get dropped(){return n}}}function fn(e,t,r){let n=[],i;switch(t.mode){case"on_event":e.onCapture(o=>t.events.includes(o.event)&&r());break;case"on_flag":{let o=e.flags?.onChange(s=>s[t.flag]&&r());o&&n.push(o);break}case"on_url":try{i=new RegExp(t.pattern)}catch{e.log("bad on_url pattern",t.pattern)}break;case"on_frustration":{let o=[],s=a=>{let l=Date.now();for(o.push({t:l,x:a.clientX,y:a.clientY});o.length&&l-o[0].t>1e3;)o.shift();o.filter(c=>Math.hypot(c.x-a.clientX,c.y-a.clientY)<=30).length>=3&&r()};document.addEventListener("click",s,!0),n.push(()=>document.removeEventListener("click",s,!0));break}default:}return{checkUrl:o=>i?.test(o)&&r(),stop:()=>n.forEach(o=>o())}}var no={on_event:"event_trigger_matched",on_url:"url_trigger_matched",on_flag:"linked_flag_matched",on_frustration:"frustration_detected"};function io(e){let t=parseInt(e.replace(/-/g,"").slice(0,12),16);return Number.isFinite(t)&&t>0?t:Date.now()}var oo=5*6e4,so={$pageview:e=>({url:e.$current_url}),$pageleave:()=>({}),$form_start:e=>({form:e.form}),$form_submit:e=>({form:e.form}),$replay_tag:e=>({name:e.name})};function Go(e,t,r,n){let{core:i}=e,o=e.config.apiHost,s=t.trigger_groups,a=t.trigger.mode,l=a==="on_url"&&n?.url_trigger||a==="on_event"&&n?.event_trigger||a==="on_flag"&&n?.linked_flag,c=!(s.length>0||a!=="always"&&!l),d=t.min_duration_ms,m=!!(n?.url_trigger||n?.event_trigger||n?.linked_flag);r.startReason=c?m?"trigger_overridden":n?.sampling?"sampling_overridden":"recording_initialized":void 0;let h=!1,p=!1,u=!1,g,b=!1,S=on(),v=t.min_duration_mode==="session"?io(i.sessionId):Date.now();r.bufferLength=()=>S.size;let C=()=>{r.status=b?"disabled":h?"paused":c?"active":"buffering"},I=Yr({url:`${o}/v1/replay`,apiKey:e.apiKey,fetch:e.fetch,ids:()=>({sessionId:i.sessionId,windowId:i.session.touch().windowId}),chunkBytes:t.chunk_bytes,flushMs:t.flush_interval_ms,hold:d>0||s.some(x=>(x.min_duration_ms??0)>0),onSent:(x,he)=>{r.flushedBytes+=he,r.ack(x)},onSessionChange:()=>{try{ce.takeFullSnapshot(!0)}catch{}},log:e.log}),T=nn(x=>{try{ce.addCustomEvent("page_height",{height:x})}catch{}}),L=jt(t.url_privacy_rules),k=ft(L,location.href),M="",U="",H,P=()=>{M=["[data-lc-mask]",...t.mask_selectors,...k.mask].join(","),U=["[data-lc-block]",...t.block_selectors,...k.block].join(","),H=t.mask_all_text||k.maskAllText?Qr(M,["[data-lc-unmask]",...t.unmask_selectors].join(",")):void 0};P(),r.bufferBytes=()=>I.unsent;let E=t.mutationThrottle?cn(t.mutationThrottle):void 0;r.throttled=()=>E?.dropped??0;let Z=x=>{try{return x?[new URL(x).origin]:[]}catch{return[]}},j=sn(t.assets,t.mask_all_text||L.some(x=>x.mask_all_text),[location.origin,...Z(o),...Z(e.config.uiHost)]),F=j&&(j.proxy||j.inlineImages)?an(j):void 0,N=!!t.canvas&&(t.canvasMask.length>0||!!t.canvasMaskRegions),$,q=t.maskUrlFn,ye=(x,he)=>{if(h||b||E&&!E.allow(x))return;x.type===2&&$?.reset();let ge=Me=>ce.mirror.getNode(Me);if(H?.scrub(x,ge),F?.scrub(x,ge),q&&x.type===4&&typeof x.data?.href=="string"){let Me=x.data;Me.href=q(Me.href)}x.type===3&&x.data?.source===0&&T.schedule(),c?I.add(x):S.push(x,!!he)},Y=t.crossOriginIframes,me=!!Y&&en(),le=me&&!tn(Y),ne=Y&&!me?rn(Y):void 0,G=()=>{if(!(g||b||le)){try{g=ve()}catch(x){r.status="rrweb_error",r.rrwebError=String(x).slice(0,200);return}N&&t.canvas&&($=ln({...t.canvas,skip:`${U},[data-lc-ignore]`,rules:t.canvasMask,regionsFn:t.canvasMaskRegions,idOf:x=>ce.mirror.getId(x),emit:x=>ye(x)})),T.reset(),C()}},ve=()=>ce({emit:ye,checkoutEveryNms:c?oo:t.buffer_ms/2,maskAllInputs:t.mask_all_inputs,maskInputOptions:{...t.maskInputOptions,password:!0},...t.maskInputFn&&{maskInputFn:t.maskInputFn},maskTextSelector:H?"*":M,...H?{maskTextFn:H.maskTextFn}:t.maskTextFn&&{maskTextFn:t.maskTextFn},blockSelector:U,ignoreSelector:"[data-lc-ignore]",sampling:{mousemove:50,scroll:150,input:"last",...t.canvas&&!N&&{canvas:t.canvas.fps}},...t.canvas&&!N&&{dataURLOptions:{type:"image/jpeg",quality:t.canvas.quality}},...j?.inlineImages&&{inlineImages:!0},...j?.collectFonts&&{collectFonts:!0},errorHandler:x=>(r.rrwebErrors++,r.rrwebError=String(x).slice(0,200),!0),recordCrossOriginIframes:!!Y,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0},recordCanvas:!!t.canvas&&!N})??void 0,te=()=>{g?.(),g=void 0,$?.stop(),$=void 0},re=(x,he)=>{if(!(c||b)){c=!0,r.startReason=x??no[a]??"recording_initialized",he?.min_duration_ms!==void 0&&(d=he.min_duration_ms),r.minDurationMs=d;for(let ge of S.drain())I.add(ge);te(),h||G(),de(),C()}},be,de=()=>{!I.held||be!==void 0||(be=setTimeout(()=>I.release(),Math.max(0,d-(Date.now()-v))))},O=s.length?Gt(e,s,()=>i.sessionId,x=>re("trigger_group_matched",x),{url:n?.url_trigger,event:n?.event_trigger,flag:n?.linked_flag,sampling:n?.sampling}):void 0,K=O??fn(e,t.trigger,()=>re());O&&(r.triggers=O.states,r.matchedGroups=O.matched);let R="",X=()=>{if(location.href===R)return;R=location.href;let x=ft(L,R),he=x.key!==k.key;he&&(k=x,P());let ge=!!g,Me=Ht(R,t.include_urls,t.exclude_urls);!Me&&!p?(p=h=!0,te(),S.drain(),I.flush(),C()):Me&&p&&(p=!1,h=u,h||G(),C()),Me&&K.checkUrl(R),he&&ge&&g&&(te(),G())},oe=setInterval(X,1e3);e.onCapture(x=>{x.event==="$pageview"&&X();let he=so[x.event];if(!(!he||h||b||!g))try{let ge=he(x.properties);q&&typeof ge.url=="string"&&(ge.url=q(ge.url)),ce.addCustomEvent(x.event,ge)}catch{}});let Q=()=>{document.visibilityState==="visible"?c&&g&&ce.takeFullSnapshot(!0):I.beacon()};return document.addEventListener("visibilitychange",Q),e.onUnload(()=>{I.held?I.discard():I.beacon()}),X(),O?.check(),h||G(),c&&de(),C(),{stop:()=>{b=!0,te(),clearInterval(oe),clearTimeout(be),document.removeEventListener("visibilitychange",Q),ne?.(),T.stop(),K.stop(),S.drain(),I.discard(),C()},paused:()=>h,pause(){u||b||(u=h=!0,te(),S.drain(),I.flush(),C())},resume(){!u||b||(u=!1,h=p,h||G(),C())}}}export{Go as startRecorder};
@@ -1 +0,0 @@
1
- var ae=(e,t)=>()=>(e&&(t=e(e=0)),t);function Oe(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function $(e,t){return!!e?.some(n=>{try{return new RegExp(Oe(n),"i").test(t)}catch{return!1}})}var Q=ae(()=>{"use strict"});var le='[data-lc-region="article"]';function O(e,t,n){if(t.articles===!1)return()=>{};let s;e.loadConfig().then(f=>{typeof f?.article_selector=="string"&&(s=f.article_selector)});let a=()=>{for(let f of[t.articleSelector,s,le])if(f)try{let y=document.querySelector(f);if(y)return y}catch{}return null},o=location.href,l=location.pathname,u=null,i=0,c=!1,r=()=>{if(u??=a(),!u)return;let f=u.getBoundingClientRect();if(f.height<=0)return;let y=Math.round(Math.min(100,Math.max(0,(window.innerHeight-f.top)/f.height*100)));i=Math.max(i,y);let _=u.querySelector("h1,h2");_&&_.getBoundingClientRect().bottom<0&&(c=!0)},p=()=>{!u||!n()||(r(),e.client.capture("$article_read",{$article_id:(u.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||l,$article_depth:i,$article_finished:i>=90,$article_headline_exit:!c&&i<25}),u=null)},d=()=>{p(),u=null,i=0,c=!1,o=location.href,l=location.pathname},m=()=>location.href!==o?d():r(),g=new MutationObserver(m);return g.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),e.onUnload(p),r(),()=>{g.disconnect(),window.removeEventListener("scroll",m)}}var w="data-lc-content",ce="data-lc-content-piece",ue="data-lc-content-target";var S=(e,t)=>(e.getAttribute(t)??"").trim().slice(0,200);function I(e,t,n){if(t.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let s=new WeakSet,a=r=>{let p={$content_name:S(r,w)},d=S(r,ce),m=S(r,ue);return d&&(p.$content_piece=d),m&&(p.$content_target=m),p},o=location.href,l=new IntersectionObserver(r=>{for(let p of r)!p.isIntersecting||s.has(p.target)||!n()||(s.add(p.target),e.client.capture("$content_impression",a(p.target)))},{threshold:.5}),u=r=>r.querySelectorAll(`[${w}]`).forEach(p=>l.observe(p));u(document);let i=new MutationObserver(()=>{location.href!==o&&(o=location.href,l.disconnect(),document.querySelectorAll(`[${w}]`).forEach(r=>s.delete(r))),u(document)});i.observe(document.documentElement,{childList:!0,subtree:!0});let c=r=>{let p=r.target?.closest?.(`[${w}]`);p&&n()&&e.client.capture("$content_interaction",{...a(p),$content_interaction_type:"click"})};return document.addEventListener("click",c,!0),()=>{l.disconnect(),i.disconnect(),document.removeEventListener("click",c,!0)}}var pe=new Set(["input","textarea","select","option"]),de=["name","type","role","aria-label","title","alt","placeholder"],fe=/(?:\d[ -]?){9,}/;function me(e){if(pe.has(e.tagName.toLowerCase())||e.isContentEditable)return;let t="";for(let n of Array.from(e.childNodes))n.nodeType===3&&(t+=n.textContent??"");if(t=t.replace(/\s+/g," ").trim(),!(!t||fe.test(t)))return t.slice(0,255)}function H(e){if(!e?.length)return()=>!1;let t=e.map(n=>n.toLowerCase());return n=>t.some(s=>s.endsWith("*")?n.startsWith(s.slice(0,-1)):n===s)}var P="***";function v(e){let t={};for(let n=e,s=0;n&&s<10;n=n.parentElement,s++)for(let a of Array.from(n.attributes)){let o=a.name.startsWith("data-lc-attr-")?a.name.slice(13):"";o&&!(o in t)&&!o.startsWith("$")&&(t[o]=a.value.slice(0,255))}return t}function ge(e,t,n,s){let a=e.parentElement,o=a?Array.from(a.children):[e],l={tag_name:e.tagName.toLowerCase(),nth_child:o.indexOf(e)+1,nth_of_type:o.filter(r=>r.tagName===e.tagName).indexOf(e)+1},u=(e.getAttribute("class")??"").split(/\s+/).filter(Boolean);u.length&&!n("class")&&(l.classes=u),e.id&&!n("id")&&(l.attr__id=s("id",e.id));let i=e.getAttribute("href");i&&!n("href")&&(l.href=s("href",i.slice(0,1024)));let c={};for(let r of Array.from(e.attributes))(r.name.startsWith("data-lc-")||de.includes(r.name))&&!n(r.name)&&(c[r.name]=s(r.name,r.value.slice(0,255)));if(Object.keys(c).length&&(l.attrs=c),t){let r=me(e);r&&(l.text=r)}return l}function b(e,t,n,s,a={}){let o=[],l=H(s),u=H(a.allow),i=a.maskAll?(r,p)=>u(r)?p:P:(r,p)=>p,c=t;for(let r=e;r&&o.length<10;r=r.parentElement)o.push(ge(r,c,l,i)),(r===n||!n)&&(c=!1);return o}var C=e=>e.replace(/(["\\])/g,"\\$1");function E(e){return e.map(t=>{let n=t.tag_name+(t.classes?"."+t.classes.join("."):"")+":";t.attr__id&&(n+=`attr__id="${C(t.attr__id)}"`),t.href&&(n+=`href="${C(t.href)}"`),t.text&&(n+=`text="${C(t.text)}"`);for(let[s,a]of Object.entries(t.attrs??{}))n+=`attr__${s}="${C(a)}"`;return n+`nth-child="${t.nth_child}"nth-of-type="${t.nth_of_type}"`}).join(";")}var h=[],ye=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,he=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,_e=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,ve="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function j(e,t=[]){if(t.length&&e.closest(t.join(","))||e.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=e.closest(ve)??e,s=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(ye.test((n.textContent??"").trim())||he.test(s))return!0;for(let a=n,o=0;a&&o<3;a=a.parentElement,o++)if(_e.test(a.getAttribute("class")??""))return!0;return!1}var be=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function N(e,t=Date.now(),n={},s){if(s&&n.ignoreSelectors?.length&&s.closest(n.ignoreSelectors.join(",")))return{};if(s&&n.suppressSteppers!==!1&&j(s,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&be())return{};let a=n.windowMs??1e3,o=n.radiusPx??30;for(h.length&&t<h[h.length-1].t&&(h.length=0),h.push({t,x:e.clientX,y:e.clientY});h.length&&t-h[0].t>a;)h.shift();let l=h.filter(u=>Math.hypot(u.x-e.clientX,u.y-e.clientY)<=o).length;return l>=(n.count??3)?{$rageclick:!0,$rageclick_count:l}:{}}function D(e,t,n=700){if(typeof MutationObserver>"u")return;let s=!1,a=new MutationObserver(()=>s=!0);a.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let o=()=>{s=!0};window.addEventListener("scroll",o,{capture:!0,passive:!0}),document.addEventListener("selectionchange",o);let l=()=>{a.disconnect(),window.removeEventListener("scroll",o,{capture:!0}),document.removeEventListener("selectionchange",o)},u=setTimeout(()=>{l(),!s&&document.visibilityState!=="hidden"&&e.client.capture("$deadclick_hint",{$selector:t,$no_mutation_ms:n})},n);e.onUnload(()=>{clearTimeout(u),l()})}var W=/^[A-Za-z_][\w-]*$/,Ee=5;function U(e){let t=[];for(let n=e;n&&t.length<Ee;n=n.parentElement){let s=n.tagName.toLowerCase();if(n.id&&W.test(n.id)){t.unshift(`${s}#${n.id}`);break}let a=(n.getAttribute("class")??"").split(/\s+/).filter(o=>W.test(o)).slice(0,2);t.unshift(s+a.map(o=>`.${o}`).join(""))}return t.join(" ")}function X(e,t,n,s,a={}){let o={$selector:U(n),$el_interactive:s};(t.clientX||t.clientY||t.detail)&&(o.$click_x=Math.round(t.clientX+(window.scrollX||0)),o.$click_y=Math.round(t.clientY+(window.scrollY||0))),a.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(o,N(t,Date.now(),a.rageClicks||{},n));let l=a.deadClicks;!s&&t.isTrusted&&l!==!1&&!(l?.ignoreSelectors?.length&&n.closest(l.ignoreSelectors.join(",")))&&D(e,o.$selector,l?.waitMs);for(let u of e.clickExtras)Object.assign(o,u(t,n));return o}var ke="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",xe="[data-lc-ignore]",A=e=>e.some(t=>typeof t=="string"?location.href.includes(t):t.test(location.href)),we=e=>!e?.length||A(e),M=e=>({maskAll:e.maskAllAttributes,allow:e.attributeAllowlist}),k=(e,t)=>!!e.closest(xe)||!!(t.denySelectors?.length&&e.closest(t.denySelectors.join(",")));function F(e,t,n){let s=t.events??["click","change","submit"],a=0,o=i=>{let c=i.target;!n()||i.isComposing||!(c instanceof Element)||k(c,t)||c instanceof HTMLInputElement&&c.type==="password"||(a+=1)},l=i=>c=>{if(!n())return;let r=c.target;if(!(r instanceof Element)||k(r,t)||t.allowSelectors?.length&&!r.closest(t.allowSelectors.join(","))||t.elementAllowlist?.length&&!r.closest(t.elementAllowlist.join(","))||!we(t.urlAllowlist)||i==="change"&&!/^(input|select|textarea)$/i.test(r.tagName)||r instanceof HTMLInputElement&&r.type==="password")return;let p=r.closest(ke);if(i==="click"&&!p&&!t.allowSelectors?.length)return;let d=b(r,t.captureText??!0,p??void 0,t.attributeIgnore,M(t)),m=d.find(f=>f.text)?.text,g=a;a=0,e.client.capture("$autocapture",{...v(r),$event_type:i,...g>0?{$keystroke_count:g}:{},$elements:d,$elements_chain:E(d),...m?{$el_text:m}:{},...i==="click"?X(e,c,r,!!p,t):{}})};e.autocaptureClicks=s.includes("click");let u=s.map(i=>[i,l(i)]);for(let[i,c]of u)document.addEventListener(i,c,!0);return document.addEventListener("keydown",o,!0),()=>{for(let[i,c]of u)document.removeEventListener(i,c,!0);document.removeEventListener("keydown",o,!0)}}var Ce='[contenteditable]:not([contenteditable="false"])',q="input,textarea,select",Re=255;function K(e){return e.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Re)}var Se=e=>e?e instanceof Element?e:e.parentElement:null;function G(e,t,n){let s=t.events??["click","change","submit"],a=t.contentEditable!==!1&&s.includes("change"),o=new WeakSet,l=p=>{let d=b(p,!1,p,t.attributeIgnore,M(t));return{...v(p),$elements:d,$elements_chain:E(d)}},u=p=>{let d=p instanceof Element?p.closest(Ce):null;return d&&!k(d,t)?d:null},i=p=>{let d=n()?u(p.target):null;d&&o.add(d)},c=p=>{let d=u(p.target);!d||!o.has(d)||p.relatedTarget instanceof Node&&d.contains(p.relatedTarget)||(o.delete(d),n()&&e.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...l(d)}))},r=p=>{if(!n()||!t.copyCut)return;let d=typeof getSelection=="function"?getSelection():null,m=p.target instanceof Element?p.target:null,g=Se(d?.anchorNode)??m;if(!g||k(g,t)||g.closest(q)||m?.closest(q))return;let f=t.captureCopiedText?K(d?.toString()??""):"";e.client.capture("$copy_autocapture",{$copy_type:p.type,...l(g),...f?{$selected_content:f}:{}})};return a&&(document.addEventListener("input",i,!0),document.addEventListener("focusout",c,!0)),document.addEventListener("copy",r,!0),document.addEventListener("cut",r,!0),()=>{document.removeEventListener("input",i,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("copy",r,!0),document.removeEventListener("cut",r,!0)}}var Ae="[data-lc-ignore]",B=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],V=["q","s","search","query"],Y=e=>e.origin+e.pathname;function z(e,t,n){let s=Array.isArray(t.fileDownloads)?t.fileDownloads.map(o=>o.toLowerCase()):B,a=[];if(t.outboundLinks!==!1||t.fileDownloads!==!1){let o=l=>{let u=l.target instanceof Element?l.target.closest("a[href]"):null;if(!u||!n()||u.closest(Ae))return;let i;try{i=new URL(u.href,location.href)}catch{return}if(i.protocol!=="http:"&&i.protocol!=="https:")return;let c=decodeURIComponent(i.pathname.split("/").pop()??""),r=c.includes(".")?c.split(".").pop().toLowerCase():"";t.fileDownloads!==!1&&(u.hasAttribute("download")||s.includes(r))?e.client.capture("$file_download",{$url:Y(i),$file_name:c,$file_extension:r}):t.outboundLinks!==!1&&i.host!==location.host&&e.client.capture("$outbound_click",{$url:Y(i),$outbound_host:i.host})};document.addEventListener("click",o,!0),a.push(()=>document.removeEventListener("click",o,!0))}if(t.siteSearch!==!1){let o=typeof t.siteSearch=="object"&&t.siteSearch.params?t.siteSearch.params:V,l=!0;a.push(()=>{l=!1}),e.onCapture(u=>{if(!l||u.event!=="$pageview"||!n())return;let i=new URLSearchParams(location.search);for(let c of o){let r=i.get(c)?.trim();if(r)return void e.client.capture("$site_search",{$search_term:r.slice(0,200),$search_param:c})}})}return()=>a.forEach(o=>o())}function Me(e,t={}){e.capture("$page_not_found",{$status:404,...t})}var Te=[25,50,75],$e="data-lc-media-title";function T(e){let t=e.currentSrc||e.src;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return"";try{let n=new URL(t,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var Le=e=>(e.getAttribute($e)??e.getAttribute("title")??e.getAttribute("aria-label")??"").trim().slice(0,200);function Z(e,t,n){if(t.media===!1)return()=>{};let s=new WeakMap,a=i=>{let c={$media_type:i instanceof HTMLVideoElement?"video":"audio",$media_src:T(i)},r=Le(i);return r&&(c.$media_title=r),Number.isFinite(i.duration)&&(c.$media_duration=Math.round(i.duration)),c},o=i=>{let c=T(i);if(!c)return null;let r=s.get(i);return(!r||r.src!==c)&&s.set(i,r={src:c,played:!1,reached:new Set,done:!1}),r},l=i=>{let c=i.target;if(!(c instanceof HTMLMediaElement)||!n())return;let r=o(c);if(r)if(i.type==="play"){if(r.done&&Object.assign(r,{played:!1,reached:new Set,done:!1}),r.played)return;r.played=!0,e.client.capture("$media_play",a(c))}else if(i.type==="timeupdate"){if(!r.played||r.done||!Number.isFinite(c.duration)||c.duration<=0)return;let p=c.currentTime/c.duration*100;for(let d of Te)p>=d&&!r.reached.has(d)&&(r.reached.add(d),e.client.capture("$media_progress",{...a(c),$media_progress:d}))}else i.type==="ended"&&r.played&&!r.done&&(r.done=!0,e.client.capture("$media_complete",a(c)))},u=["play","timeupdate","ended"];return u.forEach(i=>document.addEventListener(i,l,!0)),()=>u.forEach(i=>document.removeEventListener(i,l,!0))}function J(e=()=>performance.now()){let t=()=>document.visibilityState!=="hidden",n=0,s=t()?e():null,a=()=>{t()?s===null&&(s=e()):(s!==null&&(n+=e()-s),s=null)};return document.addEventListener("visibilitychange",a),{read:()=>Math.round(n+(s===null?0:e()-s)),reset:()=>{n=0,s=t()?e():null},stop:()=>document.removeEventListener("visibilitychange",a)}}Q();var ee=255,Ie=new Set(["input","textarea","select","option"]),He="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Pe=new Set(["value","password","autocomplete"]),je=/(?:\d[ -]?){9,}/,x=new WeakMap;function te(e){return Array.isArray(e)?e.filter(t=>{if(!t||typeof t!="object")return!1;let n=t;return typeof n.name=="string"&&n.name!==""&&!n.name.startsWith("$")&&typeof n.selector=="string"&&(n.source==="text"||n.source==="attribute"&&typeof n.attribute=="string")&&Array.isArray(n.events)}):[]}function Ne(e){if(!e||Ie.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(He)}catch{return!1}}function De(e,t){if(e.source==="attribute"){let s=(e.attribute??"").toLowerCase();if(!s||Pe.has(s)||s.startsWith("on"))return;let a=t.getAttribute(s);return a===null?void 0:a.slice(0,ee)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||je.test(n)))return n.slice(0,ee)}function L(e,t,n,s=location.href){let a={};for(let o of e){if(!o.events.includes(t)||o.url&&!$([o.url],s))continue;let l=null;try{l=o.scope==="target"?t==="click"&&n?n.closest(o.selector):null:document.querySelector(o.selector)}catch{continue}if(!Ne(l))continue;let u=De(o,l);u!==void 0&&(a[o.name]=u)}return a}function ne(e){let t=!0;return e.loadConfig().then(n=>{t&&x.set(e,te(n?.snapshot_properties))}),e.clickExtras.push((n,s)=>t?L(x.get(e)??[],"click",s):{}),()=>{t=!1,x.delete(e)}}function re(e){let t=x.get(e);return t?.length?L(t,"pageview"):{}}function oe(e){return!!x.get(e)?.some(t=>t.events.includes("pageview"))}function se(){let e=0,t=0,n=()=>{let s=document.documentElement,a=Math.max(s.scrollHeight,document.body?.scrollHeight??0),o=Math.min(a,(window.scrollY||window.pageYOffset||0)+window.innerHeight);o>e&&(e=o,t=a>0?Math.min(100,Math.round(o/a*100)):0)};return n(),window.addEventListener("scroll",n,{passive:!0}),{read:()=>({pct:t,px:e}),stop:()=>window.removeEventListener("scroll",n)}}function R(e,t,n={}){let s=n.views??!0,a=n.leave??!0,o=location.href,l=se(),u=J(),i,c=()=>{if(!a||i===o)return;i=o;let{pct:f,px:y}=l.read();e.client.capture("$pageleave",{$current_url:o,$scroll_depth:f,$scroll_depth_px:y,$engagement_time_ms:u.read()})},r=!1,p=f=>{if(!s)return;let{core:y}=e;if(!y.hasConsent("analytics")&&!y.anonymousOnReject&&!(y.consent.pending&&y.consent.queueBeforeConsent)){if(!r){r=!0;let _=()=>{r&&(r=!1,p())};e.whenConsented(_),y.onChange(ie=>{ie==="consent"&&y.anonymousOnReject&&_()})}return}e.client.capture("$pageview",{...re(e),...f===void 0?{}:{$referrer:f}})},d=()=>{if(location.href===o)return;let f=o;c(),l.stop(),o=location.href,l=se(),u.reset(),oe(e)?setTimeout(()=>p(f),0):p(f)};if(e.onUnload(c),p(),t!=="history"&&t!=="hash")return()=>(l.stop(),u.stop());let{pushState:m,replaceState:g}=history;return history.pushState=function(...f){m.apply(this,f),d()},history.replaceState=function(...f){g.apply(this,f),d()},window.addEventListener("popstate",d),t==="hash"&&window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d),history.pushState=m,history.replaceState=g,window.removeEventListener("popstate",d),l.stop(),u.stop()}}var Et=e=>{let t=[],n=e.config.autocapture,s=!1;if(n!==!1){let l=typeof n=="object"?n:{},u=()=>!s&&!(l.urlIgnorelist?.length&&A(l.urlIgnorelist));t.push(F(e,l,u),G(e,l,u),z(e,l,u),I(e,l,u),O(e,l,u),Z(e,l,u),ne(e)),n===void 0&&e.loadConfig().then(i=>s=i?.autocapture===!1)}let a=e.config.capturePageview??"history",o=e.config.capturePageleave??"if_capture_pageview";return a!==!1&&o!==!1?t.push(R(e,a)):a!==!1?t.push(R(e,a,{leave:!1})):o===!0&&t.push(R(e,"history",{views:!1})),()=>t.forEach(l=>l())};export{B as DOWNLOAD_EXTENSIONS,P as MASKED,V as SEARCH_PARAMS,v as attrProps,Et as autocapture,b as buildChain,E as chainToString,U as cssSelector,j as isStepper,K as maskCopied,T as mediaSrc,L as readSnapshot,te as snapshotRules,Me as tag404};
@@ -1 +0,0 @@
1
- function _(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function d(e,t){return!!e?.some(r=>{try{return new RegExp(_(r),"i").test(t)}catch{return!1}})}function R(e,t){return e===!1||!e&&!t?null:{fps:c(e?e.fps??2:2,1,15),quality:c(e?e.quality??.4:.4,.05,1)}}var c=(e,t,r)=>Math.min(r,Math.max(t,e)),x=1e7;function O(e,t){if(t?.session_recording===!1)return null;let r=t?.replay??{},o=(n,l)=>e[n]??r[n]??l,i=[...r.mask_selectors??[],...t?.replay_mask_selectors??[],...e.mask_selectors??[]];return{sample_rate:e.sample_rate??r.sample_rate??t?.replay_sample_rate??1,min_duration_ms:e.min_duration_ms??r.min_duration_ms??t?.replay_min_duration_ms??0,min_duration_mode:e.min_duration_mode??r.min_duration_mode??t?.replay_min_duration_mode??"buffer",trigger:o("trigger",{mode:"always"}),trigger_groups:e.trigger_groups??r.trigger_groups??t?.replay_trigger_groups??[],include_urls:o("include_urls",[]),exclude_urls:[...o("exclude_urls",[]),...(t?.replay_url_blocklist??[]).map(_)],block_selectors:[...r.block_selectors??[],...t?.replay_block_selectors??[],...e.block_selectors??[]],mask_selectors:i,mask_all_inputs:e.mask_all_inputs??(t?.mask_all_inputs===!0||r.mask_all_inputs!==!1),mask_all_text:e.mask_all_text===!0||t?.replay_mask_all_text===!0||r.mask_all_text===!0||i.includes("*"),unmask_selectors:[...e.unmask_selectors??[]],url_privacy_rules:[...Array.isArray(t?.replay_url_privacy_rules)?t?.replay_url_privacy_rules:[],...e.url_privacy_rules??[]],buffer_ms:o("buffer_ms",6e4),flush_interval_ms:o("flush_interval_ms",5e3),chunk_bytes:Math.min(o("chunk_bytes",256*1024),x-16384),canvas:R(e.captureCanvas,t?.replay_capture_canvas===!0),maskInputOptions:e.maskInputOptions,maskInputFn:e.maskInputFn,maskTextFn:e.maskTextFn,maskUrlFn:e.maskUrlFn,crossOriginIframes:e.crossOriginIframes?.allowedOrigins.length?[...e.crossOriginIframes.allowedOrigins]:null,canvasMaskRegions:e.canvasMaskRegions,canvasMask:(Array.isArray(t?.replay_canvas_mask)?t.replay_canvas_mask:[]).filter(n=>typeof n?.selector=="string"),mutationThrottle:e.mutationThrottle===!1?null:{...e.mutationThrottle},assets:e.assets}}var f=(e,t)=>e.some(r=>{try{return new RegExp(r).test(t)}catch{return!1}});function A(e,t,r){return!f(r,e)&&(!t.length||f(t,e))}function I(e){return e==="watchtower"?!1:e?!0:globalThis.__WATCHTOWER__?.replayActive!==!0}function T(e){let t=2166136261;for(let r of new TextEncoder().encode(e))t^=r,t=Math.imul(t,16777619)>>>0;return t>>>0}function C(e,t,r){return T(`${e}:${t}`)/4294967296<r}var w=(e,t)=>{let r=t[e.key];return e.variant===void 0?r!==void 0&&r!==!1&&r!=="false":r===e.variant},M=(e,t)=>e.flatMap(r=>{try{return[new RegExp(r)]}catch{return t("bad url pattern",r),[]}});function y(e){let t=[];return e.urls.length&&t.push(e.url),e.g.events?.length&&t.push(e.event),e.g.flag&&t.push(e.flag),t.length?e.g.match==="all"?t.every(Boolean):t.some(Boolean):!0}function F(e,t,r,o,i={}){let n=t.map(s=>({g:s,urls:M(s.url_patterns??[],e.log),url:!!i.url,event:!!i.event,flag:!!i.flag})),l=!1,m=!1,p=()=>{if(!(l||m)){for(let s of n)if(y(s)&&(i.sampling||C(r(),s.g.id,s.g.sample_rate??1))){l=!0,o(s.g);return}}};e.onCapture(s=>{let u=!1;for(let a of n)!a.event&&a.g.events?.includes(s.event)&&(u=a.event=!0);u&&p()});let v=s=>{let u=!1;for(let a of n)a.g.flag&&!a.flag&&w(a.g.flag,s)&&(u=a.flag=!0);u&&p()},b=e.flags?.onChange(v),g=(s,u)=>n.some(s)?n.some(a=>s(a)&&u(a))?"activated":"pending":"disabled";return{checkUrl(s){let u=!1;for(let a of n)!a.url&&a.urls.some(h=>h.test(s))&&(u=a.url=!0);u&&p()},check:p,stop(){m=!0,b?.()},matched:()=>n.filter(y).map(s=>s.g.id),states:()=>({url:g(s=>s.urls.length>0,s=>s.url),event:g(s=>!!s.g.events?.length,s=>s.event),flag:g(s=>!!s.g.flag,s=>s.flag)})}}var k=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[];function U(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.url=="string").map(t=>({url:t.url,mask_all_text:t.mask_all_text===!0,mask_selectors:k(t.mask_selectors),block_selectors:k(t.block_selectors)})):[]}function W(e,t){let r=e.filter(l=>d([l.url],t)),o=r.some(l=>l.mask_all_text===!0),i=[...new Set(r.flatMap(l=>l.mask_selectors??[]))],n=[...new Set(r.flatMap(l=>l.block_selectors??[]))];return{maskAllText:o,mask:i,block:n,key:JSON.stringify([o,i,n])}}export{d as a,x as b,O as c,A as d,I as e,T as f,C as g,F as h,U as i,W as j};
@@ -1 +0,0 @@
1
- var i=0,a=0;function p(t){let o=new Uint8Array(t),e=globalThis.crypto;if(e?.getRandomValues)e.getRandomValues(o);else for(let r=0;r<t;r++)o[r]=Math.floor(Math.random()*256);return o}function f(t=Date.now()){if(t>i){i=t;let n=p(2);a=((n[0]??0)<<8|(n[1]??0))&1023}else a++,a>4095&&(i++,a=0);let o=p(8),e=new Uint8Array(16),r=i;e[0]=Math.floor(r/2**40)&255,e[1]=Math.floor(r/2**32)&255,e[2]=Math.floor(r/2**24)&255,e[3]=Math.floor(r/2**16)&255,e[4]=Math.floor(r/2**8)&255,e[5]=r&255,e[6]=112|a>>8,e[7]=a&255,e[8]=128|(o[0]??0)&63;for(let n=1;n<8;n++)e[8+n]=o[n]??0;let s=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}function l(t,o={}){let e=Math.min(o.maxMs??3e4,(o.baseMs??1e3)*2**t);return Math.round(e*(.5+.5*(o.random??Math.random)()))}function m(t){return t===0||t===408||t===429||t>=500}export{f as a,l as b,m as c};
@@ -1 +0,0 @@
1
- import{a as w,b as i}from"./chunk-GVYMMTQM.js";import"./chunk-MI35SSIT.js";function p(t){if(t.gdprApplies===!1)return;let n=t.purpose?.consents??{},o=!!n[1]&&!!n[7];return{analytics:o,replay:o&&!!n[8],marketing:!!n[1]&&!!n[4]}}function l(t){let n=a=>a in t?t[a]==="granted":void 0,o={},r=n("analytics_storage");r!==void 0&&(o.analytics=o.replay=r);let e=n("ad_storage"),s=n("ad_user_data");return e!==void 0&&(o.marketing=e&&s!==!1),o}function C(t){let n=typeof t=="string"?t.split(","):t,o=n.includes("C0002");return{analytics:o,replay:o,marketing:n.includes("C0004")}}function g(t){return{analytics:!!t.statistics,replay:!!t.statistics,marketing:!!t.marketing}}var b=t=>{let n,r=u(()=>{let e=window.__tcfapi;return typeof e!="function"?!1:(e("addEventListener",2,(s,a)=>{if(!a||s.eventStatus!=="tcloaded"&&s.eventStatus!=="useractioncomplete")return;n=s.listenerId;let c=p(s);c&&i(t,c,"tcf",{onlyIfChanged:!0})}),!0)});return()=>{r();let e=window.__tcfapi;n!==void 0&&typeof e=="function"&&e("removeEventListener",2,()=>{},n)}},T=t=>{let n=window,o=n.dataLayer??=[],r=s=>{let a=s;a&&typeof a=="object"&&a[0]==="consent"&&(a[1]==="default"||a[1]==="update")&&a[2]&&typeof a[2]=="object"&&i(t,l(a[2]),"gcm",{onlyIfChanged:!0})};o.forEach(r);let e=o.push;return o.push=function(...s){return s.forEach(r),e.apply(this,s)},()=>{o.push=e}},k=t=>{let n=e=>{(typeof e=="string"||Array.isArray(e))&&i(t,C(e),"onetrust",{onlyIfChanged:!0})},o=window,r=e=>n(e.detail??o.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",r),n(o.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",r)},E=t=>{let n=window,o=()=>{let e=n.Cookiebot;e?.consent&&e.hasResponse!==!1&&i(t,g(e.consent),"cookiebot",{onlyIfChanged:!0})},r=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let e of r)window.addEventListener(e,o);return o(),()=>r.forEach(e=>window.removeEventListener(e,o))};function m(t){let n=t.ANALYTICS==="ACCEPT";return{analytics:n,replay:n,marketing:t.MARKETING==="ACCEPT"}}function u(t){if(t())return()=>{};let n=0,o=setInterval(()=>(t()||++n>40)&&clearInterval(o),250);return()=>clearInterval(o)}var d=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],h=t=>{let n,o=e=>{let s=e&&typeof e=="object"&&Object.keys(e).length?e:n?.getConsent?.();s&&Object.keys(s).length&&i(t,m(s),"osano",{onlyIfChanged:!0})},r=u(()=>{if(n=window.Osano?.cm,!n)return!1;for(let e of d)n.addEventListener?.(e,o);return o(n.getConsent?.()),!0});return()=>{r();for(let e of d)n?.removeEventListener?.(e,o)}};function v(t,n="Lucida"){let o=t.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!o)return;let r=o.consent?.status===!0,e=t.filter(s=>s.categorySlug==="marketing");return{analytics:r,replay:r,marketing:e.length>0&&e.every(s=>s.consent?.status===!0)}}var f=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function y(t="Lucida"){return n=>{let o=()=>{let a=window.UC_UI?.getServicesBaseInfo?.();if(!a)return!1;let c=v(a,t);return c?i(n,c,"usercentrics",{onlyIfChanged:!0}):n.log(`usercentrics: no service named "${t}"; consent left unchanged`),!0},r=()=>{o()};for(let s of f)window.addEventListener(s,r);let e=u(o);return()=>{e();for(let s of f)window.removeEventListener(s,r)}}}var O=y();var U=t=>{t.consentUi={showBanner:async n=>(await import("./banner-CGEWCIGP.js")).showBanner(t,n),hideBanner:()=>{import("./banner-CGEWCIGP.js").then(n=>n.hideBanner())}}};export{w as CONSENT_EVENT,i as applyConsent,U as consentBanner,E as cookiebotConsent,g as cookiebotToConsent,T as gcmConsent,l as gcmToConsent,k as oneTrustConsent,C as oneTrustToConsent,h as osanoConsent,m as osanoToConsent,b as tcfConsent,p as tcfToConsent,y as usercentricsBridge,O as usercentricsConsent,v as usercentricsToConsent};
@@ -1,3 +0,0 @@
1
- var je="lc_consent",ae=["analytics","replay","marketing"],M=class{constructor(e){this.o=e;this.modeNow=e.mode??"opt_out",this.queueBeforeConsent=e.queueBeforeConsent??!1;let t=this.opens();this.state={analytics:t,replay:t,marketing:t},this.key=e.storageKey||je;let s=e.storage.get(this.key);if(s)try{let r=JSON.parse(s);for(let o of ae)typeof r[o]=="boolean"&&(this.state[o]=r[o]);this.decided=ae.some(o=>typeof r[o]=="boolean")}catch{}this.waiting=!!e.awaitRemote&&!this.decided,this.waiting&&(this.state={analytics:!1,replay:!1,marketing:!1})}o;modeNow;queueBeforeConsent;state;decided=!1;waiting;geoCookieless=!1;key;listeners=[];opens(){return this.modeNow==="opt_out"&&!(this.o.respectDnt&&this.o.dnt)}get mode(){return this.modeNow}get resolving(){return this.waiting}get anonymous(){return this.geoCookieless&&!this.decided}resolve(e){if(!this.waiting)return this.state.analytics;this.waiting=!1,(e==="opt_in"||e==="opt_out")&&(this.modeNow=e),this.geoCookieless=e==="cookieless";let t=!this.geoCookieless&&this.opens();return this.state={analytics:t,replay:t,marketing:t},t}get(){return{...this.state}}has(e){return this.state[e]}status(e="analytics"){return this.decided?this.state[e]?"granted":"denied":"pending"}get pending(){return this.waiting||this.modeNow==="opt_in"&&!this.state.analytics}set(e){let t=this.get();for(let s of ae)e[s]!==void 0&&(this.state[s]=e[s]);this.decided=!0,this.waiting=!1,this.o.storage.set(this.key,JSON.stringify(this.state));for(let s of this.listeners)s(this.get(),t)}onChange(e){this.listeners.push(e)}},$=class{constructor(e,t){this.inner=e;this.allowed=t}inner;allowed;mem=new Map;get(e){return this.mem.has(e)?this.mem.get(e)??null:this.inner.get(e)}set(e,t){this.allowed()?this.inner.set(e,t):this.mem.set(e,t)}remove(e){this.allowed()?this.inner.remove(e):this.mem.set(e,null)}flushBuffered(){for(let[e,t]of this.mem)t===null?this.inner.remove(e):this.inner.set(e,t);this.mem.clear()}discardBuffered(){this.mem.clear()}};var W=0,E=0;function De(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);return e}function w(n=Date.now()){if(n>W){W=n;let o=De(2);E=((o[0]??0)<<8|(o[1]??0))&1023}else E++,E>4095&&(W++,E=0);let e=De(8),t=new Uint8Array(16),s=W;t[0]=Math.floor(s/2**40)&255,t[1]=Math.floor(s/2**32)&255,t[2]=Math.floor(s/2**24)&255,t[3]=Math.floor(s/2**16)&255,t[4]=Math.floor(s/2**8)&255,t[5]=s&255,t[6]=112|E>>8,t[7]=E&255,t[8]=128|(e[0]??0)&63;for(let o=1;o<8;o++)t[8+o]=e[o]??0;let r=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}var Le="lc_identity",V=class{constructor(e,t,s=!1,r=!1){this.storage=e;this.cookieless=s;let o=e.get(Le),a;try{a=o?JSON.parse(o):void 0}catch{a=void 0}if(a?.distinct_id)this.s=a;else if(s)this.s={distinct_id:"",anon_id:"",identified:!1};else{let u=t??w();this.s={distinct_id:u,anon_id:u,identified:r&&!!t},this.save()}}storage;cookieless;s;save(){this.storage.set(Le,JSON.stringify(this.s))}get distinctId(){return this.s.distinct_id}get priorAnonId(){return this.s.identified&&this.s.anon_id&&this.s.anon_id!==this.s.distinct_id?this.s.anon_id:void 0}get isIdentified(){return this.s.identified}identify(e){if(!e||e===this.s.distinct_id)return e&&!this.s.identified&&(this.s.identified=!0,this.save()),{event:null};let t=this.s.distinct_id,s=!this.s.identified;return this.s={...this.s,distinct_id:e,identified:!0},this.save(),s&&t?{event:"$identify",anonDistinctId:t}:{event:"$identify"}}aliasProps(e,t){return{alias:e,distinct_id:t??this.s.distinct_id}}reset(e=!1){if(this.cookieless){this.s={distinct_id:"",anon_id:"",identified:!1};return}let t=e&&this.s.anon_id||w();this.s={distinct_id:t,anon_id:t,identified:!1},this.save()}};function j(n,e={}){let t=Math.min(e.maxMs??3e4,(e.baseMs??1e3)*2**n);return Math.round(t*(.5+.5*(e.random??Math.random)()))}function Fe(n){return n===0||n===408||n===429||n>=500}var z=class{constructor(e){this.o=e;this.flushAt=e.flushAt??20,this.intervalMs=e.flushIntervalMs??5e3,this.maxSize=e.maxQueueSize??1e3,this.maxRetries=e.maxRetries??5,this.batchMax=Math.max(1,Math.min(e.maxBatchSize??1e3,1e3))}o;items=[];timer;attempt=0;inflight;closed=!1;flushAt;intervalMs;maxSize;maxRetries;batchMax;get size(){return this.items.length}enqueue(e){this.closed||(this.items.push(e),this.items.length>this.maxSize&&this.o.onDrop?.(this.items.splice(0,this.items.length-this.maxSize),"queue_full"),this.items.length>=this.flushAt?this.flush():this.arm(this.intervalMs))}arm(e){this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},e))}disarm(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0}flush(e={}){if(this.disarm(),this.inflight)return this.inflight.then(()=>this.items.length?this.flush(e):void 0);if(!this.items.length)return Promise.resolve();let t=this.items.splice(0,this.batchMax),s=(this.o.clock??Date).now(),r=JSON.stringify({api_key:this.o.apiKey,batch:t,sent_at:new Date(s).toISOString()});this.o.log?.("send batch",t.length);let o=this.o.transport.send(this.o.url,r,e.beacon?{beacon:!0}:{}).then(a=>a.status,()=>0).then(a=>this.settle(t,a,!!e.beacon)).finally(()=>{this.inflight=void 0});return this.inflight=o,o}settle(e,t,s){if(t>=200&&t<300){this.attempt=0,this.items.length>=this.flushAt?this.flush():this.items.length&&this.arm(this.intervalMs);return}if(!Fe(t)||s||this.attempt>=this.maxRetries){this.o.onDrop?.(e,`status_${t}`),this.attempt=0;return}this.items.unshift(...e);let r=j(this.attempt++,this.o.backoff);this.o.log?.("retry in",r,"ms"),this.arm(r)}clear(){this.items=[],this.disarm()}async shutdown(){await this.flush(),this.closed=!0,this.disarm()}};var ce="lc_session";function Ne(n,e,t){return typeof n=="number"&&Number.isInteger(n)&&n>=e&&n<=t?n*6e4:void 0}var K=class{constructor(e,t={}){this.storage=e;this.o=t;this.idleMs=t.idleMs??30*6e4,this.maxMs=t.maxMs??24*36e5,this.newOn=t.newOnEvents??[],this.clock=t.clock??Date,this.bootstrapId=t.bootstrapId}storage;o;windowId=w();idleMs;maxMs;newOn;clock;bootstrapId;configure(e){this.o.idleMs===void 0&&(this.idleMs=Ne(e.session_idle_minutes,1,1440)??this.idleMs),this.o.maxMs===void 0&&(this.maxMs=Ne(e.session_max_minutes,5,10080)??this.maxMs),this.o.newOnEvents===void 0&&Array.isArray(e.session_new_on_events)&&(this.newOn=e.session_new_on_events.filter(t=>typeof t=="string"&&t!==""))}read(){try{let e=this.storage.get(ce);return e?JSON.parse(e):void 0}catch{return}}touch(e,t){let s=this.clock.now(),r=this.read(),o=!!(r?.campaign&&e&&r.campaign!==e),a=t!==void 0&&this.newOn.includes(t),u=!r||s-r.last>this.idleMs||s-r.start>this.maxMs||o||a;return(u||!r)&&(r={id:!r&&this.bootstrapId||w(s),start:s,last:s}),this.bootstrapId=void 0,r.last=s,e&&(r.campaign=e),this.storage.set(ce,JSON.stringify(r)),{sessionId:r.id,windowId:this.windowId,isNew:u}}startedAt(){return this.read()?.start}reset(){this.storage.remove(ce)}};function Be(n,e){let t=n.get(e);if(t)try{return JSON.parse(t)}catch{return}}var G=class{constructor(e,t="lc_props",s){this.storage=e;this.key=t;this.persist=s;this.p=Be(e,t)??{}}storage;key;persist;p;save(){let e=this.persist;this.storage.set(this.key,JSON.stringify(e?Object.fromEntries(Object.entries(this.p).filter(([t])=>e(t))):this.p))}register(e){Object.assign(this.p,e),this.save()}registerOnce(e){for(let[t,s]of Object.entries(e))t in this.p||(this.p[t]=s);this.save()}unregister(e){delete this.p[e],this.save()}all(){return{...this.p}}clear(){this.p={},this.storage.remove(this.key)}},J=class{constructor(e){this.storage=e;this.g=Be(e,"lc_groups")??{}}storage;g;set(e,t){this.g[e]=t,this.storage.set("lc_groups",JSON.stringify(this.g))}all(){return Object.keys(this.g).length?{...this.g}:void 0}clear(){this.g={},this.storage.remove("lc_groups")}};function _t(n,e){let t=new Date(n??e);return(Number.isNaN(t.getTime())?new Date(e):t).toISOString()}var D=class{constructor(e){this.c=e;this.clock=e.clock??Date,this.consent=new M({...e.consent,storage:e.consentStorage??e.storage}),this.gated=new $(e.storage,()=>this.consent.has("analytics")),this.storage=this.gated,this.identity=new V(this.gated,e.bootstrapDistinctId,e.cookieless,e.bootstrapIdentified),this.session=new K(this.gated,{clock:this.clock,...e.session}),this.props=new G(this.gated,void 0,e.persistProperty),this.groupState=new J(this.gated),this.queue=new z({transport:e.transport,url:`${e.apiHost.replace(/\/+$/,"")}/v1/batch`,apiKey:e.apiKey,clock:this.clock,...e.log?{log:e.log}:{},...e.onDrop?{onDrop:e.onDrop}:{},...e.queue})}c;consent;identity;session;queue;storage;gated;props;groupState;clock;device;pre=[];listeners=[];captureListeners=[];sessionListeners=[];lastSession="";filter;get anonDistinctId(){return this.identity.priorAnonId}get distinctId(){return this.identity.distinctId}get deviceId(){return this.c.cookieless?"":(this.device||(this.device=this.gated.get("lc_device_id")||w(),this.gated.set("lc_device_id",this.device)),this.device)}get groups(){return this.groupState.all()}get sessionId(){return this.touchSession().sessionId}touchSession(e){let t=this.session.touch(this.c.campaignKey?.(),e);if(t.sessionId!==this.lastSession){this.lastSession=t.sessionId;for(let s of this.sessionListeners)s(t.sessionId,t.windowId)}return t}onSessionId(e){return this.sessionListeners.push(e),()=>{this.sessionListeners.splice(this.sessionListeners.indexOf(e),1)}}get sessionStart(){return this.session.startedAt()}getProperty(e){return this.props.all()[e]}setFilter(e){this.filter=e}onChange(e){this.listeners.push(e)}onCaptured(e){this.captureListeners.push(e)}emit(e){for(let t of this.listeners)t(e)}consentStatus(){return this.consent.status()}get anonymousOnReject(){return!!this.c.consent?.cookielessOnReject&&this.consent.status()==="denied"}capture(e,t={},s={}){let r=this.consent.has("analytics"),o=!r&&(this.anonymousOnReject||this.consent.anonymous),a=this.consent.pending&&(this.consent.queueBeforeConsent||this.consent.resolving);if(!r&&!o&&!a){this.c.log?.("dropped (no consent)",e);return}if(o&&(e==="$identify"||e==="$create_alias")){this.c.log?.("withheld (declined, anonymous mode)",e);return}let u=this.touchSession(e),p=this.c.enrich?.(e,t),h=this.consent.status()!=="pending",m=o?{}:{...p?.$set,...s.$set,...e==="$consent_updated"&&h?{$consent:this.consent.get()}:{}},_=o?{}:{...p?.$set_once,...s.$set_once},C=this.groupState.all(),g=o?"":this.identity.distinctId,v={uuid:w(this.clock.now()),event:e,...g?{distinct_id:g}:{},timestamp:_t(s.timestamp,this.clock.now()),properties:{...this.props.all(),...p?.properties,...t,$session_id:u.sessionId,$window_id:u.windowId,$lib:this.c.library.name,$lib_version:this.c.library.version,...h?{$consent:this.consent.get()}:{}},...Object.keys(m).length?{$set:m}:{},...Object.keys(_).length?{$set_once:_}:{},...!o&&s.$unset?.length?{$unset:s.$unset}:{},...C?{$groups:C}:{}},b=this.filter?this.filter(v):v;if(!b){this.c.log?.("dropped (policy)",e);return}this.c.log?.("capture",e,b),this.c.onCapture?.(b);for(let S of this.captureListeners)S(b);return r||o?this.queue.enqueue(b):this.pre.length<(this.c.queue?.maxQueueSize??1e3)&&this.pre.push(b),b}identify(e,t,s){let r=this.identity.identify(e);(r.event||t||s)&&this.capture("$identify",r.anonDistinctId?{$anon_distinct_id:r.anonDistinctId}:{},{...t?{$set:t}:{},...s?{$set_once:s}:{}}),this.emit("identify")}alias(e,t){this.capture("$create_alias",this.identity.aliasProps(e,t))}reset(e={}){this.identity.reset(e.reuseAnonymousId),e.resetDeviceId&&(this.device=void 0,this.gated.remove("lc_device_id")),this.props.clear(),this.groupState.clear(),this.session.reset(),this.lastSession="",this.emit("reset")}register(e){this.props.register(e)}registerOnce(e){this.props.registerOnce(e)}unregister(e){this.props.unregister(e)}group(e,t,s){this.groupState.set(e,t),this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:s??{}}),this.emit("group")}getConsent(){return this.consent.get()}getConsentStatus(e="analytics"){return this.consent.status(e)}hasConsent(e){return this.consent.has(e)}setConsent(e){let t=this.consent.has("analytics"),s=e.analytics??t;if(t&&!s&&(this.capture("$opt_out"),this.queue.flush()),!t&&s&&(this.anonymousOnReject||this.consent.anonymous)&&this.queue.flush(),this.consent.set(e),!t&&s){this.gated.flushBuffered();for(let r of this.pre.splice(0))this.queue.enqueue(r);this.capture("$opt_in")}else t&&!s&&this.queue.clear();s||(this.pre.length=0),this.emit("consent")}applyRemote(e){this.session.configure(e);let t=e.consent_default;this.resolveConsent(t==="opt_in"||t==="opt_out"||t==="cookieless"?t:void 0)}resolveConsent(e){if(!this.consent.resolving)return;let t=this.consent.resolve(e),s=this.pre.splice(0);if(t){this.gated.flushBuffered();for(let r of s)this.queue.enqueue(r)}else if(this.consent.anonymous){this.gated.discardBuffered();for(let r of s){if(r.event==="$identify"||r.event==="$create_alias")continue;let o={...r};delete o.distinct_id,delete o.$set,delete o.$set_once,delete o.$unset,this.queue.enqueue(o)}}else this.consent.queueBeforeConsent&&this.pre.push(...s);this.emit("consent")}optIn(){this.setConsent({analytics:!0,replay:!0,marketing:!0})}optOut(){this.setConsent({analytics:!1,replay:!1,marketing:!1})}flush(e){return this.queue.flush(e)}shutdown(){return this.queue.shutdown()}};function qe(n){let e="";return t=>{for(e+=t;;){let s=/\r?\n\r?\n/.exec(e);if(!s)return;let r=e.slice(0,s.index);e=e.slice(s.index+s[0].length);let o="message",a,u=[];for(let p of r.split(/\r?\n/)){if(p.startsWith(":"))continue;let h=p.indexOf(":"),[m,_]=h<0?[p,""]:[p.slice(0,h),p.slice(h+1).replace(/^ /,"")];m==="event"?o=_??"":m==="data"?u.push(_??""):m==="id"&&(a=_)}u.length&&n(a===void 0?{event:o,data:u.join(`
2
- `)}:{event:o,data:u.join(`
3
- `),id:a})}}}var Y=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;cursor=0;gen=0;polling=!1;start(){this.stopped&&(this.stopped=!1,this.loop(++this.gen))}stop(){this.stopped=!0,this.gen++,this.ctl?.abort(),this.timer&&clearTimeout(this.timer)}restart(){let e=!this.stopped;this.stop(),this.cursor=0,e&&this.start()}live(e){return!this.stopped&&e===this.gen}deliver(e){if(e.seq>this.cursor){this.cursor=e.seq;try{this.o.onIntervention(e)}catch(t){this.o.log?.("onIntervention threw",t)}}}url(e){let t=`distinct_id=${encodeURIComponent(this.o.distinctId())}${this.cursor?`&cursor=${this.cursor}`:""}`;return`${this.o.apiHost}${e}?${t}`}sleep(e){return new Promise(t=>{this.timer=setTimeout(t,e),this.timer.unref?.()})}async loop(e){let t=0;for(;this.live(e);){let s;try{let r=await this.connectOnce(e);if(r==="gone")return this.stop();r==="poll"?(t=0,s=this.o.pollMs??15e3):(r==="streamed"&&(t=0),s=j(t++,this.o.backoff))}catch(r){this.live(e)&&this.o.log?.("intervention stream error",r),s=j(t++,this.o.backoff)}if(!this.live(e))return;await this.sleep(s)}}async connectOnce(e){if(this.polling)return this.pollOnce(e);this.ctl=new AbortController;let t={Authorization:`Bearer ${this.o.apiKey}`,Accept:"text/event-stream"},s=await this.o.fetch(this.url("/v1/interventions/stream"),{headers:t,signal:this.ctl.signal});if(s.status===404)return"gone";if(!s.ok)return"failed";let r=s.body;if(!r||typeof TextDecoderStream>"u")return this.ctl.abort(),this.polling=!0,this.pollOnce(e);let o=qe(u=>{if(!(u.event!=="intervention"||!this.live(e)))try{this.deliver(JSON.parse(u.data))}catch{this.o.log?.("bad intervention payload")}}),a=r.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:u,value:p}=await a.read();if(u)return"streamed";o(p)}}async pollOnce(e){this.ctl=new AbortController;let t=await this.o.fetch(this.url("/v1/interventions"),{headers:{Authorization:`Bearer ${this.o.apiKey}`},signal:this.ctl.signal});if(t.status===404)return"gone";if(!t.ok)return"failed";let s=await t.json();if(this.live(e))for(let r of s.data??[])this.deliver(r);return"poll"}};function de(n,e){let t=new Set,{whenConsented:s,disabled:r,...o}=e,a=new Y({...o,distinctId:()=>n.distinctId,onIntervention:p=>{for(let h of[...t])h(p)}}),u=!1;return n.onChange(p=>{u&&((p==="identify"||p==="reset")&&a.restart(),p==="consent"&&(n.hasConsent("analytics")?a.start():a.stop()))}),{on(p){return t.add(p),!u&&!r&&(u=!0,s(()=>a.start())),()=>{t.delete(p)}},stop:()=>a.stop()}}function le(n,e,t={}){let s=t.key??"lc_offline",r=t.maxBatches??50,o=t.maxBytes??1e6,a=t.isOnline??(()=>!0),u,p,h=()=>{try{let g=JSON.parse(e.get(s)??"[]");return Array.isArray(g)?g:[]}catch{return[]}},m=g=>{let v=g.reduce((b,S)=>b+S.body.length,0);for(;g.length>r||v>o&&g.length>1;)v-=g.shift().body.length;g.length?e.set(s,JSON.stringify(g)):e.remove(s)},_=g=>{m([...h(),...g]),u??=setTimeout(()=>{u=void 0,C.drain()},t.retryMs??3e4)},C={async send(g,v,b){if(!a())return _([{url:g,body:v}]),{status:200};let S=await n.send(g,v,b);return S.status!==0?S:(_([{url:g,body:v}]),{status:200})},drain(){return p??=(async()=>{let g=h();if(!g.length||!a())return;e.remove(s);let v=[];for(let[b,S]of g.entries())if((await n.send(S.url,S.body)).status===0){v.push(...g.slice(b));break}v.length&&_(v)})().finally(()=>{p=void 0}),p}};return C}function ue(n){let e=Object.keys(n);if(e.length===0)return{};let t={};for(let s of e)t[`$feature/${s}`]=n[s];return t.$active_feature_flags=e.filter(s=>n[s]!==!1).sort(),t}function pe(n,e,t,s){return{key:n,value:e,enabled:e!==void 0&&e!==!1,...typeof e=="string"?{variant:e}:{},...t!==void 0?{payload:t}:{},reason:e===void 0?"not_found":s}}var R={started:"$ai_conversation_started",message:"$ai_message",feedback:"$ai_feedback",ended:"$ai_conversation_ended",outcome:"$ai_outcome"},St=["resolved","unresolved","escalated","abandoned","error"],xt=4e3,kt=2e3,Ue=["wrong","useless","not helpful","unhelpful","doesn't work","does not work","didn't help","did not help","not what i asked","that's not it","stupid","terrible","awful","frustrating","frustrated","annoying","worst","hate","incorrect","nonsense","confusing","makes no sense","real person","human agent","talk to a human","speak to a human","wtf","ugh"],We=["thanks","thank you","great","perfect","awesome","helpful","that worked","works now","solved","exactly"],N=n=>Array.from(n),ge=(n,e)=>N(n).slice(0,e).join(""),wt=0xcbf29ce484222325n,Ct=0x100000001b3n,Pt=0xffffffffffffffffn,$t=new TextEncoder;function It(n){let e=wt;for(let t of $t.encode(n))e=(e^BigInt(t))*Ct&Pt;return e}function Ve(n){let e=(n.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(r=>N(r).length>=2);if(!e.length)return;let t=new Array(64).fill(0);for(let r of e){let o=It(r);for(let a=0;a<64;a++)t[a]=(t[a]??0)+((o>>BigInt(a)&1n)===1n?1:-1)}let s=0n;for(let r=0;r<64;r++)(t[r]??0)>0&&(s|=1n<<BigInt(r));return s.toString(16).padStart(16,"0")}function ze(n){let t=` ${n.toLowerCase().replace(/’/g,"'").replace(/[.,!?;:]/g," ").replace(/\s+/g," ").trim()} `,s=0;for(let o of Ue)t.includes(` ${o} `)&&(s++,t=t.split(` ${o} `).join(" "));let r=We.filter(o=>t.includes(` ${o} `)).length;return s>r?-1:r>s?1:0}var Ke=n=>N(n).filter(e=>e>="0"&&e<="9").map(Number);function Ot(n){let e=Ke(n);if(e.length<13||e.length>19)return!1;let t=0;return e.reverse().forEach((s,r)=>t+=r%2===1?s>4?s*2-9:s*2:s),t%10===0}var He=String.raw`[\p{Alphabetic}\p{M}\p{Nd}\p{Pc}\p{Join_Control}]`,Et=[[new RegExp(String.raw`(?<!${He})\p{Nd}(?:[ -]?\p{Nd}){12,18}(?!${He})`,"gu"),Ot],[/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g,()=>!0],[/\+?\p{Nd}[\p{Nd}\s().-]{7,}\p{Nd}/gu,Rt]];function Rt(n){let e=Ke(n).length;return e>=10&&e<=15}var At=n=>N(n).map(e=>/\s/u.test(e)?e:"*").join("");function he(n){let e=n;for(let[t,s]of Et)e=e.replace(t,r=>s(r)?At(r):r);return e===n?void 0:e}function Ge(n){if(typeof n!="string")return;let e=n.toLowerCase();return/^[0-9a-f]{32}$/.test(e)?e:void 0}var Je=n=>typeof n=="string"&&St.includes(n)?n:void 0,L=(n,e)=>typeof n=="string"&&n?ge(n,e):void 0;function Tt(n,e,t){let s=ge(e,t),r=he(s);return r===void 0?{[n]:s}:{[n]:r,$ai_text_redacted:!0}}function Ye(n,e,t,s){if(n!=="user"&&n!=="assistant")return;let r={$ai_role:n,$ai_message_index:t,$ai_text_length:N(e).length};if(n==="user"){let o=Ve(e);o!==void 0&&(r.$ai_text_hash=o),r.$ai_sentiment=ze(e)}return s?{...r,...Tt("$ai_text",e,xt)}:r}function Qe(n,e){let t=n.value;if(n.kind==="thumbs"&&t!==1&&t!==-1||n.kind==="rating"&&!(Number.isInteger(t)&&t>=1&&t<=5)||n.kind!=="thumbs"&&n.kind!=="rating"&&n.kind!=="comment")return;let s={$ai_feedback_kind:n.kind};if(n.kind!=="comment"&&(s.$ai_feedback_value=t),n.comment&&e){let r=ge(n.comment,kt);s.$ai_feedback_comment=he(r)??r}return n.messageIndex!==void 0&&(s.$ai_message_index=n.messageIndex),s}function fe(n,e){let t=Je(n),s=L(e,64);return{...t?{$ai_outcome:t}:{},...s?{$ai_resolution:s}:{}}}function Mt(){let n=globalThis.crypto,e=new Uint8Array(16);if(n?.getRandomValues)n.getRandomValues(e);else for(let s=0;s<16;s++)e[s]=Math.floor(Math.random()*256);e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,s=>s.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ze(n={}){let e={$ai_conversation_id:n.conversationId||Mt()},t=(s,r)=>{r!==void 0&&(e[s]=r)};return t("$ai_agent_name",L(n.agentName,128)),t("$ai_agent_version",L(n.agentVersion,64)),t("$ai_topic",L(n.topic,128)),t("$ai_use_case",L(n.useCase,128)),t("$ai_trace_id",Ge(n.traceId)),e}var F=class{next=0;common;emit;captureText;constructor(e,t={},s=!1){this.emit=e,this.captureText=s,this.common=Ze(t)}get id(){return this.common.$ai_conversation_id}send(e,t){this.emit(e,{...this.common,...t})}start(){return this.send(R.started,{}),this}message(e,t,s={}){let r=s.index??this.next,o=Ye(e,t,r,this.captureText);return o?(this.next=r+1,this.send(R.message,o),!0):!1}feedback(e){let t=Qe(e,this.captureText);return t?(this.send(R.feedback,t),!0):!1}end(e,t){this.send(R.ended,fe(e,t))}outcome(e,t){let s=fe(e,t);return s.$ai_outcome?(this.send(R.outcome,s),!0):!1}};var jt=["bot","crawl","spider","slurp","headlesschrome","phantomjs","puppeteer","playwright","lighthouse","pingdom","uptimerobot","facebookexternalhit","preview","scrapy","python-requests","go-http-client"];function Xe(n){let e=n.toLowerCase();return jt.some(t=>e.includes(t))&&!/\bcubot\b/.test(e)}var Q=["gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","igshid","msclkid","ttclid","li_fat_id","twclid","mc_cid"],et="lc_click_ids";function tt(n,e=90,t=Date.now){let s,r=()=>{try{return JSON.parse(n.get(et)??"{}")}catch{return{}}};return()=>{let o=r();if(location.search!==s){s=location.search;let u=new URLSearchParams(s),p=!1;for(let h of Q){let m=u.get(h);m&&(o[h]={v:m.slice(0,512),t:t()},p=!0)}p&&n.set(et,JSON.stringify(o))}let a={};for(let u of Q){let p=o[u];p&&t()-p.t<e*864e5&&(a[u]=p.v)}return a}}function Dt(){return Array.from(document.querySelectorAll("meta[http-equiv]")).filter(n=>n.getAttribute("http-equiv")?.toLowerCase()==="content-security-policy").map(n=>n.getAttribute("content")??"")}function Lt(n){let e=new Map;for(let s of n.split(";")){let[r,...o]=s.trim().toLowerCase().split(/\s+/);r&&!e.has(r)&&e.set(r,o)}let t=e.get("style-src-elem")??e.get("style-src")??e.get("default-src");return!!t&&!(t.includes("'unsafe-inline'")&&!t.some(s=>s.startsWith("'nonce-")||s.startsWith("'sha")))}function st(n,e){if(typeof document>"u")return()=>{};!e&&Dt().some(Lt)&&n("CSP hint: this page's Content-Security-Policy blocks inline <style>; set the `nonce` option so guides and the experiment veil render (docs/guides/csp.md)");let t=s=>{let r=s;/^style-src/.test(r.effectiveDirective??"")&&r.blockedURI==="inline"&&n(`CSP hint: an inline style was blocked by ${r.effectiveDirective}${e?" (check that `nonce` matches the page's nonce)":"; set the `nonce` option"}`)};return document.addEventListener("securitypolicyviolation",t),()=>document.removeEventListener("securitypolicyviolation",t)}var Ft=(n,e)=>n.slice(0,e);function nt(n){try{let e=new URL(n);return e.protocol==="data:"||e.protocol==="blob:"?e.protocol:e.origin+e.pathname}catch{return Ft(n,64)}}function rt(n,e={}){if(typeof document>"u")return()=>{};let t=e.maxPerPage??20,s=new Set,r=o=>{let a=o,u={$csp_directive:a.effectiveDirective??a.violatedDirective,$csp_blocked_uri:nt(a.blockedURI??""),$csp_source_file:a.sourceFile?nt(a.sourceFile):void 0,$csp_line:a.lineNumber||void 0,$csp_column:a.columnNumber||void 0,$csp_disposition:a.disposition},p=[u.$csp_directive,u.$csp_blocked_uri,u.$csp_source_file,u.$csp_line].join("|");s.has(p)||s.size>=t||(s.add(p),n("$csp_violation",Object.fromEntries(Object.entries(u).filter(([,h])=>h!==void 0))))};return document.addEventListener("securitypolicyviolation",r),()=>document.removeEventListener("securitypolicyviolation",r)}var Nt=["chrome-extension:","moz-extension:","safari-web-extension:","ms-browser-extension:"],it=()=>typeof location<"u"&&Nt.includes(location.protocol);function Bt(n,e,t){let s=e.find(a=>n.startsWith(`${a}/`));if(!s)return n;let r=n.slice(s.length),o=r.search(/[?#]/);return s+t(o<0?r:r.slice(0,o))+(o<0?"":r.slice(o))}function ot(n,e,t,s){if(!s)return{transport:n,fetch:e};let r=o=>Bt(o,t,s);return{transport:{send:(o,a,u)=>n.send(r(o),a,u)},fetch:((o,a)=>e(typeof o=="string"?r(o):o instanceof URL?r(o.href):o,a))}}var qt="__LUCIDA_DEVTOOLS_HOOK__";function at(n,e,t){let s=globalThis[qt];if(!(!s||typeof s.emit!="function"||typeof s.attach!="function")){n.onCapture(r=>{try{s.emit(r)}catch{}});try{s.attach({projectKeyPrefix:n.apiKey.slice(0,8),apiHost:t,distinctId:()=>e.distinctId,loadToolbar:r=>e.loadToolbar(r),startReplay:async()=>n.replay?(await n.replay.start(!0),n.replay.isRecording()):!1,replayUrl:()=>e.getReplayUrl()})}catch{}}}var ct=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Ht(n){let e={},t=new URLSearchParams(location.search);for(let s of[...ct,...Q,...n]){let r=t.get(s);r&&(e[`$${s}`]=r)}return e}function dt(){let n=new URLSearchParams(location.search),e=ct.map(t=>n.get(t)??"");return e.some(Boolean)?e.join("|"):void 0}function Ut(n){try{return n?new URL(n).hostname:""}catch{return""}}var Wt=()=>location.href.replace(/([?&])__lc_toolbar=[^&#]*&?/,"$1").replace(/[?&]$/,"");function Vt(){let n=location.hash;return n.length>1?location.pathname+n.split("?")[0]:location.pathname}function lt(n,e,t=[],s=!1){let r={$current_url:Wt(),$host:location.host,$pathname:s?Vt():location.pathname,$referrer:document.referrer,$screen_width:screen.width,$screen_height:screen.height,$viewport_width:window.innerWidth,$viewport_height:window.innerHeight,$browser_language:navigator.language,$timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};if(navigator.maxTouchPoints>1&&(r.$touch_points=navigator.maxTouchPoints),n!=="$pageview")return{properties:r};let o=Ht(t);Object.assign(r,o);let a=e.$current_url??location.href,u=e.$referrer??document.referrer,p={$initial_referrer:u||"$direct",$initial_referring_domain:Ut(u)||"$direct",$initial_current_url:a};for(let[h,m]of Object.entries(o))p[`$initial_${h.slice(1)}`]=m;return{properties:r,$set_once:p}}var ut="_lcid";var zt=(n,e)=>e.some(t=>{let s=t.replace(/^\./,"").toLowerCase();return n.toLowerCase()===s||n.toLowerCase().endsWith(`.${s}`)});function Kt(n,e=Date.now()){let t=n.lastIndexOf("."),[s="",r]=n.slice(t+1).split("_",2),o=/^[0-9a-z]+$/.test(s)?parseInt(s,36):NaN,a=n.slice(0,t);if(t>0&&a.length<=200&&o<=e+5e3&&e-o<=12e4)return r&&/^[\w-]{1,64}$/.test(r)?{distinctId:a,sessionId:r}:{distinctId:a}}function pt(n){if(!n?.length)return;let e=new URL(location.href),t=e.searchParams.get(ut);if(t!==null){e.searchParams.delete(ut),history.replaceState(history.state,"",e.toString());try{if(document.referrer&&!zt(new URL(document.referrer).hostname,n))return}catch{return}return Kt(t)}}function ft(n,e=Date.now){let t=n.eventsPerSecond??10,s=n.burst??100,r=s,o=e();return()=>{let a=e();return r=Math.min(s,r+(a-o)/1e3*t),o=a,r<1?!1:(r-=1,!0)}}function Gt(n,e,t){let s=e;for(let r of n)try{let o=r(s);if(o==null)return null;s=o}catch(o){t("beforeSend hook threw, keeping event:",o)}return s}function Jt(n,e=Math.random){return t=>n>=1?t:n<=0||e()>=n?null:{...t,properties:{...t.properties,$sample_rate:n}}}function Yt(n){let e=new Set(n),t=s=>Object.fromEntries(Object.entries(s).filter(([r])=>!e.has(r)));return s=>({...s,properties:t(s.properties),...s.$set?{$set:t(s.$set)}:{},...s.$set_once?{$set_once:t(s.$set_once)}:{}})}var me="lc_person_identified",Z="lc_pending_set_once",gt=new Set(["$identify","$create_alias","$groupidentify"]),ht="$$client_ingestion_warning",Qt=6e4,ye=class{constructor(e,t){this.mode=e;this.storage=t;this.identified=t.get(me)==="1";try{this.pending=JSON.parse(t.get(Z)??"{}")}catch{this.pending={}}}mode;storage;identified;pending;get blocksPersonWrites(){return this.mode==="never"}get isProfile(){return this.mode==="always"||this.mode==="identified_only"&&this.identified}markIdentified(){this.mode!=="identified_only"||this.identified||(this.identified=!0,this.storage.set(me,"1"))}personless(e){return this.mode==="always"?!1:(this.mode==="never"||!this.identified)&&!gt.has(e)}stash(e){if(this.mode!=="identified_only"||!e)return;let t=Object.entries(e).filter(([s])=>!(s in this.pending));t.length&&(this.pending={...this.pending,...Object.fromEntries(t)},this.storage.set(Z,JSON.stringify(this.pending)))}take(){if(!Object.keys(this.pending).length)return;let e=this.pending;return this.pending={},this.storage.remove(Z),e}reset(){this.identified=!1,this.pending={},this.storage.remove(me),this.storage.remove(Z)}};function Zt(n,e){let t=e,s;if(n.person.personless(e.event)){n.person.stash(e.$set_once);let{$set:o,$set_once:a,$unset:u,...p}=e;t={...p,properties:{...e.properties,$process_person_profile:!1}}}else(s=n.person.take())&&(t={...e,$set_once:{...e.$set_once,...s}});let r=n.hooks.length?Gt(n.hooks,t,n.log):t;return r&&n.limit&&!n.limit()&&(n.log("rate limited, dropped",r.event),n.onLimited?.(),r=null),!r&&s&&n.person.stash(s),r}function Xt(n){let e=n.beforeSend?Array.isArray(n.beforeSend)?n.beforeSend:[n.beforeSend]:[];return[...n.propertyDenylist?.length?[Yt(n.propertyDenylist)]:[],...n.sampleRate!==void 0?[Jt(n.sampleRate)]:[],...e]}function mt(n,e,t,s=Date.now){let r=new ye(e.personProfiles??"always",n.storage),o,a,u=0,p=-1/0,h=()=>{u+=1,!(s()-p<Qt)&&(p=s(),queueMicrotask(()=>{let m=u;u=0,n.capture(ht,{$$client_ingestion_warning_message:`client rate limit dropped ${m} event(s)`,$dropped_count:m})}))};return n.setFilter(m=>(e.rateLimit!==o&&(o=e.rateLimit,a=o?ft(o):void 0),Zt({hooks:Xt(e),person:r,limit:m.event===ht?void 0:a,log:t,onLimited:h},m))),r}var ve=class{m=new Map;get(e){return this.m.get(e)??null}set(e,t){this.m.set(e,t)}remove(e){this.m.delete(e)}},en=365,tn=new Set("co.uk org.uk ac.uk gov.uk me.uk ltd.uk plc.uk net.uk com.au net.au org.au edu.au gov.au co.nz org.nz net.nz co.jp ne.jp or.jp ac.jp go.jp co.kr or.kr com.cn net.cn org.cn com.hk com.tw com.sg com.my co.in net.in org.in co.id co.th com.ph com.vn com.br net.br org.br com.ar com.mx com.co com.pe com.tr com.ua com.pl co.za co.il com.eg com.sa com.ng co.ke github.io gitlab.io vercel.app netlify.app herokuapp.com pages.dev workers.dev web.app firebaseapp.com azurewebsites.net cloudfront.net appspot.com onrender.com fly.dev glitch.me repl.co blogspot.com wordpress.com myshopify.com vercel.dev netlify.com surge.sh render.com railway.app koyeb.app deno.dev ngrok.io ngrok-free.app trycloudflare.com cloudfunctions.net run.app s3.amazonaws.com elasticbeanstalk.com azurestaticapps.net wixsite.com webflow.io framer.app bubbleapps.io".split(" ")),nn=new Set("co com net org edu gov gob go ac or ne ltd plc sch mil nom".split(" "));function sn(n){let e=n.toLowerCase().split(".");for(let t=1;t<e.length-1;t++)if(tn.has(e.slice(t).join("."))||t===e.length-2&&e[t+1].length===2&&nn.has(e[t]))return e.slice(t-1).join(".")}function rn(n=location.hostname){if(/^[\d.]+$/.test(n)||n.includes(":"))return;let e=n.split(".");for(let t=e.length-2;t>=0;t--){let s=e.slice(t).join(".");if(document.cookie=`__lc_probe=1; Domain=${s}; Path=/; Max-Age=10; SameSite=Lax`,document.cookie.includes("__lc_probe=1"))return document.cookie=`__lc_probe=; Domain=${s}; Path=/; Max-Age=0`,s}return sn(n)}var X=class{constructor(e={}){this.o=e}o;domain=null;attr(){return this.domain===null&&(this.domain=this.o.domain??(this.o.crossSubdomain?rn():void 0)),this.domain?`; Domain=${this.domain}`:""}get(e){for(let t of document.cookie.split("; ")){let s=t.indexOf("=");if(t.slice(0,s)===e)try{return decodeURIComponent(t.slice(s+1))}catch{return null}}return null}set(e,t){let s=this.o.secure??location.protocol==="https:"?"; Secure":"",r=Math.round((this.o.expiryDays??en)*86400);document.cookie=`${e}=${encodeURIComponent(t)}; Max-Age=${r}; Path=/${this.attr()}; SameSite=Lax${s}`}remove(e){document.cookie=`${e}=; Max-Age=0; Path=/${this.attr()}; SameSite=Lax`}},A=class{constructor(e="localStorage"){this.kind=e}kind;store(){try{return globalThis[this.kind]}catch{return}}get(e){try{return this.store()?.getItem(e)??null}catch{return null}}set(e,t){try{this.store()?.setItem(e,t)}catch{}}remove(e){try{this.store()?.removeItem(e)}catch{}}},be=class extends A{constructor(){super("localStorage")}},on=["lc_identity","lc_session","lc_device_id","lc_consent","lc_person_identified"],_e=class{constructor(e,t,s){this.cookie=e;this.local=t;this.cookieKeys=s}cookie;local;cookieKeys;get(e){let[t,s]=this.cookieKeys(e)?[this.cookie,this.local]:[this.local,this.cookie];return t.get(e)??s.get(e)}set(e,t){this.local.set(e,t),this.cookieKeys(e)?this.cookie.set(e,t):this.cookie.remove(e)}remove(e){this.local.remove(e),this.cookie.remove(e)}},ee=class{constructor(e,t){this.inner=e;this.delayMs=t}inner;delayMs;pending=new Map;timer;get(e){return this.pending.has(e)?this.pending.get(e)??null:this.inner.get(e)}set(e,t){this.queue(e,t)}remove(e){this.queue(e,null)}queue(e,t){this.pending.set(e,t),this.timer??=setTimeout(()=>this.flush(),this.delayMs)}flush(){clearTimeout(this.timer),this.timer=void 0;for(let[e,t]of this.pending)t===null?this.inner.remove(e):this.inner.set(e,t);this.pending.clear()}},Se=class{constructor(e,t){this.inner=e;this.suffix=t}inner;suffix;get(e){return this.inner.get(e+this.suffix)}set(e,t){this.inner.set(e+this.suffix,t)}remove(e){this.inner.remove(e+this.suffix)}},xe=n=>`_${n.replace(/\W/g,"").slice(-8)}`;function te(n,e,t){if(n==="memory"||n==="none")return new ve;let s=xe(e),r=n==="cookie"?new X(t):n==="localStorage+cookie"?new _e(new X(t),new be,o=>on.some(a=>o===a+s)):new A(n);return new Se(r,s)}async function an(n){if(!(typeof CompressionStream>"u"||typeof Response>"u"))try{let e=new Response(n).body?.pipeThrough(new CompressionStream("gzip"));return e?new Uint8Array(await new Response(e).arrayBuffer()):void 0}catch{return}}function yt(n,e={}){let t=e.compress??!0,s=(r,o)=>(e.onError?.({url:r,status:o}),{status:o});return{async send(r,o,a){if(a?.beacon&&!e.disableBeacon&&typeof navigator<"u"&&navigator.sendBeacon)return navigator.sendBeacon(r,new Blob([o],{type:"text/plain"}))?{status:200}:s(r,0);try{let u=t&&o.length>=1024?await an(o):void 0,p=await n(u?`${r}${r.includes("?")?"&":"?"}compression=gzip`:r,{method:"POST",body:u??o,headers:{...e.headers,"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:(u?.length??o.length)<6e4});return p.status>=400?s(r,p.status):{status:p.status}}catch{return s(r,0)}}}}var ke={send:async()=>({status:200})};var cn="lucida-browser",dn="0.1.0",we="lc_internal",ln=3e3,vt="https://app.lucida.dev",Ce=n=>!!n&&typeof n=="object"&&Object.getPrototypeOf(n)===Object.prototype;function Pe(n,e={},t=[]){let s=!!e.debug||typeof location<"u"&&/[?&]__(lc|lucida)_debug=(1|true)/.test(location.search),r=(...i)=>{s&&console.debug("[lucida]",...i)},o=(e.apiHost??vt).replace(/\/+$/,""),a=Object.fromEntries(Object.entries(e).map(([i,c])=>[i,Ce(c)?{...c}:c]));a.apiHost=o;let u=e.extension??it(),p=i=>u&&(i==="cookie"||i==="localStorage+cookie")?e.extensionPersistence??"localStorage":i,h=p(e.cookieless==="always"?"none":e.persistence??"cookie"),m=[o,...e.flagsApiHost?[e.flagsApiHost.replace(/\/+$/,"")]:[]],_=e.fetch??((...i)=>fetch(...i)),C=i=>ot(i,_,m,e.rewritePath),g=C(ke).fetch,v=e.consent?.respectDnt,b=navigator.globalPrivacyControl===!0,S=(e.respectDnt??v)===!0&&navigator.doNotTrack==="1"||(e.respectGpc??v)===!0&&b,$e=e.blockBots!==!1&&typeof navigator<"u"&&Xe(navigator.userAgent??""),k=!!e.disabled||$e;$e&&r("bot user agent: capture disabled");let ne,se=C(e.transport??yt(_,{headers:a.requestHeaders,onError:e.onRequestError,disableBeacon:e.disableBeacon})).transport;if(!e.transport&&e.offlineQueue!==!1&&h!=="memory"&&h!=="none"){let i=new $(new A(h==="sessionStorage"?"sessionStorage":"localStorage"),()=>l.hasConsent("analytics"));se=ne=le(se,i,{key:`lc_offline${xe(n)}`,isOnline:()=>navigator.onLine!==!1})}let B=k?void 0:pt(e.crossDomains),Ie=te(k?"memory":h,n,e.cookie),re=(e.storageWriteDelayMs??0)>0?new ee(Ie,e.storageWriteDelayMs):void 0,Oe=B?.sessionId??e.bootstrap?.sessionId,ie,q=!1,Ee,oe=[],l=new D({apiKey:n,apiHost:o,transport:k?ke:se,storage:re??Ie,...e.consentPersistence&&!k?{consentStorage:te(p(e.consentPersistence),n,e.cookie)}:{},persistProperty:i=>!a.persistedProperties||a.persistedProperties.includes(i),...h==="none"?{cookieless:!0}:{},library:{name:cn,version:dn},consent:{...e.cookieless==="on_reject"?{cookielessOnReject:!0}:{},...e.consent,...e.consent?.geo&&!k?{awaitRemote:!0}:{},respectDnt:!0,dnt:S},queue:{...e.flushAt?{flushAt:e.flushAt}:{},...e.flushIntervalMs?{flushIntervalMs:e.flushIntervalMs}:{}},...B||e.bootstrap?.distinctId?{bootstrapDistinctId:B?.distinctId??e.bootstrap?.distinctId}:{},...e.bootstrap?.isIdentified&&!B?{bootstrapIdentified:!0}:{},session:{...e.session,...Oe?{bootstrapId:Oe}:{}},enrich:(i,c)=>{let d=lt(i,c,a.customCampaignParams,e.capturePageview==="hash");if(o!==vt&&(d.properties={...d.properties,$lib_custom_api_host:o}),oe.length){let I=l.sessionId;for(let bt of oe)d.properties={...d.properties,...bt(I)}}let y=Ee?.()??{},P=Object.keys(y);return P.length&&(d.properties={...d.properties,$click_ids:y},i==="$pageview"&&(d.$set_once={...Object.fromEntries(P.map(I=>[`$initial_${I}`,y[I]])),...d.$set_once},d.$set=Object.fromEntries(P.map(I=>[`$last_${I}`,y[I]])))),a.sendFeatureFlags!==!1&&i!=="$snapshot"&&ie&&(d.properties={...ue(ie.all()),...d.properties}),q?{...d,properties:{...d.properties,$internal:!0}}:d},campaignKey:dt,log:r});q=l.storage.get(we)==="1",e.clickIds!==!1&&(Ee=tt(l.storage,e.clickIds?.expiryDays));let x=mt(l,a,r);e.bootstrap?.isIdentified&&x.markIdentified();let T=i=>x.blocksPersonWrites?(r(`personProfiles=never: ${i} ignored`),!0):!1,Re=[],O=[st(r,e.nonce)],Ae=l.storage;if(e.flagPersistence&&!k){let i=new $(te(p(e.flagPersistence),n,e.cookie),()=>l.hasConsent("analytics"));l.onChange(c=>{c==="consent"&&(l.hasConsent("analytics")?i.flushBuffered():i.discardBuffered())}),Ae=i}let H=i=>{if(k)return;if(l.hasConsent("analytics"))return i();let c=!1;l.onChange(d=>{!c&&d==="consent"&&l.hasConsent("analytics")&&(c=!0,i())})},Te,f={core:l,client:void 0,config:a,flagStorage:Ae,apiKey:n,log:r,fetch:g,onUnload:i=>{Re.push(i)},whenConsented:H,onCapture:i=>l.onCaptured(i),eventExtras:oe,clickExtras:[],flagPersonProps:[],loadConfig:()=>Te??=new Promise(i=>H(()=>{g(`${o}/v1/config?api_key=${encodeURIComponent(n)}`).then(c=>c.ok?c.json():null).then(c=>(c&&l.applyRemote(c),c)).then(i,()=>i(null))}))};if(l.consent.resolving){let i=g(`${o}/v1/config?api_key=${encodeURIComponent(n)}`,{credentials:"omit"}).then(d=>d.ok?d.json():null).catch(()=>null);Te=i;let c=setTimeout(()=>l.applyRemote({}),ln);i.then(d=>{clearTimeout(c),l.applyRemote(d??{})})}let Me=de(l,{apiHost:o,apiKey:n,fetch:g,whenConsented:H,log:r,disabled:k});O.push(()=>Me.stop());let U={get distinctId(){return l.distinctId},capture:(i,c,d)=>{l.capture(i,c,d?.timestamp!==void 0?{timestamp:d.timestamp}:{})&&(d?.sendInstantly||d?.transport)&&l.flush(d.transport==="beacon"?{beacon:!0}:{})},identify:(i,c,d)=>{T("identify")||(x.markIdentified(),l.identify(i,c,d))},alias:(i,c)=>{T("alias")||(x.markIdentified(),l.alias(i,c))},reset:i=>{l.reset({resetDeviceId:!!i,reuseAnonymousId:!!e.reuseAnonymousId}),x.reset()},createPersonProfile:()=>{T("createPersonProfile")||x.isProfile||(x.markIdentified(),l.capture("$set",{}))},setConfig:i=>{let c=a;for(let[d,y]of Object.entries(i)){let P=c[d];Ce(P)&&Ce(y)?Object.assign(P,y):c[d]=y}"debug"in i&&(s=!!i.debug)},setPersonProperties:(i,c)=>{!i&&!c||T("setPersonProperties")||(x.markIdentified(),l.capture("$set",{},{...i?{$set:i}:{},...c?{$set_once:c}:{}}))},unsetPersonProperties:i=>{!i.length||T("unsetPersonProperties")||(x.markIdentified(),l.capture("$set",{},{$unset:i}))},getSessionId:()=>l.sessionId,onSessionId:i=>l.onSessionId(c=>i(c)),getProperty:i=>l.getProperty(i),hasOptedOut:()=>!l.hasConsent("analytics"),getReplayUrl:i=>{let d=`${(e.uiHost??o).replace(/\/+$/,"")}/replays/${encodeURIComponent(l.sessionId)}`,y=l.sessionStart;return!i?.withTimestamp||y===void 0?d:`${d}?t=${Math.max(0,Math.round((Date.now()-y)/1e3-(i.timestampLookBackSeconds??10)))}`},debug:(i=!0)=>{s=i},featureView:(i,c)=>{l.capture("$feature_view",{...c,$feature_flag:i},{$set:{[`$feature_view/${i}`]:!0}})},featureInteraction:(i,c)=>{l.capture("$feature_interaction",{...c,$feature_flag:i},{$set:{[`$feature_interaction/${i}`]:!0}})},updateFlags:(i,c,d)=>f.flags?.update(i,c,d?.merge??!0),register:i=>l.register(i),registerOnce:i=>l.registerOnce(i),unregister:i=>l.unregister(i),group:(i,c,d)=>{x.markIdentified(),l.group(i,c,d)},optIn:()=>l.optIn(),optOut:()=>l.optOut(),optOutInternal:(i=!0)=>{q=i,i?l.storage.set(we,"1"):l.storage.remove(we)},get isInternal(){return q},setConsent:i=>l.setConsent(i),getConsent:()=>l.getConsent(),getConsentStatus:i=>l.getConsentStatus(i),consentStatus:()=>l.consentStatus(),getFlag:i=>f.flags?.get(i),getFlagPayload:i=>f.flags?.payload(i),getFlagResult:(i,c)=>f.flags?.result(i,c)??pe(i,void 0,void 0,"not_found"),getLayerParam:(i,c,d)=>f.flags?.layerParam(i,c)??d,isFeatureEnabled:i=>{let c=f.flags?.get(i);return c!==void 0&&c!==!1},onFlags:i=>f.flags?.onChange(i)??(()=>{}),onIntervention:i=>Me.on(i),reloadFlags:()=>f.flags?.reload()??Promise.resolve(),getAllFlags:()=>f.flags?.all()??{},overrideFlags:(i,c)=>f.flags?.override(i,c),setPersonPropertiesForFlags:(i,c)=>f.flags?.setPersonProperties(i,c),resetPersonPropertiesForFlags:()=>f.flags?.resetPersonProperties(),setGroupPropertiesForFlags:(i,c)=>f.flags?.setGroupProperties(i,c),resetGroupPropertiesForFlags:()=>f.flags?.resetGroupProperties(),setContext:(i,c,d)=>f.flags?.setContext(i,c,d),clearContext:i=>f.flags?.clearContext(i),guides:{showChangelog:()=>f.guides?.showChangelog()??0,show:i=>f.guides?.show(i)??!1,reset:i=>f.guides?.reset(i)},ai:{startConversation:i=>new F((c,d)=>U.capture(c,d),i,a.ai?.captureText===!0).start()},earlyAccess:{list:()=>f.earlyAccess?.list()??Promise.resolve([]),optIn:i=>f.earlyAccess?.optIn(i),optOut:i=>f.earlyAccess?.optOut(i)},replay:{start:i=>f.replay?.start(i)??Promise.resolve(),stop:()=>f.replay?.stop(),pause:()=>f.replay?.pause(),resume:()=>f.replay?.resume(),tag:i=>f.replay?.tag(i),isRecording:()=>f.replay?.isRecording()??!1},consent:{showBanner:i=>f.consentUi?.showBanner(i)??Promise.resolve(null),hideBanner:()=>f.consentUi?.hideBanner()},loadToolbar:i=>f.toolbar?.load(typeof i=="string"?i:i.token)??Promise.resolve(!1),activateExperiment:i=>f.experiments?.activate(i),recommendations:(i,c)=>f.recs?.get(i,c)??Promise.resolve({placement:i,strategy:"",items:[],shown(){},clicked(){}}),flush:()=>l.flush(),shutdown:async()=>{for(let i of O)i();re?.flush(),await l.shutdown()}};if(f.client=U,!k){let i=()=>{for(let d of Re)d();re?.flush(),l.flush({beacon:!0})};window.addEventListener("pagehide",i);let c=()=>{document.visibilityState==="hidden"&&l.flush({beacon:!0})};if(document.addEventListener("visibilitychange",c),O.push(()=>{window.removeEventListener("pagehide",i),document.removeEventListener("visibilitychange",c)}),ne){let d=()=>{ne.drain()};window.addEventListener("online",d),O.push(()=>window.removeEventListener("online",d)),H(d)}if(e.captureCspViolations){let d=typeof e.captureCspViolations=="object"?e.captureCspViolations:{};O.push(rt((y,P)=>{l.capture(y,P)},d))}for(let d of t){let y=d(f);y&&O.push(y)}ie=f.flags,at(f,U,o)}return r("initialised",{apiHost:o,consent:l.getConsent()}),U}function Ss(n,e={}){return Pe(n,e)}export{Pe as createClient,Ss as init};
@@ -1,3 +0,0 @@
1
- function Ae(e,t={}){let n=Math.min(t.maxMs??3e4,(t.baseMs??1e3)*2**e);return Math.round(n*(.5+.5*(t.random??Math.random)()))}function st(e){let t="";return n=>{for(t+=n;;){let r=/\r?\n\r?\n/.exec(t);if(!r)return;let i=t.slice(0,r.index);t=t.slice(r.index+r[0].length);let o="message",s,a=[];for(let u of i.split(/\r?\n/)){if(u.startsWith(":"))continue;let l=u.indexOf(":"),[d,g]=l<0?[u,""]:[u.slice(0,l),u.slice(l+1).replace(/^ /,"")];d==="event"?o=g??"":d==="data"?a.push(g??""):d==="id"&&(s=g)}a.length&&e(s===void 0?{event:o,data:a.join(`
2
- `)}:{event:o,data:a.join(`
3
- `),id:s})}}}var U=class{constructor(t){this.o=t}o;ctl;stopped=!0;timer;start(){this.stopped&&(this.stopped=!1,this.loop())}stop(){this.stopped=!0,this.ctl?.abort(),this.timer&&clearTimeout(this.timer),this.o.onState?.(!1)}async loop(){let t=0;for(;!this.stopped;){try{await this.connectOnce()&&(t=0)}catch(r){this.stopped||this.o.log?.("flag stream error",r)}if(this.o.onState?.(!1),this.stopped)return;let n=Ae(t++,this.o.backoff);await new Promise(r=>{this.timer=setTimeout(r,n),this.timer.unref?.()})}}async connectOnce(){this.ctl=new AbortController;let t=await this.o.fetch(this.o.url,{headers:{Authorization:`Bearer ${this.o.secretKey}`,Accept:"text/event-stream"},signal:this.ctl.signal});if(!t.ok||!t.body)throw new Error(`stream status ${t.status}`);this.o.onState?.(!0);let n=st(i=>{if(i.event==="definitions")try{this.o.onChange(JSON.parse(i.data).etag)}catch{this.o.onChange(void 0)}}),r=t.body.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:i,value:o}=await r.read();if(i)return!0;n(o)}}};function Y(e){let t=!1,n,r=new U({url:`${e.apiHost}/v1/flags/stream`,secretKey:e.apiKey,fetch:e.fetch,...e.backoff?{backoff:e.backoff}:{},...e.log?{log:e.log}:{},onState:l=>t=l,onChange:l=>{l!==void 0&&l===n||(n=l,e.reload())}}),i=()=>e.visibility?.hidden()??!1,o=e.pollMs??6e4,s=o>0?setInterval(()=>!t&&!i()&&e.reload(),o):void 0,a=()=>{i()?r.stop():(r.start(),e.reload())};i()||r.start();let u=e.visibility?.subscribe(a);return()=>{r.stop(),u?.(),s&&clearInterval(s)}}var at=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),E=(e,t)=>e>>>t|e<<32-t;function $e(e){let t=new TextEncoder().encode(e),n=t.length+9+63>>6<<6,r=new Uint8Array(n);r.set(t),r[t.length]=128;let i=new DataView(r.buffer);i.setUint32(n-8,Math.floor(t.length*8/2**32)),i.setUint32(n-4,t.length*8>>>0);let o=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],s=new Uint32Array(64);for(let a=0;a<n;a+=64){for(let l=0;l<16;l++)s[l]=i.getUint32(a+l*4);for(let l=16;l<64;l++){let d=s[l-15],g=s[l-2],m=E(d,7)^E(d,18)^d>>>3,b=E(g,17)^E(g,19)^g>>>10;s[l]=s[l-16]+m+s[l-7]+b|0}let u=o.slice();for(let l=0;l<64;l++){let[d,g,m,,b,k,y,R]=u,P=R+(E(b,6)^E(b,11)^E(b,25))+(b&k^~b&y)+at[l]+s[l]|0,A=(E(d,2)^E(d,13)^E(d,22))+(d&g^d&m^g&m)|0;u.pop(),u.unshift(P+A|0),u[4]=u[4]+P|0}for(let l=0;l<8;l++)o[l]=o[l]+u[l]|0}return o.map(a=>(a>>>0).toString(16).padStart(8,"0")).join("")}var ct=/^(0|[1-9]\d{0,2})$/,lt=/^[0-9a-fA-F]{1,4}$/,ut=/^(0|[1-9]\d*)$/;function je(e){let t=e.split(".");if(t.length!==4)return;let n=[];for(let r of t){if(!ct.test(r)||Number(r)>255)return;n.push(Number(r))}return n}function ft(e){if(e.includes("%"))return;let t=e,n=e.lastIndexOf(":"),r=e.slice(n+1);if(r.includes(".")){let d=je(r);if(!d)return;t=`${e.slice(0,n+1)}${(d[0]<<8|d[1]).toString(16)}:${(d[2]<<8|d[3]).toString(16)}`}let i=t.split("::");if(i.length>2)return;let o=d=>{if(d==="")return[];let g=[];for(let m of d.split(":")){if(!lt.test(m))return;g.push(parseInt(m,16))}return g},s=o(i[0]),a=i.length===2?o(i[1]):[];if(!s||!a)return;let u=s.length+a.length;return(i.length===2?u>7:u!==8)?void 0:[...s,...Array(8-u).fill(0),...a].flatMap(d=>[d>>8,d&255])}function Me(e){return e.includes(":")?ft(e):je(e)}var dt=e=>e.length===16&&e.slice(0,10).every(t=>t===0)&&e[10]===255&&e[11]===255;function Ve(e){if(typeof e!="string")return;let t=Me(e.trim());return t&&dt(t)?t.slice(12):t}function pt(e){let t=typeof e=="string"?[e]:Array.isArray(e)?e:[],n=[];for(let r of t){if(typeof r!="string")continue;let i=r.trim(),o=i.indexOf("/");if(o<0){let u=Ve(i);u&&n.push({bytes:u,bits:u.length*8});continue}let s=Me(i.slice(0,o)),a=i.slice(o+1);!s||!ut.test(a)||Number(a)>s.length*8||n.push({bytes:s,bits:Number(a)})}return n}function gt(e,t){if(e.bytes.length!==t.length)return!1;for(let n=0;n<e.bits;n+=8){let i=255<<8-Math.min(8,e.bits-n)&255,o=n/8;if((e.bytes[o]&i)!==(t[o]&i))return!1}return!0}function Te(e,t,n,r){switch(e){case"array_contains_any":case"array_contains_all":case"array_contains_none":{if(!Array.isArray(t)||!Array.isArray(n))return!1;let i=n.filter(o=>t.some(s=>r(s,o))).length;return e==="array_contains_any"?i>0:e==="array_contains_all"?i===n.length:i===0}case"ip_in_cidr":case"ip_not_in_cidr":{let i=Ve(t),o=pt(n);return!i||!o.length?!1:o.some(s=>gt(s,i))===(e==="ip_in_cidr")}}return!1}var mt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,Ie=/^\d{4}-\d{2}-\d{2}$/,vt=/^-?(\d{1,6})([hdwmy])$/,yt={h:3600,d:86400,w:604800,m:2592e3,y:31536e3};function bt(e){let t=vt.exec(e.trim());return t?Number(t[1])*yt[t[2]]:void 0}function qe(e,t,n){if(typeof e=="number")return e*1e3;if(typeof e!="string")return;let r=e.trim();if(n){let o=bt(r);if(o!==void 0)return t-o*1e3}if(!mt.test(r)&&!Ie.test(r))return;let i=Date.parse(Ie.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(i)?void 0:i}function De(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=e[n]??0,i=t[n]??0;if(r!==i)return r<i?-1:1}return 0}function ht(e,t,n){if(typeof t!="string")return;let r=t.trim().replace(/^v/,"").split(".");if(e==="semver_wildcard"){let l=r[r.length-1];if(l!=="*"&&l!=="x"&&l!=="X")return;if(r.length===1)return[[0],[2**30]];let d=n.parseVersion(r.slice(0,-1).join("."));if(!d)return;let g=[...d];return g[g.length-1]=g[g.length-1]+1,[d,g]}let i=n.parseVersion(t);if(!i)return;for(;i.length<3;)i.push(0);let[o,s,a]=i,u;return e==="semver_tilde"&&r.length===1?u=[o+1,0,0]:e==="semver_tilde"||o===0&&s>0?u=[o,s+1,0]:o>0?u=[o+1,0,0]:u=[0,0,a+1],[i,u]}function Ne(e,t,n,r,i){switch(e){case"icontains":case"not_icontains":case"starts_with":case"not_starts_with":case"ends_with":case"not_ends_with":return typeof t!="string"||typeof n!="string"?!1:e.endsWith("icontains")?t.toLowerCase().includes(n.toLowerCase())===(e==="icontains"):e.endsWith("starts_with")?t.startsWith(n)===(e==="starts_with"):t.endsWith(n)===(e==="ends_with");case"between":case"not_between":{let o=i.toFloat(t);if(!Array.isArray(n)||n.length!==2||o===void 0)return!1;let[s,a]=n;return typeof s!="number"||typeof a!="number"?!1:(o>=s&&o<=a)==(e==="between")}case"is_date_before":case"is_date_after":{let o=qe(t,r,!1),s=qe(n,r,!0);return o===void 0||s===void 0?!1:e==="is_date_before"?o<s:o>s}case"semver_eq":case"semver_neq":case"semver_gt":case"semver_gte":case"semver_lt":case"semver_lte":{let o=i.cmpVersion(t,n);if(o===void 0)return!1;let s=e.slice(7);return s==="eq"?o===0:s==="neq"?o!==0:s==="gt"?o>0:s==="gte"?o>=0:s==="lt"?o<0:o<=0}case"semver_tilde":case"semver_caret":case"semver_wildcard":{let o=i.parseVersion(t),s=ht(e,n,i);return!!o&&!!s&&De(o,s[0])>=0&&De(o,s[1])<0}}return!1}var _t=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function X(e){if(typeof e=="number")return e;if(typeof e=="string"&&_t.test(e.trim()))return Number(e.trim())}function Z(e,t){let n=typeof e=="number",r=typeof t=="number";return n||r?n&&r&&e===t:e===t}function Q(e){if(typeof e!="string")return;let t=e.trim().replace(/^v/,""),n=t.search(/[-+]/);n>=0&&(t=t.slice(0,n));let r=[];for(let i of t.split(".")){if(!/^[+-]?\d+$/.test(i))return;let o=parseInt(i,10);if(o<0)return;r.push(o)}return r}function z(e,t){let n=Q(e),r=Q(t);if(!(!n||!r)){for(let i=0;i<Math.max(n.length,r.length);i++){let o=n[i]??0,s=r[i]??0;if(o!==s)return o<s?-1:1}return 0}}var xt=(e,t)=>e<t?-1:e>t?1:0;function C(e,t,n,r,i,o=Date.now()){let s=n&&t!==null&&t!==void 0;if(e==="is_set")return s;if(e==="is_not_set")return!s;if(!s)return!1;switch(e){case"eq":case"neq":{let a;if(i){let u=z(t,r);if(u===void 0)return!1;a=u===0}else a=Z(t,r);return a===(e==="eq")}case"contains":case"ncontains":case"regex":case"nregex":{if(typeof t!="string"||typeof r!="string")return!1;if(e==="contains"||e==="ncontains")return t.includes(r)===(e==="contains");let a;try{a=new RegExp(r)}catch{return!1}return a.test(t)===(e==="regex")}case"gt":case"gte":case"lt":case"lte":{let a;if(i)a=z(t,r);else{let u=X(t),l=X(r);a=u===void 0||l===void 0?void 0:xt(u,l)}return a===void 0?!1:e==="gt"?a>0:e==="gte"?a>=0:e==="lt"?a<0:a<=0}case"in":case"not_in":return Array.isArray(r)?r.some(a=>Z(t,a))===(e==="in"):!1}return e.startsWith("array_")||e.startsWith("ip_")?Te(e,t,r,Z):Ne(e,t,r,o,{toFloat:X,parseVersion:Q,cmpVersion:z})}function te(e){return e.properties?.length?`${e.key}|${JSON.stringify(e.properties.map(t=>[t.key,t.op,t.value??null]))}`:e.key}function Le(e,t,n=Date.now()){return(e.properties??[]).every(r=>C(r.op,t[r.key],Object.hasOwn(t,r.key),r.value,!1,n))}function ne(e,t){let n=t[e.scope??"session"]?.[te(e)]??0;return e.op==="is_set"?n>0:e.op==="is_not_set"?n===0:C(e.op,n,!0,e.value,!1)}var He=e=>(e??[]).filter(t=>t.type==="event");function Ke(e,t,n){for(let o of e.runtime??[])if(o.filters.every(a=>{if(a.type!=="flag")return ne(a,t);let u=n(a.key);return!!u&&C(a.op,u.value,!0,a.value,!1)}))return Ke(o.result,t,n);if(!e.runtime)return e;let{runtime:r,...i}=e;return i}function re(e,t){let n={},r=new Map,i=o=>{if(r.get(o)===2)return n[o];let s=e[o];if(!s||r.get(o)===1)return;r.set(o,1);let a=Ke(s,t,i);return n[o]=a,r.set(o,2),a};for(let o of Object.keys(e))i(o);return n}function B(e,t){let n=[],r=o=>{o.type==="event"&&o.properties?.length&&n.push(o)};for(let o of e??[])for(let s of o.conditions)for(let a of s.filters??[])r(a);let i=o=>{for(let s of o.runtime??[])s.filters.forEach(r),i(s.result)};return Object.values(t).forEach(i),n}var ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function G(e,t){if(!ee(t))return t;let n=ee(e)?{...e}:{};for(let[r,i]of Object.entries(t))i===null?delete n[r]:n[r]=G(n[r],i);return n}var q=class{session={};page={};sid="";constructor(t){if(t&&typeof t.sid=="string"&&ee(t.session)){this.sid=t.sid;for(let[n,r]of Object.entries(t.session))typeof r=="number"&&r>0&&(this.session[n]=r)}}record(t,n,r={},i=[]){n!==this.sid&&(this.sid=n,this.session={},this.page={}),t==="$pageview"&&(this.page={});let o=new Set([t]);for(let s of i)s.type==="event"&&s.key===t&&s.properties?.length&&Le(s,r)&&o.add(te(s));for(let s of o)this.session[s]=(this.session[s]??0)+1,this.page[s]=(this.page[s]??0)+1}counts(t){return t===this.sid?{session:{...this.session},page:{...this.page}}:{session:{},page:{}}}saved(){return{sid:this.sid,session:{...this.session}}}};function Ue(e,t){let n=t?e.contexts?.[t]:void 0;if(n)return n;if(t==="user")return{key:e.bucketing_key||e.distinct_id,properties:e.person_properties};if(t==="device")return{key:e.device_id,properties:e.device_properties}}var kt=["user","device","org"],Rt=16**13;function D(e,t,n,r=!1){let i=r?`${e}.${t}.variant.${n}`:`${e}.${t}.${n}`;return parseInt($e(i).slice(0,13),16)/Rt}var w=(e,t=-1)=>({value:!1,reason:e,condition_index:t});function wt(e,t){return typeof t=="boolean"?typeof e=="boolean"?e===t:t:e===t}function Ft(e,t,n){let r=t.now?Date.parse(t.now):NaN,i=Number.isNaN(r)?Date.now():r,o;switch(e.type){case"person":o=t.person_properties;break;case"group":o=t.group_properties?.[e.group_type??""];break;case"device":o=t.device_properties;break;case"geo":o=t.geo_properties;break;case"context":if(!kt.includes(e.context_kind??""))return!1;o=Ue(t,e.context_kind)?.properties;break;case"app_version":return C(e.op,t.app_version,!!t.app_version,e.value,!0,i);case"flag":{let s=n[e.key];return!!s&&C(e.op,s.value,!0,e.value,!1,i)}default:return!1}return C(e.op,o?.[e.key],!!o&&Object.hasOwn(o,e.key),e.value,!1,i)}function St(e,t,n){let r=e.variants;if(t.variant_override){let s=r.find(a=>a.key===t.variant_override);if(s)return s}let i=D(e.key,e.salt,n,!0)*100,o=0;for(let s of r)if(o+=s.rollout_pct,i<o)return s;return r[r.length-1]}function Be(e,t){return Ge(e.aggregation,t)}function Ge(e,t){return e.kind==="group"?t.groups?.[e.group_type??""]:e.kind==="device"?t.device_id:e.kind==="context"?Ue(t,e.context_kind)?.key:t.bucketing_key||t.distinct_id}function Et(e,t,n,r){let i=e.sticky?r.sticky_assignments?.[e.key]:void 0;if(i===void 0)return;let o={value:!0,reason:"sticky_bucket",condition_index:n};if(e.type==="multivariate"&&e.variants?.length){if(e.variants.some(a=>a.key===t.variant_override))return;let s=e.variants.find(a=>a.key===i);return s?(o.value=o.variant=s.key,J(o,s.payload,t)):void 0}if(i===!0)return J(o,e.type==="json"?e.payload:void 0,t)}function J(e,t,n){let r=n.payload_patch===void 0||n.payload_patch===null?t:G(t,n.payload_patch);return r!==void 0&&(e.payload=r),e}var oe=(e,t)=>t.length?{...e,runtime:t}:e;function Ot(e,t){return!e.app_contexts?.length||!t.app_contexts?.length?!0:e.app_contexts.some(n=>t.app_contexts?.includes(n))}function Je(e,t,n={}){if(!Ot(e,t))return w("app_context_excluded");if(!e.active)return w("inactive");if(e.kill_switch)return w("kill_switch");let r=!1;for(let u of e.prerequisites??[]){let l=n[u.flag];if(!l)return w("prerequisite_missing");if(l.reason==="requires_server")r=!0;else if(l.reason==="prerequisite_cycle"||!wt(l.value,u.value))return w("prerequisite_failed")}if(r)return w("requires_server");let i=Be(e,t),o=e.conditions.some(u=>u.aggregation);if(!i&&(!o||e.holdout||e.namespace))return w("no_bucketing_key");if(e.holdout&&D("holdout",e.holdout.salt,i??"")*100<e.holdout.percentage)return w("holdout");if(e.namespace&&e.namespace.total>0){let u=Math.floor(D("namespace",e.namespace.salt,i??"")*e.namespace.total);if(u<e.namespace.start||u>=e.namespace.end)return w("namespace_excluded")}let s=0,a=[];for(let[u,l]of e.conditions.entries()){let d=l.aggregation?Ge(l.aggregation,t):i;if(!d){s++;continue}let g=!1,m=!0,b=!1;for(let y of l.filters??[]){if(y.type==="event"){if(t.runtime_events===void 0)b=!0;else if(!ne(y,t.runtime_events)){m=!1;break}continue}let R=y.type==="cohort"?t.cohorts?.[y.key]:void 0;if(R!==void 0){if(R===(y.op==="not_in"||y.op==="neq")){m=!1;break}}else if(y.type==="cohort"||y.type==="flag"&&n[y.key]?.reason==="requires_server")g=!0;else if(!Ft(y,t,n)){m=!1;break}}if(!m)continue;if(g)return oe(w("requires_server",u),a);let k=Pt(e,l,u,t,d);if(k)if(b)a.push({filters:He(l.filters),result:k});else return oe(k,a)}return oe(w(s>0&&s===e.conditions.length?"no_bucketing_key":"no_condition_match"),a)}function Pt(e,t,n,r,i){let o=t.aggregation?void 0:Et(e,t,n,r);if(o)return o;if(D(e.key,e.salt,i)*100>=t.rollout_pct)return e.early_exit?w("out_of_rollout",n):void 0;let s={value:!0,reason:"condition_match",condition_index:n};if(e.type==="multivariate"&&e.variants?.length){let a=St(e,t,i);return s.value=s.variant=a.key,J(s,a.payload,t)}return J(s,e.type==="json"?e.payload:void 0,t)}function We(e){return[...(e.prerequisites??[]).map(t=>t.flag),...e.conditions.flatMap(t=>(t.filters??[]).filter(n=>n.type==="flag").map(n=>n.key))]}function se(e,t){let n=new Map(e.map(s=>[s.key,s])),r={},i=new Map,o=s=>{let a=n.get(s);if(!a||i.has(s))return;i.set(s,1);let u=!1;for(let l of We(a))o(l),(i.get(l)===1||r[l]?.reason==="prerequisite_cycle")&&(u=!0);r[s]=u?w("prerequisite_cycle"):At(a,t,r),i.set(s,2)};for(let s of e)o(s.key);return r}var Ct=4;function At(e,t,n){let r=[];for(let i of We(e))!r.includes(i)&&n[i]?.runtime?.length&&r.length<Ct&&r.push(i);return ie(e,t,n,r)}function ie(e,t,n,r){let[i,...o]=r;if(i===void 0)return Je(e,t,n);let s=ie(e,t,n,o),a=n[i],u=new Set([a.value]),l=[];for(let b of Ye(a)){if(u.has(b.value))continue;u.add(b.value);let k=ie(e,t,{...n,[i]:b},o);Xe(k,s)||l.push({filters:[{type:"flag",key:i,op:"eq",value:b.value}],result:k})}let d=[...l,...s.runtime??[]],{runtime:g,...m}=s;return d.length?{...m,runtime:d}:m}function Ye(e){return(e.runtime??[]).flatMap(t=>{let{runtime:n,...r}=t.result;return[r,...Ye(t.result)]})}function Xe(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let n=e,r=t,i=new Set([...Object.keys(n),...Object.keys(r)]);for(let o of i)if(!Xe(n[o],r[o]))return!1;return!0}var ae=e=>e.reason==="requires_server",ce=e=>e.reason!=="app_context_excluded";function le(e,t,n,r){return{key:e,value:t,enabled:t!==void 0&&t!==!1,...typeof t=="string"?{variant:t}:{},...n!==void 0?{payload:n}:{},reason:t===void 0?"not_found":r}}var N=class{constructor(t,n=Date.now){this.ttlMs=t;this.now=n}ttlMs;now;stamp;mark(t){return this.stamp={at:this.now(),id:t}}restore(t){typeof t?.at=="number"&&typeof t.id=="string"&&(this.stamp={at:t.at,id:t.id})}fresh(t){return!!this.ttlMs&&this.ttlMs>0&&!!this.stamp&&this.stamp.id===t&&this.now()-this.stamp.at<this.ttlMs}clear(){this.stamp=void 0}};var $t="lc_preview",ue="lc_preview";function jt(e){let t={};for(let n of(e??"").split(",")){let r=n.indexOf(":");r>0&&r<n.length-1&&(t[n.slice(0,r)]=n.slice(r+1))}return t}function Ze(e){let t=new URL(e).searchParams.get($t),n=null;try{n=sessionStorage.getItem(ue)}catch{}return{forced:jt(t==="off"?null:t??n),persist(){try{t==="off"?sessionStorage.removeItem(ue):t&&sessionStorage.setItem(ue,t)}catch{}}}}var fe=["gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","igshid","msclkid","ttclid","li_fat_id","twclid","mc_cid"];var de=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];var pe="lc_flag_initial";function Mt(e){try{return e?new URL(e).hostname:""}catch{return""}}function Vt(){let e=new URLSearchParams(location.search),t={$initial_referrer:document.referrer||"$direct",$initial_referring_domain:Mt(document.referrer)||"$direct",$initial_current_url:location.href.split("#")[0]};for(let n of[...de,...fe]){let r=e.get(n);r&&(t[`$initial_${n}`]=r)}return t}function ze(e,t){if(typeof location>"u")return{};let n=e.get(pe);if(n)try{return JSON.parse(n)}catch{}let r=Vt();return t(()=>{e.get(pe)||e.set(pe,JSON.stringify(r))}),r}function Tt(){let e=navigator.userAgent,t=/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":/Firefox\//.test(e)?"Firefox":/Chrome\/|CriOS/.test(e)?"Chrome":/Safari\//.test(e)?"Safari":"Other",n=/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/iPhone|iPad|iPod/.test(e)?"iOS":/Mac OS X/.test(e)?"Mac OS X":/CrOS/.test(e)?"Chrome OS":/Linux/.test(e)?"Linux":"Other";return{browser:t,os:n}}function Qe(){if(typeof location>"u"||typeof navigator>"u")return{};let e={},t=new URLSearchParams(location.search);for(let i of[...de,...fe]){let o=t.get(i);o&&(e[`$${i}`]=o)}let{browser:n,os:r}=Tt();return e.$browser=n,e.$os=r,e.$device_type=String(ge().$device_type??"Desktop"),e}function ge(){if(typeof window>"u")return{};let e=window.innerWidth;return{$viewport_width:e,$viewport_height:window.innerHeight,$screen_width:screen.width,$screen_height:screen.height,$browser_language:navigator.language,$device_type:e<768?"Mobile":e<1024?"Tablet":"Desktop"}}function me(e){return typeof e=="object"?e.value??e.variant??!!e.enabled:e}function ve(e){let t={value:me(e),reason:e.reason??"remote",condition_index:e.condition_index??-1};return e.variant&&(t.variant=e.variant),e.payload!==void 0&&(t.payload=e.payload),e.runtime?.length&&(t.runtime=e.runtime.map(n=>({filters:n.filters,result:ve(n.result)}))),t}var et="lc_rt_events",tt=e=>!!e?.some(t=>t.conditions.some(n=>n.filters?.some(r=>r.type==="event")));function nt(e,t){let n;try{let s=e.flagStorage.get(et);s&&(n=JSON.parse(s))}catch{}let r=new q(n),i={},o=B(t,i);return{counts:()=>r.counts(e.core.sessionId),setServer(s){i=s,o=B(t,i)},server:()=>i,drop(s){for(let a of s)delete i[a]},resolved(){return re(i,r.counts(e.core.sessionId))},record(s,a,u){r.record(s,e.core.sessionId,a,o),u&&e.whenConsented(()=>e.flagStorage.set(et,JSON.stringify(r.saved())))}}}var rt="lc_flags",ye="lc_flag_overrides_api";function ot(e){try{let t=localStorage.getItem("lc_flag_overrides");return t?JSON.parse(t)[e]:void 0}catch{return}}var kn=e=>{let{core:t,config:n}=e,r={},i={},o={},s,a=!1,u=0,l=new Set,d=new Set,g="",m={},b=()=>Object.keys(m).length>0,k={},y={},R={},P=new Set,A=typeof location>"u"?{forced:{},persist(){}}:Ze(location.href),it=Object.keys(A.forced).length>0,$=()=>({...r,...R}),h=e.config.flagOptions??{},j=new N(h.cacheTtlMs),be=(e.config.flagsApiHost??e.config.apiHost).replace(/\/+$/,""),he=h.keys?.length?new Set(h.keys):void 0,_e=c=>he?Object.fromEntries(Object.entries(c).filter(([f])=>he.has(f))):c,I=(c,f,p=!0)=>{if(r=_e(c),i=_e(f),a=!0,p)for(let v of P)v($())},M=nt(e,n.localFlags),xe=e.flagStorage.get(rt);if(xe)try{let c=JSON.parse(xe);r=c.values,i=c.payloads,o=Object.fromEntries(Object.keys(r).map(f=>[f,"cached"])),c.rt&&M.setServer(c.rt),j.restore(c)}catch{}let ke=e.flagStorage.get(ye);if(ke)try{R=JSON.parse(ke)}catch{}let L=n.bootstrap;if(L?.flags){I({...L.flags},{...L.payloads});for(let c of Object.keys(L.flags))o[c]="bootstrap"}let Re={},we=()=>({...h.autoProperties===!1?{}:Qe(),...ze(t.storage,e.whenConsented),...Object.assign({},...e.flagPersonProps.map(c=>c())),...k}),Fe=h.evaluationContexts?.length?{app_contexts:h.evaluationContexts}:{},W=(c=!0)=>{let f=n.localFlags;if(!f?.length)return!0;let p=n.localFlagsContext,v=se(f,{runtime_events:M.counts(),distinct_id:t.distinctId,...t.groups?{groups:t.groups}:{},...t.deviceId?{device_id:t.deviceId}:{},...b()?{contexts:m}:{},...Fe,...p,person_properties:{...we(),...p?.person_properties},group_properties:{...p?.group_properties,...y}}),_={},x={},V=!1;for(let[T,F]of Object.entries(v))ae(F)?V=!0:ce(F)&&(_[T]=F.value,o[T]=F.reason,F.payload!==void 0&&(x[T]=F.payload));return Re=_,I({...r,..._},{...i,...x},c),V},Se=c=>{let f={...r},p={...i};for(let[v,_]of Object.entries(M.resolved()))f[v]=_.value,o[v]=_.reason,_.payload!==void 0?p[v]=_.payload:delete p[v];I(f,p,c)},Ee=tt(n.localFlags);e.onCapture(c=>{let f=Ee||Object.keys(M.server()).length>0;if(M.record(c.event,c.properties,f),!f)return;let p=JSON.stringify([$(),i]);if(Ee&&W(!1),Se(!1),JSON.stringify([$(),i])!==p)for(let v of P)v($())});let O=(c=!0)=>{let f=++u;return!W()||h.disableRemote||!c&&j.fresh(t.distinctId)?Promise.resolve():new Promise(p=>{e.whenConsented(()=>{if(f!==u)return p();A.persist();let v=new AbortController,_=setTimeout(()=>v.abort(),h.timeoutMs??1e4);e.fetch(`${be}/v1/flags`,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",signal:v.signal,body:JSON.stringify({api_key:e.apiKey,...t.distinctId?{distinct_id:t.distinctId}:{},...t.anonDistinctId?{anon_distinct_id:t.anonDistinctId}:{},groups:t.groups??{},person_properties:we(),...Object.keys(y).length?{group_properties:y}:{},device_properties:ge(),...t.deviceId?{device_id:t.deviceId}:{},...b()?{contexts:m}:{},...Fe,...it?{preview:A.forced}:{},...h.keys?.length?{flag_keys:h.keys}:{}})}).then(x=>x.ok?x.json():Promise.reject(new Error(`status ${x.status}`))).then(x=>{if(f!==u)return;if(x.quota_limited)return e.log("flags quota limited; keeping cached values");let V={},T={},F={};for(let[K,S]of Object.entries(x.flags??{}))V[K]=me(S),typeof S=="object"&&S.payload!==void 0&&(T[K]=S.payload),o[K]=typeof S=="object"&&typeof S.reason=="string"?S.reason:"remote",typeof S=="object"&&S.runtime?.length&&(F[K]=ve(S));s=x.request_id,M.setServer(F),I({...Re,...V},T,!1),Se(!0),e.flagStorage.set(rt,JSON.stringify({values:V,payloads:T,rt:F,...j.mark(t.distinctId)})),e.log("flags loaded",V)}).catch(x=>e.log("flags fetch failed",x)).finally(()=>{clearTimeout(_),p()})})})},Oe=c=>R[c]??ot(c)??r[c];e.flags={get(c){let f=Oe(c);if(f===void 0)return;if(c in A.forced||c in R)return f;let p=t.sessionId;p!==g&&(l.clear(),d.clear(),g=p),d.has(c)||(d.add(c),t.capture("$exposure",{$feature_flag:c,$feature_flag_response:f,...typeof f=="string"?{$feature_flag_variant:f}:{},...s?{$feature_flag_request_id:s}:{}}));let v=`${c}:${String(f)}`;return l.has(v)||(l.add(v),t.capture("$feature_flag_called",{$feature_flag:c,$feature_flag_response:f,...s?{$feature_flag_request_id:s}:{}})),f},all:()=>a||Object.keys(r).length||Object.keys(R).length?$():{},payload:c=>i[c],result(c,f){let p=f?.sendExposure===!1?Oe(c):this.get(c),v=c in R||ot(c)!==void 0?"override":c in A.forced?"preview":o[c]??"remote";return le(c,p,i[c],v)},layerParam(c,f){for(let[p,v]of Object.entries(i)){let _=v;if(_?.lc_layer!==c||!_.lc_params||!(f in _.lc_params))continue;let x=this.get(p);if(x!==void 0&&x!==!1)return _.lc_params[f]}},onChange(c){return P.add(c),a&&c($()),()=>{P.delete(c)}},reload:O,update(c,f,p=!0){for(let v of Object.keys(c))o[v]="pushed";M.drop(Object.keys(c)),I(p?{...r,...c}:{...c},p?{...i,...f}:{...f})},override(c,f){R=c?{...c}:{},c?f?.persist&&e.whenConsented(()=>e.flagStorage.set(ye,JSON.stringify(R))):e.flagStorage.remove(ye);for(let p of P)p($())},setPersonProperties(c,f=!0){j.clear(),k={...k,...c},f&&O()},resetPersonProperties(){k={}},setGroupProperties(c,f=!0){j.clear();for(let[p,v]of Object.entries(c))y[p]={...y[p],...v};f&&O()},resetGroupProperties(){y={}},setContext(c,f,p){j.clear(),m={...m,[c]:{key:f,properties:p??{}}},O()},clearContext(c){j.clear();let{[c]:f,...p}=m;m=p,O()}},t.onChange(c=>{c==="reset"&&(m={},k={},y={}),(c==="identify"||c==="reset"||c==="group")&&O()}),n.disableFlagsOnFirstLoad?W():O(!1);let H=n.flagStream,Pe;H&&!h.disableRemote&&e.whenConsented(()=>{Pe=Y({apiHost:be,apiKey:e.apiKey,fetch:e.fetch,reload:()=>{O()},visibility:{hidden:()=>document.visibilityState==="hidden",subscribe:c=>(document.addEventListener("visibilitychange",c),()=>document.removeEventListener("visibilitychange",c))},...typeof H=="object"&&H.pollMs!==void 0?{pollMs:H.pollMs}:{},log:e.log})});let Ce=h.refreshMs&&h.refreshMs>0&&!h.disableRemote?setInterval(()=>document.visibilityState!=="hidden"&&void O(!1),h.refreshMs):void 0;return()=>{Pe?.(),Ce&&clearInterval(Ce)}};export{kn as flags};