@kubesense/kubesense-browser-rum 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,9 +52,53 @@ kubesenseSdk.addAction('checkout', { cartValue: 42 })
52
52
  kubesenseSdk.addError(new Error('Something went wrong'), { source: 'checkout' })
53
53
 
54
54
  // Identify the current user
55
- kubesenseSdk.setUser({ id: 'u-123', name: 'Jane Doe', email: 'jane@example.com' })
55
+ kubesenseSdk.setUser({ id: 'u-123', name: 'Jane Doe', email: 'jane@example.com', mobile: '+919876543210' })
56
56
  ```
57
57
 
58
+ `setUser()` accepts `id`, `name`, `email`, `mobile`, and any custom properties.
59
+ Changing the user id ends the current session and starts a new one, so one user's
60
+ events never land in another user's session — call it only when the identity
61
+ actually changes, not on every route change or component mount.
62
+
63
+ ### Recording only some routes
64
+
65
+ `sessionReplayRoutes` scopes Session Replay to the routes you care about. The SDK
66
+ starts and stops the recorder as the user navigates, and each recorded stretch
67
+ begins with a fresh snapshot so it stays self-contained:
68
+
69
+ ```javascript
70
+ kubesenseSdk.init({
71
+ // ...
72
+ sessionReplaySampleRate: 100,
73
+ sessionReplayRoutes: {
74
+ include: ['/checkout', '/account'],
75
+ exclude: ['/account/settings'],
76
+ },
77
+ })
78
+ ```
79
+
80
+ Route rules only ever narrow recording: a session that lost the
81
+ `sessionReplaySampleRate` draw is still never recorded. Omit `sessionReplayRoutes`
82
+ to record everywhere — that remains the default. See [Route-Based Recording][routes].
83
+
84
+ ### Dashboard-managed configuration
85
+
86
+ With `enableRemoteSdkConfiguration`, sampling rates, feature switches and privacy
87
+ settings can be changed from the Kubesense dashboard without a redeploy:
88
+
89
+ ```javascript
90
+ kubesenseSdk.init({
91
+ // ...
92
+ enableRemoteSdkConfiguration: true,
93
+ })
94
+ ```
95
+
96
+ The flag is the whole integration: the SDK reads its cached document during
97
+ `init()` (synchronous, no network) and refreshes it in the background afterwards,
98
+ so dashboard changes take effect from the next page load. It is off by default,
99
+ and whenever a remote value is missing or invalid your local `init()` value — and
100
+ failing that, the SDK default — is used. See [Remote SDK Configuration][remote-config].
101
+
58
102
  ## Documentation
59
103
 
60
104
  The full API — configuration reference, view/action/error tracking, Session
@@ -67,3 +111,5 @@ documented in the [Browser RUM Integration Guide][guide].
67
111
 
68
112
  [rum-slim]: https://www.npmjs.com/package/@kubesense/kubesense-browser-rum-slim
69
113
  [guide]: https://github.com/kubesense-ai/kubesense-browser-sdk/blob/main/docs/browser-rum-integration.md
114
+ [routes]: https://github.com/kubesense-ai/kubesense-browser-sdk/blob/main/docs/browser-rum-integration.md#route-based-recording
115
+ [remote-config]: https://github.com/kubesense-ai/kubesense-browser-sdk/blob/main/docs/REMOTE_SDK_CONFIG.md
@@ -1 +1 @@
1
- (self.webpackChunk_kubesense_kubesense_browser_rum=self.webpackChunk_kubesense_kubesense_browser_rum||[]).push([["profiler"],{437(e,t,n){n.d(t,{createRumProfiler:()=>f});var s=n(315),r=n(197),a=n(433),i=n(875),o=n(749),c=n(636),u=n(215);const l=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g,p=(e,t)=>e||function(e){return e?e.replace(l,"/?"):"/"}(t);var d=n(485);const m={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3,minNumberOfSamples:50};function f(e,t,n,l,f,v,w,g=m){const h=(0,u.wP)(e,t,v,6);let k;const b=[];let y={state:"stopped",stateReason:"initializing"};function S(){if("running"===y.state)return;const t=w.findView();k=t?{startClocks:t.startClocks,viewId:t.id,viewName:p(t.name,document.location.pathname)}:void 0,b.push((0,r.q)(e,window,"visibilitychange",P).stop,(0,r.q)(e,window,"beforeunload",E).stop),_()}async function I(e){await async function(e){"running"===y.state&&(await T(),y={state:"stopped",stateReason:e})}(e),b.forEach(e=>e()),l.set({status:"stopped",error_reason:void 0})}function _(){const e=(0,a.VZ)().Profiler;if(!e)throw l.set({status:"error",error_reason:"not-supported-by-browser"}),Error("RUM Profiler is not supported in this browser.");M(y).catch(s.Dx);const{cleanupTasks:n}=function(e){if("running"===e.state)return{cleanupTasks:e.cleanupTasks};const n=[],s=t.subscribe(2,e=>{const t={viewId:e.id,viewName:p(e.name,document.location.pathname),startClocks:e.startClocks};C(t),k=t});return n.push(s.unsubscribe),{cleanupTasks:n}}(y);let r;try{r=new e({sampleInterval:g.sampleIntervalMs,maxBufferSize:Math.round(1.5*g.collectIntervalMs/g.sampleIntervalMs)})}catch(e){return void(e instanceof Error&&e.message.includes("disabled by Document Policy")?(i.Vy.warn("[KUBESENSE_SDK] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",e),l.set({status:"error",error_reason:"missing-document-policy-header"})):l.set({status:"error",error_reason:"unexpected-exception"}))}l.set({status:"running",error_reason:void 0}),y={state:"running",startClocks:(0,o.M8)(),profiler:r,timeoutId:(0,c.wg)(_,g.collectIntervalMs),views:[],cleanupTasks:n,longTasks:[]},C(k),r.addEventListener("samplebufferfull",D)}async function M(t){if("running"!==t.state)return;(0,c.DJ)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",D);const{startClocks:r,views:a}=t;await t.profiler.stop().then(t=>{const s=(0,o.M8)(),i=f.findLongTasks(r.relative),c=(0,o.vk)(r.timeStamp,s.timeStamp)<g.minProfileDurationMs,u=function(e){let t=0;for(const n of e)void 0!==n.stackId&&t++;return t}(t.samples)<g.minNumberOfSamples;0===i.length&&(c||u)||function(t){var s;const r=null===(s=n.findTrackedSession())||void 0===s?void 0:s.id,a=function(e,t,n){const s=function(e,t,n){const s=(0,d.m5)(t),r=function(e,t,n){const s={application:{id:t}};n&&(s.session={id:n});const{ids:r,names:a}=function(e){const t={ids:[],names:[]};for(const n of e)t.ids.push(n.viewId),n.viewName&&t.names.push(n.viewName);return t.names=Array.from(new Set(t.names)),t}(e.views);r.length&&(s.view={id:r,name:a});const i=e.longTasks.map(e=>e.id).filter(e=>void 0!==e);return i.length&&(s.long_task={id:i}),s}(e,t.applicationId,n),a=function(e){return e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}(s);return{...r,attachments:["wall-time.json"],start:new Date(e.startClocks.timeStamp).toISOString(),end:new Date(e.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:a.join(","),_kubesense:{clock_drift:(0,o.TP)()}}}(e,t,n);return{event:s,"wall-time.json":e}}(t,e,r);h.send(a)}(Object.assign(t,{startClocks:r,endClocks:s,clocksOrigin:(0,o.Oc)(),longTasks:i,views:a,sampleInterval:g.sampleIntervalMs}))}).catch(s.Dx)}async function T(){"running"===y.state&&(y.cleanupTasks.forEach(e=>e()),await M(y))}function C(e){"running"===y.state&&e&&y.views.push(e)}function D(){_()}function P(){"hidden"===document.visibilityState&&"running"===y.state?async function(){"running"===y.state&&(await T(),y={state:"paused"})}().catch(s.Dx):"visible"===document.visibilityState&&"paused"===y.state&&_()}function E(){_()}return t.subscribe(9,()=>{I("session-expired").catch(s.Dx)}),t.subscribe(10,()=>{"stopped"===y.state&&"session-expired"===y.stateReason&&S()}),{start:S,async stop(){await I("stopped-by-user")},isStopped:()=>"stopped"===y.state,isRunning:()=>"running"===y.state,isPaused:()=>"paused"===y.state}}}}]);
1
+ (self.webpackChunk_kubesense_kubesense_browser_rum=self.webpackChunk_kubesense_kubesense_browser_rum||[]).push([["profiler"],{437(e,t,n){n.d(t,{createRumProfiler:()=>f});var s=n(315),r=n(197),a=n(433),i=n(875),o=n(749),c=n(636),u=n(446);const l=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g,p=(e,t)=>e||function(e){return e?e.replace(l,"/?"):"/"}(t);var d=n(485);const m={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3,minNumberOfSamples:50};function f(e,t,n,l,f,v,w,g=m){const h=(0,u.wP)(e,t,v,6);let k;const b=[];let y={state:"stopped",stateReason:"initializing"};function S(){if("running"===y.state)return;const t=w.findView();k=t?{startClocks:t.startClocks,viewId:t.id,viewName:p(t.name,document.location.pathname)}:void 0,b.push((0,r.q)(e,window,"visibilitychange",P).stop,(0,r.q)(e,window,"beforeunload",E).stop),_()}async function I(e){await async function(e){"running"===y.state&&(await T(),y={state:"stopped",stateReason:e})}(e),b.forEach(e=>e()),l.set({status:"stopped",error_reason:void 0})}function _(){const e=(0,a.VZ)().Profiler;if(!e)throw l.set({status:"error",error_reason:"not-supported-by-browser"}),Error("RUM Profiler is not supported in this browser.");M(y).catch(s.Dx);const{cleanupTasks:n}=function(e){if("running"===e.state)return{cleanupTasks:e.cleanupTasks};const n=[],s=t.subscribe(2,e=>{const t={viewId:e.id,viewName:p(e.name,document.location.pathname),startClocks:e.startClocks};C(t),k=t});return n.push(s.unsubscribe),{cleanupTasks:n}}(y);let r;try{r=new e({sampleInterval:g.sampleIntervalMs,maxBufferSize:Math.round(1.5*g.collectIntervalMs/g.sampleIntervalMs)})}catch(e){return void(e instanceof Error&&e.message.includes("disabled by Document Policy")?(i.Vy.warn("[KUBESENSE_SDK] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",e),l.set({status:"error",error_reason:"missing-document-policy-header"})):l.set({status:"error",error_reason:"unexpected-exception"}))}l.set({status:"running",error_reason:void 0}),y={state:"running",startClocks:(0,o.M8)(),profiler:r,timeoutId:(0,c.wg)(_,g.collectIntervalMs),views:[],cleanupTasks:n,longTasks:[]},C(k),r.addEventListener("samplebufferfull",D)}async function M(t){if("running"!==t.state)return;(0,c.DJ)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",D);const{startClocks:r,views:a}=t;await t.profiler.stop().then(t=>{const s=(0,o.M8)(),i=f.findLongTasks(r.relative),c=(0,o.vk)(r.timeStamp,s.timeStamp)<g.minProfileDurationMs,u=function(e){let t=0;for(const n of e)void 0!==n.stackId&&t++;return t}(t.samples)<g.minNumberOfSamples;0===i.length&&(c||u)||function(t){var s;const r=null===(s=n.findTrackedSession())||void 0===s?void 0:s.id,a=function(e,t,n){const s=function(e,t,n){const s=(0,d.m5)(t),r=function(e,t,n){const s={application:{id:t}};n&&(s.session={id:n});const{ids:r,names:a}=function(e){const t={ids:[],names:[]};for(const n of e)t.ids.push(n.viewId),n.viewName&&t.names.push(n.viewName);return t.names=Array.from(new Set(t.names)),t}(e.views);r.length&&(s.view={id:r,name:a});const i=e.longTasks.map(e=>e.id).filter(e=>void 0!==e);return i.length&&(s.long_task={id:i}),s}(e,t.applicationId,n),a=function(e){return e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}(s);return{...r,attachments:["wall-time.json"],start:new Date(e.startClocks.timeStamp).toISOString(),end:new Date(e.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:a.join(","),_kubesense:{clock_drift:(0,o.TP)()}}}(e,t,n);return{event:s,"wall-time.json":e}}(t,e,r);h.send(a)}(Object.assign(t,{startClocks:r,endClocks:s,clocksOrigin:(0,o.Oc)(),longTasks:i,views:a,sampleInterval:g.sampleIntervalMs}))}).catch(s.Dx)}async function T(){"running"===y.state&&(y.cleanupTasks.forEach(e=>e()),await M(y))}function C(e){"running"===y.state&&e&&y.views.push(e)}function D(){_()}function P(){"hidden"===document.visibilityState&&"running"===y.state?async function(){"running"===y.state&&(await T(),y={state:"paused"})}().catch(s.Dx):"visible"===document.visibilityState&&"paused"===y.state&&_()}function E(){_()}return t.subscribe(9,()=>{I("session-expired").catch(s.Dx)}),t.subscribe(10,()=>{"stopped"===y.state&&"session-expired"===y.stateReason&&S()}),{start:S,async stop(){await I("stopped-by-user")},isStopped:()=>"stopped"===y.state,isRunning:()=>"running"===y.state,isPaused:()=>"paused"===y.state}}}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_kubesense_kubesense_browser_rum=self.webpackChunk_kubesense_kubesense_browser_rum||[]).push([["recorder"],{814(t,e,n){n.d(e,{startRecording:()=>at});var o=n(534),s=n(725),r=n(362),i=n(474),a=n(215),c=n(749),u=n(877);function d(t,e){const n=t.tagName,o=t.value;if((0,a.Ie)(t,e)){const e=t.type;if("INPUT"===n&&("button"===e||"submit"===e||"reset"===e))return o;if(!o||"OPTION"===n)return;return a.o}return"OPTION"===n||"SELECT"===n?t.value:"INPUT"===n||"TEXTAREA"===n?o:void 0}const l=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,f=/^[A-Za-z]+:|^\/\//,p=/^["']?data:.*,/i,m=/[^a-z1-6-_]/;function h(t){return t.tagName.toLowerCase()}function g(t,e){return`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${e}' style='background-color:silver'%3E%3C/svg%3E`}function v(t){if(void 0!==t&&0!==t.length)return t.map(t=>{const e=t.cssRules||t.rules;return{cssRules:Array.from(e,t=>t.cssText),disabled:t.disabled||void 0,media:t.media.length>0?Array.from(t.media):void 0}})}var y=n(760);function w(t,e,n,o){if(e===a.$m.HIDDEN)return null;const s=t.getAttribute(n),r=t.tagName;if((0,a.ap)(r,n,s,e,o)){if("IMG"===r){const e=t;if(e.naturalWidth>0)return g(e.naturalWidth,e.naturalHeight);const{width:n,height:o}=t.getBoundingClientRect();return n>0||o>0?g(n,o):a.eT}return"SOURCE"===r?a.eT:a.o}return s?(0,a.ei)(s,1e6):s}function S(t,e,n){if(e===a.$m.HIDDEN)return{};const o={},s=h(t);for(let s=0;s<t.attributes.length;s+=1){const r=t.attributes.item(s).name,i=w(t,e,r,n.scope.configuration);null!==i&&(o[r]=i)}if(t.value&&("textarea"===s||"select"===s||"option"===s||"input"===s)){const n=d(t,e);void 0!==n&&(o.value=n)}if("option"===s){const n=t;n.selected&&!(0,a.Ie)(n,e)?o.selected="":delete o.selected}const r=t;return"input"!==s||"radio"!==r.type&&"checkbox"!==r.type||(r.checked&&!(0,a.Ie)(r,e)?o.checked="":delete o.checked),o}function b(t,e,n){if(e===a.$m.HIDDEN)return{};const o={},s=t.ownerDocument,r=h(t);if("link"===r){const e=Array.from(s.styleSheets).find(e=>e.href===t.href),r=I(e);r&&e&&(n.addMetric("cssText",r.length),o._cssText=r)}if("style"===r&&t.sheet){const e=I(t.sheet);e&&(n.addMetric("cssText",e.length),o._cssText=e)}if("audio"===r||"video"===r){const e=t;o.rr_mediaState=e.paused?"paused":"played"}let i,c;switch(n.kind){case 0:i=Math.round(t.scrollTop),c=Math.round(t.scrollLeft),(i||c)&&n.scope.elementsScrollPositions.set(t,{scrollTop:i,scrollLeft:c});break;case 1:n.scope.elementsScrollPositions.has(t)&&({scrollTop:i,scrollLeft:c}=n.scope.elementsScrollPositions.get(t))}return c&&(o.rr_scrollLeft=c),i&&(o.rr_scrollTop=i),o}function I(t){if(!t)return null;let e;try{e=t.rules||t.cssRules}catch(t){}return e?(n=Array.from(e,(0,y.nr)()?x:N).join(""),o=t.href,n.replace(l,(t,e,n,s,r,i)=>{const a=n||r||i;if(!o||!a||f.test(a)||p.test(a))return t;const c=e||s||"";return`url(${c}${function(t,e){try{return(0,u.c$)(t,e).href}catch(e){return t}}(a,o)}${c})`})):null;var n,o}function x(t){if(function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")){const e=/(\[[\w-]+[^\\])(:[^\]]+\])/g;return t.cssText.replace(e,"$1\\$2")}return N(t)}function N(t){return function(t){return"styleSheet"in t}(t)&&I(t.styleSheet)||t.cssText}function E(t,e,n){switch(t.nodeType){case t.DOCUMENT_NODE:return function(t,e,n){return{type:0,id:n.assignId(t),childNodes:T(t,e,n),adoptedStyleSheets:v(t.adoptedStyleSheets)}}(t,e,n);case t.DOCUMENT_FRAGMENT_NODE:return function(t,e,n){const o=(0,a.p_)(t);return o&&n.scope.shadowRootsController.addShadowRoot(t,n.scope),{type:11,id:n.assignId(t),childNodes:T(t,e,n),isShadowRoot:o,adoptedStyleSheets:o?v(t.adoptedStyleSheets):void 0}}(t,e,n);case t.DOCUMENT_TYPE_NODE:return function(t,e){return{type:1,id:e.assignId(t),name:t.name,publicId:t.publicId,systemId:t.systemId}}(t,n);case t.ELEMENT_NODE:return function(t,e,n){const o=function(t){const e=t.toLowerCase().trim();return m.test(e)?"div":e}(t.tagName),s="svg"===(i=t).tagName||i instanceof SVGElement||void 0,r=(0,a.jR)((0,a.dT)(t),e);var i;if(r===a.$m.HIDDEN){const{width:e,height:r}=t.getBoundingClientRect();return{type:2,id:n.assignId(t),tagName:o,attributes:{rr_width:e+"px",rr_height:r+"px",[a.NT]:a.Wd},childNodes:[],isSVG:s}}if(r===a.$m.IGNORE)return null;const c=n.assignId(t),u=function(t,e,n){return{...S(t,e,n),...b(t,e,n)}}(t,r,n);let d=[];return(0,a.wR)(t)&&"style"!==o&&(d=T(t,r,n)),{type:2,id:c,tagName:o,attributes:u,childNodes:d,isSVG:s}}(t,e,n);case t.TEXT_NODE:return function(t,e,n){const o=(0,a.rf)(t,e);return void 0===o?null:{type:3,id:n.assignId(t),textContent:o}}(t,e,n);case t.CDATA_SECTION_NODE:return function(t,e){return{type:4,id:e.assignId(t),textContent:""}}(t,n);default:return null}}function T(t,e,n){const o=[];return(0,a.wI)(t,t=>{const s=E(t,e,n);s&&o.push(s)}),o}function C(t,e){return E(t,e.scope.configuration.defaultPrivacyLevel,e)}function _(t,e,n){t[e].count+=1,t[e].max=Math.max(t[e].max,n),t[e].sum+=n}function R(t,e,n,o,s){const r=[],i={cssText:{count:0,max:0,sum:0},serializationDuration:{count:0,max:0,sum:0}},a={add(t){r.push(t)},addMetric(t,e){_(i,t,e)},assignId(t){const e=o.nodeIds.assign(t);return a.serializedNodeIds&&a.serializedNodeIds.add(e),e},kind:t,scope:o},u=(0,c.nx)();s(a),_(i,"serializationDuration",(0,c.vk)(u,(0,c.nx)()));for(const t of r)e(t);n(i)}const D=t=>({scale:t.scale,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop,pageLeft:t.pageLeft,pageTop:t.pageTop,height:t.height,width:t.width});function L(t,e,n,o,s){R(e,n,o,s,e=>{const{width:n,height:o}=(0,a.pB)();e.add({data:{height:o,href:window.location.href,width:n},type:4,timestamp:t}),e.add({data:{has_focus:document.hasFocus()},type:6,timestamp:t}),e.add({data:{node:C(document,e),initialOffset:{left:(0,a.Gn)(),top:(0,a.zL)()}},type:2,timestamp:t}),window.visualViewport&&e.add({data:D(window.visualViewport),type:8,timestamp:t})})}var M=n(769),O=n(300),k=n(197);function P(t){return!!t.changedTouches}function $(t){return!0===t.composed&&(0,a.XS)(t.target)?t.composedPath()[0]:t.target}function A(t,e){return{data:{source:t,...e},type:3,timestamp:(0,c.nx)()}}function z(t,e){const{throttled:n,cancel:o}=(0,i.n)(n=>{const o=$(n),s=e.nodeIds.get(o);if(void 0===s)return;const r=H(n);if(!r)return;const i={id:s,timeOffset:0,x:r.x,y:r.y};t(A(P(n)?6:1,{positions:[i]}))},50,{trailing:!1}),{stop:s}=(0,k.l)(e.configuration,document,["mousemove","touchmove"],n,{capture:!0,passive:!0});return{stop(){s(),o()}}}function H(t){let{clientX:e,clientY:n}=P(t)?t.changedTouches[0]:t;if(window.visualViewport){const{visualViewportX:t,visualViewportY:o}=((t,e)=>{const n=window.visualViewport,o={layoutViewportX:t,layoutViewportY:e,visualViewportX:t,visualViewportY:e};return n?(function(t){return Math.abs(t.pageTop-t.offsetTop-window.scrollY)>25||Math.abs(t.pageLeft-t.offsetLeft-window.scrollX)>25}(n)?(o.layoutViewportX=Math.round(t+n.offsetLeft),o.layoutViewportY=Math.round(e+n.offsetTop)):(o.visualViewportX=Math.round(t-n.offsetLeft),o.visualViewportY=Math.round(e-n.offsetTop)),o):o})(e,n);e=t,n=o}if(Number.isFinite(e)&&Number.isFinite(n))return{x:e,y:n}}const V={pointerup:0,mousedown:1,click:2,contextmenu:3,dblclick:4,focus:5,blur:6,touchstart:7,touchend:9};function F(t,e){return(0,k.l)(e.configuration,document,Object.keys(V),n=>{const o=$(n),s=e.nodeIds.get(o);if(void 0===s||(0,a.PJ)(o,e.configuration.defaultPrivacyLevel)===a.$m.HIDDEN)return;const r=V[n.type];let i;if(6!==r&&5!==r){const t=H(n);if(!t)return;i={id:s,type:r,x:t.x,y:t.y}}else i={id:s,type:r};t({id:e.eventIds.getIdForEvent(n),...A(2,i)})},{capture:!0,passive:!0})}function G(t,e,n){const{throttled:o,cancel:s}=(0,i.n)(t=>{const o=$(t);if(!o)return;const s=n.nodeIds.get(o);if(void 0===s||(0,a.PJ)(o,n.configuration.defaultPrivacyLevel)===a.$m.HIDDEN)return;const r=o===document?{scrollTop:(0,a.zL)(),scrollLeft:(0,a.Gn)()}:{scrollTop:Math.round(o.scrollTop),scrollLeft:Math.round(o.scrollLeft)};n.elementsScrollPositions.set(o,r),e(A(3,{id:s,x:r.scrollLeft,y:r.scrollTop}))},100),{stop:r}=(0,k.q)(n.configuration,t,"scroll",o,{capture:!0,passive:!0});return{stop(){r(),s()}}}function B(t,e){const n=(0,a.g1)(e.configuration).subscribe(e=>{t(A(4,e))});return{stop(){n.unsubscribe()}}}function J(t,e){const n=window.visualViewport;if(!n)return{stop:i.l};const{throttled:o,cancel:s}=(0,i.n)(()=>{t({data:D(n),type:8,timestamp:(0,c.nx)()})},200,{trailing:!1}),{stop:r}=(0,k.l)(e.configuration,n,["resize","scroll"],o,{capture:!0,passive:!0});return{stop(){r(),s()}}}function X(t,e){return(0,k.l)(e.configuration,document,["play","pause"],n=>{const o=$(n);if(!o)return;const s=e.nodeIds.get(o);void 0!==s&&(0,a.PJ)(o,e.configuration.defaultPrivacyLevel)!==a.$m.HIDDEN&&t(A(7,{id:s,type:"play"===n.type?0:1}))},{capture:!0,passive:!0})}var Y=n(801);function U(t,e){function n(t,n){if(!t||!t.ownerNode)return;const o=e.nodeIds.get(t.ownerNode);void 0!==o&&n(o)}const o=[(0,Y.H)(CSSStyleSheet.prototype,"insertRule",({target:e,parameters:[o,s]})=>{n(e,e=>t(A(8,{id:e,adds:[{rule:o,index:s}]})))}),(0,Y.H)(CSSStyleSheet.prototype,"deleteRule",({target:e,parameters:[o]})=>{n(e,e=>t(A(8,{id:e,removes:[{index:o}]})))})];function s(e){o.push((0,Y.H)(e.prototype,"insertRule",({target:e,parameters:[o,s]})=>{n(e.parentStyleSheet,n=>{const r=W(e);r&&(r.push(s||0),t(A(8,{id:n,adds:[{rule:o,index:r}]})))})}),(0,Y.H)(e.prototype,"deleteRule",({target:e,parameters:[o]})=>{n(e.parentStyleSheet,n=>{const s=W(e);s&&(s.push(o),t(A(8,{id:n,removes:[{index:s}]})))})}))}return"undefined"!=typeof CSSGroupingRule?s(CSSGroupingRule):(s(CSSMediaRule),s(CSSSupportsRule)),{stop(){o.forEach(t=>t.stop())}}}function W(t){const e=[];let n=t;for(;n.parentRule;){const t=Array.from(n.parentRule.cssRules).indexOf(n);e.unshift(t),n=n.parentRule}if(!n.parentStyleSheet)return;const o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);return e.unshift(o),e}function q(t,e){return(0,k.l)(e.configuration,window,["focus","blur"],()=>{t({data:{has_focus:document.hasFocus()},type:6,timestamp:(0,c.nx)()})})}function j(t,e,n){const o=t.subscribe(12,t=>{var o,s;t.rawRumEvent.type===a.bb.ACTION&&t.rawRumEvent.action.type===a.X2.CLICK&&(null===(s=null===(o=t.rawRumEvent.action.frustration)||void 0===o?void 0:o.type)||void 0===s?void 0:s.length)&&"events"in t.domainContext&&t.domainContext.events&&t.domainContext.events.length&&e({timestamp:t.rawRumEvent.date,type:9,data:{frustrationTypes:t.rawRumEvent.action.frustration.type,recordIds:t.domainContext.events.map(t=>n.eventIds.getIdForEvent(t))}})});return{stop(){o.unsubscribe()}}}function K(t,e,n){const o=t.subscribe(5,()=>{n(),e({timestamp:(0,c.nx)(),type:7})});return{stop(){o.unsubscribe()}}}function Z(t,e,n){const o=n.configuration.defaultPrivacyLevel,s=new WeakMap,r=t!==document,{stop:c}=(0,k.l)(n.configuration,t,r?["change"]:["input","change"],t=>{const e=$(t);(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&l(e)},{capture:!0,passive:!0});let u;if(r)u=i.l;else{const t=[(0,Y.t)(HTMLInputElement.prototype,"value",l),(0,Y.t)(HTMLInputElement.prototype,"checked",l),(0,Y.t)(HTMLSelectElement.prototype,"value",l),(0,Y.t)(HTMLTextAreaElement.prototype,"value",l),(0,Y.t)(HTMLSelectElement.prototype,"selectedIndex",l)];u=()=>{t.forEach(t=>t.stop())}}return{stop(){u(),c()}};function l(t){const e=(0,a.PJ)(t,o);if(e===a.$m.HIDDEN)return;const n=t.type;let s;if("radio"===n||"checkbox"===n){if((0,a.Ie)(t,e))return;s={isChecked:t.checked}}else{const n=d(t,e);if(void 0===n)return;s={text:n}}f(t,s);const r=t.name;"radio"===n&&r&&t.checked&&document.querySelectorAll(`input[type="radio"][name="${CSS.escape(r)}"]`).forEach(e=>{e!==t&&f(e,{isChecked:!1})})}function f(t,o){const r=n.nodeIds.get(t);if(void 0===r)return;const i=s.get(t);i&&i.text===o.text&&i.isChecked===o.isChecked||(s.set(t,o),e(A(5,{id:r,...o})))}}var Q=n(315),tt=n(981);function et(t,e,n,o){const s=(0,a.W3)();if(!s)return{stop:i.l,flush:i.l};const r=function(){let t=i.l,s=[];function r(){var r;t(),r=s,R(2,e,n,o,t=>function(t,e){const n=new Map;t.filter(t=>"childList"===t.type).forEach(t=>{t.removedNodes.forEach(t=>{nt(t,e.scope.shadowRootsController.removeShadowRoot)})});const o=t.filter(t=>t.target.isConnected&&e.scope.nodeIds.areAssignedForNodeAndAncestors(t.target)&&(0,a.PJ)(t.target,e.scope.configuration.defaultPrivacyLevel,n)!==a.$m.HIDDEN),{adds:s,removes:r,hasBeenSerialized:i}=function(t,e,n){const o=new Set,s=new Map;for(const e of t)e.addedNodes.forEach(t=>{o.add(t)}),e.removedNodes.forEach(t=>{o.has(t)||s.set(t,e.target),o.delete(t)});const r=Array.from(o);r.sort((t,e)=>{const n=t.compareDocumentPosition(e);return n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_CONTAINS||n&Node.DOCUMENT_POSITION_FOLLOWING?1:n&Node.DOCUMENT_POSITION_PRECEDING?-1:0}),n.serializedNodeIds=new Set;const i=[];for(const t of r){if(u(t))continue;const o=(0,a.PJ)(t.parentNode,n.scope.configuration.defaultPrivacyLevel,e);if(o===a.$m.HIDDEN||o===a.$m.IGNORE)continue;const s=E(t,o,n);if(!s)continue;const r=(0,a.$4)(t);i.push({nextId:d(t),parentId:n.scope.nodeIds.get(r),node:s})}const c=[];return s.forEach((t,e)=>{const o=n.scope.nodeIds.get(t),s=n.scope.nodeIds.get(e);void 0!==o&&void 0!==s&&c.push({parentId:o,id:s})}),{adds:i,removes:c,hasBeenSerialized:u};function u(t){var e;const o=n.scope.nodeIds.get(t);return void 0!==o&&(null===(e=n.serializedNodeIds)||void 0===e?void 0:e.has(o))}function d(t){let e=t.nextSibling;for(;e;){const t=n.scope.nodeIds.get(e);if(void 0!==t)return t;e=e.nextSibling}return null}}(o.filter(t=>"childList"===t.type),n,e),c=function(t,e,n){var o;const s=[],r=new Set,i=t.filter(t=>!r.has(t.target)&&(r.add(t.target),!0));for(const t of i){if(t.target.textContent===t.oldValue)continue;const r=n.scope.nodeIds.get(t.target);if(void 0===r)continue;const i=(0,a.PJ)((0,a.$4)(t.target),n.scope.configuration.defaultPrivacyLevel,e);i!==a.$m.HIDDEN&&i!==a.$m.IGNORE&&s.push({id:r,value:null!==(o=(0,a.rf)(t.target,i))&&void 0!==o?o:null})}return s}(o.filter(t=>"characterData"===t.type&&!i(t.target)),n,e),u=function(t,e,n){const o=[],s=new Map,r=t.filter(t=>{const e=s.get(t.target);return!(e&&e.has(t.attributeName)||(e?e.add(t.attributeName):s.set(t.target,new Set([t.attributeName])),0))}),i=new Map;for(const t of r){if(t.target.getAttribute(t.attributeName)===t.oldValue)continue;const s=n.scope.nodeIds.get(t.target);if(void 0===s)continue;const r=(0,a.PJ)(t.target,n.scope.configuration.defaultPrivacyLevel,e),c=w(t.target,r,t.attributeName,n.scope.configuration);let u;if("value"===t.attributeName){const e=d(t.target,r);if(void 0===e)continue;u=e}else u="string"==typeof c?c:null;let l=i.get(t.target);l||(l={id:s,attributes:{}},o.push(l),i.set(t.target,l)),l.attributes[t.attributeName]=u}return o}(o.filter(t=>"attributes"===t.type&&!i(t.target)),n,e);(c.length||u.length||r.length||s.length)&&e.add(A(0,{adds:s,removes:r,texts:c,attributes:u}))}(r.concat(c.takeRecords()),t)),s=[]}const{throttled:u,cancel:l}=(0,i.n)(r,16,{leading:!1});return{addMutations(e){0===s.length&&(t=(0,tt.BB)(u,{timeout:100})),s.push(...e)},flush:r,stop(){t(),l()}}}(),c=new s((0,Q.dm)(r.addMutations));return c.observe(t,{attributeOldValue:!0,attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{stop(){c.disconnect(),r.stop()},flush(){r.flush()}}}function nt(t,e){(0,a.XS)(t)&&e(t.shadowRoot),(0,a.wI)(t,t=>nt(t,e))}var ot=n(887),st=n(636);function rt({context:t,creationReason:e,encoder:n}){let o=0;const s=t.view.id,r={start:1/0,end:-1/0,creation_reason:e,records_count:0,has_full_snapshot:!1,index_in_view:O.K_(s),source:"browser",...t},i={cssText:{count:0,max:0,sum:0},serializationDuration:{count:0,max:0,sum:0}};return O.H5(s),{addRecord(t,e){r.start=Math.min(r.start,t.timestamp),r.end=Math.max(r.end,t.timestamp),r.records_count+=1,r.has_full_snapshot||(r.has_full_snapshot=2===t.type);const s=n.isEmpty?'{"records":[':",";n.write(s+JSON.stringify(t),t=>{o+=t,e(o)})},addStats(t){!function(t,e){for(const n of["cssText","serializationDuration"])t[n].count+=e[n].count,t[n].max=Math.max(t[n].max,e[n].max),t[n].sum+=e[n].sum}(i,t)},flush(t){if(n.isEmpty)throw Error("Empty segment flushed");n.write(`],${JSON.stringify(r).slice(1)}\n`),n.finish(e=>{O.L7(r.view.id,e.rawBytesCount),t(r,i,e)})}}}const it=5*c.OY;function at(t,e,n,u,d,l,f){const p=[],m=f||(0,s.sA)([e.sessionReplayEndpointBuilder],e=>{t.notify(14,{error:e}),(0,o.A2)("Error reported to customer",{"error.message":e.message})},6e4);let h,g;if((0,r.d0)())({addRecord:h}=function(t){const e=(0,r.Y9)();return{addRecord(n){const o=t.findView();e.send("record",n,o.id)}}}(u)),g=i.l;else{const s=function(t,e,n,o,s,r){return function(t,s,r,i){let a={status:0,nextSegmentCreationReason:"init"};const{unsubscribe:c}=t.subscribe(2,()=>{d("view_change")}),{unsubscribe:u}=t.subscribe(11,t=>{d(t.reason)});function d(t){1===a.status&&(a.segment.flush((e,n,o)=>{const s=function(t,e,n,o){const s=new FormData;s.append("segment",new Blob([t],{type:"application/octet-stream"}),`${e.session.id}-${e.start}`);const r={raw_segment_size:o,compressed_segment_size:t.byteLength,...e},i=JSON.stringify(r);return s.append("event",new Blob([i],{type:"application/json"})),{data:s,bytesCount:t.byteLength,cssText:n.cssText,isFullSnapshot:0===e.index_in_view,rawSize:o,recordCount:e.records_count,serializationDuration:n.serializationDuration}}(o.output,e,n,o.rawBytesCount);(0,ot.Kp)(t)?r.sendOnExit(s):r.send(s)}),(0,st.DJ)(a.expirationTimeoutId)),a="stop"!==t?{status:0,nextSegmentCreationReason:t}:{status:2}}return{addRecord(t){if(2!==a.status){if(0===a.status){const t=function(t,e,n){const o=e.findTrackedSession(),s=n.findView();if(o&&s)return{application:{id:t},session:{id:o.id},view:{id:s.id}}}(e.applicationId,n,o);if(!t)return;a={status:1,segment:rt({encoder:i,context:t,creationReason:a.nextSegmentCreationReason}),expirationTimeoutId:(0,st.wg)(()=>{d("segment_duration_limit")},it)}}a.segment.addRecord(t,t=>{t>6e4&&d("segment_bytes_limit")})}},addStats(t){1===a.status&&a.segment.addStats(t)},stop(){d("stop"),c(),u()}}}(t,0,s,r)}(t,e,n,u,m,d);h=s.addRecord,g=s.addStats,p.push(s.stop);const r=function(t,e){if(!t.metricsEnabled)return{stop:i.l};const{unsubscribe:n}=e.subscribe(t=>{if("failure"===t.type||"queue-full"===t.type||"success"===t.type&&t.payload.isFullSnapshot){const r=(e=t.type,n=t.bandwidth,{cssText:{count:(s=t.payload).cssText.count,max:s.cssText.max,sum:s.cssText.sum},isFullSnapshot:s.isFullSnapshot,ongoingRequests:{count:n.ongoingRequestCount,totalSize:n.ongoingByteCount},recordCount:s.recordCount,result:e,serializationDuration:{count:s.serializationDuration.count,max:s.serializationDuration.max,sum:s.serializationDuration.sum},size:{compressed:s.bytesCount,raw:s.rawSize}});(0,o.Gk)("Segment network request metrics",{metrics:r})}var e,n,s});return{stop:n}}(l,m.observable);p.push(r.stop)}const{stop:v}=function(t){const{emitRecord:e,emitStats:n,configuration:o,lifeCycle:s}=t;if(!e||!n)throw Error("emit functions are required");const r=n=>{e(n),(0,M.b)("record",{record:n});const o=t.viewHistory.findView();O.$1(o.id)},i=((t,e)=>{const n=new Map;return{addShadowRoot(o,s){if(n.has(o))return;const r=et(o,t,e,s),i=Z(o,t,s),a=G(o,t,s);n.set(o,{flush:()=>r.flush(),stop(){r.stop(),i.stop(),a.stop()}})},removeShadowRoot(t){const e=n.get(t);e&&(e.stop(),n.delete(t))},stop(){n.forEach(({stop:t})=>t())},flush(){n.forEach(({flush:t})=>t())}}})(r,n),u=function(t,e,n,o,s){return{configuration:t,elementsScrollPositions:e,eventIds:n,nodeIds:o,shadowRootsController:s}}(o,function(){const t=new WeakMap;return{set(e,n){(e!==document||document.scrollingElement)&&t.set(e===document?document.scrollingElement:e,n)},get(e){return t.get(e)},has(e){return t.has(e)}}}(),function(){const t=new WeakMap;let e=1;return{getIdForEvent(n){return t.has(n)||t.set(n,e++),t.get(n)}}}(),function(){const t=new WeakMap;let e=0;const n=e=>t.get(e);return{assign(o){let s=n(o);return void 0===s&&(s=e++,t.set(o,s)),s},get:n,areAssignedForNodeAndAncestors(t){let e=t;for(;e;){if(void 0===n(e)&&!(0,a.p_)(e))return!1;e=(0,a.$4)(e)}return!0}}}(),i),{stop:d}=function(t,e,n,o,s){L((0,c.nx)(),0,e,n,s);const{unsubscribe:r}=t.subscribe(2,t=>{o(),L(t.startClocks.timeStamp,1,e,n,s)});return{stop:r}}(s,r,n,l,u);function l(){i.flush(),f.flush()}const f=et(document,r,n,u),p=[f,z(r,u),F(r,u),G(document,r,u),B(r,u),Z(document,r,u),X(r,u),U(r,u),q(r,u),J(r,u),j(s,r,u),K(s,r,l)];return{stop(){i.stop(),p.forEach(t=>t.stop()),d()},flushMutations:l,shadowRootsController:i}}({emitRecord:h,emitStats:g,configuration:e,lifeCycle:t,viewHistory:u});return p.push(v),{stop(){p.forEach(t=>t())}}}}}]);
1
+ (self.webpackChunk_kubesense_kubesense_browser_rum=self.webpackChunk_kubesense_kubesense_browser_rum||[]).push([["recorder"],{814(t,e,n){n.d(e,{startRecording:()=>at});var o=n(534),s=n(725),r=n(362),i=n(474),a=n(446),c=n(749),u=n(877);function d(t,e){const n=t.tagName,o=t.value;if((0,a.Ie)(t,e)){const e=t.type;if("INPUT"===n&&("button"===e||"submit"===e||"reset"===e))return o;if(!o||"OPTION"===n)return;return a.o}return"OPTION"===n||"SELECT"===n?t.value:"INPUT"===n||"TEXTAREA"===n?o:void 0}const l=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,f=/^[A-Za-z]+:|^\/\//,p=/^["']?data:.*,/i,m=/[^a-z1-6-_]/;function h(t){return t.tagName.toLowerCase()}function g(t,e){return`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${e}' style='background-color:silver'%3E%3C/svg%3E`}function v(t){if(void 0!==t&&0!==t.length)return t.map(t=>{const e=t.cssRules||t.rules;return{cssRules:Array.from(e,t=>t.cssText),disabled:t.disabled||void 0,media:t.media.length>0?Array.from(t.media):void 0}})}var y=n(760);function w(t,e,n,o){if(e===a.$m.HIDDEN)return null;const s=t.getAttribute(n),r=t.tagName;if((0,a.ap)(r,n,s,e,o)){if("IMG"===r){const e=t;if(e.naturalWidth>0)return g(e.naturalWidth,e.naturalHeight);const{width:n,height:o}=t.getBoundingClientRect();return n>0||o>0?g(n,o):a.eT}return"SOURCE"===r?a.eT:a.o}return s?(0,a.ei)(s,1e6):s}function S(t,e,n){if(e===a.$m.HIDDEN)return{};const o={},s=h(t);for(let s=0;s<t.attributes.length;s+=1){const r=t.attributes.item(s).name,i=w(t,e,r,n.scope.configuration);null!==i&&(o[r]=i)}if(t.value&&("textarea"===s||"select"===s||"option"===s||"input"===s)){const n=d(t,e);void 0!==n&&(o.value=n)}if("option"===s){const n=t;n.selected&&!(0,a.Ie)(n,e)?o.selected="":delete o.selected}const r=t;return"input"!==s||"radio"!==r.type&&"checkbox"!==r.type||(r.checked&&!(0,a.Ie)(r,e)?o.checked="":delete o.checked),o}function b(t,e,n){if(e===a.$m.HIDDEN)return{};const o={},s=t.ownerDocument,r=h(t);if("link"===r){const e=Array.from(s.styleSheets).find(e=>e.href===t.href),r=I(e);r&&e&&(n.addMetric("cssText",r.length),o._cssText=r)}if("style"===r&&t.sheet){const e=I(t.sheet);e&&(n.addMetric("cssText",e.length),o._cssText=e)}if("audio"===r||"video"===r){const e=t;o.rr_mediaState=e.paused?"paused":"played"}let i,c;switch(n.kind){case 0:i=Math.round(t.scrollTop),c=Math.round(t.scrollLeft),(i||c)&&n.scope.elementsScrollPositions.set(t,{scrollTop:i,scrollLeft:c});break;case 1:n.scope.elementsScrollPositions.has(t)&&({scrollTop:i,scrollLeft:c}=n.scope.elementsScrollPositions.get(t))}return c&&(o.rr_scrollLeft=c),i&&(o.rr_scrollTop=i),o}function I(t){if(!t)return null;let e;try{e=t.rules||t.cssRules}catch(t){}return e?(n=Array.from(e,(0,y.nr)()?x:N).join(""),o=t.href,n.replace(l,(t,e,n,s,r,i)=>{const a=n||r||i;if(!o||!a||f.test(a)||p.test(a))return t;const c=e||s||"";return`url(${c}${function(t,e){try{return(0,u.c$)(t,e).href}catch(e){return t}}(a,o)}${c})`})):null;var n,o}function x(t){if(function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")){const e=/(\[[\w-]+[^\\])(:[^\]]+\])/g;return t.cssText.replace(e,"$1\\$2")}return N(t)}function N(t){return function(t){return"styleSheet"in t}(t)&&I(t.styleSheet)||t.cssText}function E(t,e,n){switch(t.nodeType){case t.DOCUMENT_NODE:return function(t,e,n){return{type:0,id:n.assignId(t),childNodes:T(t,e,n),adoptedStyleSheets:v(t.adoptedStyleSheets)}}(t,e,n);case t.DOCUMENT_FRAGMENT_NODE:return function(t,e,n){const o=(0,a.p_)(t);return o&&n.scope.shadowRootsController.addShadowRoot(t,n.scope),{type:11,id:n.assignId(t),childNodes:T(t,e,n),isShadowRoot:o,adoptedStyleSheets:o?v(t.adoptedStyleSheets):void 0}}(t,e,n);case t.DOCUMENT_TYPE_NODE:return function(t,e){return{type:1,id:e.assignId(t),name:t.name,publicId:t.publicId,systemId:t.systemId}}(t,n);case t.ELEMENT_NODE:return function(t,e,n){const o=function(t){const e=t.toLowerCase().trim();return m.test(e)?"div":e}(t.tagName),s="svg"===(i=t).tagName||i instanceof SVGElement||void 0,r=(0,a.jR)((0,a.dT)(t),e);var i;if(r===a.$m.HIDDEN){const{width:e,height:r}=t.getBoundingClientRect();return{type:2,id:n.assignId(t),tagName:o,attributes:{rr_width:e+"px",rr_height:r+"px",[a.NT]:a.Wd},childNodes:[],isSVG:s}}if(r===a.$m.IGNORE)return null;const c=n.assignId(t),u=function(t,e,n){return{...S(t,e,n),...b(t,e,n)}}(t,r,n);let d=[];return(0,a.wR)(t)&&"style"!==o&&(d=T(t,r,n)),{type:2,id:c,tagName:o,attributes:u,childNodes:d,isSVG:s}}(t,e,n);case t.TEXT_NODE:return function(t,e,n){const o=(0,a.rf)(t,e);return void 0===o?null:{type:3,id:n.assignId(t),textContent:o}}(t,e,n);case t.CDATA_SECTION_NODE:return function(t,e){return{type:4,id:e.assignId(t),textContent:""}}(t,n);default:return null}}function T(t,e,n){const o=[];return(0,a.wI)(t,t=>{const s=E(t,e,n);s&&o.push(s)}),o}function C(t,e){return E(t,e.scope.configuration.defaultPrivacyLevel,e)}function _(t,e,n){t[e].count+=1,t[e].max=Math.max(t[e].max,n),t[e].sum+=n}function R(t,e,n,o,s){const r=[],i={cssText:{count:0,max:0,sum:0},serializationDuration:{count:0,max:0,sum:0}},a={add(t){r.push(t)},addMetric(t,e){_(i,t,e)},assignId(t){const e=o.nodeIds.assign(t);return a.serializedNodeIds&&a.serializedNodeIds.add(e),e},kind:t,scope:o},u=(0,c.nx)();s(a),_(i,"serializationDuration",(0,c.vk)(u,(0,c.nx)()));for(const t of r)e(t);n(i)}const D=t=>({scale:t.scale,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop,pageLeft:t.pageLeft,pageTop:t.pageTop,height:t.height,width:t.width});function L(t,e,n,o,s){R(e,n,o,s,e=>{const{width:n,height:o}=(0,a.pB)();e.add({data:{height:o,href:window.location.href,width:n},type:4,timestamp:t}),e.add({data:{has_focus:document.hasFocus()},type:6,timestamp:t}),e.add({data:{node:C(document,e),initialOffset:{left:(0,a.Gn)(),top:(0,a.zL)()}},type:2,timestamp:t}),window.visualViewport&&e.add({data:D(window.visualViewport),type:8,timestamp:t})})}var M=n(769),O=n(300),k=n(197);function P(t){return!!t.changedTouches}function $(t){return!0===t.composed&&(0,a.XS)(t.target)?t.composedPath()[0]:t.target}function A(t,e){return{data:{source:t,...e},type:3,timestamp:(0,c.nx)()}}function z(t,e){const{throttled:n,cancel:o}=(0,i.n)(n=>{const o=$(n),s=e.nodeIds.get(o);if(void 0===s)return;const r=H(n);if(!r)return;const i={id:s,timeOffset:0,x:r.x,y:r.y};t(A(P(n)?6:1,{positions:[i]}))},50,{trailing:!1}),{stop:s}=(0,k.l)(e.configuration,document,["mousemove","touchmove"],n,{capture:!0,passive:!0});return{stop(){s(),o()}}}function H(t){let{clientX:e,clientY:n}=P(t)?t.changedTouches[0]:t;if(window.visualViewport){const{visualViewportX:t,visualViewportY:o}=((t,e)=>{const n=window.visualViewport,o={layoutViewportX:t,layoutViewportY:e,visualViewportX:t,visualViewportY:e};return n?(function(t){return Math.abs(t.pageTop-t.offsetTop-window.scrollY)>25||Math.abs(t.pageLeft-t.offsetLeft-window.scrollX)>25}(n)?(o.layoutViewportX=Math.round(t+n.offsetLeft),o.layoutViewportY=Math.round(e+n.offsetTop)):(o.visualViewportX=Math.round(t-n.offsetLeft),o.visualViewportY=Math.round(e-n.offsetTop)),o):o})(e,n);e=t,n=o}if(Number.isFinite(e)&&Number.isFinite(n))return{x:e,y:n}}const V={pointerup:0,mousedown:1,click:2,contextmenu:3,dblclick:4,focus:5,blur:6,touchstart:7,touchend:9};function F(t,e){return(0,k.l)(e.configuration,document,Object.keys(V),n=>{const o=$(n),s=e.nodeIds.get(o);if(void 0===s||(0,a.PJ)(o,e.configuration.defaultPrivacyLevel)===a.$m.HIDDEN)return;const r=V[n.type];let i;if(6!==r&&5!==r){const t=H(n);if(!t)return;i={id:s,type:r,x:t.x,y:t.y}}else i={id:s,type:r};t({id:e.eventIds.getIdForEvent(n),...A(2,i)})},{capture:!0,passive:!0})}function G(t,e,n){const{throttled:o,cancel:s}=(0,i.n)(t=>{const o=$(t);if(!o)return;const s=n.nodeIds.get(o);if(void 0===s||(0,a.PJ)(o,n.configuration.defaultPrivacyLevel)===a.$m.HIDDEN)return;const r=o===document?{scrollTop:(0,a.zL)(),scrollLeft:(0,a.Gn)()}:{scrollTop:Math.round(o.scrollTop),scrollLeft:Math.round(o.scrollLeft)};n.elementsScrollPositions.set(o,r),e(A(3,{id:s,x:r.scrollLeft,y:r.scrollTop}))},100),{stop:r}=(0,k.q)(n.configuration,t,"scroll",o,{capture:!0,passive:!0});return{stop(){r(),s()}}}function B(t,e){const n=(0,a.g1)(e.configuration).subscribe(e=>{t(A(4,e))});return{stop(){n.unsubscribe()}}}function J(t,e){const n=window.visualViewport;if(!n)return{stop:i.l};const{throttled:o,cancel:s}=(0,i.n)(()=>{t({data:D(n),type:8,timestamp:(0,c.nx)()})},200,{trailing:!1}),{stop:r}=(0,k.l)(e.configuration,n,["resize","scroll"],o,{capture:!0,passive:!0});return{stop(){r(),s()}}}function X(t,e){return(0,k.l)(e.configuration,document,["play","pause"],n=>{const o=$(n);if(!o)return;const s=e.nodeIds.get(o);void 0!==s&&(0,a.PJ)(o,e.configuration.defaultPrivacyLevel)!==a.$m.HIDDEN&&t(A(7,{id:s,type:"play"===n.type?0:1}))},{capture:!0,passive:!0})}var Y=n(801);function U(t,e){function n(t,n){if(!t||!t.ownerNode)return;const o=e.nodeIds.get(t.ownerNode);void 0!==o&&n(o)}const o=[(0,Y.H)(CSSStyleSheet.prototype,"insertRule",({target:e,parameters:[o,s]})=>{n(e,e=>t(A(8,{id:e,adds:[{rule:o,index:s}]})))}),(0,Y.H)(CSSStyleSheet.prototype,"deleteRule",({target:e,parameters:[o]})=>{n(e,e=>t(A(8,{id:e,removes:[{index:o}]})))})];function s(e){o.push((0,Y.H)(e.prototype,"insertRule",({target:e,parameters:[o,s]})=>{n(e.parentStyleSheet,n=>{const r=W(e);r&&(r.push(s||0),t(A(8,{id:n,adds:[{rule:o,index:r}]})))})}),(0,Y.H)(e.prototype,"deleteRule",({target:e,parameters:[o]})=>{n(e.parentStyleSheet,n=>{const s=W(e);s&&(s.push(o),t(A(8,{id:n,removes:[{index:s}]})))})}))}return"undefined"!=typeof CSSGroupingRule?s(CSSGroupingRule):(s(CSSMediaRule),s(CSSSupportsRule)),{stop(){o.forEach(t=>t.stop())}}}function W(t){const e=[];let n=t;for(;n.parentRule;){const t=Array.from(n.parentRule.cssRules).indexOf(n);e.unshift(t),n=n.parentRule}if(!n.parentStyleSheet)return;const o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);return e.unshift(o),e}function q(t,e){return(0,k.l)(e.configuration,window,["focus","blur"],()=>{t({data:{has_focus:document.hasFocus()},type:6,timestamp:(0,c.nx)()})})}function j(t,e,n){const o=t.subscribe(12,t=>{var o,s;t.rawRumEvent.type===a.bb.ACTION&&t.rawRumEvent.action.type===a.X2.CLICK&&(null===(s=null===(o=t.rawRumEvent.action.frustration)||void 0===o?void 0:o.type)||void 0===s?void 0:s.length)&&"events"in t.domainContext&&t.domainContext.events&&t.domainContext.events.length&&e({timestamp:t.rawRumEvent.date,type:9,data:{frustrationTypes:t.rawRumEvent.action.frustration.type,recordIds:t.domainContext.events.map(t=>n.eventIds.getIdForEvent(t))}})});return{stop(){o.unsubscribe()}}}function K(t,e,n){const o=t.subscribe(5,()=>{n(),e({timestamp:(0,c.nx)(),type:7})});return{stop(){o.unsubscribe()}}}function Z(t,e,n){const o=n.configuration.defaultPrivacyLevel,s=new WeakMap,r=t!==document,{stop:c}=(0,k.l)(n.configuration,t,r?["change"]:["input","change"],t=>{const e=$(t);(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&l(e)},{capture:!0,passive:!0});let u;if(r)u=i.l;else{const t=[(0,Y.t)(HTMLInputElement.prototype,"value",l),(0,Y.t)(HTMLInputElement.prototype,"checked",l),(0,Y.t)(HTMLSelectElement.prototype,"value",l),(0,Y.t)(HTMLTextAreaElement.prototype,"value",l),(0,Y.t)(HTMLSelectElement.prototype,"selectedIndex",l)];u=()=>{t.forEach(t=>t.stop())}}return{stop(){u(),c()}};function l(t){const e=(0,a.PJ)(t,o);if(e===a.$m.HIDDEN)return;const n=t.type;let s;if("radio"===n||"checkbox"===n){if((0,a.Ie)(t,e))return;s={isChecked:t.checked}}else{const n=d(t,e);if(void 0===n)return;s={text:n}}f(t,s);const r=t.name;"radio"===n&&r&&t.checked&&document.querySelectorAll(`input[type="radio"][name="${CSS.escape(r)}"]`).forEach(e=>{e!==t&&f(e,{isChecked:!1})})}function f(t,o){const r=n.nodeIds.get(t);if(void 0===r)return;const i=s.get(t);i&&i.text===o.text&&i.isChecked===o.isChecked||(s.set(t,o),e(A(5,{id:r,...o})))}}var Q=n(315),tt=n(981);function et(t,e,n,o){const s=(0,a.W3)();if(!s)return{stop:i.l,flush:i.l};const r=function(){let t=i.l,s=[];function r(){var r;t(),r=s,R(2,e,n,o,t=>function(t,e){const n=new Map;t.filter(t=>"childList"===t.type).forEach(t=>{t.removedNodes.forEach(t=>{nt(t,e.scope.shadowRootsController.removeShadowRoot)})});const o=t.filter(t=>t.target.isConnected&&e.scope.nodeIds.areAssignedForNodeAndAncestors(t.target)&&(0,a.PJ)(t.target,e.scope.configuration.defaultPrivacyLevel,n)!==a.$m.HIDDEN),{adds:s,removes:r,hasBeenSerialized:i}=function(t,e,n){const o=new Set,s=new Map;for(const e of t)e.addedNodes.forEach(t=>{o.add(t)}),e.removedNodes.forEach(t=>{o.has(t)||s.set(t,e.target),o.delete(t)});const r=Array.from(o);r.sort((t,e)=>{const n=t.compareDocumentPosition(e);return n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_CONTAINS||n&Node.DOCUMENT_POSITION_FOLLOWING?1:n&Node.DOCUMENT_POSITION_PRECEDING?-1:0}),n.serializedNodeIds=new Set;const i=[];for(const t of r){if(u(t))continue;const o=(0,a.PJ)(t.parentNode,n.scope.configuration.defaultPrivacyLevel,e);if(o===a.$m.HIDDEN||o===a.$m.IGNORE)continue;const s=E(t,o,n);if(!s)continue;const r=(0,a.$4)(t);i.push({nextId:d(t),parentId:n.scope.nodeIds.get(r),node:s})}const c=[];return s.forEach((t,e)=>{const o=n.scope.nodeIds.get(t),s=n.scope.nodeIds.get(e);void 0!==o&&void 0!==s&&c.push({parentId:o,id:s})}),{adds:i,removes:c,hasBeenSerialized:u};function u(t){var e;const o=n.scope.nodeIds.get(t);return void 0!==o&&(null===(e=n.serializedNodeIds)||void 0===e?void 0:e.has(o))}function d(t){let e=t.nextSibling;for(;e;){const t=n.scope.nodeIds.get(e);if(void 0!==t)return t;e=e.nextSibling}return null}}(o.filter(t=>"childList"===t.type),n,e),c=function(t,e,n){var o;const s=[],r=new Set,i=t.filter(t=>!r.has(t.target)&&(r.add(t.target),!0));for(const t of i){if(t.target.textContent===t.oldValue)continue;const r=n.scope.nodeIds.get(t.target);if(void 0===r)continue;const i=(0,a.PJ)((0,a.$4)(t.target),n.scope.configuration.defaultPrivacyLevel,e);i!==a.$m.HIDDEN&&i!==a.$m.IGNORE&&s.push({id:r,value:null!==(o=(0,a.rf)(t.target,i))&&void 0!==o?o:null})}return s}(o.filter(t=>"characterData"===t.type&&!i(t.target)),n,e),u=function(t,e,n){const o=[],s=new Map,r=t.filter(t=>{const e=s.get(t.target);return!(e&&e.has(t.attributeName)||(e?e.add(t.attributeName):s.set(t.target,new Set([t.attributeName])),0))}),i=new Map;for(const t of r){if(t.target.getAttribute(t.attributeName)===t.oldValue)continue;const s=n.scope.nodeIds.get(t.target);if(void 0===s)continue;const r=(0,a.PJ)(t.target,n.scope.configuration.defaultPrivacyLevel,e),c=w(t.target,r,t.attributeName,n.scope.configuration);let u;if("value"===t.attributeName){const e=d(t.target,r);if(void 0===e)continue;u=e}else u="string"==typeof c?c:null;let l=i.get(t.target);l||(l={id:s,attributes:{}},o.push(l),i.set(t.target,l)),l.attributes[t.attributeName]=u}return o}(o.filter(t=>"attributes"===t.type&&!i(t.target)),n,e);(c.length||u.length||r.length||s.length)&&e.add(A(0,{adds:s,removes:r,texts:c,attributes:u}))}(r.concat(c.takeRecords()),t)),s=[]}const{throttled:u,cancel:l}=(0,i.n)(r,16,{leading:!1});return{addMutations(e){0===s.length&&(t=(0,tt.BB)(u,{timeout:100})),s.push(...e)},flush:r,stop(){t(),l()}}}(),c=new s((0,Q.dm)(r.addMutations));return c.observe(t,{attributeOldValue:!0,attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{stop(){c.disconnect(),r.stop()},flush(){r.flush()}}}function nt(t,e){(0,a.XS)(t)&&e(t.shadowRoot),(0,a.wI)(t,t=>nt(t,e))}var ot=n(887),st=n(636);function rt({context:t,creationReason:e,encoder:n}){let o=0;const s=t.view.id,r={start:1/0,end:-1/0,creation_reason:e,records_count:0,has_full_snapshot:!1,index_in_view:O.K_(s),source:"browser",...t},i={cssText:{count:0,max:0,sum:0},serializationDuration:{count:0,max:0,sum:0}};return O.H5(s),{addRecord(t,e){r.start=Math.min(r.start,t.timestamp),r.end=Math.max(r.end,t.timestamp),r.records_count+=1,r.has_full_snapshot||(r.has_full_snapshot=2===t.type);const s=n.isEmpty?'{"records":[':",";n.write(s+JSON.stringify(t),t=>{o+=t,e(o)})},addStats(t){!function(t,e){for(const n of["cssText","serializationDuration"])t[n].count+=e[n].count,t[n].max=Math.max(t[n].max,e[n].max),t[n].sum+=e[n].sum}(i,t)},flush(t){if(n.isEmpty)throw Error("Empty segment flushed");n.write(`],${JSON.stringify(r).slice(1)}\n`),n.finish(e=>{O.L7(r.view.id,e.rawBytesCount),t(r,i,e)})}}}const it=5*c.OY;function at(t,e,n,u,d,l,f){const p=[],m=f||(0,s.sA)([e.sessionReplayEndpointBuilder],e=>{t.notify(14,{error:e}),(0,o.A2)("Error reported to customer",{"error.message":e.message})},6e4);let h,g;if((0,r.d0)())({addRecord:h}=function(t){const e=(0,r.Y9)();return{addRecord(n){const o=t.findView();e.send("record",n,o.id)}}}(u)),g=i.l;else{const s=function(t,e,n,o,s,r){return function(t,s,r,i){let a={status:0,nextSegmentCreationReason:"init"};const{unsubscribe:c}=t.subscribe(2,()=>{d("view_change")}),{unsubscribe:u}=t.subscribe(11,t=>{d(t.reason)});function d(t){1===a.status&&(a.segment.flush((e,n,o)=>{const s=function(t,e,n,o){const s=new FormData;s.append("segment",new Blob([t],{type:"application/octet-stream"}),`${e.session.id}-${e.start}`);const r={raw_segment_size:o,compressed_segment_size:t.byteLength,...e},i=JSON.stringify(r);return s.append("event",new Blob([i],{type:"application/json"})),{data:s,bytesCount:t.byteLength,cssText:n.cssText,isFullSnapshot:0===e.index_in_view,rawSize:o,recordCount:e.records_count,serializationDuration:n.serializationDuration}}(o.output,e,n,o.rawBytesCount);(0,ot.Kp)(t)?r.sendOnExit(s):r.send(s)}),(0,st.DJ)(a.expirationTimeoutId)),a="stop"!==t?{status:0,nextSegmentCreationReason:t}:{status:2}}return{addRecord(t){if(2!==a.status){if(0===a.status){const t=function(t,e,n){const o=e.findTrackedSession(),s=n.findView();if(o&&s)return{application:{id:t},session:{id:o.id},view:{id:s.id}}}(e.applicationId,n,o);if(!t)return;a={status:1,segment:rt({encoder:i,context:t,creationReason:a.nextSegmentCreationReason}),expirationTimeoutId:(0,st.wg)(()=>{d("segment_duration_limit")},it)}}a.segment.addRecord(t,t=>{t>6e4&&d("segment_bytes_limit")})}},addStats(t){1===a.status&&a.segment.addStats(t)},stop(){d("stop"),c(),u()}}}(t,0,s,r)}(t,e,n,u,m,d);h=s.addRecord,g=s.addStats,p.push(s.stop);const r=function(t,e){if(!t.metricsEnabled)return{stop:i.l};const{unsubscribe:n}=e.subscribe(t=>{if("failure"===t.type||"queue-full"===t.type||"success"===t.type&&t.payload.isFullSnapshot){const r=(e=t.type,n=t.bandwidth,{cssText:{count:(s=t.payload).cssText.count,max:s.cssText.max,sum:s.cssText.sum},isFullSnapshot:s.isFullSnapshot,ongoingRequests:{count:n.ongoingRequestCount,totalSize:n.ongoingByteCount},recordCount:s.recordCount,result:e,serializationDuration:{count:s.serializationDuration.count,max:s.serializationDuration.max,sum:s.serializationDuration.sum},size:{compressed:s.bytesCount,raw:s.rawSize}});(0,o.Gk)("Segment network request metrics",{metrics:r})}var e,n,s});return{stop:n}}(l,m.observable);p.push(r.stop)}const{stop:v}=function(t){const{emitRecord:e,emitStats:n,configuration:o,lifeCycle:s}=t;if(!e||!n)throw Error("emit functions are required");const r=n=>{e(n),(0,M.b)("record",{record:n});const o=t.viewHistory.findView();O.$1(o.id)},i=((t,e)=>{const n=new Map;return{addShadowRoot(o,s){if(n.has(o))return;const r=et(o,t,e,s),i=Z(o,t,s),a=G(o,t,s);n.set(o,{flush:()=>r.flush(),stop(){r.stop(),i.stop(),a.stop()}})},removeShadowRoot(t){const e=n.get(t);e&&(e.stop(),n.delete(t))},stop(){n.forEach(({stop:t})=>t())},flush(){n.forEach(({flush:t})=>t())}}})(r,n),u=function(t,e,n,o,s){return{configuration:t,elementsScrollPositions:e,eventIds:n,nodeIds:o,shadowRootsController:s}}(o,function(){const t=new WeakMap;return{set(e,n){(e!==document||document.scrollingElement)&&t.set(e===document?document.scrollingElement:e,n)},get(e){return t.get(e)},has(e){return t.has(e)}}}(),function(){const t=new WeakMap;let e=1;return{getIdForEvent(n){return t.has(n)||t.set(n,e++),t.get(n)}}}(),function(){const t=new WeakMap;let e=0;const n=e=>t.get(e);return{assign(o){let s=n(o);return void 0===s&&(s=e++,t.set(o,s)),s},get:n,areAssignedForNodeAndAncestors(t){let e=t;for(;e;){if(void 0===n(e)&&!(0,a.p_)(e))return!1;e=(0,a.$4)(e)}return!0}}}(),i),{stop:d}=function(t,e,n,o,s){L((0,c.nx)(),0,e,n,s);const{unsubscribe:r}=t.subscribe(2,t=>{o(),L(t.startClocks.timeStamp,1,e,n,s)});return{stop:r}}(s,r,n,l,u);function l(){i.flush(),f.flush()}const f=et(document,r,n,u),p=[f,z(r,u),F(r,u),G(document,r,u),B(r,u),Z(document,r,u),X(r,u),U(r,u),q(r,u),J(r,u),j(s,r,u),K(s,r,l)];return{stop(){i.stop(),p.forEach(t=>t.stop()),d()},flushMutations:l,shadowRootsController:i}}({emitRecord:h,emitStats:g,configuration:e,lifeCycle:t,viewHistory:u});return p.push(v),{stop(){p.forEach(t=>t())}}}}}]);