flowgrid-sdk 1.6.9 → 1.6.10
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/dist/umd/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FlowGridSDK=t():e.FlowGridSDK=t()}(this,()=>(()=>{var e={8156(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.resetCartId=t.getOrCreateCartId=t.getOrCreateAnonId=t.ConsentManager=t.IdentityManager=t.getUTMHistory=t.getUTM=t.getWebId=t.getSessionId=t.getVisitorId=t.getCookie=t.Forecasting=t.SecurityAnalytics=t.AlertsAnalytics=t.PathAnalytics=t.AcquisitionAnalytics=t.SupportAnalytics=t.MultiPathFunnels=t.Monetization=t.ChurnAnalytics=t.Cohorts=t.Engagement=t.FlowGridTransport=t.Subscriptions=t.SearchAnalytics=t.CustomerLTV=t.WishlistTracking=t.Promotions=t.Refunds=t.Purchases=t.Checkout=t.CartTracking=t.Products=t.SessionReplay=t.Performance=t.PerformanceTracking=t.Heatmaps=t.Attribution=t.Retention=t.Funnels=t.Identify=t.Events=t.Sessions=t.PageViews=t.Experiment=t.TrackPrompt=t.TrackFeature=t.Activation=t.default=t.FlowGrid=void 0,t.attachConsentBanner=t.setupConsent=void 0;var i=r(7138);Object.defineProperty(t,"FlowGrid",{enumerable:!0,get:function(){return i.FlowGrid}});var s=r(7138);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n(s).default}});var o=r(7244);Object.defineProperty(t,"Activation",{enumerable:!0,get:function(){return o.Activation}}),Object.defineProperty(t,"TrackFeature",{enumerable:!0,get:function(){return o.TrackFeature}}),Object.defineProperty(t,"TrackPrompt",{enumerable:!0,get:function(){return o.TrackPrompt}}),Object.defineProperty(t,"Experiment",{enumerable:!0,get:function(){return o.Experiment}});var a=r(8597);Object.defineProperty(t,"PageViews",{enumerable:!0,get:function(){return a.PageViews}}),Object.defineProperty(t,"Sessions",{enumerable:!0,get:function(){return a.Sessions}}),Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return a.Events}}),Object.defineProperty(t,"Identify",{enumerable:!0,get:function(){return a.Identify}}),Object.defineProperty(t,"Funnels",{enumerable:!0,get:function(){return a.Funnels}}),Object.defineProperty(t,"Retention",{enumerable:!0,get:function(){return a.Retention}}),Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return a.Attribution}}),Object.defineProperty(t,"Heatmaps",{enumerable:!0,get:function(){return a.Heatmaps}}),Object.defineProperty(t,"PerformanceTracking",{enumerable:!0,get:function(){return a.PerformanceTracking}}),Object.defineProperty(t,"Performance",{enumerable:!0,get:function(){return a.PerformanceTracking}}),Object.defineProperty(t,"SessionReplay",{enumerable:!0,get:function(){return a.SessionReplay}});var c=r(5405);Object.defineProperty(t,"Products",{enumerable:!0,get:function(){return c.Products}}),Object.defineProperty(t,"CartTracking",{enumerable:!0,get:function(){return c.CartTracking}}),Object.defineProperty(t,"Checkout",{enumerable:!0,get:function(){return c.Checkout}}),Object.defineProperty(t,"Purchases",{enumerable:!0,get:function(){return c.Purchases}}),Object.defineProperty(t,"Refunds",{enumerable:!0,get:function(){return c.Refunds}}),Object.defineProperty(t,"Promotions",{enumerable:!0,get:function(){return c.Promotions}}),Object.defineProperty(t,"WishlistTracking",{enumerable:!0,get:function(){return c.WishlistTracking}}),Object.defineProperty(t,"CustomerLTV",{enumerable:!0,get:function(){return c.CustomerLTV}}),Object.defineProperty(t,"SearchAnalytics",{enumerable:!0,get:function(){return c.SearchAnalytics}}),Object.defineProperty(t,"Subscriptions",{enumerable:!0,get:function(){return c.Subscriptions}});var u=r(5975);Object.defineProperty(t,"FlowGridTransport",{enumerable:!0,get:function(){return u.FlowGridTransport}});var l=r(7736);Object.defineProperty(t,"Engagement",{enumerable:!0,get:function(){return l.Engagement}}),Object.defineProperty(t,"Cohorts",{enumerable:!0,get:function(){return l.Cohorts}}),Object.defineProperty(t,"ChurnAnalytics",{enumerable:!0,get:function(){return l.ChurnAnalytics}}),Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return l.Monetization}}),Object.defineProperty(t,"MultiPathFunnels",{enumerable:!0,get:function(){return l.MultiPathFunnels}}),Object.defineProperty(t,"SupportAnalytics",{enumerable:!0,get:function(){return l.SupportAnalytics}}),Object.defineProperty(t,"AcquisitionAnalytics",{enumerable:!0,get:function(){return l.AcquisitionAnalytics}}),Object.defineProperty(t,"PathAnalytics",{enumerable:!0,get:function(){return l.PathAnalytics}}),Object.defineProperty(t,"AlertsAnalytics",{enumerable:!0,get:function(){return l.AlertsAnalytics}}),Object.defineProperty(t,"SecurityAnalytics",{enumerable:!0,get:function(){return l.SecurityAnalytics}}),Object.defineProperty(t,"Forecasting",{enumerable:!0,get:function(){return l.Forecasting}});var d=r(4211);Object.defineProperty(t,"getCookie",{enumerable:!0,get:function(){return d.getCookie}}),Object.defineProperty(t,"getVisitorId",{enumerable:!0,get:function(){return d.getVisitorId}}),Object.defineProperty(t,"getSessionId",{enumerable:!0,get:function(){return d.getSessionId}}),Object.defineProperty(t,"getWebId",{enumerable:!0,get:function(){return d.getWebId}}),Object.defineProperty(t,"getUTM",{enumerable:!0,get:function(){return d.getUTM}}),Object.defineProperty(t,"getUTMHistory",{enumerable:!0,get:function(){return d.getUTMHistory}});var p=r(5558);Object.defineProperty(t,"IdentityManager",{enumerable:!0,get:function(){return p.IdentityManager}});var h=r(4513);Object.defineProperty(t,"ConsentManager",{enumerable:!0,get:function(){return h.ConsentManager}});var m=r(1134);Object.defineProperty(t,"getOrCreateAnonId",{enumerable:!0,get:function(){return m.getOrCreateAnonId}}),Object.defineProperty(t,"getOrCreateCartId",{enumerable:!0,get:function(){return m.getOrCreateCartId}}),Object.defineProperty(t,"resetCartId",{enumerable:!0,get:function(){return m.resetCartId}}),Object.defineProperty(t,"setupConsent",{enumerable:!0,get:function(){return m.setupConsent}}),Object.defineProperty(t,"attachConsentBanner",{enumerable:!0,get:function(){return m.attachConsentBanner}})},5975(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlowGridTransport=void 0;const n=r(4211);class i{constructor(e,t,r,n,i,s){if(!e?.trim()||!t?.trim())throw new Error("SDK init failed: webId and endpoint are required.");this.webId=e.trim(),this.endpoint=this.normalizeEndpoint(t),this.apiKey=r,this.identityManager=i,this.visitorId=n??"",this.transportConfig={botDetection:s?.botDetection??"block",respectDNT:s?.respectDNT??!0,sampleRate:s?.sampleRate??1},this.drainEventBuffer()}static setConsent(e){Object.assign(i.consent,e)}static hasConsent(e){return i.consent[e]??!1}static isLikelyBot(){return!("undefined"==typeof navigator||!navigator.webdriver&&!/bot|crawl|spider|headless|phantom|puppeteer/i.test(navigator.userAgent))}isDNTEnabled(){return"undefined"!=typeof navigator&&(!!navigator.globalPrivacyControl||"1"===navigator.doNotTrack)}static getDeviceContext(){if("undefined"==typeof window||"undefined"==typeof navigator)return{};const e=window.location,t="undefined"!=typeof document?document:void 0;return{_screen_width:window.screen?.width,_screen_height:window.screen?.height,_device_type:/Mobi|Android/i.test(navigator.userAgent)?"mobile":"desktop",_language:navigator.language,_url:e?.href,_page:e?.pathname,_referrer:t?.referrer||void 0,_title:t?.title||void 0,...i.getUtmContext()}}static getUtmContext(){if("undefined"==typeof window)return{};let e=null;try{e=new URLSearchParams(window.location?.search??"")}catch{e=null}const t={};for(const r of i.ATTRIBUTION_KEYS){const i=e?.get(r)||(0,n.getCookie)(`__flowgrid_${r}`);i&&(t[`_${r}`]=i)}return t}sendViaBeacon(e,t={}){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;const r=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",n=t.type||"event",s=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(n)}`,o=JSON.stringify({web_id:this.webId,visitor_id:r,event_name:e,properties:{...t,...i.getDeviceContext()}});return navigator.sendBeacon(s,new Blob([o],{type:"application/json"}))}async postRaw(e,t,r={}){if(!1===i.consent.analytics)return;if(!1!==this.transportConfig.respectDNT&&this.isDNTEnabled())return;const n=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(e)}`,s=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",o=JSON.stringify({web_id:this.webId,visitor_id:s,...t}),a=!0===r.useBeacon,c=o.length,u=a&&c<=6e4;if(a&&c>6e4){const t=JSON.stringify({...JSON.parse(o),api_key:this.apiKey});try{"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(n,new Blob([t],{type:"application/json"}))||"undefined"==typeof console||console.warn(`[Flowgrid] ${e} beacon rejected (payload ${c} bytes)`)}catch(t){"undefined"!=typeof console&&console.warn(`[Flowgrid] ${e} beacon error:`,t)}return}try{const t=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:o,...u?{keepalive:!0}:{}});t.ok||"undefined"==typeof console||console.warn(`[Flowgrid] ${e} rejected: ${t.status} ${t.statusText} (${c} bytes)`)}catch(t){"undefined"!=typeof console&&console.warn(`[Flowgrid] ${e} network error (${c} bytes):`,t)}}bufferEvent(e,t,r){if("undefined"!=typeof localStorage)try{const n=localStorage.getItem(i.EVENT_BUFFER_KEY),s=n?JSON.parse(n):[];if(s.length>=i.MAX_BUFFER_EVENTS)return;const o=JSON.stringify([...s,{url:e,method:t,body:r}]);if((new TextEncoder).encode(o).length>i.MAX_BUFFER_SIZE)return;s.push({url:e,method:t,body:r}),localStorage.setItem(i.EVENT_BUFFER_KEY,JSON.stringify(s))}catch{}}drainEventBuffer(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(i.EVENT_BUFFER_KEY);if(!e)return;const t=JSON.parse(e);localStorage.removeItem(i.EVENT_BUFFER_KEY);for(const e of t)fetch(e.url,{method:e.method,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:e.body}).catch(()=>{})}catch{}}async init(e,t={},r="POST"){if(!i.hasConsent("analytics"))return{};if(this.transportConfig.respectDNT&&this.isDNTEnabled())return{};if("block"===this.transportConfig.botDetection&&i.isLikelyBot())return{};this.validateInput(e,t),"tag"===this.transportConfig.botDetection&&i.isLikelyBot()&&(t={...t,_bot:!0});const n={...i.getDeviceContext(),...t},s=n.type||"event",o=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(s)}`,a=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",c=JSON.stringify({web_id:this.webId,visitor_id:a,event_name:e,properties:n});return this.executeRequest(o,r,"GET"===r?void 0:c)}async initFeature(e,t){if(this.validateInput(e,t),!t.type)throw new Error("Feature events must include a type property");const r=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(t.type)}`,n=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",i=JSON.stringify({web_id:this.webId,visitor_id:n,event_name:e,properties:t});return this.executeRequest(r,"POST",i)}async executeRequest(e,t,r,n){let s=0;for(;s<=i.MAX_RETRIES;){const o=new AbortController,a=setTimeout(()=>o.abort(),i.TIMEOUT_MS);try{const c=await fetch(e,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,...n},body:r,signal:o.signal});if(clearTimeout(a),c.status>=500&&s<i.MAX_RETRIES){s++,await this.backoff(s);continue}if(!c.ok){const e=await this.safeRead(c);throw new Error(`SDK request failed (${c.status} ${c.statusText}) ${e}`)}return await c.json()}catch(n){if(clearTimeout(a),n instanceof Error&&("AbortError"===n.name||n.message.includes("fetch"))&&s<i.MAX_RETRIES){s++,await this.backoff(s);continue}if(s>=i.MAX_RETRIES&&(r&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(e,new Blob([r],{type:"application/json"}))||this.bufferEvent(e,t,r)),n instanceof Error&&"AbortError"===n.name)throw new Error("SDK request timed out");throw n}}throw new Error("SDK request exhausted retries without resolution")}backoff(e){const t=Math.min(1e3*Math.pow(2,e-1),3e4),r=Math.random()*t;return new Promise(e=>setTimeout(e,r))}validateInput(e,t){if(!e||"string"!=typeof e||!e.trim())throw new Error("Event name must be a non-empty string");if(e.length>100)throw new Error("Event name must be less than 100 characters");let r;try{r=JSON.stringify({web_id:this.webId,visitor_id:this.visitorId??"",event_name:e,properties:t})}catch{throw new Error("Properties must be JSON serializable")}if((new TextEncoder).encode(r).length>i.MAX_PAYLOAD_SIZE)throw new Error("Event payload too large (max 10KB)");const n=["password","token","secret","apikey","authorization"],s=r.toLowerCase();for(const e of n)s.includes(e)&&console.warn(`SDK Warning: Properties may contain sensitive data (${e}).`)}normalizeEndpoint(e){let t=e.trim();return t.startsWith("http://")||t.startsWith("https://")||(t=`https://${t}`),t.replace(/\/+$/,"")}async safeRead(e){try{return await e.text()}catch{return""}}}t.FlowGridTransport=i,i.MAX_PAYLOAD_SIZE=1e4,i.TIMEOUT_MS=1e4,i.MAX_RETRIES=3,i.MAX_BUFFER_EVENTS=100,i.MAX_BUFFER_SIZE=5e4,i.EVENT_BUFFER_KEY="fg_event_buffer",i.consent={analytics:!0,marketing:!0},i.ATTRIBUTION_KEYS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","ref","via","source"]},4513(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentManager=void 0;var n=r(1906);Object.defineProperty(t,"ConsentManager",{enumerable:!0,get:function(){return n.ConsentManager}})},1906(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentManager=void 0;const r="fg_tracking_consent",n={necessary:!0,analytics:!1,marketing:!1,preferences:!0};t.ConsentManager=class{constructor(e){this.config={cookieName:e?.cookieName??"fg_consent",cookieDays:e?.cookieDays??365,cookieDomain:e?.cookieDomain,respectDNT:e?.respectDNT??!0,requireExplicitConsent:e?.requireExplicitConsent??!0,onChange:e?.onChange,defaultPreferences:{...n,...e?.defaultPreferences,necessary:!0}};const t=this.loadFromCookie();t?this.preferences=t:this.isDNTEnabled()&&this.config.respectDNT?this.preferences={necessary:!0,analytics:!1,marketing:!1,preferences:!1}:this.config.requireExplicitConsent?this.preferences={...this.config.defaultPreferences}:this.preferences={necessary:!0,analytics:!0,marketing:!0,preferences:!0}}hasConsented(){return null!==this.loadFromCookie()}getPreferences(){return{...this.preferences}}hasCategory(e){return this.preferences[e]??!1}acceptAll(){this.setPreferences({necessary:!0,analytics:!0,marketing:!0,preferences:!0})}rejectNonEssential(){this.setPreferences({necessary:!0,analytics:!1,marketing:!1,preferences:!1})}update(e){this.setPreferences({...this.preferences,...e,necessary:!0})}reset(){this.deleteCookie(),this.preferences={...this.config.defaultPreferences}}setPreferences(e){this.preferences,this.preferences={...e,necessary:!0},this.saveToCookie(),this.config.onChange&&this.config.onChange(this.preferences)}isDNTEnabled(){return"undefined"!=typeof navigator&&(!!navigator.globalPrivacyControl||"1"===navigator.doNotTrack)}loadFromCookie(){if("undefined"==typeof document)return null;const e=document.cookie.match(new RegExp("(^| )"+this.config.cookieName+"=([^;]+)"));if(!e)return null;try{const t=JSON.parse(decodeURIComponent(e[2]));return"object"==typeof t&&null!==t&&"boolean"==typeof t.necessary?{...n,...t,necessary:!0}:null}catch{return null}}saveToCookie(){if("undefined"==typeof document)return;const e=encodeURIComponent(JSON.stringify(this.preferences)),t=24*this.config.cookieDays*60*60,n=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"",i="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";document.cookie=`${this.config.cookieName}=${e}; Path=/; Max-Age=${t}; SameSite=Lax${i}${n}`;const s=this.preferences.analytics?"true":"false";document.cookie=`${r}=${s}; Path=/; Max-Age=${t}; SameSite=Lax${i}${n}`}deleteCookie(){if("undefined"==typeof document)return;const e=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"";document.cookie=`${this.config.cookieName}=; Path=/; Max-Age=0${e}`,document.cookie=`${r}=; Path=/; Max-Age=0${e}`}}},2412(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Attribution=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async trackTouchpoint(e){return await this.init("attribution_touchpoint",{type:"attribution_touchpoint",userId:e.userId,channel:e.channel,campaign:e.campaign,medium:e.medium,source:e.source,content:e.content,term:e.term,referrer:e.referrer,landingPage:e.landingPage,...e.properties,timestamp:(new Date).toISOString()})}async recordConversion(e){return await this.init("attribution_conversion",{type:"attribution_conversion",userId:e.userId,conversionType:e.conversionType,value:e.value,conversionId:e.conversionId,...e.properties,timestamp:(new Date).toISOString()})}captureFromUrl(e){if(!(0,i.isBrowser)())return null;const t=(0,i.getWindow)(),r=(0,i.getDocument)();if(!t||!r)return null;const n=new URLSearchParams(t.location.search),s={utmSource:n.get("utm_source")??void 0,utmMedium:n.get("utm_medium")??void 0,utmCampaign:n.get("utm_campaign")??void 0,utmTerm:n.get("utm_term")??void 0,utmContent:n.get("utm_content")??void 0},o=r.referrer||void 0;if(!(s.utmSource||s.utmMedium||s.utmCampaign||o))return null;const a={userId:e,channel:s.utmSource||(o?"referral":"direct"),campaign:s.utmCampaign,medium:s.utmMedium,source:s.utmSource,content:s.utmContent,term:s.utmTerm,referrer:o,landingPage:t.location.pathname};return this.trackTouchpoint(a),a}}t.Attribution=s,t.default=s},9648(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Events=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("custom_event",{type:"custom_event",eventName:e.eventName,category:e.category||"general",action:e.action,label:e.label,value:e.value,nonInteraction:e.nonInteraction||!1,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackBatch(e){const t=e.events.map(e=>({...e,timestamp:(new Date).toISOString()}));return await this.init("batch_events",{type:"batch_events",events:t,count:t.length,timestamp:(new Date).toISOString()})}async trackClick(e){return await this.init("click_event",{type:"click_event",...e,timestamp:(new Date).toISOString()})}async trackForm(e){return await this.init("form_event",{type:"form_event",...e,timestamp:(new Date).toISOString()})}async trackSearch(e){return await this.init("search_event",{type:"search_event",query:e.query,category:e.category,resultsCount:e.resultsCount,resultClicked:e.resultClicked,clickedPosition:e.clickedPosition,filters:e.filters,timestamp:(new Date).toISOString()})}async trackError(e){return await this.init("error_event",{type:"error_event",message:e.message,stack:e.stack,errorType:e.type,fatal:e.fatal||!1,context:e.context,userAction:e.userAction,timestamp:(new Date).toISOString()})}}t.Events=i,t.default=i},4492(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Funnels=void 0;const n=r(5975);class i extends n.FlowGridTransport{async define(e){return await this.init("define_funnel",{type:"define_funnel",funnelId:e.funnelId,name:e.name,description:e.description,steps:e.steps,timestamp:(new Date).toISOString()})}async trackStep(e){return await this.init("funnel_step",{type:"funnel_step",funnelId:e.funnelId,step:e.step,stepNumber:e.stepNumber,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackComplete(e,t,r){return await this.init("funnel_complete",{type:"funnel_complete",funnelId:e,userId:t,...r,timestamp:(new Date).toISOString()})}async trackAbandon(e,t,r,n){return await this.init("funnel_abandon",{type:"funnel_abandon",funnelId:e,lastStep:t,userId:r,reason:n,timestamp:(new Date).toISOString()})}async analyze(e,t){return await this.init("analyze_funnel",{type:"query",funnelId:e,filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}async compare(e,t,r){return await this.init("compare_funnel",{type:"query",funnelId:e,baselineFilter:t,comparisonFilter:r,timestamp:(new Date).toISOString()})}async list(){return await this.init("list_funnels",{type:"query",timestamp:(new Date).toISOString()})}}t.Funnels=i,t.default=i},5004(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Heatmaps=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{constructor(){super(...arguments),this.lastMovementTime=0,this.lastScrollTime=0}async trackClick(e){return await this.init("heatmap_click",{type:"heatmap_click",pageUrl:e.pageUrl,x:e.x,y:e.y,normalizedX:e.x/e.viewportWidth,normalizedY:e.y/e.viewportHeight,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight,elementSelector:e.elementSelector,elementText:e.elementText?.substring(0,50),userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async trackMovement(e){const t=Date.now();return t-this.lastMovementTime<s.MOVEMENT_THROTTLE_MS?{eventName:"heatmap_movement",properties:{},response:{recorded:!1,interactionId:""},timestamp:(new Date).toISOString()}:(this.lastMovementTime=t,await this.init("heatmap_movement",{type:"heatmap_movement",pageUrl:e.pageUrl,path:e.path,viewport:e.viewport,sessionId:e.sessionId,timestamp:(new Date).toISOString()}))}async trackScroll(e){const t=Date.now();return t-this.lastScrollTime<s.SCROLL_THROTTLE_MS?{eventName:"heatmap_scroll",properties:{},response:{recorded:!1,interactionId:""},timestamp:(new Date).toISOString()}:(this.lastScrollTime=t,await this.init("heatmap_scroll",{type:"heatmap_scroll",pageUrl:e.pageUrl,maxScrollDepth:e.maxScrollDepth,pageHeight:e.pageHeight,viewportHeight:e.viewportHeight,timeAtDepths:e.timeAtDepths,sessionId:e.sessionId,timestamp:(new Date).toISOString()}))}async trackRageClick(e,t,r,n){return await this.init("heatmap_rage_click",{type:"heatmap_rage_click",pageUrl:e,x:t,y:r,clickCount:n,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)(),n=r=>{const n=r.target;var i;this.trackClick({pageUrl:t.location.pathname,x:r.clientX,y:r.clientY+t.scrollY,viewportWidth:t.innerWidth,viewportHeight:t.innerHeight,elementSelector:(i=n,i?i.id?`#${i.id}`:`${i.tagName.toLowerCase()}${i.className&&"string"==typeof i.className?"."+i.className.trim().split(/\s+/).slice(0,2).join("."):""}`:""),elementText:(n?.textContent||"").trim().slice(0,50),userId:e.userId,sessionId:e.sessionId})};r.addEventListener("click",n,{capture:!0,passive:!0});let s=0,o=!1;const a=()=>{o=!1;const n=r.documentElement;this.trackScroll({pageUrl:t.location.pathname,maxScrollDepth:s,pageHeight:n.scrollHeight,viewportHeight:t.innerHeight,sessionId:e.sessionId})},c=()=>{const e=r.documentElement,n=t.scrollY||e.scrollTop,i=Math.max(1,e.scrollHeight-t.innerHeight),c=Math.min(100,Math.round(n/i*100));c>s&&(s=c),o||(o=!0,t.addEventListener("pagehide",a,{once:!0}))};let u;if(t.addEventListener("scroll",c,{passive:!0}),e.movement){let n=[];const i=Date.now(),s=r=>{if(n.push({x:r.clientX,y:r.clientY,t:Date.now()-i}),n.length>=50){const r=n;n=[],this.trackMovement({pageUrl:t.location.pathname,path:r,viewport:{width:t.innerWidth,height:t.innerHeight},sessionId:e.sessionId})}};r.addEventListener("mousemove",s,{passive:!0}),u=()=>r.removeEventListener("mousemove",s)}return(0,i.combineTeardowns)(()=>r.removeEventListener("click",n,{capture:!0}),()=>t.removeEventListener("scroll",c),()=>t.removeEventListener("pagehide",a),u)}}t.Heatmaps=s,s.MOVEMENT_THROTTLE_MS=100,s.SCROLL_THROTTLE_MS=500,t.default=s},7565(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identify=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async user(e){return await this.init("identify_user",{type:"identify",userId:e.userId,anonymousId:e.anonymousId,traits:e.traits||{},timestamp:(new Date).toISOString()})}async updateTraits(e,t){return await this.init("update_traits",{type:"update_traits",userId:e,traits:t,timestamp:(new Date).toISOString()})}async alias(e){return await this.init("alias_user",{type:"alias",previousId:e.previousId,userId:e.userId,timestamp:(new Date).toISOString()})}async group(e){return await this.init("group_user",{type:"group",userId:e.userId,groupId:e.groupId,traits:e.traits||{},timestamp:(new Date).toISOString()})}async reset(e){return await this.init("reset_identity",{type:"reset",userId:e,timestamp:(new Date).toISOString()})}autoTrackForms(e={}){if(!(0,i.isBrowser)())return()=>{};if(!n.FlowGridTransport.hasConsent("analytics"))return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)(),s=e.debounceMs??800,o=e.excludePath??/\/(checkout|account\/settings|admin)(\/|$)/i,a=/(password|cardnumber|creditcard|\bcard\b|cvv|cvc|ssn|\bpin\b|securitycode)/i,c=/(message|comment|note|feedback|search|query)/i,u=[{re:/(email|emailaddress)/,trait:"email",pii:!0,identify:!0},{re:/(phone|tel|mobile|cell)/,trait:"phone",pii:!0,identify:!1},{re:/(firstname|fname|givenname)/,trait:"firstName",pii:!1,identify:!1},{re:/(lastname|lname|surname|familyname)/,trait:"lastName",pii:!1,identify:!1},{re:/(company|organi[sz]ation|businessname)/,trait:"company",pii:!1,identify:!1},{re:/(streetaddress|addressline|^address$|^street$)/,trait:"address",pii:!1,identify:!1},{re:/(^city$|town)/,trait:"city",pii:!1,identify:!1},{re:/(postcode|postalcode|zipcode|^zip$)/,trait:"postcode",pii:!1,identify:!1},{re:/(fullname|^name$|username|yourname|contactname|displayname)/,trait:"firstName",pii:!1,identify:!1}],l={},d=new WeakSet,p=new WeakMap,h=[],m=e=>{const t=(e=>[e.name,e.id,e.getAttribute("placeholder"),e.getAttribute("autocomplete")].filter(Boolean).join(" ").toLowerCase().replace(/[\s_-]/g,""))(e);return t?((e,t)=>{const r=e;return"password"===r.type||"hidden"===r.type||"ignore"===e.getAttribute("data-analytics")||!(!e.classList||!e.classList.contains("no-track"))||a.test(t)})(e,t)?{blocked:!0}:c.test(t)?null:u.find(e=>e.re.test(t))??null:null},f=()=>(this.identityManager?this.identityManager.getVisitorId():this.visitorId)||"",g=()=>this.identityManager?this.identityManager.getSessionId():null,y=()=>{const e=f();if(!this.webId||!e)return;if(!(l.email||l.emailHash||l.firstName||l.lastName))return;const r={email:l.email??null,email_hash:l.emailHash??null,phone_hash:l.phoneHash??null,first_name:l.firstName??null,last_name:l.lastName??null,company:l.company??null,address:l.address??null,city:l.city??null,postcode:l.postcode??null},n=`${this.endpoint}/api/v1/identity/identify`,i=JSON.stringify({web_id:this.webId,visitor_id:e,session_id:g(),path_name:t.location.pathname,traits:r});try{"undefined"!=typeof navigator&&navigator.sendBeacon&&navigator.sendBeacon(n,new Blob([i],{type:"application/json"}))||fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:i,keepalive:!0}).catch(()=>{})}catch{}},v=e=>{const r=m(e);if(!r||"blocked"in r)return;const n=(e.value||"").trim();n&&(r.pii?(async e=>{try{const r=(new TextEncoder).encode(String(e).trim().toLowerCase()),n=await t.crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch{return null}})("phone"===r.trait?n.replace(/[^\d+]/g,""):n).then(e=>{"email"===r.trait?(l.email=n,e&&(l.emailHash=e)):"phone"===r.trait&&e&&(l.phoneHash=e),(r.identify||l.email)&&y()}):(l[r.trait]=n,l.email&&y()))},I=e=>{if(d.has(e))return;const t=m(e);if(!t||"blocked"in t)return;d.add(e);const r=()=>v(e),n=()=>{clearTimeout(p.get(e)),p.set(e,setTimeout(()=>v(e),s))};e.addEventListener("blur",r,{passive:!0}),e.addEventListener("input",n,{passive:!0}),h.push(()=>{e.removeEventListener("blur",r),e.removeEventListener("input",n)})},b=()=>{o.test(t.location.pathname)||r.querySelectorAll("input, textarea, select").forEach(I)};b();let S=null;try{S=new MutationObserver(()=>b()),r.body&&S.observe(r.body,{childList:!0,subtree:!0})}catch{}return()=>{if(S)try{S.disconnect()}catch{}for(const e of h)try{e()}catch{}}}}t.Identify=s,t.default=s},8597(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.revokeReplayConsent=t.grantReplayConsent=t.hasReplayConsent=t.SessionReplay=t.Performance=t.PerformanceTracking=t.Heatmaps=t.Attribution=t.Retention=t.Funnels=t.Identify=t.Events=t.Sessions=t.PageViews=void 0;var n=r(1265);Object.defineProperty(t,"PageViews",{enumerable:!0,get:function(){return n.PageViews}});var i=r(6636);Object.defineProperty(t,"Sessions",{enumerable:!0,get:function(){return i.Sessions}});var s=r(9648);Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return s.Events}});var o=r(7565);Object.defineProperty(t,"Identify",{enumerable:!0,get:function(){return o.Identify}});var a=r(4492);Object.defineProperty(t,"Funnels",{enumerable:!0,get:function(){return a.Funnels}});var c=r(755);Object.defineProperty(t,"Retention",{enumerable:!0,get:function(){return c.Retention}});var u=r(2412);Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return u.Attribution}});var l=r(5004);Object.defineProperty(t,"Heatmaps",{enumerable:!0,get:function(){return l.Heatmaps}});var d=r(39);Object.defineProperty(t,"PerformanceTracking",{enumerable:!0,get:function(){return d.PerformanceTracking}}),Object.defineProperty(t,"Performance",{enumerable:!0,get:function(){return d.PerformanceTracking}});var p=r(8206);Object.defineProperty(t,"SessionReplay",{enumerable:!0,get:function(){return p.SessionReplay}}),Object.defineProperty(t,"hasReplayConsent",{enumerable:!0,get:function(){return p.hasReplayConsent}}),Object.defineProperty(t,"grantReplayConsent",{enumerable:!0,get:function(){return p.grantReplayConsent}}),Object.defineProperty(t,"revokeReplayConsent",{enumerable:!0,get:function(){return p.revokeReplayConsent}})},1265(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageViews=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async track(e){return await this.init("page_view",{type:"page_view",url:e.url,path:e.path,title:e.title||"",referrer:e.referrer||"",userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackScrollDepth(e){return await this.init("scroll_depth",{type:"scroll_depth",path:e.path,scrollDepth:Math.min(100,Math.max(0,e.scrollDepth)),timeAtDepth:e.timeAtDepth,timestamp:(new Date).toISOString()})}async trackTimeOnPage(e){return await this.init("time_on_page",{type:"time_on_page",path:e.path,duration:e.duration,engaged:e.engaged??!1,timestamp:(new Date).toISOString()})}async trackExit(e,t,r){return await this.init("page_exit",{type:"page_exit",path:e,duration:t,scrollDepth:r,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)();let n=t.location.pathname,s=Date.now(),o=0;const a=new Set,c=()=>{this.track({url:t.location.href,path:t.location.pathname,title:r.title,referrer:r.referrer,userId:e.userId,sessionId:e.sessionId})},u=()=>{const e=Math.round((Date.now()-s)/1e3);e<=0||this.trackTimeOnPage({path:n,duration:e,engaged:o>10})},l=()=>{t.location.pathname!==n&&(u(),n=t.location.pathname,s=Date.now(),o=0,a.clear(),c())},d=t.history.pushState,p=t.history.replaceState;t.history.pushState=function(...e){const r=d.apply(this,e);return t.dispatchEvent(new Event("flowgrid:locationchange")),r},t.history.replaceState=function(...e){const r=p.apply(this,e);return t.dispatchEvent(new Event("flowgrid:locationchange")),r};const h=()=>l(),m=()=>l();t.addEventListener("popstate",h),t.addEventListener("flowgrid:locationchange",m);const f=()=>{const e=r.documentElement,i=t.scrollY||e.scrollTop,s=Math.max(1,e.scrollHeight-t.innerHeight),c=Math.min(100,Math.round(i/s*100));c>o&&(o=c);for(const e of[25,50,75,100])c>=e&&!a.has(e)&&(a.add(e),this.trackScrollDepth({path:n,scrollDepth:e}))};t.addEventListener("scroll",f,{passive:!0});const g=()=>{"hidden"===r.visibilityState&&u()};return r.addEventListener("visibilitychange",g),t.addEventListener("pagehide",u),c(),(0,i.combineTeardowns)(()=>t.removeEventListener("popstate",h),()=>t.removeEventListener("flowgrid:locationchange",m),()=>t.removeEventListener("scroll",f),()=>r.removeEventListener("visibilitychange",g),()=>t.removeEventListener("pagehide",u),()=>{t.history.pushState=d,t.history.replaceState=p})}}t.PageViews=s,t.default=s},39(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.Performance=t.PerformanceTracking=void 0;const a=r(5975),c=r(7890);class u extends a.FlowGridTransport{async trackWebVitals(e){return await this.init("web_vitals",{type:"web_vitals",...e,timestamp:(new Date).toISOString()})}async trackPageLoad(e){return await this.init("page_load",{type:"page_load",...e,timestamp:(new Date).toISOString()})}async trackResource(e){return await this.init("resource_timing",{type:"resource_timing",...e,timestamp:(new Date).toISOString()})}async trackApiCall(e,t,r,n){return await this.init("api_timing",{type:"api_timing",endpoint:e,duration:t,success:r,statusCode:n,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,c.isBrowser)())return()=>{};const t=(0,c.getWindow)(),n=t.location.pathname,i=[];let s=!1;Promise.resolve().then(()=>o(r(8796))).then(t=>{if(s)return;const r=t=>{const r=t.name.toLowerCase(),i={pageUrl:n,userId:e.userId};i[r]=t.value,this.trackWebVitals(i)};t.onLCP?.(r),t.onCLS?.(r),t.onINP?.(r),t.onFCP?.(r),t.onTTFB?.(r),t.onFID?.(r)}).catch(()=>{}),i.push(()=>{s=!0});const a=()=>{const e=t.performance?.getEntriesByType?.("navigation")?.[0];e&&this.trackPageLoad({pageUrl:n,dnsTime:Math.max(0,e.domainLookupEnd-e.domainLookupStart),tcpTime:Math.max(0,e.connectEnd-e.connectStart),ttfb:Math.max(0,e.responseStart-e.requestStart),domContentLoaded:e.domContentLoadedEventEnd,loadTime:e.loadEventEnd,domInteractive:e.domInteractive,transferSize:e.transferSize})};if("complete"===t.document.readyState)a();else{const e=()=>a();t.addEventListener("load",e,{once:!0}),i.push(()=>t.removeEventListener("load",e))}if(e.resources&&"function"==typeof t.PerformanceObserver){const r=e.minDuration??200,s=new t.PerformanceObserver(e=>{for(const t of e.getEntries()){if(t.duration<r)continue;const e=t.initiatorType;this.trackResource({resourceUrl:t.name,resourceType:["script","stylesheet","image","font","fetch","xhr"].includes(e)?e:"other",duration:Math.round(t.duration),transferSize:t.transferSize,pageUrl:n})}});try{s.observe({type:"resource",buffered:!0}),i.push(()=>s.disconnect())}catch{}}return(0,c.combineTeardowns)(...i)}}t.PerformanceTracking=u,t.Performance=u,t.default=u},8206(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.SessionReplay=void 0,t.hasReplayConsent=l,t.grantReplayConsent=function(){if((0,c.isBrowser)())try{localStorage.setItem(u,"granted")}catch{}},t.revokeReplayConsent=function(){if((0,c.isBrowser)())try{localStorage.removeItem(u)}catch{}};const a=r(5975),c=r(7890),u="flowgrid:replayConsent";function l(){if(!(0,c.isBrowser)())return!1;try{return"granted"===localStorage.getItem(u)}catch{return!1}}const d="flowgrid:replaySessionId",p="rrweb@2";class h extends a.FlowGridTransport{constructor(){super(...arguments),this.disabled=!1,this.active=null,this.state="idle"}async start(e={}){if(!1===e.enabled||this.disabled)return this.setState("disabled",e),()=>{};if(this.active&&!this.active.stopped)return this.emitStatus(this.active.options),()=>this.stop("manual");if(!(0,c.isBrowser)())return()=>{};if(!0===e.requireConsent&&!l()&&!a.FlowGridTransport.hasConsent("analytics"))return this.setState("disabled",e),()=>{};this.setState("starting",e);const t=e.sampleRate??1;if(t<1&&Math.random()>t)return this.setState("sampled_out",e),()=>{};let n;try{n=await Promise.resolve().then(()=>o(r(6546)))}catch(t){return"undefined"!=typeof console&&console.error("[FlowGrid] Session replay failed to load rrweb:",t),this.handleError(this.toError(t),{phase:"import"},e),()=>{}}const i=(0,c.getDocument)();if(!i)return()=>{};const s=e.sessionId??this.resolveSessionId(),u=this.normalizeOptions(e),d=Date.now(),p={sessionId:s,userId:e.userId??this.boundUserId,startedAtMs:d,startedAt:new Date(d).toISOString(),sequence:0,buffer:[],bufferBytes:0,totalBytes:0,droppedEvents:0,stopped:!1,initialSnapshotCaptured:!1,flushTimer:setInterval(()=>{this.flush("interval")},u.flushIntervalMs),durationGuard:setTimeout(()=>this.stop("max_duration"),u.maxDurationMs),onVisibility:()=>{"hidden"===i.visibilityState&&this.flush("visibility_hidden",{useBeacon:!0})},onPageHide:()=>{this.flush("pagehide",{useBeacon:!0})},options:u};this.active=p;try{p.stopRecording=n.record({emit:e=>this.captureEvent(e),maskAllInputs:u.maskAllInputs,maskTextClass:u.maskTextClass??"fg-mask",blockClass:u.blockClass??"fg-block",ignoreClass:u.ignoreClass??"fg-ignore",checkoutEveryNth:200,checkoutEveryNms:3e4,inlineImages:!1,collectFonts:!1})}catch(e){return this.handleError(this.toError(e),{phase:"record",sessionId:s},u),p.stopped=!0,this.cleanupActive("stop"),this.active=null,()=>{}}return i.addEventListener("visibilitychange",p.onVisibility),window.addEventListener("pagehide",p.onPageHide),this.setState("recording",u),()=>this.stop("manual")}enable(e={}){return this.disabled=!1,this.start({...e,enabled:!0})}disable(){this.disabled=!0,this.stop("manual"),this.setState("disabled",this.active?.options)}stop(e="stop"){const t=this.active;t&&!t.stopped&&(t.stopped=!0,this.cleanupActive(e),this.flush(e,{useBeacon:!0,isFinal:!0}),this.setState("stopped",t.options,e),this.active=null)}async flush(e="manual",t={}){const r=this.active;if(!r||0===r.buffer.length)return;const n=r.buffer,i=n.length,s=r.bufferBytes,o=r.sequence++;r.buffer=[],r.bufferBytes=0;const a=(new Date).toISOString(),c=this.createIdempotencyKey(r.sessionId,o,s),u={sessionId:r.sessionId,userId:r.userId,sequence:o,eventsCount:i,byteSize:s,reason:e,isFinal:!0===t.isFinal,droppedEvents:r.droppedEvents,capturedAt:a,idempotencyKey:c};try{await this.postReplayChunk(r.sessionId,n,{userId:r.userId,sequence:o,useBeacon:t.useBeacon,startedAt:r.startedAt,capturedAt:a,pageUrl:this.getPageUrl(),isFinal:u.isFinal,reason:e,privacy:this.createPrivacyMetadata(r.options,"sampled_in"),droppedEvents:r.droppedEvents,recorderVersion:p},c),r.options.onFlush?.(u),this.emitStatus(r.options,e)}catch(e){this.handleError(this.toError(e),{phase:"flush",sessionId:r.sessionId},r.options)}}identify(e){this.boundUserId=e,this.active&&(this.active.userId=e,this.emitStatus(this.active.options))}getStatus(){return this.createStatus(this.active?.options)}async sendChunk(e,t,r={}){0!==t.length&&await this.postReplayChunk(e,t,r)}async postReplayChunk(e,t,r,n=this.createIdempotencyKey(e,r.sequence??0,this.measureEvents(t))){await this.postRaw("replay_chunk",{type:"replay_chunk",session_id:e,user_id:r.userId,sequence:r.sequence??0,started_at:r.startedAt,captured_at:r.capturedAt??(new Date).toISOString(),events:t,page_url:r.pageUrl??this.getPageUrl(),idempotency_key:n,compression:"none",is_final:!0===r.isFinal,chunk_kind:r.isFinal?"final":"partial",flush_reason:r.reason??"manual",dropped_events:r.droppedEvents??0,recorder_version:r.recorderVersion??p,privacy:r.privacy??this.createPrivacyMetadata(void 0,"sampled_in")},{useBeacon:r.useBeacon})}captureEvent(e){const t=this.active;if(!t||t.stopped)return;let r=0;try{r=JSON.stringify(e).length}catch{return t.droppedEvents++,void t.options.onDrop?.({sessionId:t.sessionId,reason:"serialization_error",droppedEvents:t.droppedEvents})}return t.totalBytes+r>t.options.maxBytes?(t.droppedEvents++,t.options.onDrop?.({sessionId:t.sessionId,reason:"max_bytes",droppedEvents:t.droppedEvents,byteSize:t.totalBytes+r,maxBytes:t.options.maxBytes}),void this.stop("max_bytes")):(t.totalBytes+=r,t.buffer.push(e),t.bufferBytes+=r,t.initialSnapshotCaptured||2!==e.type?void(t.bufferBytes>=t.options.flushBytes&&this.flush("size")):(t.initialSnapshotCaptured=!0,void Promise.resolve().then(()=>{this.flush("manual")})))}cleanupActive(e){const t=this.active;if(!t)return;const r=(0,c.getDocument)();clearInterval(t.flushTimer),clearTimeout(t.durationGuard),r?.removeEventListener("visibilitychange",t.onVisibility),window.removeEventListener("pagehide",t.onPageHide);try{t.stopRecording?.()}catch(e){this.handleError(this.toError(e),{phase:"stop",sessionId:t.sessionId},t.options)}this.emitStatus(t.options,e)}normalizeOptions(e){return{...e,flushIntervalMs:e.flushIntervalMs??5e3,flushBytes:e.flushBytes??524288,maxDurationMs:e.maxDurationMs??18e5,maxBytes:e.maxBytes??10485760,maskAllInputs:e.maskAllInputs??!0}}createStatus(e,t){const r=this.active;return{state:this.state,sessionId:r?.sessionId,userId:r?.userId??this.boundUserId,startedAt:r?.startedAt,sequence:r?.sequence??0,bufferedEvents:r?.buffer.length??0,bufferedBytes:r?.bufferBytes??0,totalBytes:r?.totalBytes??0,droppedEvents:r?.droppedEvents??0,recorderVersion:p,lastFlushReason:t,lastError:this.lastError}}setState(e,t,r){this.state=e,this.emitStatus(t,r)}emitStatus(e,t){e?.onStatus?.(this.createStatus(e,t))}handleError(e,t,r){this.lastError=e.message,this.state="error",r?.onError?.(e,t),this.emitStatus(r)}createPrivacyMetadata(e,t="sampled_in"){const r=l()||a.FlowGridTransport.hasConsent("analytics");return{masking_mode:!1===e?.maskAllInputs?"selective":"all_inputs",blocked_selectors:this.selectorList(e?.blockClass??"fg-block"),redacted_fields:this.selectorList(e?.maskTextClass??"fg-mask"),consent_state:r?"granted":"denied",sampling_state:t}}selectorList(e){return"string"==typeof e?[e]:[e.source]}getPageUrl(){try{return"undefined"!=typeof location?location.href:""}catch{return""}}createIdempotencyKey(e,t,r){return`${this.webId}:${e}:${t}:${r}`}measureEvents(e){try{return JSON.stringify(e).length}catch{return 0}}toError(e){return e instanceof Error?e:new Error(String(e))}resolveSessionId(){try{const e=sessionStorage.getItem(d);if(e)return e;const t=this.generateId();return sessionStorage.setItem(d,t),t}catch{return this.generateId()}}generateId(){const e="undefined"!=typeof crypto?crypto:void 0;return e?.randomUUID?e.randomUUID():`rep_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}}t.SessionReplay=h,t.default=h},755(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Retention=void 0;const n=r(5975);class i extends n.FlowGridTransport{async trackActivity(e){return await this.init("user_activity",{type:"user_activity",userId:e.userId,action:e.action||"active",sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackLifecycleChange(e,t,r){return await this.init("lifecycle_change",{type:"lifecycle_change",userId:e,stage:t,previousStage:r,timestamp:(new Date).toISOString()})}}t.Retention=i,t.default=i},6636(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sessions=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async start(e={}){return await this.init("session_start",{type:"session_start",user:e.user,device:e.device,location:e.location,source:e.source||e.utm?.utmSource,medium:e.medium||e.utm?.utmMedium,campaign:e.campaign||e.utm?.utmCampaign,utm:e.utm,landingPage:e.landingPage||("undefined"!=typeof window?window.location.href:""),referrer:e.referrer||("undefined"!=typeof document?document.referrer:""),...e.properties,timestamp:(new Date).toISOString()})}async update(e,t){return await this.init("session_update",{type:"session_update",sessionId:e,...t,timestamp:(new Date).toISOString()})}async end(e){return await this.init("session_end",{type:"session_end",sessionId:e,timestamp:(new Date).toISOString()})}async heartbeat(e){return await this.init("session_heartbeat",{type:"session_heartbeat",sessionId:e,timestamp:(new Date).toISOString()})}autoTrack(e={},t={}){if(!(0,i.isBrowser)())return()=>{};const r=(0,i.getWindow)(),n=(0,i.getDocument)(),s=t.heartbeatMs??3e4,o="flowgrid:sessionId";let a;try{a=r.sessionStorage.getItem(o)||void 0}catch{}const c=a?Promise.resolve(a):this.start(e).then(e=>{a=e.response.sessionId;try{r.sessionStorage.setItem(o,a)}catch{}return a}).catch(()=>{}),u=r.setInterval(()=>{a&&"visible"===n.visibilityState&&this.heartbeat(a)},s),l=()=>{a&&this.end(a)};return r.addEventListener("pagehide",l),(0,i.combineTeardowns)(()=>r.clearInterval(u),()=>r.removeEventListener("pagehide",l),()=>{c.then(()=>{a&&this.end(a)})},()=>{try{r.sessionStorage.removeItem(o)}catch{}})}}t.Sessions=s,t.default=s},9286(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Activation=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init(e.eventName,{...e.properties,type:"activation",timestamp:(new Date).toISOString()})}async trackOnboardingStep(e){return await this.init("onboarding_step",{type:"activation",subtype:"onboarding_step",userId:e.userId,stepId:e.stepId,stepName:e.stepName,stepOrder:e.stepOrder,totalSteps:e.totalSteps,progress:Math.round(e.stepOrder/e.totalSteps*100),timeSpent:e.timeSpent,skipped:e.skipped||!1,...e.properties,timestamp:(new Date).toISOString()})}async completeOnboarding(e,t,r,n){return await this.init("onboarding_completed",{type:"activation",subtype:"onboarding_complete",userId:e,totalTimeSpent:t,stepsCompleted:r,stepsSkipped:n,completionRate:Math.round(r/(r+n)*100),timestamp:(new Date).toISOString()})}async trackFirstAction(e){return await this.init("first_action",{type:"activation",subtype:"first_action",userId:e.userId,actionName:e.actionName,timeSinceSignup:e.timeSinceSignup,source:e.source,...e.properties,timestamp:(new Date).toISOString()})}async trackSignup(e,t,r,n){return await this.init("signup_completed",{type:"activation",subtype:"signup",userId:e,method:t,source:r,...n,timestamp:(new Date).toISOString()})}}t.Activation=i,t.default=i},6045(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Experiment=t.HOLDOUT_PCT=void 0;const n=r(5975),i=r(4211);function s(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=16777619*t>>>0;return t}t.HOLDOUT_PCT=5;const o="fg_exp_assignments",a="fg_exp_assignments";class c extends n.FlowGridTransport{constructor(){super(...arguments),this.experiments={},this.assignments={}}parseAssignmentCookie(e){if(!e)return{};try{const t=decodeURIComponent(e),r=JSON.parse(t);return r&&"object"==typeof r?r:{}}catch{return{}}}readAssignmentCookie(){return this.parseAssignmentCookie((0,i.getCookie)(a))}writeAssignmentCookie(){try{if("undefined"==typeof document)return;const e=encodeURIComponent(JSON.stringify(this.assignments)),t=31536e3,r="Lax",n="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";document.cookie=`${a}=${e}; Path=/; Max-Age=${t}; SameSite=${r}${n}`}catch{}}loadAssignments(){try{if("undefined"!=typeof localStorage){const e=localStorage.getItem(o);if(e){const t=JSON.parse(e);if(t&&"object"==typeof t)return t}}}catch{}const e=this.readAssignmentCookie();return Object.keys(e).length>0?e:{}}saveAssignments(){try{"undefined"!=typeof localStorage&&localStorage.setItem(o,JSON.stringify(this.assignments))}catch{}this.writeAssignmentCookie()}injectAssignments(e){this.assignments={...this.assignments,...e}}getAssignments(){return{...this.assignments}}hydrateFromCookies(e){const t=e.get(a),r="string"==typeof t?t:t?.value??null,n=this.parseAssignmentCookie(r??null);Object.keys(n).length>0&&this.injectAssignments(n)}hydrateFromCookieHeader(e){if(!e)return;const t=e.split(/;\s*/),r=`${a}=`,n=t.find(e=>e.startsWith(r));if(!n)return;const i=this.parseAssignmentCookie(n.slice(r.length));Object.keys(i).length>0&&this.injectAssignments(i)}serializeAssignmentCookie(){const e=encodeURIComponent(JSON.stringify(this.assignments));return`${a}=${e}; Path=/; Max-Age=31536000; SameSite=Lax`}clearAssignments(){this.assignments={};try{"undefined"!=typeof localStorage&&localStorage.removeItem(o)}catch{}try{"undefined"!=typeof document&&(document.cookie=`${a}=; Path=/; Max-Age=0; SameSite=Lax`)}catch{}}getOrCreateAnonId(){try{if("undefined"!=typeof localStorage){const e=localStorage.getItem(c.ANON_ID_KEY);if(e)return e;const t="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return localStorage.setItem(c.ANON_ID_KEY,t),t}}catch{}return"anon_"+s(String(Math.random())).toString(36)}deterministicAssign(e,t,r){const n=s(e+t);let i=0;for(const e of r)i+=e.weight;const o=n%1e4/1e4*i;let a=0;for(const e of r)if(a+=e.weight,o<a)return e.id;return r[r.length-1].id}assignVariant(e,r,n={},i=[]){this.assignments=this.loadAssignments();const o=this.assignments[e],a=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId(),c="string"==typeof n.status?n.status:void 0,u="string"==typeof n.winner_id?n.winner_id:void 0;if("complete"===c&&u&&r.some(e=>e.id===u)){if(o===u)return;return this.assignments[e]=u,this.saveAssignments(),void this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e,userId:a,variantId:u,source:"shipped_winner",assignmentSource:"sdk_init",timestamp:(new Date).toISOString()}).catch(()=>{})}if(o&&r.some(e=>e.id===o))return;if(function(e,r=t.HOLDOUT_PCT){return!(r<=0)&&(r>=100||s("holdout::"+e)%1e4/100<r)}(a))return;const l="string"==typeof n.exclusion_group?n.exclusion_group:void 0;if(l&&!function(e,t,r,n){const i=Array.from(new Set([...n,t])).sort();return i.length<=1||i[s("exclusion::"+r+"::"+e)%i.length]===t}(a,e,l,i))return;const d=this.deterministicAssign(a,e,r);this.assignments[e]=d,this.saveAssignments(),this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e,userId:a,variantId:d,source:"random",assignmentSource:"sdk_init",timestamp:(new Date).toISOString()}).catch(()=>{})}computeExclusionGroupMembers(e){const t=new Map;for(const r of e){const e="string"==typeof r.properties?.exclusion_group?r.properties.exclusion_group:void 0;e&&(t.has(e)||t.set(e,[]),t.get(e).push(r.experiment_id))}return t}assignFromLocalConfigs(e){const t=this.computeExclusionGroupMembers(e.map(e=>({experiment_id:e.id,properties:e.properties})));for(const r of e){this.experiments[r.id]={variants:r.variants,properties:r.properties||{},verified:!1};const e="string"==typeof r.properties?.exclusion_group?r.properties.exclusion_group:void 0;this.assignVariant(r.id,r.variants,r.properties||{},e?t.get(e)??[]:[])}}async verifyExperiments(e){const t={web_id:this.webId,experiments:e.map(e=>({experiment_id:e.id,variants:e.variants,properties:e.properties||{}}))};try{const r=await fetch(`${this.endpoint}/api/v1/experiments/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.ok&&Array.isArray(n.data)){const e=this.computeExclusionGroupMembers(n.data);for(const t of n.data)if("error"!==t.action){this.experiments[t.experiment_id]={variants:t.variants,properties:t.properties??{},verified:!0};const r="string"==typeof t.properties?.exclusion_group?t.properties.exclusion_group:void 0;this.assignVariant(t.experiment_id,t.variants,t.properties??{},r?e.get(r)??[]:[])}}else this.assignFromLocalConfigs(e)}catch{this.assignFromLocalConfigs(e)}}async initExperiments(e){this.assignments=this.loadAssignments(),e.length>0&&await this.verifyExperiments(e)}getLocalVariant(e){return this.assignments=this.loadAssignments(),this.assignments[e]??null}async trackLocalConversion(e,t="conversion",r=1){const n=this.getLocalVariant(e);if(!n)return;const i=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId();await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:e,userId:i,variantId:n,metricName:t,value:r,timestamp:(new Date).toISOString()})}async trackLocalExposure(e){const t=this.getLocalVariant(e);if(!t)return;const r=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId();await this.trackExposure(e,r,t)}async track(e){return await this.init(e.eventName,{...e.properties,type:"experiment",subtype:"custom",variant:e.variant,timestamp:(new Date).toISOString()})}async define(e){return await this.init("experiment_definition",{type:"experiment",subtype:"definition",...e,timestamp:(new Date).toISOString()})}async assign(e){return await this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e.experimentId,userId:e.userId,variantId:e.variantId,source:e.source||"random",timestamp:(new Date).toISOString()})}async trackConversion(e){return await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:e.experimentId,userId:e.userId,variantId:e.variantId,metricName:e.metricName,value:e.value,timestamp:(new Date).toISOString()})}async trackExposure(e,t,r){return await this.init("experiment_exposure",{type:"experiment",subtype:"exposure",experimentId:e,userId:t,variantId:r,timestamp:(new Date).toISOString()})}}t.Experiment=c,c.ANON_ID_KEY="fg_anon_id",t.default=c},7244(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Experiment=t.TrackPrompt=t.TrackFeature=t.Activation=void 0;var n=r(9286);Object.defineProperty(t,"Activation",{enumerable:!0,get:function(){return n.Activation}});var i=r(1944);Object.defineProperty(t,"TrackFeature",{enumerable:!0,get:function(){return i.TrackFeature}});var s=r(2078);Object.defineProperty(t,"TrackPrompt",{enumerable:!0,get:function(){return s.TrackPrompt}});var o=r(6045);Object.defineProperty(t,"Experiment",{enumerable:!0,get:function(){return o.Experiment}})},1944(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackFeature=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init("create_tracking",{type:"feature_usage",subtype:"create_custom",userId:e.userId,category:e.category,action:e.action,...e.properties,timestamp:(new Date).toISOString()})}async trackUsage(e){return await this.init(e.eventName??"feature_usage",{type:"feature_usage",subtype:e.action,featureId:e.featureId,featureName:e.featureName,userId:e.userId,action:e.action,duration:e.duration,success:e.success,category:e.category,...e.properties,timestamp:(new Date).toISOString()})}}t.TrackFeature=i,t.default=i},2078(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackPrompt=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init(e.eventName,{...e.properties,type:"prompt",timestamp:(new Date).toISOString()})}async trackSubmission(e){return await this.init("prompt_submitted",{type:"prompt",subtype:"submission",promptId:e.promptId,userId:e.userId,promptType:e.promptType,model:e.model,inputTokens:e.inputTokens,conversationId:e.conversationId,...e.properties,timestamp:(new Date).toISOString()})}async trackResponse(e){return await this.init("prompt_response",{type:"prompt",subtype:"response",promptId:e.promptId,responseTime:e.responseTime,outputTokens:e.outputTokens,completed:e.completed,error:e.error,qualityScore:e.qualityScore,timestamp:(new Date).toISOString()})}async trackFeedback(e){return await this.init("prompt_feedback",{type:"prompt",subtype:"feedback",promptId:e.promptId,userId:e.userId,feedbackType:e.feedbackType,rating:e.rating,comment:e.comment,timestamp:(new Date).toISOString()})}async trackConversation(e,t,r,n){return await this.init("prompt_conversation",{type:"prompt",subtype:"conversation",conversationId:e,userId:t,turnCount:r,totalDuration:n,timestamp:(new Date).toISOString()})}}t.TrackPrompt=i,t.default=i},9927(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CartTracking=void 0;const n=r(5975);class i extends n.FlowGridTransport{async addItem(e){const t=e.product.price*e.quantity-(e.product.discount||0);return await this.init("add_to_cart",{type:"ecommerce",subtype:"add_to_cart",product:e.product,quantity:e.quantity,lineTotal:t,cartId:e.cartId,userId:e.userId,source:e.source,...e.properties,timestamp:(new Date).toISOString()})}async removeItem(e){return await this.init("remove_from_cart",{type:"ecommerce",subtype:"remove_from_cart",product:e.product,quantity:e.quantity,cartId:e.cartId,userId:e.userId,reason:e.reason||"user_action",timestamp:(new Date).toISOString()})}async updateItem(e){return await this.init("update_cart_item",{type:"ecommerce",subtype:"update_cart_item",product:e.product,previousQuantity:e.previousQuantity,newQuantity:e.newQuantity,quantityChange:e.newQuantity-e.previousQuantity,cartId:e.cartId,timestamp:(new Date).toISOString()})}async view(e){return await this.init("view_cart",{type:"ecommerce",subtype:"view_cart",cartId:e.cart.cartId,cart:e.cart,cartValue:e.cart.total,itemCount:e.cart.itemCount,userId:e.userId,timestamp:(new Date).toISOString()})}async abandon(e,t){return await this.init("cart_abandoned",{type:"ecommerce",subtype:"cart_abandoned",cart:e,cartValue:e.total,itemCount:e.itemCount,reason:t,timestamp:(new Date).toISOString()})}async applyCoupon(e,t,r,n){return await this.init("apply_coupon",{type:"ecommerce",subtype:"apply_coupon",cartId:e,couponCode:t,success:r,discount:n,timestamp:(new Date).toISOString()})}}t.CartTracking=i,t.default=i},3661(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Checkout=void 0;const n=r(5975);class i extends n.FlowGridTransport{async begin(e){return await this.init("begin_checkout",{type:"ecommerce",subtype:"begin_checkout",cart:e.cart,cartValue:e.cart.total,itemCount:e.cart.itemCount,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async step(e){return await this.init("checkout_step",{type:"ecommerce",subtype:"checkout_step",step:e.step,stepNumber:e.stepNumber,cart:e.cart,option:e.option,userId:e.userId,timestamp:(new Date).toISOString()})}async addShipping(e){return await this.init("add_shipping_info",{type:"ecommerce",subtype:"shipping_info",cart:e.cart,shipping:e.shipping,shippingMethod:e.shipping.method,shippingCost:e.shipping.cost,userId:e.userId,timestamp:(new Date).toISOString()})}async addPayment(e){return await this.init("add_payment_info",{type:"ecommerce",subtype:"payment_info",cart:e.cart,payment:e.payment,paymentMethod:e.payment.method,userId:e.userId,timestamp:(new Date).toISOString()})}async abandon(e,t,r){return await this.init("checkout_abandoned",{type:"ecommerce",subtype:"checkout_abandoned",cart:e,step:t,cartValue:e.total,reason:r,timestamp:(new Date).toISOString()})}async paymentAttempt(e,t,r,n){return await this.init("payment_attempt",{type:"ecommerce",subtype:"payment_attempt",success:e,cart:t,payment:r,errorCode:n,timestamp:(new Date).toISOString()})}}t.Checkout=i,t.default=i},5405(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subscriptions=t.SearchAnalytics=t.CustomerLTV=t.WishlistTracking=t.Promotions=t.Refunds=t.Purchases=t.Checkout=t.CartTracking=t.Products=void 0;var n=r(1253);Object.defineProperty(t,"Products",{enumerable:!0,get:function(){return n.Products}});var i=r(9927);Object.defineProperty(t,"CartTracking",{enumerable:!0,get:function(){return i.CartTracking}});var s=r(3661);Object.defineProperty(t,"Checkout",{enumerable:!0,get:function(){return s.Checkout}});var o=r(3241);Object.defineProperty(t,"Purchases",{enumerable:!0,get:function(){return o.Purchases}});var a=r(7530);Object.defineProperty(t,"Refunds",{enumerable:!0,get:function(){return a.Refunds}});var c=r(4183);Object.defineProperty(t,"Promotions",{enumerable:!0,get:function(){return c.Promotions}});var u=r(5926);Object.defineProperty(t,"WishlistTracking",{enumerable:!0,get:function(){return u.WishlistTracking}});var l=r(9227);Object.defineProperty(t,"CustomerLTV",{enumerable:!0,get:function(){return l.CustomerLTV}});var d=r(4589);Object.defineProperty(t,"SearchAnalytics",{enumerable:!0,get:function(){return d.SearchAnalytics}});var p=r(3847);Object.defineProperty(t,"Subscriptions",{enumerable:!0,get:function(){return p.Subscriptions}})},9227(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomerLTV=void 0;const n=r(5975);class i extends n.FlowGridTransport{async recordAcquisitionCost(e){return await this.init("record_acquisition_cost",{type:"ecommerce",subtype:"acquisition_cost",userId:e.userId,cost:e.cost,channel:e.channel,campaign:e.campaign,timestamp:(new Date).toISOString()})}async updateSegment(e,t){return await this.init("update_customer_segment",{type:"ecommerce",subtype:"update_customer_segment",userId:e,segment:t,timestamp:(new Date).toISOString()})}}t.CustomerLTV=i,t.default=i},1253(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Products=void 0;const n=r(5975);class i extends n.FlowGridTransport{async view(e){return await this.init("product_view",{type:"ecommerce",subtype:"product_view",product:{productId:e.productId,name:e.name,brand:e.brand,category:e.category,variant:e.variant,price:e.price,currency:e.currency,url:e.url,imageUrl:e.imageUrl,rating:e.rating,reviewCount:e.reviewCount,stockStatus:e.stockStatus,attributes:e.attributes},source:e.source,searchQuery:e.searchQuery,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async impression(e){return await this.init("product_impression",{type:"ecommerce",subtype:"product_impression",list:e.list,productCount:e.list.products.length,userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async click(e){return await this.init("product_click",{type:"ecommerce",subtype:"product_click",product:e.product,listId:e.listId,position:e.position,userId:e.userId,timestamp:(new Date).toISOString()})}async quickView(e,t){return await this.init("product_quick_view",{type:"ecommerce",subtype:"product_quick_view",product:e,listId:t,timestamp:(new Date).toISOString()})}async interaction(e,t,r){return await this.init("product_interaction",{type:"ecommerce",subtype:"product_interaction",productId:e,action:t,...r,timestamp:(new Date).toISOString()})}}t.Products=i,t.default=i},4183(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Promotions=void 0;const n=r(5975);class i extends n.FlowGridTransport{async view(e){return await this.init("promotion_view",{type:"ecommerce",subtype:"promotion_view",promotionId:e.promotionId,name:e.name,creative:e.creative,position:e.position,page:e.page,userId:e.userId,timestamp:(new Date).toISOString()})}async click(e){return await this.init("promotion_click",{type:"ecommerce",subtype:"promotion_click",promotionId:e.promotionId,name:e.name,creative:e.creative,position:e.position,destinationUrl:e.destinationUrl,userId:e.userId,timestamp:(new Date).toISOString()})}async couponUsed(e){return await this.init("coupon_used",{type:"ecommerce",subtype:"coupon_used",code:e.code,orderId:e.orderId,discountValue:e.discountValue,discountType:e.discountType,orderValueBefore:e.orderValueBefore,orderValueAfter:e.orderValueAfter,savings:e.orderValueBefore-e.orderValueAfter,userId:e.userId,timestamp:(new Date).toISOString()})}async couponAttempt(e,t,r){return await this.init("coupon_attempt",{type:"ecommerce",subtype:"coupon_attempt",code:e,success:t,failureReason:r,timestamp:(new Date).toISOString()})}}t.Promotions=i,t.default=i},3241(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Purchases=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){const t=e.order;return await this.init("purchase",{type:"ecommerce",subtype:"purchase",order:{orderId:t.orderId,items:t.items,subtotal:t.subtotal,discountTotal:t.discountTotal,shippingTotal:t.shippingTotal,taxTotal:t.taxTotal,total:t.total,currency:t.currency,shipping:t.shipping,payment:t.payment,coupons:t.coupons,affiliation:t.affiliation},revenue:t.total,itemCount:t.items.reduce((e,t)=>e+t.quantity,0),userId:e.userId,sessionId:e.sessionId,attribution:e.attribution,...e.properties,timestamp:(new Date).toISOString()})}async statusChange(e,t,r){return await this.init("order_status_change",{type:"ecommerce",subtype:"order_status_change",orderId:e,newStatus:t,previousStatus:r,timestamp:(new Date).toISOString()})}async shipped(e,t){return await this.init("order_shipped",{type:"ecommerce",subtype:"order_shipped",orderId:e,shipping:t,timestamp:(new Date).toISOString()})}async delivered(e,t){return await this.init("order_delivered",{type:"ecommerce",subtype:"order_delivered",orderId:e,deliveredAt:t||(new Date).toISOString(),timestamp:(new Date).toISOString()})}}t.Purchases=i,t.default=i},7530(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Refunds=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("refund",{type:"ecommerce",subtype:"refund",orderId:e.orderId,refundId:e.refundId,items:e.items,amount:e.amount,currency:e.currency,reason:e.reason,isFullRefund:e.isFullRefund,userId:e.userId,initiatedBy:e.initiatedBy,...e.properties,timestamp:(new Date).toISOString()})}async request(e,t,r){return await this.init("refund_requested",{type:"ecommerce",subtype:"refund_requested",orderId:e,items:t,reason:r,timestamp:(new Date).toISOString()})}async approve(e,t){return await this.init("refund_approved",{type:"ecommerce",subtype:"refund_approved",refundId:e,approvedAmount:t,timestamp:(new Date).toISOString()})}async deny(e,t){return await this.init("refund_denied",{type:"ecommerce",subtype:"refund_denied",refundId:e,denialReason:t,timestamp:(new Date).toISOString()})}async complete(e,t){return await this.init("refund_completed",{type:"ecommerce",subtype:"refund_completed",refundId:e,processedAmount:t,timestamp:(new Date).toISOString()})}}t.Refunds=i,t.default=i},4589(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAnalytics=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("site_search",{type:"ecommerce",subtype:"site_search",query:e.query,resultsCount:e.resultsCount,hasResults:e.resultsCount>0,category:e.category,filters:e.filters,sortBy:e.sortBy,page:e.page||1,userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async trackClick(e){return await this.init("search_result_click",{type:"ecommerce",subtype:"search_result_click",query:e.query,product:e.product,position:e.position,page:e.page||1,timestamp:(new Date).toISOString()})}async trackRefinement(e,t,r){return await this.init("search_refinement",{type:"ecommerce",subtype:"search_refinement",originalQuery:e,refinedQuery:t,refinementType:r,timestamp:(new Date).toISOString()})}async trackSuggestion(e,t,r){return await this.init("search_suggestion",{type:"ecommerce",subtype:"search_suggestion",partialQuery:e,selectedSuggestion:t,suggestionPosition:r,timestamp:(new Date).toISOString()})}}t.SearchAnalytics=i,t.default=i},3847(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subscriptions=void 0;const n=r(5975);class i extends n.FlowGridTransport{async start(e){return await this.init("subscription_start",{type:"ecommerce",subtype:"subscription_start",subscriptionId:e.subscriptionId,userId:e.userId,plan:e.plan,mrr:e.mrr,billingCycle:e.billingCycle,trialDays:e.trialDays,coupon:e.coupon,isTrialing:(e.trialDays||0)>0,...e.properties,timestamp:(new Date).toISOString()})}async change(e){const t=e.newMrr.amount-e.previousMrr.amount;return await this.init("subscription_change",{type:"ecommerce",subtype:"subscription_change",subscriptionId:e.subscriptionId,userId:e.userId,previousPlan:e.previousPlan,newPlan:e.newPlan,previousMrr:e.previousMrr,newMrr:e.newMrr,mrrChange:t,changeType:e.changeType,timestamp:(new Date).toISOString()})}async cancel(e){return await this.init("subscription_cancel",{type:"ecommerce",subtype:"subscription_cancel",subscriptionId:e.subscriptionId,userId:e.userId,plan:e.plan,lostMrr:e.lostMrr,reason:e.reason,feedback:e.feedback,immediate:e.immediate,timestamp:(new Date).toISOString()})}async renew(e,t,r){return await this.init("subscription_renew",{type:"ecommerce",subtype:"subscription_renew",subscriptionId:e,userId:t,mrr:r,timestamp:(new Date).toISOString()})}async trialConverted(e,t,r,n){return await this.init("trial_converted",{type:"ecommerce",subtype:"trial_converted",subscriptionId:e,userId:t,plan:r,mrr:n,timestamp:(new Date).toISOString()})}async trialExpired(e,t){return await this.init("trial_expired",{type:"ecommerce",subtype:"trial_expired",subscriptionId:e,userId:t,timestamp:(new Date).toISOString()})}}t.Subscriptions=i,t.default=i},5926(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WishlistTracking=void 0;const n=r(5975);class i extends n.FlowGridTransport{async add(e){return await this.init("add_to_wishlist",{type:"ecommerce",subtype:"add_to_wishlist",product:e.product,wishlistId:e.wishlistId,userId:e.userId,source:e.source,timestamp:(new Date).toISOString()})}async remove(e){return await this.init("remove_from_wishlist",{type:"ecommerce",subtype:"remove_from_wishlist",product:e.product,wishlistId:e.wishlistId,userId:e.userId,reason:e.reason||"user_action",timestamp:(new Date).toISOString()})}async view(e){return await this.init("view_wishlist",{type:"ecommerce",subtype:"view_wishlist",wishlistId:e.wishlistId,itemCount:e.items.length,timestamp:(new Date).toISOString()})}async moveToCart(e,t){return await this.init("wishlist_to_cart",{type:"ecommerce",subtype:"wishlist_to_cart",product:e,wishlistId:t,timestamp:(new Date).toISOString()})}async share(e,t){return await this.init("share_wishlist",{type:"ecommerce",subtype:"share_wishlist",wishlistId:e,method:t,timestamp:(new Date).toISOString()})}}t.WishlistTracking=i,t.default=i},991(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AcquisitionAnalytics=void 0,t.calculateCAC=function(e,t,r){return 0===t?{amount:0,currency:r}:{amount:Math.round(e/t*100)/100,currency:r}},t.calculateROAS=function(e,t){return 0===t?0:Math.round(e/t*100)/100},t.calculateLTVCACRatio=function(e,t){return 0===t?0:Math.round(e/t*100)/100},t.parseUTMParams=function(e){const t={};try{const r=new URL(e),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];for(const e of n){const n=r.searchParams.get(e);n&&(t[e.replace("utm_","")]=n)}}catch{}return t},t.classifySource=function(e,t){if(!e&&!t)return"direct";const r=e?.toLowerCase()??"",n=t?.toLowerCase()??"";return n.includes("cpc")||n.includes("paid")?r.includes("facebook")||r.includes("instagram")||r.includes("linkedin")?"paid_social":"paid_search":r.includes("facebook")||r.includes("twitter")||r.includes("linkedin")?"organic_social":"email"===n?"email":"referral"===n?"referral":"affiliate"===n?"affiliate":"organic"};const n=r(5975);class i extends n.FlowGridTransport{async trackAcquisition(e){return await this.initFeature("acquisition.acquired",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async trackLifecycleTransition(e){return await this.initFeature("acquisition.lifecycle_transition",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async createCampaign(e){return await this.initFeature("acquisition.create_campaign",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async trackCampaignSpend(e){return await this.initFeature("acquisition.campaign_spend",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}}t.AcquisitionAnalytics=i},1765(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlertsAnalytics=void 0,t.calculateStdDev=function(e){if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,r=e.map(e=>Math.pow(e-t,2)),n=r.reduce((e,t)=>e+t,0)/r.length;return Math.sqrt(n)},t.calculateZScore=function(e,t,r){return 0===r?0:(e-t)/r},t.isAnomaly=function(e,t=.5){const r=4-2*t;return Math.abs(e)>r},t.calculateAnomalyScore=function(e){const t=Math.abs(e);return t<=2?t/10:t<=3?.2+.3*(t-2):t<=4?.5+.3*(t-3):Math.min(.8+.1*(t-4),1)},t.classifySeverity=function(e){return e<.25?"info":e<.5?"warning":e<.75?"high":"critical"},t.checkAlertCondition=function(e,t,r,n,i){switch(t){case"exceeds":return e>r;case"drops_below":return e<r;case"changes_by":return void 0!==n&&void 0!==i&&100*Math.abs((e-n)/n)>=i;case"no_data":return 0===e||null===e;default:return!1}};const n=r(5975);class i extends n.FlowGridTransport{async createAlert(e){return await this.initFeature("alerts.create",{type:"alerts",...e,alertId:e.alertId??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"_"),enabled:e.enabled??!0,timestamp:(new Date).toISOString()})}async updateAlert(e,t){return await this.initFeature("alerts.update",{type:"alerts",alertId:e,...t,timestamp:(new Date).toISOString()})}async deleteAlert(e){return await this.initFeature("alerts.delete",{type:"alerts",alertId:e,timestamp:(new Date).toISOString()})}async toggleAlert(e,t){return await this.initFeature("alerts.toggle",{type:"alerts",alertId:e,enabled:t,timestamp:(new Date).toISOString()})}async listAlerts(e){return await this.initFeature("alerts.list",{type:"alerts",enabled:e,timestamp:(new Date).toISOString()})}async acknowledgeAlert(e,t){return await this.initFeature("alerts.acknowledge",{type:"alerts",instanceId:e,acknowledgedBy:t,timestamp:(new Date).toISOString()})}async resolveAlert(e,t){return await this.initFeature("alerts.resolve",{type:"alerts",instanceId:e,notes:t,timestamp:(new Date).toISOString()})}async muteAlert(e,t){return await this.initFeature("alerts.mute",{type:"alerts",alertId:e,durationMinutes:t,timestamp:(new Date).toISOString()})}async detectAnomalies(e){return await this.initFeature("alerts.detect_anomalies",{type:"alerts",...e,timestamp:(new Date).toISOString()})}async configureNotification(e){return await this.initFeature("alerts.configure_notification",{type:"alerts",...e,timestamp:(new Date).toISOString()})}async testNotification(e){return await this.initFeature("alerts.test_notification",{type:"alerts",channel:e,timestamp:(new Date).toISOString()})}}t.AlertsAnalytics=i},9746(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChurnAnalytics=void 0,t.calculateChurnRiskScore=function(e){const t=.25,r=.2,n=.15,i=.1,s=.1,o=.1,a=.05,c=.05;let u=0;return u+=100*Math.min(e.daysSinceLastActivity/30,1)*t,u+=Math.max(0,-e.usageTrend)*r,u+=Math.max(0,-e.sessionFrequencyChange)*n,u+=Math.max(0,-e.featureUsageChange)*i,u+=Math.min(10*e.supportTickets,100)*s,void 0!==e.npsScore&&(u+=(100-10*e.npsScore)*o),u+=Math.min(25*e.paymentFailures,100)*a,void 0!==e.daysUntilRenewal&&(u+=Math.max(0,100-e.daysUntilRenewal)*c),Math.round(Math.min(u,100))},t.classifyRiskLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"critical"},t.generateRecommendations=function(e){const t=[],r={daysSinceLastActivity:"Send a re-engagement email or push notification",usageTrend:"Schedule a product walkthrough or training session",sessionFrequencyChange:"Offer incentives to increase usage frequency",featureUsageChange:"Highlight underutilized features via in-app messaging",supportTickets:"Escalate to customer success for personalized support",npsScore:"Conduct a follow-up call to address concerns",paymentFailures:"Reach out to resolve payment issues proactively",daysUntilRenewal:"Start renewal conversation early with value recap"};for(const n of e.slice(0,3))r[n.factor]&&t.push(r[n.factor]);return t};const n=r(5975);class i extends n.FlowGridTransport{async trackUsageDecay(e){return await this.initFeature("churn.usage_decay",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackNPS(e){return await this.initFeature("churn.nps",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackChurn(e){return await this.initFeature("churn.churn_event",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackPreventionAction(e){return await this.initFeature("churn.prevention_action",{type:"churn",...e,timestamp:(new Date).toISOString()})}async updatePreventionOutcome(e,t,r){return await this.initFeature("churn.update_prevention_outcome",{type:"churn",userId:e,actionType:t,outcome:r,timestamp:(new Date).toISOString()})}}t.ChurnAnalytics=i},9774(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cohorts=void 0,t.evaluateCohortRules=function(e,t){let r=!0,n="and";for(const s of t){const t=i(e[s.attribute],s.operator,s.value);r="and"===n?r&&t:r||t,n=s.logicalOperator??"and"}return r},t.generateCohortId=s;const n=r(5975);function i(e,t,r){switch(t){case"equals":return e===r;case"not_equals":return e!==r;case"contains":return String(e).includes(String(r));case"not_contains":return!String(e).includes(String(r));case"gt":return Number(e)>Number(r);case"gte":return Number(e)>=Number(r);case"lt":return Number(e)<Number(r);case"lte":return Number(e)<=Number(r);case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"exists":return null!=e;case"not_exists":return null==e;case"between":if(Array.isArray(r)&&2===r.length){const t=Number(e);return t>=Number(r[0])&&t<=Number(r[1])}return!1;default:return!1}}function s(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}class o extends n.FlowGridTransport{async createCohort(e){const t=e.cohortId??s(e.name);return await this.initFeature("cohorts.create",{type:"cohorts",cohortId:t,name:e.name,description:e.description,cohortType:e.type,rules:e.rules,dynamic:e.dynamic??!0,timeWindow:e.timeWindow,timestamp:(new Date).toISOString()})}async updateCohort(e,t){const{type:r,...n}=t;return await this.initFeature("cohorts.update",{type:"cohorts",cohortId:e,cohortType:r,...n,timestamp:(new Date).toISOString()})}async deleteCohort(e){return await this.initFeature("cohorts.delete",{type:"cohorts",cohortId:e,timestamp:(new Date).toISOString()})}async listCohorts(e){return await this.initFeature("cohorts.list",{type:"cohorts",filter:e,timestamp:(new Date).toISOString()})}async isUserInCohort(e,t){return await this.initFeature("cohorts.check_membership",{type:"cohorts",userId:e,cohortId:t,timestamp:(new Date).toISOString()})}async createSegment(e){return await this.initFeature("cohorts.create_segment",{type:"cohorts",...e,timestamp:(new Date).toISOString()})}async compareCohorts(e){return await this.initFeature("cohorts.compare",{type:"cohorts",...e,timestamp:(new Date).toISOString()})}}t.Cohorts=o},4805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Engagement=void 0,t.calculateEngagementScore=function(e,t,r,n){const i=.25,s=.25,o=.3,a=.2;return Math.round(100*(e*i+t*s+r*o+n*a))/100},t.classifyEngagementLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"power"},t.calculateSessionDepthScore=s;const n=r(5975),i=r(7890);function s(e,t,r){const n=30*Math.min(e/10,1),i=40*Math.min(t/5,1),s=30*Math.min(r/20,1);return Math.round(n+i+s)}class o extends n.FlowGridTransport{async trackDwellTime(e){return await this.initFeature("engagement.dwell_time",{type:"engagement",featureId:e.featureId,userId:e.userId,sessionId:e.sessionId,dwellTimeMs:e.dwellTimeMs,wasActive:e.wasActive??!0,...e.properties,timestamp:(new Date).toISOString()})}async trackSessionDepth(e){const t=s(e.pagesVisited,e.featuresUsed,e.actionsTaken);return await this.initFeature("engagement.session_depth",{type:"engagement",sessionId:e.sessionId,userId:e.userId,pagesVisited:e.pagesVisited,featuresUsed:e.featuresUsed,actionsTaken:e.actionsTaken,durationMs:e.durationMs,depthScore:t,timestamp:(new Date).toISOString()})}async trackContentConsumption(e){return await this.initFeature("engagement.content_consumption",{type:"engagement",contentId:e.contentId,contentType:e.contentType,userId:e.userId,percentageConsumed:e.percentageConsumed,timeSpentMs:e.timeSpentMs,completed:e.completed??e.percentageConsumed>=90,...e.properties,timestamp:(new Date).toISOString()})}async trackUserActivity(e){return await this.initFeature("engagement.user_activity",{type:"engagement",userId:e.userId,activityType:e.activityType,durationMs:e.durationMs,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}autoTrackDwell(e,t={}){if(!(0,i.isBrowser)())return()=>{};const r=(0,i.getDocument)();if(!r)return()=>{};let n=0,s="visible"===r.visibilityState?Date.now():0;const o=()=>{const e=Date.now();"visible"===r.visibilityState?s=e:s&&(n+=e-s,s=0)};r.addEventListener("visibilitychange",o);let a=!1;return()=>{a||(a=!0,r.removeEventListener("visibilitychange",o),s&&(n+=Date.now()-s,s=0),n>0&&this.trackDwellTime({featureId:e,dwellTimeMs:n,userId:t.userId,sessionId:t.sessionId,wasActive:!0}))}}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)();if(!t||!r)return()=>{};const n=e.idleAfterMs??3e4,s=e.pollMs??5e3;let o=e.sessionId;if(!o)try{o=t.sessionStorage.getItem("flowgrid:sessionId")||void 0}catch{}o||(o=`eng_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`);const a=Date.now();let c=1;const u=new Set;let l=0,d=Date.now(),p="visible"===r.visibilityState?"active":"idle",h=Date.now();const m=t.history.pushState,f=t.history.replaceState,g=()=>{c++};t.history.pushState=function(...e){const t=m.apply(this,e);return g(),t},t.history.replaceState=function(...e){const t=f.apply(this,e);return g(),t},t.addEventListener("popstate",g);const y=e=>{l++,d=Date.now();const t=e.target,r=t?.closest?.("[data-flowgrid-feature]")?.getAttribute("data-flowgrid-feature");r&&u.add(r)};r.addEventListener("click",y,{capture:!0}),r.addEventListener("keydown",y,{capture:!0}),r.addEventListener("scroll",y,{capture:!0,passive:!0});const v=t=>{if(t===p)return;const r=Date.now(),n=r-h,i=p;p=t,h=r,n>0&&e.userId&&this.trackUserActivity({userId:e.userId,activityType:i,durationMs:n,sessionId:o})},I=()=>{const e=Date.now();let t;t="visible"!==r.visibilityState?"idle":e-d<n?"active":"passive",v(t)},b=t.setInterval(I,s),S=()=>I();r.addEventListener("visibilitychange",S);let w=!1;const C=()=>{if(w)return;w=!0,v("visible"===r.visibilityState?p:"idle");const t=Date.now()-a;t<=0||this.trackSessionDepth({sessionId:o,userId:e.userId,pagesVisited:c,featuresUsed:u.size,actionsTaken:l,durationMs:t})};return t.addEventListener("pagehide",C),(0,i.combineTeardowns)(()=>t.clearInterval(b),()=>r.removeEventListener("visibilitychange",S),()=>r.removeEventListener("click",y,!0),()=>r.removeEventListener("keydown",y,!0),()=>r.removeEventListener("scroll",y,!0),()=>t.removeEventListener("popstate",g),()=>t.removeEventListener("pagehide",C),()=>{t.history.pushState=m,t.history.replaceState=f},()=>C())}}t.Engagement=o},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Forecasting=void 0,t.calculateMAPE=function(e,t){if(e.length!==t.length||0===e.length)return 0;let r=0,n=0;for(let i=0;i<e.length;i++)0!==e[i]&&(r+=Math.abs((e[i]-t[i])/e[i]),n++);return n>0?Math.round(r/n*1e4)/100:0},t.calculateRMSE=function(e,t){if(e.length!==t.length||0===e.length)return 0;let r=0;for(let n=0;n<e.length;n++)r+=Math.pow(e[n]-t[n],2);return Math.round(100*Math.sqrt(r/e.length))/100},t.calculateR2=function(e,t){if(e.length!==t.length||0===e.length)return 0;const r=e.reduce((e,t)=>e+t,0)/e.length;let n=0,i=0;for(let s=0;s<e.length;s++)n+=Math.pow(e[s]-t[s],2),i+=Math.pow(e[s]-r,2);return 0!==i?Math.round(1e4*(1-n/i))/1e4:0},t.classifyTrend=function(e,t,r=5){if(0===e)return t>0?"growing":"stable";const n=(t-e)/e*100;return n>r?"growing":n<-r?"declining":"stable"},t.calculateAvgGrowthRate=function(e){if(e.length<2)return 0;let t=0,r=0;for(let n=1;n<e.length;n++)0!==e[n-1]&&(t+=(e[n]-e[n-1])/e[n-1],r++);return r>0?Math.round(t/r*1e4)/100:0},t.applyConfidenceInterval=function(e,t,r=.95){const n=({.9:1.645,.95:1.96,.99:2.576}[r]??1.96)*t;return{lower:Math.max(0,e-n),upper:e+n}};const n=r(5975);class i extends n.FlowGridTransport{async forecastActiveUsers(e){return await this.initFeature("forecasting.active_users",{type:"forecasting",...e,model:e.model??"ensemble",includeConfidence:e.includeConfidence??!0,timestamp:(new Date).toISOString()})}async forecastRevenue(e){return await this.initFeature("forecasting.revenue",{type:"forecasting",...e,metric:"revenue",currency:e.currency??"USD",timestamp:(new Date).toISOString()})}async forecastMRR(e){return await this.initFeature("forecasting.mrr",{type:"forecasting",...e,metric:"mrr",timestamp:(new Date).toISOString()})}async forecastFeatureAdoption(e){return await this.initFeature("forecasting.feature_adoption",{type:"forecasting",...e,metric:"feature_usage",timestamp:(new Date).toISOString()})}async forecastChurn(e){return await this.initFeature("forecasting.churn",{type:"forecasting",...e,metric:"churn_rate",timestamp:(new Date).toISOString()})}async forecastSignups(e){return await this.initFeature("forecasting.signups",{type:"forecasting",...e,metric:"signups",timestamp:(new Date).toISOString()})}async compareScenarios(e){return await this.initFeature("forecasting.scenarios",{type:"forecasting",...e,timestamp:(new Date).toISOString()})}async forecastCustomMetric(e,t){return await this.initFeature("forecasting.custom",{type:"forecasting",...t,metric:"custom",customMetricName:e,timestamp:(new Date).toISOString()})}}t.Forecasting=i},7736(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.classifySecurityRiskLevel=t.SecurityAnalytics=t.checkAlertCondition=t.classifySeverity=t.calculateAnomalyScore=t.isAnomaly=t.calculateZScore=t.calculateStdDev=t.AlertsAnalytics=t.findCommonSubPaths=t.calculatePathSimilarity=t.isDeadEnd=t.calculateExitRate=t.stringToPath=t.pathToString=t.PathAnalytics=t.classifySource=t.parseUTMParams=t.calculateLTVCACRatio=t.calculateROAS=t.calculateCAC=t.AcquisitionAnalytics=t.formatDuration=t.classifyCSAT=t.calculateAvgResponseTime=t.calculateFCRRate=t.SupportAnalytics=t.generatePathId=t.calculateMicroConversionScore=t.findBestPath=t.calculateDropOffRate=t.calculateConversionRate=t.MultiPathFunnels=t.calculateLTV=t.monthlyToAnnual=t.calculateGRR=t.calculateNRR=t.calculateARPU=t.Monetization=t.generateRecommendations=t.classifyRiskLevel=t.calculateChurnRiskScore=t.ChurnAnalytics=t.generateCohortId=t.evaluateCohortRules=t.Cohorts=t.calculateSessionDepthScore=t.classifyEngagementLevel=t.calculateEngagementScore=t.Engagement=void 0,t.applyConfidenceInterval=t.calculateAvgGrowthRate=t.classifyTrend=t.calculateR2=t.calculateRMSE=t.calculateMAPE=t.Forecasting=t.determineEventSeverity=t.isSuspiciousLoginPattern=t.calculateFailedLoginRate=void 0;var n=r(4805);Object.defineProperty(t,"Engagement",{enumerable:!0,get:function(){return n.Engagement}}),Object.defineProperty(t,"calculateEngagementScore",{enumerable:!0,get:function(){return n.calculateEngagementScore}}),Object.defineProperty(t,"classifyEngagementLevel",{enumerable:!0,get:function(){return n.classifyEngagementLevel}}),Object.defineProperty(t,"calculateSessionDepthScore",{enumerable:!0,get:function(){return n.calculateSessionDepthScore}});var i=r(9774);Object.defineProperty(t,"Cohorts",{enumerable:!0,get:function(){return i.Cohorts}}),Object.defineProperty(t,"evaluateCohortRules",{enumerable:!0,get:function(){return i.evaluateCohortRules}}),Object.defineProperty(t,"generateCohortId",{enumerable:!0,get:function(){return i.generateCohortId}});var s=r(9746);Object.defineProperty(t,"ChurnAnalytics",{enumerable:!0,get:function(){return s.ChurnAnalytics}}),Object.defineProperty(t,"calculateChurnRiskScore",{enumerable:!0,get:function(){return s.calculateChurnRiskScore}}),Object.defineProperty(t,"classifyRiskLevel",{enumerable:!0,get:function(){return s.classifyRiskLevel}}),Object.defineProperty(t,"generateRecommendations",{enumerable:!0,get:function(){return s.generateRecommendations}});var o=r(7867);Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return o.Monetization}}),Object.defineProperty(t,"calculateARPU",{enumerable:!0,get:function(){return o.calculateARPU}}),Object.defineProperty(t,"calculateNRR",{enumerable:!0,get:function(){return o.calculateNRR}}),Object.defineProperty(t,"calculateGRR",{enumerable:!0,get:function(){return o.calculateGRR}}),Object.defineProperty(t,"monthlyToAnnual",{enumerable:!0,get:function(){return o.monthlyToAnnual}}),Object.defineProperty(t,"calculateLTV",{enumerable:!0,get:function(){return o.calculateLTV}});var a=r(8329);Object.defineProperty(t,"MultiPathFunnels",{enumerable:!0,get:function(){return a.MultiPathFunnels}}),Object.defineProperty(t,"calculateConversionRate",{enumerable:!0,get:function(){return a.calculateConversionRate}}),Object.defineProperty(t,"calculateDropOffRate",{enumerable:!0,get:function(){return a.calculateDropOffRate}}),Object.defineProperty(t,"findBestPath",{enumerable:!0,get:function(){return a.findBestPath}}),Object.defineProperty(t,"calculateMicroConversionScore",{enumerable:!0,get:function(){return a.calculateMicroConversionScore}}),Object.defineProperty(t,"generatePathId",{enumerable:!0,get:function(){return a.generatePathId}});var c=r(1247);Object.defineProperty(t,"SupportAnalytics",{enumerable:!0,get:function(){return c.SupportAnalytics}}),Object.defineProperty(t,"calculateFCRRate",{enumerable:!0,get:function(){return c.calculateFCRRate}}),Object.defineProperty(t,"calculateAvgResponseTime",{enumerable:!0,get:function(){return c.calculateAvgResponseTime}}),Object.defineProperty(t,"classifyCSAT",{enumerable:!0,get:function(){return c.classifyCSAT}}),Object.defineProperty(t,"formatDuration",{enumerable:!0,get:function(){return c.formatDuration}});var u=r(991);Object.defineProperty(t,"AcquisitionAnalytics",{enumerable:!0,get:function(){return u.AcquisitionAnalytics}}),Object.defineProperty(t,"calculateCAC",{enumerable:!0,get:function(){return u.calculateCAC}}),Object.defineProperty(t,"calculateROAS",{enumerable:!0,get:function(){return u.calculateROAS}}),Object.defineProperty(t,"calculateLTVCACRatio",{enumerable:!0,get:function(){return u.calculateLTVCACRatio}}),Object.defineProperty(t,"parseUTMParams",{enumerable:!0,get:function(){return u.parseUTMParams}}),Object.defineProperty(t,"classifySource",{enumerable:!0,get:function(){return u.classifySource}});var l=r(5284);Object.defineProperty(t,"PathAnalytics",{enumerable:!0,get:function(){return l.PathAnalytics}}),Object.defineProperty(t,"pathToString",{enumerable:!0,get:function(){return l.pathToString}}),Object.defineProperty(t,"stringToPath",{enumerable:!0,get:function(){return l.stringToPath}}),Object.defineProperty(t,"calculateExitRate",{enumerable:!0,get:function(){return l.calculateExitRate}}),Object.defineProperty(t,"isDeadEnd",{enumerable:!0,get:function(){return l.isDeadEnd}}),Object.defineProperty(t,"calculatePathSimilarity",{enumerable:!0,get:function(){return l.calculatePathSimilarity}}),Object.defineProperty(t,"findCommonSubPaths",{enumerable:!0,get:function(){return l.findCommonSubPaths}});var d=r(1765);Object.defineProperty(t,"AlertsAnalytics",{enumerable:!0,get:function(){return d.AlertsAnalytics}}),Object.defineProperty(t,"calculateStdDev",{enumerable:!0,get:function(){return d.calculateStdDev}}),Object.defineProperty(t,"calculateZScore",{enumerable:!0,get:function(){return d.calculateZScore}}),Object.defineProperty(t,"isAnomaly",{enumerable:!0,get:function(){return d.isAnomaly}}),Object.defineProperty(t,"calculateAnomalyScore",{enumerable:!0,get:function(){return d.calculateAnomalyScore}}),Object.defineProperty(t,"classifySeverity",{enumerable:!0,get:function(){return d.classifySeverity}}),Object.defineProperty(t,"checkAlertCondition",{enumerable:!0,get:function(){return d.checkAlertCondition}});var p=r(1924);Object.defineProperty(t,"SecurityAnalytics",{enumerable:!0,get:function(){return p.SecurityAnalytics}}),Object.defineProperty(t,"classifySecurityRiskLevel",{enumerable:!0,get:function(){return p.classifyRiskLevel}}),Object.defineProperty(t,"calculateFailedLoginRate",{enumerable:!0,get:function(){return p.calculateFailedLoginRate}}),Object.defineProperty(t,"isSuspiciousLoginPattern",{enumerable:!0,get:function(){return p.isSuspiciousLoginPattern}}),Object.defineProperty(t,"determineEventSeverity",{enumerable:!0,get:function(){return p.determineEventSeverity}});var h=r(8119);Object.defineProperty(t,"Forecasting",{enumerable:!0,get:function(){return h.Forecasting}}),Object.defineProperty(t,"calculateMAPE",{enumerable:!0,get:function(){return h.calculateMAPE}}),Object.defineProperty(t,"calculateRMSE",{enumerable:!0,get:function(){return h.calculateRMSE}}),Object.defineProperty(t,"calculateR2",{enumerable:!0,get:function(){return h.calculateR2}}),Object.defineProperty(t,"classifyTrend",{enumerable:!0,get:function(){return h.classifyTrend}}),Object.defineProperty(t,"calculateAvgGrowthRate",{enumerable:!0,get:function(){return h.calculateAvgGrowthRate}}),Object.defineProperty(t,"applyConfidenceInterval",{enumerable:!0,get:function(){return h.applyConfidenceInterval}})},7867(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0,t.calculateARPU=function(e,t,r){const n=t>0?e/t:0;return{amount:Math.round(100*n)/100,currency:r}},t.calculateNRR=function(e,t,r,n){return 0===e?0:Math.round((e+t-r-n)/e*1e4)/100},t.calculateGRR=function(e,t,r){return 0===e?0:Math.round((e-t-r)/e*1e4)/100},t.monthlyToAnnual=function(e){return{amount:12*e.amount,currency:e.currency}},t.calculateLTV=function(e,t,r){if(t<=0)return{amount:60*e,currency:r};const n=e/t;return{amount:Math.round(100*n)/100,currency:r}};const n=r(5975);class i extends n.FlowGridTransport{async trackRevenue(e){const{type:t,...r}=e;return await this.initFeature("monetization.revenue",{type:"monetization",revenueType:t,...r,timestamp:(new Date).toISOString()})}async trackExpansion(e,t,r,n){return await this.initFeature("monetization.expansion",{type:"monetization",userId:e,fromPlan:t,toPlan:r,additionalRevenue:n,revenueType:"expansion",timestamp:(new Date).toISOString()})}async trackContraction(e,t,r,n){return await this.initFeature("monetization.contraction",{type:"monetization",userId:e,fromPlan:t,toPlan:r,reducedRevenue:n,revenueType:"downgrade",timestamp:(new Date).toISOString()})}}t.Monetization=i},8329(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiPathFunnels=void 0,t.calculateConversionRate=function(e,t){return 0===e?0:Math.round(t/e*1e4)/100},t.calculateDropOffRate=function(e,t){return 0===e?0:Math.round((e-t)/e*1e4)/100},t.findBestPath=function(e){return 0===e.length?null:e.reduce((e,t)=>t.completionRate>e.completionRate?t:e)},t.calculateMicroConversionScore=function(e,t){let r=0,n=0;for(const i of t){const t=i.weight??1;r+=t;const s=e.find(e=>e.id===i.id);s&&(n+=t*s.completionRate)}return r>0?Math.round(n/r*100)/100:0},t.generatePathId=i;const n=r(5975);function i(e){return e.join("_").toLowerCase().replace(/[^a-z0-9_]/g,"")}class s extends n.FlowGridTransport{async defineFunnel(e){const t=e.funnelId??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"_"),r=e.paths.map(e=>({...e,pathId:e.pathId??i(e.steps)}));return await this.initFeature("multi_path_funnels.define",{type:"multi_path_funnels",funnelId:t,name:e.name,description:e.description,paths:r,microConversions:e.microConversions,goalEvent:e.goalEvent,timestamp:(new Date).toISOString()})}async updateFunnel(e,t){return await this.initFeature("multi_path_funnels.update",{type:"multi_path_funnels",funnelId:e,...t,timestamp:(new Date).toISOString()})}async deleteFunnel(e){return await this.initFeature("multi_path_funnels.delete",{type:"multi_path_funnels",funnelId:e,timestamp:(new Date).toISOString()})}async trackStep(e){return await this.initFeature("multi_path_funnels.track_step",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async trackMicroConversion(e){return await this.initFeature("multi_path_funnels.track_micro_conversion",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async trackGoal(e,t,r){return await this.initFeature("multi_path_funnels.track_goal",{type:"multi_path_funnels",funnelId:e,userId:t,...r,timestamp:(new Date).toISOString()})}async analyzeFunnel(e){return await this.initFeature("multi_path_funnels.analyze",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async comparePaths(e,t){return await this.initFeature("multi_path_funnels.compare_paths",{type:"multi_path_funnels",funnelId:e,filter:t,timestamp:(new Date).toISOString()})}async listFunnels(){return await this.initFeature("multi_path_funnels.list",{type:"multi_path_funnels",timestamp:(new Date).toISOString()})}}t.MultiPathFunnels=s},5284(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathAnalytics=void 0,t.pathToString=i,t.stringToPath=s,t.calculateExitRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.isDeadEnd=function(e,t,r=50){return e>r&&!t},t.calculatePathSimilarity=function(e,t){const r=new Set(e),n=new Set(t),i=new Set([...r].filter(e=>n.has(e))),s=new Set([...r,...n]);return i.size/s.size},t.findCommonSubPaths=function(e,t=2){const r=new Map;for(const n of e)for(let e=0;e<=n.length-t;e++)for(let s=e+t;s<=n.length;s++){const t=i(n.slice(e,s));r.set(t,(r.get(t)??0)+1)}return Array.from(r.entries()).filter(([,e])=>e>1).map(([e,t])=>({subPath:s(e),count:t})).sort((e,t)=>t.count-e.count)};const n=r(5975);function i(e){return e.join(" → ")}function s(e){return e.split(" → ").map(e=>e.trim())}class o extends n.FlowGridTransport{async trackTransition(e){return await this.initFeature("paths.transition",{type:"paths",...e,timestamp:(new Date).toISOString()})}async trackFeatureSequence(e){return await this.initFeature("paths.feature_sequence",{type:"paths",...e,timestamp:(new Date).toISOString()})}async definePath(e){return await this.initFeature("paths.define_path",{type:"paths",...e,timestamp:(new Date).toISOString()})}async comparePaths(e,t){return await this.initFeature("paths.compare_paths",{type:"paths",paths:e,filter:t,timestamp:(new Date).toISOString()})}}t.PathAnalytics=o},1924(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityAnalytics=void 0,t.classifyRiskLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"critical"},t.calculateFailedLoginRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.isSuspiciousLoginPattern=function(e,t,r=5){return e>=r&&t<=15},t.determineEventSeverity=i;const n=r(5975);function i(e,t){return["suspicious_activity"].includes(e)?"critical":["role_change","permission_change","data_deletion","api_key_revoked"].includes(e)?"high":["login_failure","password_reset","data_export"].includes(e)?t?"medium":"high":"low"}class s extends n.FlowGridTransport{async trackLoginAttempt(e){const t=e.success?"login_success":"login_failure",r=i(t,e.success);return await this.initFeature("security.login_attempt",{type:"security",...e,eventType:t,severity:r,timestamp:(new Date).toISOString()})}async trackLogout(e,t){return await this.initFeature("security.logout",{type:"security",userId:e,sessionId:t,eventType:"logout",timestamp:(new Date).toISOString()})}async trackPasswordChange(e,t=!1){return await this.initFeature("security.password_change",{type:"security",userId:e,forced:t,eventType:"password_change",timestamp:(new Date).toISOString()})}async trackRoleChange(e){return await this.initFeature("security.role_change",{type:"security",...e,eventType:"role_change",timestamp:(new Date).toISOString()})}async trackPermissionChange(e){return await this.initFeature("security.permission_change",{type:"security",...e,eventType:"permission_change",timestamp:(new Date).toISOString()})}async trackDataAccess(e){return await this.initFeature("security.data_access",{type:"security",...e,eventType:"data_access",timestamp:(new Date).toISOString()})}async trackDataExport(e,t,r){return await this.initFeature("security.data_export",{type:"security",userId:e,resourceType:t,recordCount:r,eventType:"data_export",timestamp:(new Date).toISOString()})}async trackSuspiciousActivity(e,t,r){return await this.initFeature("security.suspicious_activity",{type:"security",userId:e,activityType:t,details:r,eventType:"suspicious_activity",severity:"critical",timestamp:(new Date).toISOString()})}async trackComplianceEvent(e){return await this.initFeature("security.compliance_event",{type:"security",...e,timestamp:(new Date).toISOString()})}}t.SecurityAnalytics=s},1247(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupportAnalytics=void 0,t.calculateFCRRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.calculateAvgResponseTime=function(e){if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t,0);return Math.round(t/e.length)},t.classifyCSAT=function(e){return e<2?"poor":e<3?"fair":e<4?"good":"excellent"},t.formatDuration=function(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:e<864e5?`${Math.round(e/36e5)}h`:`${Math.round(e/864e5)}d`};const n=r(5975);class i extends n.FlowGridTransport{async trackTicket(e){return await this.initFeature("support.ticket_created",{type:"support",...e,status:"open",createdAt:(new Date).toISOString(),timestamp:(new Date).toISOString()})}async updateTicket(e){return await this.initFeature("support.ticket_updated",{type:"support",...e,timestamp:(new Date).toISOString()})}async trackResponse(e,t,r){return await this.initFeature("support.ticket_response",{type:"support",ticketId:e,agentId:t,responseTimeMs:r,timestamp:(new Date).toISOString()})}async trackResolution(e,t,r){return await this.initFeature("support.ticket_resolved",{type:"support",ticketId:e,resolutionTimeMs:t,interactionCount:r,firstContactResolution:1===r,timestamp:(new Date).toISOString()})}async trackCSAT(e){return await this.initFeature("support.csat",{type:"support",...e,timestamp:(new Date).toISOString()})}async trackFeatureComplaint(e){return await this.initFeature("support.feature_complaint",{type:"support",...e,timestamp:(new Date).toISOString()})}}t.SupportAnalytics=i},7138(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.FlowGrid=void 0;const a=r(5975),c=r(5558),u=r(7244),l=r(8597),d=r(5405),p=r(938),h=r(4895),m=r(1075);let f=null,g=null;function y(){return f&&g?Promise.resolve():Promise.all([Promise.resolve().then(()=>o(r(7736))),Promise.resolve().then(()=>o(r(658)))]).then(([e,t])=>{f=e,g=t})}const v={handled:!1},I=["productId","name","brand","category","variant","price","currency","quantity","discount","coupon","position","url","imageUrl","rating","reviewCount","stockStatus","attributes"];function b(e){return{handled:!0,value:e}}function S(e,t){const r=e[t];return"string"==typeof r&&r.length>0?r:void 0}function w(e,t){const r=e[t];return"number"==typeof r&&Number.isFinite(r)?r:void 0}function C(e,t){const r=e[t];return"boolean"==typeof r?r:void 0}function k(e,t){const r=e[t];return function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(r)?r:void 0}function T(e,t){const r=e[t];return null!=r&&!("string"==typeof r&&0===r.length)}function _(e,t){const r={},n=new Set([...t,"domain"]);for(const[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return r}function A(e){const t=k(e,"product");if(t)return{...t,currency:t.currency??"USD"};if(!T(e,"productId")||!T(e,"name")||!T(e,"price"))return;const r={currency:"USD"};for(const t of I)void 0!==e[t]&&(r[t]=e[t]);return r}class O{static init(e){if(O._instance)return"undefined"!=typeof console&&console.warn("[FlowGrid] init() called more than once — returning existing instance."),O._instance;if(!e?.webId||!e?.apiKey)throw new Error("FlowGrid.init: `webId` and `apiKey` are required.");e.consent&&O.setConsent(e.consent);const t=new O(e.webId,e.endpoint??"https://core.flow-grid.xyz",e.apiKey,e.visitorId,e.identityManager,e.transport);O._instance=t,y(),e.user?.userId&&t.identifyUser(e.user.userId,e.user.traits);const r=e.autoTrack,n=e.replay,i=!1===r?{sessions:!1,pageViews:!1,performance:!1,heatmaps:!1,attribution:!1,engagement:!1,replay:!1}:!0===r||void 0===r?{sessions:!1,pageViews:!1,performance:!1,heatmaps:!1,attribution:!1}:r;return void 0!==n&&(i.replay=n),t._autoTrackStop=t.autoTrack({...i,userId:e.user?.userId??i.userId}),t}static instance(){return O._instance}static loadEnterprise(){return y()}static reset(){if(O._instance?._autoTrackStop)try{O._instance._autoTrackStop()}catch{}O._instance=null}constructor(e,t,r,n,i,s){this._autoTrackStop=null,this._raw=new Map,this._wrapped=new Map,this.webId=e,this.endpoint=t,this.apiKey=r,this.visitorId=n,this.identityManager=i??new c.IdentityManager(n?{visitorId:n}:void 0),this.config=s}raw(e,t){let r=this._raw.get(e);return r||(r=new t(this.webId,this.endpoint,this.apiKey,this.visitorId,this.identityManager,this.config),this._raw.set(e,r)),r}wrap(e,t,r){let n=this._wrapped.get(e);return n||(n=new r(this.raw(e,t)),this._wrapped.set(e,n)),n}get activation(){return this.wrap("activation",u.Activation,p.ActivationTracker)}get features(){return this.wrap("features",u.TrackFeature,p.FeatureTracker)}get prompts(){return this.wrap("prompts",u.TrackPrompt,p.PromptTracker)}get experiments(){return this.wrap("experiments",u.Experiment,p.ExperimentTracker)}get pageViews(){return this.wrap("pageViews",l.PageViews,h.PageViewTracker)}get sessions(){return this.wrap("sessions",l.Sessions,h.SessionTracker)}get events(){return this.wrap("events",l.Events,h.EventTracker)}get identify(){return this.wrap("identify",l.Identify,h.IdentifyTracker)}get funnels(){return this.wrap("funnels",l.Funnels,h.FunnelTracker)}get retention(){return this.wrap("retention",l.Retention,h.RetentionTracker)}get attribution(){return this.wrap("attribution",l.Attribution,h.AttributionTracker)}get heatmaps(){return this.wrap("heatmaps",l.Heatmaps,h.HeatmapTracker)}get performance(){return this.wrap("performance",l.PerformanceTracking,h.PerformanceTracker)}get replay(){return this.wrap("replay",l.SessionReplay,h.ReplayTracker)}get products(){return this.wrap("products",d.Products,m.ProductTracker)}get cart(){return this.wrap("cart",d.CartTracking,m.CartTracker)}get checkout(){return this.wrap("checkout",d.Checkout,m.CheckoutTracker)}get purchases(){return this.wrap("purchases",d.Purchases,m.PurchaseTracker)}get refunds(){return this.wrap("refunds",d.Refunds,m.RefundTracker)}get promotions(){return this.wrap("promotions",d.Promotions,m.PromotionTracker)}get wishlist(){return this.wrap("wishlist",d.WishlistTracking,m.WishlistTracker)}get ltv(){return this.wrap("ltv",d.CustomerLTV,m.LTVTracker)}get search(){return this.wrap("search",d.SearchAnalytics,m.SearchTracker)}get subscriptions(){return this.wrap("subscriptions",d.Subscriptions,m.SubscriptionTracker)}_requireEnterprise(){const e=f,t=g;if(!e||!t)throw new Error("[FlowGrid] Enterprise features are still loading. await FlowGrid.loadEnterprise() before accessing enterprise namespaces directly.");return{ent:e,entT:t}}get engagement(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("engagement",e.Engagement,t.EngagementTracker)}get cohorts(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("cohorts",e.Cohorts,t.CohortTracker)}get churn(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("churn",e.ChurnAnalytics,t.ChurnTracker)}get monetization(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("monetization",e.Monetization,t.MonetizationTracker)}get multiPathFunnels(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("multiPathFunnels",e.MultiPathFunnels,t.MultiPathFunnelTracker)}get support(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("support",e.SupportAnalytics,t.SupportTracker)}get acquisition(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("acquisition",e.AcquisitionAnalytics,t.AcquisitionTracker)}get paths(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("paths",e.PathAnalytics,t.PathTracker)}get alerts(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("alerts",e.AlertsAnalytics,t.AlertTracker)}get security(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("security",e.SecurityAnalytics,t.SecurityTracker)}get forecasting(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("forecasting",e.Forecasting,t.ForecastingTracker)}track(e,t={},r={}){const n=this.withTrackContext(t,r),i=this.dispatchTrack(e,n,Boolean(r.domain),r.domain);return i.handled?i.value:this.events.track(e,t,r)}withTrackContext(e,t){return{...e,...void 0!==t.userId&&void 0===e.userId?{userId:t.userId}:{},...void 0!==t.sessionId&&void 0===e.sessionId?{sessionId:t.sessionId}:{}}}requireTrackProperties(e,t,r,n){const i=r.filter(e=>!T(t,e));if(0===i.length)return!0;if(n)throw new Error(`FlowGrid.track("${e}") missing required properties: ${i.join(", ")}`);return!1}dispatchTrack(e,t,r,n){const i=[];n&&"activation"!==n||i.push(()=>this.dispatchActivationTrack(e,t,r)),n&&"feature"!==n||i.push(()=>this.dispatchFeatureTrack(e,t,r)),n&&"prompt"!==n||i.push(()=>this.dispatchPromptTrack(e,t,r)),n&&"experiment"!==n||i.push(()=>this.dispatchExperimentTrack(e,t,r)),n&&"analytics"!==n&&"funnel"!==n&&"retention"!==n&&"attribution"!==n||i.push(()=>this.dispatchAnalyticsTrack(e,t,r,n)),n&&"ecommerce"!==n||i.push(()=>this.dispatchEcommerceTrack(e,t,r)),n&&"engagement"!==n&&"churn"!==n&&"monetization"!==n&&"support"!==n&&"acquisition"!==n&&"paths"!==n&&"security"!==n&&"multiPathFunnels"!==n||i.push(()=>this.dispatchEnterpriseTrack(e,t,r,n));for(const e of i){const t=e();if(t.handled)return t}return v}dispatchActivationTrack(e,t,r){switch(e){case"signup_completed":return this.requireTrackProperties(e,t,["userId","method"],r)?b(this.activation.signup(S(t,"userId"),S(t,"method"),S(t,"source"),_(t,["userId","method","source"]))):v;case"onboarding_step":return this.requireTrackProperties(e,t,["userId","stepId","stepName","stepOrder","totalSteps"],r)?b(this.activation.onboardingStep(S(t,"userId"),S(t,"stepId"),S(t,"stepName"),w(t,"stepOrder"),w(t,"totalSteps"),{skipped:C(t,"skipped"),timeSpent:w(t,"timeSpent"),properties:_(t,["userId","stepId","stepName","stepOrder","totalSteps","skipped","timeSpent"])})):v;case"onboarding_completed":return this.requireTrackProperties(e,t,["userId","totalTimeSpent","stepsCompleted"],r)?b(this.activation.onboardingComplete(S(t,"userId"),w(t,"totalTimeSpent"),w(t,"stepsCompleted"),w(t,"stepsSkipped")??0)):v;case"first_action":return this.requireTrackProperties(e,t,["userId","actionName","timeSinceSignup"],r)?b(this.activation.firstAction(S(t,"userId"),S(t,"actionName"),w(t,"timeSinceSignup"),_(t,["userId","actionName","timeSinceSignup"]))):v;default:return r?b(this.activation.event(e,t)):v}}dispatchFeatureTrack(e,t,r){const n={feature_viewed:"viewed",feature_used:"used",feature_completed:"completed",feature_abandoned:"abandoned"}[e]??("feature_usage"===e?t.action:void 0);return"feature_usage"===e||n?this.requireTrackProperties(e,t,["featureId","featureName"],r)?b(this.features.client.trackUsage({...t,action:"string"==typeof n?n:"used",eventName:e})):v:r&&this.requireTrackProperties(e,t,["userId","featureName"],!0)?b(this.features.create(S(t,"userId"),e,S(t,"featureName"),_(t,["userId","featureName"]))):v}dispatchPromptTrack(e,t,r){switch(e){case"prompt_submitted":return this.requireTrackProperties(e,t,["promptId","promptType"],r)?b(this.prompts.client.trackSubmission(t)):v;case"prompt_response":return this.requireTrackProperties(e,t,["promptId","responseTime","completed"],r)?b(this.prompts.client.trackResponse(t)):v;case"prompt_feedback":return this.requireTrackProperties(e,t,["promptId","feedbackType"],r)?b(this.prompts.client.trackFeedback(t)):v;case"prompt_conversation":return this.requireTrackProperties(e,t,["conversationId","userId","turnCount","totalDuration"],r)?b(this.prompts.conversation(S(t,"conversationId"),S(t,"userId"),w(t,"turnCount"),w(t,"totalDuration"))):v;default:return r||e.startsWith("prompt_")?b(this.prompts.event(e,t)):v}}dispatchExperimentTrack(e,t,r){switch(e){case"experiment_assignment":return this.requireTrackProperties(e,t,["experimentId","userId","variantId"],r)?b(this.experiments.client.assign(t)):v;case"experiment_exposure":return this.requireTrackProperties(e,t,["experimentId","userId","variantId"],r)?b(this.experiments.exposure(S(t,"experimentId"),S(t,"userId"),S(t,"variantId"))):v;case"experiment_conversion":return this.requireTrackProperties(e,t,["experimentId","userId","variantId","metricName"],r)?b(this.experiments.client.trackConversion({...t,value:w(t,"value")??1})):v;default:return(r||e.startsWith("experiment_"))&&this.requireTrackProperties(e,t,["variant"],r)?b(this.experiments.client.track({eventName:e,variant:S(t,"variant"),properties:_(t,["variant"])})):v}}dispatchAnalyticsTrack(e,t,r,n){switch(e){case"click_event":return this.requireTrackProperties(e,t,["elementId","elementText"],r)?b(this.events.client.trackClick(t)):v;case"form_event":return this.requireTrackProperties(e,t,["formId","formName"],r)?b(this.events.client.trackForm(t)):v;case"search_event":return this.requireTrackProperties(e,t,["query","category"],r)?b(this.events.client.trackSearch(t)):v;case"error_event":return this.requireTrackProperties(e,t,["message","type"],r)?b(this.events.client.trackError(t)):v;case"funnel_step":return this.requireTrackProperties(e,t,["funnelId","step","stepNumber"],r)?b(this.funnels.client.trackStep(t)):v;case"funnel_complete":return this.requireTrackProperties(e,t,["funnelId"],r)?b(this.funnels.complete(S(t,"funnelId"),S(t,"userId"),_(t,["funnelId","userId"]))):v;case"funnel_abandon":return this.requireTrackProperties(e,t,["funnelId","lastStep"],r)?b(this.funnels.abandon(S(t,"funnelId"),S(t,"lastStep"),S(t,"userId"),S(t,"reason"))):v;case"user_activity":return n&&"retention"!==n?v:this.requireTrackProperties(e,t,["userId"],r)?b(this.retention.client.trackActivity(t)):v;case"attribution_touchpoint":return this.requireTrackProperties(e,t,["userId","channel"],r)?b(this.attribution.client.trackTouchpoint(t)):v;case"attribution_conversion":return this.requireTrackProperties(e,t,["userId","conversionType"],r)?b(this.attribution.client.recordConversion(t)):v;default:return v}}dispatchEcommerceTrack(e,t,r){switch(e){case"product_view":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}return b(this.products.client.view({...n,..._(t,["product",...I])}))}case"product_impression":return this.requireTrackProperties(e,t,["list"],r)?b(this.products.client.impression(t)):v;case"product_click":{const n=A(t);return n&&this.requireTrackProperties(e,t,["listId","position"],r)?b(this.products.client.click({...t,product:n})):v}case"add_to_cart":case"remove_from_cart":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}const i={..._(t,["product",...I]),product:n,quantity:w(t,"quantity")??1};return b("add_to_cart"===e?this.cart.client.addItem(i):this.cart.client.removeItem(i))}case"update_cart_item":{const n=A(t);return n&&this.requireTrackProperties(e,t,["previousQuantity","newQuantity"],r)?b(this.cart.client.updateItem({..._(t,["product",...I]),product:n})):v}case"view_cart":return this.requireTrackProperties(e,t,["cart"],r)?b(this.cart.client.view(t)):v;case"begin_checkout":return this.requireTrackProperties(e,t,["cart"],r)?b(this.checkout.client.begin(t)):v;case"checkout_step":return this.requireTrackProperties(e,t,["step","stepNumber","cart"],r)?b(this.checkout.client.step(t)):v;case"add_shipping_info":return this.requireTrackProperties(e,t,["cart","shipping"],r)?b(this.checkout.client.addShipping(t)):v;case"add_payment_info":return this.requireTrackProperties(e,t,["cart","payment"],r)?b(this.checkout.client.addPayment(t)):v;case"purchase":return this.requireTrackProperties(e,t,["order"],r)?b(this.purchases.client.track(t)):v;case"refund":return this.requireTrackProperties(e,t,["orderId","refundId","amount","currency"],r)?b(this.refunds.client.track(t)):v;case"refund_requested":return this.requireTrackProperties(e,t,["orderId"],r)?b(this.refunds.client.request(S(t,"orderId"),t.items,S(t,"reason"))):v;case"refund_approved":return this.requireTrackProperties(e,t,["refundId","approvedAmount"],r)?b(this.refunds.client.approve(S(t,"refundId"),w(t,"approvedAmount"))):v;case"refund_denied":return this.requireTrackProperties(e,t,["refundId","reason"],r)?b(this.refunds.client.deny(S(t,"refundId"),S(t,"reason"))):v;case"refund_completed":return this.requireTrackProperties(e,t,["refundId","processedAmount"],r)?b(this.refunds.client.complete(S(t,"refundId"),w(t,"processedAmount"))):v;case"promotion_view":return this.requireTrackProperties(e,t,["promotionId","name","creative","position"],r)?b(this.promotions.client.view(t)):v;case"promotion_click":return this.requireTrackProperties(e,t,["promotionId","name","creative","position"],r)?b(this.promotions.client.click(t)):v;case"coupon_used":return this.requireTrackProperties(e,t,["code","orderId","discountValue","discountType","orderValueBefore","orderValueAfter"],r)?b(this.promotions.client.couponUsed(t)):v;case"add_to_wishlist":case"remove_from_wishlist":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}const i={..._(t,["product",...I]),product:n};return b("add_to_wishlist"===e?this.wishlist.client.add(i):this.wishlist.client.remove(i))}case"view_wishlist":return this.requireTrackProperties(e,t,["wishlist"],r)?b(this.wishlist.client.view(k(t,"wishlist"))):v;case"wishlist_to_cart":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}return b(this.wishlist.client.moveToCart(n,S(t,"wishlistId")))}case"share_wishlist":return this.requireTrackProperties(e,t,["wishlistId","method"],r)?b(this.wishlist.client.share(S(t,"wishlistId"),S(t,"method"))):v;case"subscription_start":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","mrr","billingCycle"],r)?b(this.subscriptions.client.start(t)):v;case"subscription_change":return this.requireTrackProperties(e,t,["subscriptionId","userId","previousPlan","newPlan","previousMrr","newMrr","changeType"],r)?b(this.subscriptions.client.change(t)):v;case"subscription_cancel":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","lostMrr"],r)?b(this.subscriptions.client.cancel(t)):v;case"subscription_renew":return this.requireTrackProperties(e,t,["subscriptionId","userId","mrr"],r)?b(this.subscriptions.client.renew(S(t,"subscriptionId"),S(t,"userId"),k(t,"mrr"))):v;case"trial_converted":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","mrr"],r)?b(this.subscriptions.client.trialConverted(S(t,"subscriptionId"),S(t,"userId"),S(t,"plan"),k(t,"mrr"))):v;case"trial_expired":return this.requireTrackProperties(e,t,["subscriptionId","userId"],r)?b(this.subscriptions.client.trialExpired(S(t,"subscriptionId"),S(t,"userId"))):v;case"record_acquisition_cost":return this.requireTrackProperties(e,t,["userId","cost","channel"],r)?b(this.ltv.client.recordAcquisitionCost(t)):v;case"update_customer_segment":return this.requireTrackProperties(e,t,["userId","newSegment"],r)?b(this.ltv.client.updateSegment(S(t,"userId"),S(t,"newSegment"))):v;case"site_search":return this.requireTrackProperties(e,t,["query","resultsCount"],r)?b(this.search.client.track(t)):v;case"search_result_click":{const n=A(t);return n&&this.requireTrackProperties(e,t,["query","position"],r)?b(this.search.client.trackClick({...t,product:n})):v}case"search_refinement":return this.requireTrackProperties(e,t,["originalQuery","refinedQuery","refinementType"],r)?b(this.search.client.trackRefinement(S(t,"originalQuery"),S(t,"refinedQuery"),S(t,"refinementType"))):v;case"search_suggestion":return this.requireTrackProperties(e,t,["partialQuery","selectedSuggestion","suggestionPosition"],r)?b(this.search.client.trackSuggestion(S(t,"partialQuery"),S(t,"selectedSuggestion"),w(t,"suggestionPosition"))):v;default:return v}}dispatchEnterpriseTrack(e,t,r,n){if(!f||!g)return v;switch(e){case"engagement.dwell_time":case"engagement_dwell_time":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["featureId","dwellTimeMs"],r)?b(this.engagement.client.trackDwellTime(t)):v;case"engagement.session_depth":case"engagement_session_depth":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["sessionId","pagesVisited","featuresUsed","actionsTaken","durationMs"],r)?b(this.engagement.client.trackSessionDepth(t)):v;case"engagement.content_consumption":case"engagement_content_consumption":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["contentId","contentType","percentageConsumed","timeSpentMs"],r)?b(this.engagement.client.trackContentConsumption(t)):v;case"engagement.user_activity":case"engagement_user_activity":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["userId","activityType","durationMs"],r)?b(this.engagement.client.trackUserActivity(t)):v;case"churn.usage_decay":case"churn_usage_decay":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","metric","periods"],r)?b(this.churn.client.trackUsageDecay(t)):v;case"churn.nps":case"churn_nps":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","score"],r)?b(this.churn.client.trackNPS(t)):v;case"churn.churn_event":case"churn_churn_event":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","churnType"],r)?b(this.churn.client.trackChurn(t)):v;case"churn.prevention_action":case"churn_prevention_action":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","actionType"],r)?b(this.churn.client.trackPreventionAction(t)):v;case"monetization.revenue":case"monetization_revenue":return n&&"monetization"!==n?v:this.requireTrackProperties(e,t,["userId","amount","currency","type"],r)?b(this.monetization.client.trackRevenue(t)):v;case"support.ticket_created":case"support_ticket_created":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","userId","subject","category","priority","channel"],r)?b(this.support.client.trackTicket(t)):v;case"support.ticket_updated":case"support_ticket_updated":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","status"],r)?b(this.support.client.updateTicket(t)):v;case"support.csat":case"support_csat":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","userId","score"],r)?b(this.support.client.trackCSAT(t)):v;case"support.feature_complaint":case"support_feature_complaint":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["userId","featureId","complaintType","severity"],r)?b(this.support.client.trackFeatureComplaint(t)):v;case"acquisition.acquired":case"acquisition_acquired":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["userId","source"],r)?b(this.acquisition.client.trackAcquisition(t)):v;case"acquisition.lifecycle_transition":case"acquisition_lifecycle_transition":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["userId","fromStage","toStage"],r)?b(this.acquisition.client.trackLifecycleTransition(t)):v;case"acquisition.campaign_spend":case"acquisition_campaign_spend":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["campaignId","amount","date"],r)?b(this.acquisition.client.trackCampaignSpend(t)):v;case"paths.transition":case"paths_transition":return n&&"paths"!==n?v:this.requireTrackProperties(e,t,["userId","fromScreen","toScreen"],r)?b(this.paths.client.trackTransition(t)):v;case"paths.feature_sequence":case"paths_feature_sequence":return n&&"paths"!==n?v:this.requireTrackProperties(e,t,["userId","feature","order"],r)?b(this.paths.client.trackFeatureSequence(t)):v;case"security.login_attempt":case"security_login_attempt":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","success"],r)?b(this.security.client.trackLoginAttempt(t)):v;case"security.role_change":case"security_role_change":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","changedBy","previousRole","newRole"],r)?b(this.security.client.trackRoleChange(t)):v;case"security.permission_change":case"security_permission_change":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","changedBy","permission","action"],r)?b(this.security.client.trackPermissionChange(t)):v;case"security.data_access":case"security_data_access":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","resourceType","accessType"],r)?b(this.security.client.trackDataAccess(t)):v;case"security.compliance_event":case"security_compliance_event":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","eventType"],r)?b(this.security.client.trackComplianceEvent(t)):v;case"multi_path_funnels.track_step":case"multi_path_funnels_track_step":return n&&"multiPathFunnels"!==n?v:this.requireTrackProperties(e,t,["funnelId","step","userId"],r)?b(this.multiPathFunnels.client.trackStep(t)):v;case"multi_path_funnels.track_micro_conversion":case"multi_path_funnels_track_micro_conversion":return n&&"multiPathFunnels"!==n?v:this.requireTrackProperties(e,t,["conversionId","userId"],r)?b(this.multiPathFunnels.client.trackMicroConversion(t)):v;default:return v}}experiment(e,t){return this.experiments.exposure(e,t.userId,t.variant)}identifyUser(e,t,r){return this.identify.user(e,t,r)}defineFeature(e,t,r={}){const n=(n,i)=>this.track("feature_usage",{featureId:e,featureName:t,action:n,...r.category?{category:r.category}:{},...i??{}},{domain:"feature"});return{featureId:e,featureName:t,viewed:e=>n("viewed",e),used:e=>n("used",e),completed:e=>n("completed",e),abandoned:e=>n("abandoned",e),track:(e,t)=>n(e,t)}}page(e,t,r){return this.pageViews.view(e,t,r)}autoTrack(e={}){const t=[],r={userId:e.userId};if(!0===e.sessions&&t.push(this.sessions.autoTrack(r.userId?{user:{userId:r.userId}}:{})),!0===e.pageViews&&t.push(this.pageViews.autoTrack(r)),!0===e.performance||!1!==e.performance&&"object"==typeof e.performance){const n="object"==typeof e.performance?e.performance:{};t.push(this.performance.autoTrack({...n,userId:r.userId}))}if(!0===e.heatmaps||!1!==e.heatmaps&&"object"==typeof e.heatmaps){const n="object"==typeof e.heatmaps?e.heatmaps:{};t.push(this.heatmaps.autoTrack({...n,userId:r.userId}))}if(!1!==e.engagement){const n="object"==typeof e.engagement?e.engagement:{};let i=null,s=!1;y().then(()=>{s||(i=this.engagement.client.autoTrack({...n,userId:r.userId}))}),t.push(()=>{if(s=!0,i)try{i()}catch{}})}if(!0===e.attribution&&r.userId&&this.attribution.captureFromUrl(r.userId),!0===e.passiveIdentity||!1!==e.passiveIdentity&&"object"==typeof e.passiveIdentity){const r="object"==typeof e.passiveIdentity?e.passiveIdentity:{};t.push(this.identify.client.autoTrackForms(r))}if(!1!==e.replay){const n="object"==typeof e.replay?e.replay:{};let i=null,s=!1;this.replay.start({userId:r.userId,...n}).then(e=>{if(s)try{e()}catch{}else i=e}),t.push(()=>{if(s=!0,i)try{i()}catch{}})}return()=>{for(const e of t)try{e()}catch{}}}}t.FlowGrid=O,O._instance=null,O.setConsent=a.FlowGridTransport.setConsent.bind(a.FlowGridTransport),O.hasConsent=a.FlowGridTransport.hasConsent.bind(a.FlowGridTransport),t.default=O},5568(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setupConsent=s,t.attachConsentBanner=function(e){if("undefined"==typeof document)return null;const{bannerId:t="cookie-banner",acceptId:r="accept-btn",rejectId:n="reject-btn",manager:i,...o}=e??{},a=document.getElementById(t);if(!a)return null;const c=i??s(o),u=()=>{a.style.display=""},l=()=>{a.style.display="none"},d=a.querySelector(`#${r}`),p=a.querySelector(`#${n}`),h=()=>{c.acceptAll(),l()},m=()=>{c.rejectNonEssential(),l()};return d?.addEventListener("click",h),p?.addEventListener("click",m),c.hasConsented()?l():u(),{manager:c,show:u,hide:l,destroy(){d?.removeEventListener("click",h),p?.removeEventListener("click",m)}}};const n=r(4513),i=r(5975);function s(e){const t=e?.onChange,r=new n.ConsentManager({...e,onChange:e=>{o(e),t?.(e)}});return o(r.getPreferences()),r}function o(e){i.FlowGridTransport.setConsent({analytics:e.analytics,marketing:e.marketing})}},4806(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOrCreateAnonId=function(){if("undefined"==typeof localStorage)return"anon";try{const e=localStorage.getItem(r);if(e)return e;const t=i();return localStorage.setItem(r,t),t}catch{return"anon"}},t.getOrCreateCartId=function(){if("undefined"==typeof sessionStorage)return"cart_anon";try{const e=sessionStorage.getItem(n);if(e)return e;const t=`cart_${i()}`;return sessionStorage.setItem(n,t),t}catch{return"cart_anon"}},t.resetCartId=function(){try{"undefined"!=typeof sessionStorage&&sessionStorage.removeItem(n)}catch{}};const r="fg_anon_id",n="fg_cart_id";function i(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},1134(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attachConsentBanner=t.setupConsent=t.resetCartId=t.getOrCreateCartId=t.getOrCreateAnonId=void 0;var n=r(4806);Object.defineProperty(t,"getOrCreateAnonId",{enumerable:!0,get:function(){return n.getOrCreateAnonId}}),Object.defineProperty(t,"getOrCreateCartId",{enumerable:!0,get:function(){return n.getOrCreateCartId}}),Object.defineProperty(t,"resetCartId",{enumerable:!0,get:function(){return n.resetCartId}});var i=r(5568);Object.defineProperty(t,"setupConsent",{enumerable:!0,get:function(){return i.setupConsent}}),Object.defineProperty(t,"attachConsentBanner",{enumerable:!0,get:function(){return i.attachConsentBanner}})},642(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AttributionTracker=void 0,t.AttributionTracker=class{constructor(e){this.client=e}touchpoint(e,t,r){return this.client.trackTouchpoint({userId:e,channel:t,properties:r})}conversion(e,t,r){return this.client.recordConversion({userId:e,conversionType:t,properties:r})}captureFromUrl(e){return this.client.captureFromUrl(e)}}},7486(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTracker=void 0,t.EventTracker=class{constructor(e){this.client=e}track(e,t,r){return this.client.track({eventName:e,properties:t,userId:r?.userId,sessionId:r?.sessionId})}batch(e){return this.client.trackBatch({events:e})}click(e,t,r){return this.client.trackClick({elementId:e,elementText:t,properties:r})}form(e,t,r){return this.client.trackForm({formId:e,formName:t,properties:r})}search(e,t,r){return this.client.trackSearch({query:e,category:t,properties:r})}error(e,t,r){return this.client.trackError({message:e,type:t,properties:r})}}},8946(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FunnelTracker=void 0,t.FunnelTracker=class{constructor(e){this.client=e}define(e){return this.client.define(e)}step(e,t,r,n,i){return this.client.trackStep({funnelId:e,step:t,stepNumber:r,userId:n,properties:i})}complete(e,t,r){return this.client.trackComplete(e,t,r)}abandon(e,t,r,n){return this.client.trackAbandon(e,t,r,n)}}},8202(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeatmapTracker=void 0,t.HeatmapTracker=class{constructor(e){this.client=e}click(e,t,r,n,i){return this.client.trackClick({pageUrl:e,x:t,y:r,viewportWidth:n,viewportHeight:i})}movement(e,t,r){return this.client.trackMovement({pageUrl:e,path:t,viewport:r})}scroll(e,t,r,n){return this.client.trackScroll({pageUrl:e,maxScrollDepth:t,pageHeight:r,viewportHeight:n})}autoTrack(e){return this.client.autoTrack(e)}}},4767(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifyTracker=void 0,t.IdentifyTracker=class{constructor(e){this.client=e}user(e,t,r){return this.client.user({userId:e,anonymousId:r,traits:t})}updateTraits(e,t){return this.client.updateTraits(e,t)}alias(e,t){return this.client.alias({previousId:e,userId:t})}group(e,t,r){return this.client.group({userId:e,groupId:t,traits:r})}}},4895(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReplayTracker=t.PerformanceTracker=t.HeatmapTracker=t.AttributionTracker=t.RetentionTracker=t.FunnelTracker=t.IdentifyTracker=t.SessionTracker=t.PageViewTracker=t.EventTracker=void 0;var n=r(7486);Object.defineProperty(t,"EventTracker",{enumerable:!0,get:function(){return n.EventTracker}});var i=r(1179);Object.defineProperty(t,"PageViewTracker",{enumerable:!0,get:function(){return i.PageViewTracker}});var s=r(7046);Object.defineProperty(t,"SessionTracker",{enumerable:!0,get:function(){return s.SessionTracker}});var o=r(4767);Object.defineProperty(t,"IdentifyTracker",{enumerable:!0,get:function(){return o.IdentifyTracker}});var a=r(8946);Object.defineProperty(t,"FunnelTracker",{enumerable:!0,get:function(){return a.FunnelTracker}});var c=r(3545);Object.defineProperty(t,"RetentionTracker",{enumerable:!0,get:function(){return c.RetentionTracker}});var u=r(642);Object.defineProperty(t,"AttributionTracker",{enumerable:!0,get:function(){return u.AttributionTracker}});var l=r(8202);Object.defineProperty(t,"HeatmapTracker",{enumerable:!0,get:function(){return l.HeatmapTracker}});var d=r(213);Object.defineProperty(t,"PerformanceTracker",{enumerable:!0,get:function(){return d.PerformanceTracker}});var p=r(84);Object.defineProperty(t,"ReplayTracker",{enumerable:!0,get:function(){return p.ReplayTracker}})},1179(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageViewTracker=void 0,t.PageViewTracker=class{constructor(e){this.client=e}view(e,t,r){const n=function(){const e="undefined"!=typeof window&&"undefined"!=typeof document;return{url:e?window.location.href:"",path:e?window.location.pathname:"",title:e?document.title:void 0,referrer:e?document.referrer:void 0}}(),i=e&&/^https?:\/\//i.test(e),s=i?e:n.url,o=i?new URL(e).pathname:e??n.path;return this.client.track({url:s,path:o,title:r?.title??n.title,referrer:r?.referrer??n.referrer,userId:r?.userId,sessionId:r?.sessionId,properties:t})}scroll(e,t,r){return this.client.trackScrollDepth({path:e,scrollDepth:t,timeAtDepth:r})}time(e,t){return this.client.trackTimeOnPage({path:e,duration:t})}exit(e,t,r){return this.client.trackExit(e,t,r)}autoTrack(e){return this.client.autoTrack(e)}}},213(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PerformanceTracker=void 0,t.PerformanceTracker=class{constructor(e){this.client=e}webVitals(e,t){return this.client.trackWebVitals({pageUrl:e,...t})}pageLoad(e,t){return this.client.trackPageLoad({pageUrl:e,...t})}resource(e,t,r,n){return this.client.trackResource({pageUrl:e,resourceUrl:t,resourceType:r,duration:n})}autoTrack(e){return this.client.autoTrack(e)}}},84(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReplayTracker=void 0,t.ReplayTracker=class{constructor(e){this.client=e}start(e){return this.client.start(e??{})}enable(e){return this.client.enable(e??{})}disable(){this.client.disable()}stop(e){this.client.stop(e)}flush(e){return this.client.flush(e??"manual")}identify(e){this.client.identify(e)}status(){return this.client.getStatus()}sendChunk(e,t,r){return this.client.sendChunk(e,t,r??{})}}},3545(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetentionTracker=void 0,t.RetentionTracker=class{constructor(e){this.client=e}active(e,t){return this.client.trackActivity({userId:e,properties:t})}}},7046(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTracker=void 0,t.SessionTracker=class{constructor(e){this.client=e}start(e){return this.client.start(e)}update(e,t){return this.client.update(e,t)}end(e){return this.client.end(e)}heartbeat(e){return this.client.heartbeat(e)}autoTrack(e,t){return this.client.autoTrack(e,t)}}},2300(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivationTracker=void 0,t.ActivationTracker=class{constructor(e){this.client=e}signup(e,t,r,n){return this.client.trackSignup(e,t,r,n)}onboardingStep(e,t,r,n,i,s){return this.client.trackOnboardingStep({userId:e,stepId:t,stepName:r,stepOrder:n,totalSteps:i,...s})}onboardingComplete(e,t,r,n=0){return this.client.completeOnboarding(e,t,r,n)}firstAction(e,t,r,n){return this.client.trackFirstAction({userId:e,actionName:t,timeSinceSignup:r,properties:n})}event(e,t={}){return this.client.create({eventName:e,properties:t})}}},2115(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExperimentTracker=void 0,t.ExperimentTracker=class{constructor(e){this.client=e}define(e){return this.client.define(e)}init(e){return this.client.initExperiments(e)}variant(e){return this.client.getLocalVariant(e)}assign(e,t,r,n="targeted"){return this.client.assign({experimentId:e,userId:t,variantId:r,source:n})}exposure(e,t,r){return this.client.trackExposure(e,t,r)}exposureAuto(e){return this.client.trackLocalExposure(e)}conversion(e,t,r,n,i=1){return this.client.trackConversion({experimentId:e,userId:t,variantId:r,metricName:n,value:i})}localConversion(e,t="conversion",r=1){return this.client.trackLocalConversion(e,t,r)}hydrateFromCookies(e){this.client.hydrateFromCookies(e)}hydrateFromCookieHeader(e){this.client.hydrateFromCookieHeader(e)}injectAssignments(e){this.client.injectAssignments(e)}getAssignments(){return this.client.getAssignments()}serializeAssignmentCookie(){return this.client.serializeAssignmentCookie()}clearAssignments(){this.client.clearAssignments()}}},76(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FeatureTracker=void 0,t.FeatureTracker=class{constructor(e){this.client=e}record(e,t,r="used",n){return this.client.trackUsage({featureId:e,featureName:t,action:r,properties:n})}viewed(e,t,r){return this.record(e,t,"viewed",r)}used(e,t,r){return this.record(e,t,"used",r)}completed(e,t,r){return this.record(e,t,"completed",r)}abandoned(e,t,r){return this.record(e,t,"abandoned",r)}create(e,t,r,n){return this.client.create({userId:e,action:t,properties:{featureName:r,...n}})}}},938(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromptTracker=t.FeatureTracker=t.ExperimentTracker=t.ActivationTracker=void 0;var n=r(2300);Object.defineProperty(t,"ActivationTracker",{enumerable:!0,get:function(){return n.ActivationTracker}});var i=r(2115);Object.defineProperty(t,"ExperimentTracker",{enumerable:!0,get:function(){return i.ExperimentTracker}});var s=r(76);Object.defineProperty(t,"FeatureTracker",{enumerable:!0,get:function(){return s.FeatureTracker}});var o=r(8794);Object.defineProperty(t,"PromptTracker",{enumerable:!0,get:function(){return o.PromptTracker}})},8794(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromptTracker=void 0,t.PromptTracker=class{constructor(e){this.client=e}submitted(e,t,r){return this.client.trackSubmission({promptId:e,promptType:t,properties:r})}responded(e,t,r,n){return this.client.trackResponse({promptId:e,responseTime:t,completed:r,properties:n})}feedback(e,t,r){return this.client.trackFeedback({promptId:e,feedbackType:t,properties:r})}conversation(e,t,r,n){return this.client.trackConversation(e,t,r,n)}event(e,t={}){return this.client.create({eventName:e,properties:t})}}},6149(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CartTracker=void 0,t.CartTracker=class{constructor(e){this.client=e}add(e,t=1,r){return this.client.addItem({product:e,quantity:t,cartId:r})}remove(e,t=1,r){return this.client.removeItem({product:e,quantity:t,cartId:r})}update(e,t,r,n){return this.client.updateItem({product:e,previousQuantity:t,newQuantity:r,cartId:n})}view(e){return this.client.view({cart:e})}}},5267(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CheckoutTracker=void 0,t.CheckoutTracker=class{constructor(e){this.client=e}begin(e){return this.client.begin({cart:e})}step(e,t,r){return this.client.step({step:e,stepNumber:t,cart:r})}shipping(e,t){return this.client.addShipping({cart:e,shipping:t})}payment(e,t){return this.client.addPayment({cart:e,payment:t})}}},1075(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchTracker=t.LTVTracker=t.SubscriptionTracker=t.WishlistTracker=t.PromotionTracker=t.RefundTracker=t.PurchaseTracker=t.CheckoutTracker=t.CartTracker=t.ProductTracker=void 0;var n=r(1235);Object.defineProperty(t,"ProductTracker",{enumerable:!0,get:function(){return n.ProductTracker}});var i=r(6149);Object.defineProperty(t,"CartTracker",{enumerable:!0,get:function(){return i.CartTracker}});var s=r(5267);Object.defineProperty(t,"CheckoutTracker",{enumerable:!0,get:function(){return s.CheckoutTracker}});var o=r(1971);Object.defineProperty(t,"PurchaseTracker",{enumerable:!0,get:function(){return o.PurchaseTracker}});var a=r(1500);Object.defineProperty(t,"RefundTracker",{enumerable:!0,get:function(){return a.RefundTracker}});var c=r(5573);Object.defineProperty(t,"PromotionTracker",{enumerable:!0,get:function(){return c.PromotionTracker}});var u=r(9392);Object.defineProperty(t,"WishlistTracker",{enumerable:!0,get:function(){return u.WishlistTracker}});var l=r(8857);Object.defineProperty(t,"SubscriptionTracker",{enumerable:!0,get:function(){return l.SubscriptionTracker}});var d=r(5865);Object.defineProperty(t,"LTVTracker",{enumerable:!0,get:function(){return d.LTVTracker}});var p=r(7583);Object.defineProperty(t,"SearchTracker",{enumerable:!0,get:function(){return p.SearchTracker}})},5865(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LTVTracker=void 0,t.LTVTracker=class{constructor(e){this.client=e}acquisitionCost(e,t,r){return this.client.recordAcquisitionCost({userId:e,cost:t,channel:r})}segment(e,t){return this.client.updateSegment(e,t)}}},1235(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProductTracker=void 0,t.ProductTracker=class{constructor(e){this.client=e}view(e,t){return this.client.view({...e,properties:t})}impression(e,t,r){return this.client.impression({list:{listId:e,listName:t,products:r}})}click(e,t,r){return this.client.click({product:e,listId:t,position:r})}}},5573(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionTracker=void 0,t.PromotionTracker=class{constructor(e){this.client=e}view(e,t,r,n){return this.client.view({promotionId:e,name:t,creative:r,position:n})}click(e,t,r,n){return this.client.click({promotionId:e,name:t,creative:r,position:n})}coupon(e,t,r,n,i,s){return this.client.couponUsed({code:e,orderId:t,discountValue:r,discountType:n,orderValueBefore:i,orderValueAfter:s})}}},1971(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PurchaseTracker=void 0,t.PurchaseTracker=class{constructor(e){this.client=e}complete(e){return this.client.track({order:e})}}},1500(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RefundTracker=void 0,t.RefundTracker=class{constructor(e){this.client=e}request(e,t,r){return this.client.request(e,t,r)}approve(e,t){return this.client.approve(e,t)}deny(e,t){return this.client.deny(e,t)}complete(e,t,r,n,i,s=!1){return this.client.track({orderId:e,refundId:t,amount:r,currency:n,reason:i,isFullRefund:s})}}},7583(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchTracker=void 0,t.SearchTracker=class{constructor(e){this.client=e}query(e,t,r){return this.client.track({query:e,resultsCount:t,...r})}click(e,t,r){return this.client.trackClick({query:e,product:t,position:r})}refine(e,t,r){return this.client.trackRefinement(e,t,r)}suggestion(e,t,r){return this.client.trackSuggestion(e,t,r)}}},8857(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubscriptionTracker=void 0,t.SubscriptionTracker=class{constructor(e){this.client=e}start(e,t,r,n,i){return this.client.start({subscriptionId:e,userId:t,plan:r,mrr:n,billingCycle:i})}change(e,t,r,n,i,s,o){return this.client.change({subscriptionId:e,userId:t,previousPlan:r,newPlan:n,previousMrr:i,newMrr:s,changeType:o})}cancel(e,t,r,n,i=!1){return this.client.cancel({subscriptionId:e,userId:t,plan:r,lostMrr:n,immediate:i})}renew(e,t,r){return this.client.renew(e,t,r)}trialConverted(e,t,r,n){return this.client.trialConverted(e,t,r,n)}trialExpired(e,t){return this.client.trialExpired(e,t)}}},9392(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WishlistTracker=void 0,t.WishlistTracker=class{constructor(e){this.client=e}add(e,t){return this.client.add({product:e,wishlistId:t})}remove(e,t){return this.client.remove({product:e,wishlistId:t})}view(e){return this.client.view(e)}moveToCart(e,t){return this.client.moveToCart(e,t)}share(e,t){return this.client.share(e,t)}}},8949(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AcquisitionTracker=void 0,t.AcquisitionTracker=class{constructor(e){this.client=e}acquired(e,t,r){return this.client.trackAcquisition({userId:e,source:t,properties:r})}campaign(e){return this.client.createCampaign(e)}spend(e,t,r){return this.client.trackCampaignSpend({campaignId:e,amount:t,date:r})}lifecycle(e,t,r){return this.client.trackLifecycleTransition({userId:e,fromStage:t,toStage:r})}}},2215(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlertTracker=void 0,t.AlertTracker=class{constructor(e){this.client=e}create(e){return this.client.createAlert(e)}update(e,t){return this.client.updateAlert(e,t)}delete(e){return this.client.deleteAlert(e)}acknowledge(e,t){return this.client.acknowledgeAlert(e,t)}resolve(e,t){return this.client.resolveAlert(e,t)}mute(e,t){return this.client.muteAlert(e,t)}}},7708(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChurnTracker=void 0,t.ChurnTracker=class{constructor(e){this.client=e}decay(e,t,r){return this.client.trackUsageDecay({userId:e,metric:t,periods:r})}nps(e,t,r){return this.client.trackNPS({userId:e,score:t,feedback:r})}churned(e,t,r){return this.client.trackChurn({userId:e,churnType:t,reason:r})}prevention(e,t,r){return this.client.trackPreventionAction({userId:e,actionType:t,details:r})}}},6360(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CohortTracker=void 0,t.CohortTracker=class{constructor(e){this.client=e}create(e){return this.client.createCohort(e)}segment(e){return this.client.createSegment(e)}isMember(e,t){return this.client.isUserInCohort(e,t)}}},2231(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementTracker=void 0,t.EngagementTracker=class{constructor(e){this.client=e}dwell(e,t,r){return this.client.trackDwellTime({featureId:e,dwellTimeMs:t,properties:r})}sessionDepth(e,t,r,n,i){return this.client.trackSessionDepth({sessionId:e,pagesVisited:t,featuresUsed:r,actionsTaken:n,durationMs:i})}contentConsumption(e,t,r,n){return this.client.trackContentConsumption({contentId:e,contentType:t,percentageConsumed:r,timeSpentMs:n})}activity(e,t,r){return this.client.trackUserActivity({userId:e,activityType:t,durationMs:r})}autoTrackDwell(e,t){return this.client.autoTrackDwell(e,t)}autoTrack(e){return this.client.autoTrack(e)}}},5481(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForecastingTracker=void 0,t.ForecastingTracker=class{constructor(e){this.client=e}activeUsers(e,t,r){return this.client.forecastActiveUsers({metric:e,periods:t,granularity:r})}revenue(e,t){return this.client.forecastRevenue({periods:e,granularity:t})}featureAdoption(e,t,r){return this.client.forecastFeatureAdoption({featureId:e,periods:t,granularity:r})}churn(e,t){return this.client.forecastChurn({periods:e,granularity:t})}}},658(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForecastingTracker=t.SecurityTracker=t.AlertTracker=t.PathTracker=t.AcquisitionTracker=t.SupportTracker=t.MultiPathFunnelTracker=t.MonetizationTracker=t.ChurnTracker=t.CohortTracker=t.EngagementTracker=void 0;var n=r(2231);Object.defineProperty(t,"EngagementTracker",{enumerable:!0,get:function(){return n.EngagementTracker}});var i=r(6360);Object.defineProperty(t,"CohortTracker",{enumerable:!0,get:function(){return i.CohortTracker}});var s=r(7708);Object.defineProperty(t,"ChurnTracker",{enumerable:!0,get:function(){return s.ChurnTracker}});var o=r(3345);Object.defineProperty(t,"MonetizationTracker",{enumerable:!0,get:function(){return o.MonetizationTracker}});var a=r(9731);Object.defineProperty(t,"MultiPathFunnelTracker",{enumerable:!0,get:function(){return a.MultiPathFunnelTracker}});var c=r(9481);Object.defineProperty(t,"SupportTracker",{enumerable:!0,get:function(){return c.SupportTracker}});var u=r(8949);Object.defineProperty(t,"AcquisitionTracker",{enumerable:!0,get:function(){return u.AcquisitionTracker}});var l=r(3222);Object.defineProperty(t,"PathTracker",{enumerable:!0,get:function(){return l.PathTracker}});var d=r(2215);Object.defineProperty(t,"AlertTracker",{enumerable:!0,get:function(){return d.AlertTracker}});var p=r(1890);Object.defineProperty(t,"SecurityTracker",{enumerable:!0,get:function(){return p.SecurityTracker}});var h=r(5481);Object.defineProperty(t,"ForecastingTracker",{enumerable:!0,get:function(){return h.ForecastingTracker}})},3345(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MonetizationTracker=void 0,t.MonetizationTracker=class{constructor(e){this.client=e}revenue(e,t,r,n,i){return this.client.trackRevenue({userId:e,amount:t,currency:r,type:n,properties:i})}}},9731(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiPathFunnelTracker=void 0,t.MultiPathFunnelTracker=class{constructor(e){this.client=e}define(e){return this.client.defineFunnel(e)}step(e,t,r,n){return this.client.trackStep({funnelId:e,step:t,userId:r,properties:n})}microConversion(e,t,r){return this.client.trackMicroConversion({conversionId:e,userId:t,properties:r})}}},3222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathTracker=void 0,t.PathTracker=class{constructor(e){this.client=e}transition(e,t,r,n){return this.client.trackTransition({userId:e,fromScreen:t,toScreen:r,properties:n})}sequence(e,t,r){return this.client.trackFeatureSequence({userId:e,feature:t,order:r})}define(e){return this.client.definePath(e)}}},1890(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityTracker=void 0,t.SecurityTracker=class{constructor(e){this.client=e}login(e,t,r){return this.client.trackLoginAttempt({userId:e,success:t,properties:r})}roleChange(e,t,r,n){return this.client.trackRoleChange({userId:e,changedBy:t,previousRole:r,newRole:n})}permissionChange(e,t,r,n){return this.client.trackPermissionChange({userId:e,changedBy:t,permission:r,action:n})}dataAccess(e,t,r,n){return this.client.trackDataAccess({userId:e,resourceType:t,accessType:r,properties:n})}compliance(e,t,r){return this.client.trackComplianceEvent({userId:e,eventType:t,properties:r})}}},9481(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupportTracker=void 0,t.SupportTracker=class{constructor(e){this.client=e}ticket(e,t,r,n,i,s){return this.client.trackTicket({ticketId:e,userId:t,subject:r,category:n,priority:i,channel:s})}update(e,t,r){return this.client.updateTicket({ticketId:e,status:t,properties:r})}csat(e,t,r,n){return this.client.trackCSAT({ticketId:e,userId:t,score:r,feedback:n})}featureComplaint(e,t,r,n){return this.client.trackFeatureComplaint({userId:e,featureId:t,complaintType:r,severity:n})}}},7890(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWindow=function(){return"undefined"!=typeof window?window:void 0},t.getDocument=function(){return"undefined"!=typeof document?document:void 0},t.isBrowser=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},t.combineTeardowns=function(...e){return()=>{for(const t of e)if("function"==typeof t)try{t()}catch{}}}},5558(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityManager=void 0;const n=r(4211),i="fg_visitor_id",s="fg_session_id",o="fg_session_touch";t.IdentityManager=class{constructor(e){this.visitorId="",this.sessionId="",this.memoryStore={},this.config={visitorId:e?.visitorId??"",cookieDomain:e?.cookieDomain??"",visitorMaxAgeDays:e?.visitorMaxAgeDays??365,sessionTimeoutMinutes:e?.sessionTimeoutMinutes??30,storage:e?.storage??(this.detectBrowser()?"cookie":"memory"),serverCookies:e?.serverCookies,compat:e?.compat??!0},this.visitorId=this.resolveVisitorId(),this.sessionId=""}getVisitorId(){return this.visitorId||(this.visitorId=this.resolveVisitorId()),this.visitorId}getSessionId(){if("memory"===this.config.storage)return this.getMemorySessionId();if(!this.detectBrowser())return this.getMemorySessionId();try{const e=sessionStorage.getItem(s),t=sessionStorage.getItem(o);if(e&&t){if(Date.now()-parseInt(t,10)<60*this.config.sessionTimeoutMinutes*1e3)return sessionStorage.setItem(o,String(Date.now())),this.sessionId=e,e}const r=this.generateSessionId();return sessionStorage.setItem(s,r),sessionStorage.setItem(o,String(Date.now())),this.sessionId=r,r}catch{return this.getMemorySessionId()}}setVisitorId(e){this.visitorId=e,this.persistVisitorId(e)}clearSession(){if(this.sessionId="",delete this.memoryStore[s],delete this.memoryStore[o],this.detectBrowser())try{sessionStorage.removeItem(s),sessionStorage.removeItem(o)}catch{}}clearAll(){if(this.visitorId="",this.sessionId="",this.memoryStore={},this.detectBrowser())try{this.deleteCookie(this.visitorCookieName),this.deleteCookie(i),localStorage.removeItem(this.visitorCookieName),localStorage.removeItem(i),localStorage.removeItem("fg_exp_assignments"),sessionStorage.removeItem(s),sessionStorage.removeItem(o)}catch{}}isBrowser(){return this.detectBrowser()}get visitorCookieName(){return this.config.compat?"visitor_id":i}resolveVisitorId(){if(this.config.visitorId)return this.config.visitorId;if(this.detectBrowser()){const e=(0,n.getVisitorId)();if(e){const t=this.readCookie(i)||this.readLocalStorage(i);return t&&t!==e&&this.removeLegacyCookie(),this.persistVisitorId(e),e}}if(this.config.compat){const e=this.readCookie(i)||this.readLocalStorage(i);if(e)return this.persistVisitorId(e),this.removeLegacyCookie(),e}const e=this.readCookie(this.visitorCookieName);if(e)return e;if(this.detectBrowser())try{const e=localStorage.getItem(this.visitorCookieName);if(e)return e}catch{}if(this.config.serverCookies){const e=this.readServerCookie(this.visitorCookieName);if(e)return e}if(this.memoryStore[this.visitorCookieName])return this.memoryStore[this.visitorCookieName];const t=this.generateVisitorId();return this.persistVisitorId(t),t}readLocalStorage(e){if(!this.detectBrowser())return null;try{return localStorage.getItem(e)}catch{return null}}removeLegacyCookie(){if(this.deleteCookie(i),this.detectBrowser())try{localStorage.removeItem(i)}catch{}}persistVisitorId(e){const t=this.visitorCookieName;if("memory"!==this.config.storage)if(this.detectBrowser()){this.writeCookie(t,e,this.config.visitorMaxAgeDays);try{localStorage.setItem(t,e)}catch{}}else this.memoryStore[t]=e;else this.memoryStore[t]=e}getMemorySessionId(){const e=this.memoryStore[s],t=this.memoryStore[o];if(e&&t&&Date.now()-parseInt(t,10)<60*this.config.sessionTimeoutMinutes*1e3)return this.memoryStore[o]=String(Date.now()),this.sessionId=e,e;const r=this.generateSessionId();return this.memoryStore[s]=r,this.memoryStore[o]=String(Date.now()),this.sessionId=r,r}readCookie(e){return this.config.serverCookies?this.readServerCookie(e):this.detectBrowser()?(0,n.getCookie)(e):null}readServerCookie(e){if(!this.config.serverCookies)return null;const t=this.config.serverCookies.get(e);return t?"object"==typeof t&&"value"in t?t.value||null:"string"==typeof t&&t||null:null}writeCookie(e,t,r){if(!this.detectBrowser())return;const n=24*r*60*60,i=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"",s="https:"===location.protocol?"; Secure":"";document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; Max-Age=${n}; SameSite=Lax${s}${i}`}deleteCookie(e){if(!this.detectBrowser())return;const t=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"";document.cookie=`${e}=; Path=/; Max-Age=0${t}`}generateVisitorId(){return`fg_${this.uuidV4()}`}generateSessionId(){return`fgs_${Date.now()}_${this.randomHex(8)}`}uuidV4(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}randomHex(e){const t=new Uint8Array(e);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}detectBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}}},4211(e,t){"use strict";function r(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]+)"));return t?t[2]:null}Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=r,t.getVisitorId=function(){try{return r("visitor_id")||localStorage.getItem("visitor_id")}catch{return r("visitor_id")}},t.getSessionId=function(){try{return sessionStorage.getItem("session_id")}catch{return null}},t.getWebId=function(){try{return localStorage.getItem("web_id")}catch{return null}},t.getUTM=function(){return{utmSource:r("__flowgrid_utm_source")||void 0,utmMedium:r("__flowgrid_utm_medium")||void 0,utmCampaign:r("__flowgrid_utm_campaign")||void 0,utmTerm:r("__flowgrid_utm_term")||void 0,utmContent:r("__flowgrid_utm_content")||void 0,ref:r("__flowgrid_ref")||void 0,source:r("__flowgrid_source")||void 0,via:r("__flowgrid_via")||void 0}},t.getUTMHistory=function(){try{const e=localStorage.getItem("utm_history")||r("utm_history");return e?JSON.parse(e):[]}catch{return[]}}},8796(e,t){!function(e){"use strict";let t=-1;const r=e=>{addEventListener("pageshow",r=>{r.persisted&&(t=r.timeStamp,e(r))},!0)},n=(e,t,r,n)=>{let i,s;return o=>{t.value>=0&&(o||n)&&(s=t.value-(i??0),(s||void 0===i)&&(i=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},o=()=>s()?.activationStart??0,a=(e,r=-1)=>{const n=s();let i="navigate";return t>=0?i="back-forward-cache":n&&(document.prerendering||o()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:r,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},c=new WeakMap;function u(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class l{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},p=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let h=-1;const m=new Set,f=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,g=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of m)e();isFinite(h)||(h="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",g,!0))}},y=()=>{if(h<0){const e=o(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;h=t??f(),addEventListener("visibilitychange",g,!0),addEventListener("prerenderingchange",g,!0),r(()=>{setTimeout(()=>{h=f()})})}return{get firstHiddenTime(){return h},onHidden(e){m.add(e)}}},v=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},I=[1800,3e3],b=(e,t={})=>{v(()=>{const s=y();let c,u=a("FCP");const l=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(l.disconnect(),t.startTime<s.firstHiddenTime&&(u.value=Math.max(t.startTime-o(),0),u.entries.push(t),c(!0)))});l&&(c=n(e,u,I,t.reportAllChanges),r(r=>{u=a("FCP"),c=n(e,u,I,t.reportAllChanges),i(()=>{u.value=performance.now()-r.timeStamp,c(!0)})}))})},S=[.1,.25];let w=0,C=1/0,k=0;const T=e=>{for(const t of e)t.interactionId&&(C=Math.min(C,t.interactionId),k=Math.max(k,t.interactionId),w=k?(k-C)/7+1:0)};let _;const A=()=>_?w:performance.interactionCount??0;let O=0;class E{l=[];u=new Map;p;m;v(){O=A(),this.l.length=0,this.u.clear()}T(){const e=Math.min(this.l.length-1,Math.floor((A()-O)/50));return this.l[e]}h(e){if(this.p?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.l.at(-1);let r=this.u.get(e.interactionId);if(r||this.l.length<10||e.duration>t.L){if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],L:e.duration},this.u.set(r.id,r),this.l.push(r)),this.l.sort((e,t)=>t.L-e.L),this.l.length>10){const e=this.l.splice(10);for(const t of e)this.u.delete(t.id)}this.m?.(r)}}}const M=e=>{const t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=p(e);let i=-1;const s=()=>{r(i),n()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),i=t(()=>{removeEventListener("visibilitychange",s,{capture:!0}),n()})}},N=[200,500];class D{p;h(e){this.p?.(e)}}const x=[2500,4e3],P=[800,1800],R=e=>{document.prerendering?v(()=>R(e)):"complete"!==document.readyState?addEventListener("load",()=>R(e),!0):setTimeout(e)};e.CLSThresholds=S,e.FCPThresholds=I,e.INPThresholds=N,e.LCPThresholds=x,e.TTFBThresholds=P,e.onCLS=(e,t={})=>{const s=y();b(p(()=>{let o,c=a("CLS",0);const p=u(t,l),h=e=>{for(const t of e)p.h(t);p.i>c.value&&(c.value=p.i,c.entries=p.o,o())},m=d("layout-shift",h);m&&(o=n(e,c,S,t.reportAllChanges),s.onHidden(()=>{h(m.takeRecords()),o(!0)}),r(()=>{p.i=0,c=a("CLS",0),o=n(e,c,S,t.reportAllChanges),i(o)}),setTimeout(o))}))},e.onFCP=b,e.onINP=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=y();v(()=>{"interactionCount"in performance||_||(_=d("event",T,{durationThreshold:0}));let s,o=a("INP");const c=u(t,E),l=e=>{M(()=>{for(const t of e)c.h(t);const t=c.T();t&&t.L!==o.value&&(o.value=t.L,o.entries=t.entries,s())})},p=d("event",l,{durationThreshold:t.durationThreshold??40});s=n(e,o,N,t.reportAllChanges),p&&(p.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{l(p.takeRecords()),s(!0)}),r(()=>{c.v(),o=a("INP"),s=n(e,o,N,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{v(()=>{const s=y();let c,l=a("LCP");const h=u(t,D),m=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)h.h(t),t.startTime<s.firstHiddenTime&&(l.value=Math.max(t.startTime-o(),0),l.entries=[t],c())},f=d("largest-contentful-paint",m);if(f){c=n(e,l,x,t.reportAllChanges);const s=p(()=>{m(f.takeRecords()),f.disconnect(),c(!0)}),o=e=>{e.isTrusted&&(M(s),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});r(r=>{l=a("LCP"),c=n(e,l,x,t.reportAllChanges),i(()=>{l.value=performance.now()-r.timeStamp,c(!0)})})}})},e.onTTFB=(e,t={})=>{let i=a("TTFB"),c=n(e,i,P,t.reportAllChanges);R(()=>{const u=s();u&&(i.value=Math.max(u.responseStart-o(),0),i.entries=[u],c(!0),r(()=>{i=a("TTFB",0),c=n(e,i,P,t.reportAllChanges),c(!0)}))})}}(t)},6546(e,t,r){"use strict";r.r(t),r.d(t,{EventType:()=>he,IncrementalSource:()=>me,MouseInteractions:()=>fe,PLUGIN_NAME:()=>Ir,Replayer:()=>Pn,ReplayerEvents:()=>ye,addCustomEvent:()=>gt,freezePage:()=>yt,getRecordConsolePlugin:()=>br,getReplayConsolePlugin:()=>kr,mirror:()=>z,pack:()=>or,record:()=>ft,unpack:()=>ar,utils:()=>n});var n={};r.r(n),r.d(n,{StyleSheetMirror:()=>pe,_mirror:()=>z,getBaseDimension:()=>ae,getNestedRule:()=>ue,getPositionsAndIndex:()=>le,getWindowHeight:()=>Y,getWindowWidth:()=>$,hasShadowRoot:()=>ce,hookSetter:()=>Z,isAncestorRemoved:()=>ee,isBlocked:()=>J,isIgnored:()=>X,isSerialized:()=>Q,isSerializedIframe:()=>se,isSerializedStylesheet:()=>oe,isTouchEvent:()=>te,iterateResolveTree:()=>ie,on:()=>G,patch:()=>K,polyfill:()=>re,queueToResolveTrees:()=>ne,throttle:()=>H,uniqueTextMutations:()=>de});var i,s={};function o(e){return e.nodeType===e.ELEMENT_NODE}function a(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function c(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function u(e){try{var t=e.rules||e.cssRules;return t?((r=Array.from(t).map(l).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),r):null}catch(e){return null}var r}function l(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=u(e.styleSheet)||t}catch(e){}return t}r.r(s),r.d(s,{default:()=>on}),function(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"}(i||(i={}));var d=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function p(){return new d}function h(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,i=e.value,s=e.maskInputFn,o=i||"";return(t[r.toLowerCase()]||t[n])&&(o=s?s(o):"*".repeat(o.length)),o}var m,f,g="__rrweb_original__",y=1,v=new RegExp("[^a-z0-9-_:]");function I(){return y++}var b=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,S=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,w=/^(data:)([^,]*),(.*)/i;function C(e,t){return(e||"").replace(b,function(e,r,n,i,s,o){var a,c=n||s||o,u=r||i||"";if(!c)return e;if(!S.test(c))return"url(".concat(u).concat(c).concat(u,")");if(w.test(c))return"url(".concat(u).concat(c).concat(u,")");if("/"===c[0])return"url(".concat(u).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(u,")");var l=t.split("/"),d=c.split("/");l.pop();for(var p=0,h=d;p<h.length;p++){var m=h[p];"."!==m&&(".."===m?l.pop():l.push(m))}return"url(".concat(u).concat(l.join("/")).concat(u,")")})}var k=/^[^ \t\n\r\u000c]+/,T=/^[, \t\n\r\u000c]+/;function _(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function A(){var e=document.createElement("a");return e.href="",e.href}function O(e,t,r,n){return"src"===r||"href"===r&&n&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&n&&"#"!==n[0]?_(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,i=e.exec(t.substring(r));return i?(n=i[0],r+=n.length,n):""}for(var i=[];n(T),!(r>=t.length);){var s=n(k);if(","===s.slice(-1))s=_(e,s.substring(0,s.length-1)),i.push(s);else{var o="";s=_(e,s);for(var a=!1;;){var c=t.charAt(r);if(""===c){i.push((s+o).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){r+=1,i.push((s+o).trim());break}"("===c&&(a=!0)}o+=c,r+=1}}}return i.join(", ")}(e,n):"style"===r&&n?C(n,A()):"object"===t&&"data"===r&&n?_(e,n):n:_(e,n)}function E(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&E(e.parentNode,t,r);for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}return!!r&&E(e.parentNode,t,r)}function M(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(E(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function N(e){return void 0===e?"":e.toLowerCase()}function D(e,t){var r,n=t.doc,s=t.mirror,l=t.blockClass,d=t.blockSelector,p=t.maskTextClass,y=t.maskTextSelector,b=t.skipChild,S=void 0!==b&&b,w=t.inlineStylesheet,k=void 0===w||w,T=t.maskInputOptions,_=void 0===T?{}:T,E=t.maskTextFn,x=t.maskInputFn,P=t.slimDOMOptions,R=t.dataURLOptions,F=void 0===R?{}:R,L=t.inlineImages,j=void 0!==L&&L,B=t.recordCanvas,U=void 0!==B&&B,V=t.onSerialize,q=t.onIframeLoad,G=t.iframeLoadTimeout,W=void 0===G?5e3:G,z=t.onStylesheetLoad,H=t.stylesheetLoadTimeout,Z=void 0===H?5e3:H,K=t.keepIframeSrcFn,Y=void 0===K?function(){return!1}:K,$=t.newlyAddedElement,J=void 0!==$&&$,Q=t.preserveWhiteSpace,X=void 0===Q||Q,ee=function(e,t){var r=t.doc,n=t.mirror,s=t.blockClass,o=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.inlineStylesheet,d=t.maskInputOptions,p=void 0===d?{}:d,y=t.maskTextFn,I=t.maskInputFn,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=t.recordCanvas,T=t.keepIframeSrcFn,_=t.newlyAddedElement,E=void 0!==_&&_,N=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:i.Document,childNodes:[],compatMode:e.compatMode}:{type:i.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:i.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:N};case e.ELEMENT_NODE:return function(e,t){for(var r=t.doc,n=t.inlineStylesheet,s=t.maskInputOptions,o=void 0===s?{}:s,a=t.maskInputFn,c=t.dataURLOptions,l=void 0===c?{}:c,d=t.inlineImages,p=t.recordCanvas,y=t.keepIframeSrcFn,I=t.newlyAddedElement,b=void 0!==I&&I,S=t.rootId,w=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}return!!r&&e.matches(r)}(e,t.blockClass,t.blockSelector),k=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return v.test(t)?"div":t}(e),T={},_=e.attributes.length,E=0;E<_;E++){var M=e.attributes[E];T[M.name]=O(r,k,M.name,M.value)}if("link"===k&&n){var N=Array.from(r.styleSheets).find(function(t){return t.href===e.href}),D=null;N&&(D=u(N)),D&&(delete T.rel,delete T.href,T._cssText=C(D,N.href))}if("style"===k&&e.sheet&&!(e.innerText||e.textContent||"").trim().length&&(D=u(e.sheet))&&(T._cssText=C(D,A())),"input"===k||"textarea"===k||"select"===k){var x=e.value,P=e.checked;"radio"!==T.type&&"checkbox"!==T.type&&"submit"!==T.type&&"button"!==T.type&&x?T.value=h({type:T.type,tagName:k,value:x,maskInputOptions:o,maskInputFn:a}):P&&(T.checked=P)}if("option"===k&&(e.selected&&!o.select?T.selected=!0:delete T.selected),"canvas"===k&&p)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var i=t.getImageData,s=g in i?i[g]:i;if(new Uint32Array(s.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(T.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){var R=e.toDataURL(l.type,l.quality),F=document.createElement("canvas");F.width=e.width,F.height=e.height,R!==F.toDataURL(l.type,l.quality)&&(T.rr_dataURL=R)}if("img"===k&&d){m||(m=r.createElement("canvas"),f=m.getContext("2d"));var L=e,j=L.crossOrigin;L.crossOrigin="anonymous";var B=function(){try{m.width=L.naturalWidth,m.height=L.naturalHeight,f.drawImage(L,0,0),T.rr_dataURL=m.toDataURL(l.type,l.quality)}catch(e){console.warn("Cannot inline img src=".concat(L.currentSrc,"! Error: ").concat(e))}j?T.crossOrigin=j:L.removeAttribute("crossorigin")};L.complete&&0!==L.naturalWidth?B():L.onload=B}if("audio"!==k&&"video"!==k||(T.rr_mediaState=e.paused?"paused":"played",T.rr_mediaCurrentTime=e.currentTime),b||(e.scrollLeft&&(T.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(T.rr_scrollTop=e.scrollTop)),w){var U=e.getBoundingClientRect(),V=U.width,q=U.height;T={class:T.class,rr_width:"".concat(V,"px"),rr_height:"".concat(q,"px")}}return"iframe"!==k||y(T.src)||(e.contentDocument||(T.rr_src=T.src),delete T.src),{type:i.Element,tagName:k,attributes:T,childNodes:[],isSVG:(G=e,Boolean("svg"===G.tagName||G.ownerSVGElement)||void 0),needBlock:w,rootId:S};var G}(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:p,maskInputFn:I,dataURLOptions:S,inlineImages:w,recordCanvas:k,keepIframeSrcFn:T,newlyAddedElement:E,rootId:N});case e.TEXT_NODE:return function(e,t){var r,n,s=t.maskTextClass,o=t.maskTextSelector,a=t.maskTextFn,c=t.rootId,u=e.parentNode&&e.parentNode.tagName,l=e.textContent,d="STYLE"===u||void 0,p="SCRIPT"===u||void 0;if(d&&l){try{e.nextSibling||e.previousSibling||(null===(r=e.parentNode.sheet)||void 0===r?void 0:r.cssRules)&&(l=(n=e.parentNode.sheet).cssRules?Array.from(n.cssRules).map(function(e){return e.cssText||""}).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=C(l,A())}return p&&(l="SCRIPT_PLACEHOLDER"),!d&&!p&&l&&M(e,s,o)&&(l=a?a(l):l.replace(/[\S]/g,"*")),{type:i.Text,textContent:l||"",isStyle:d,rootId:c}}(e,{maskTextClass:a,maskTextSelector:c,maskTextFn:y,rootId:N});case e.CDATA_SECTION_NODE:return{type:i.CDATA,textContent:"",rootId:N};case e.COMMENT_NODE:return{type:i.Comment,textContent:e.textContent||"",rootId:N};default:return!1}}(e,{doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,dataURLOptions:F,inlineImages:j,recordCanvas:U,keepIframeSrcFn:Y,newlyAddedElement:J});if(!ee)return console.warn(e,"not serialized"),null;r=s.hasNode(e)?s.getId(e):!function(e,t){if(t.comment&&e.type===i.Comment)return!0;if(e.type===i.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(N(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===N(e.attributes.name)||"icon"===N(e.attributes.rel)||"apple-touch-icon"===N(e.attributes.rel)||"shortcut icon"===N(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&N(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(N(e.attributes.property).match(/^(og|twitter|fb):/)||N(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===N(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===N(e.attributes.name)||"googlebot"===N(e.attributes.name)||"bingbot"===N(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===N(e.attributes.name)||"generator"===N(e.attributes.name)||"framework"===N(e.attributes.name)||"publisher"===N(e.attributes.name)||"progid"===N(e.attributes.name)||N(e.attributes.property).match(/^article:/)||N(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===N(e.attributes.name)||"yandex-verification"===N(e.attributes.name)||"csrf-token"===N(e.attributes.name)||"p:domain_verify"===N(e.attributes.name)||"verify-v1"===N(e.attributes.name)||"verification"===N(e.attributes.name)||"shopify-checkout-api-token"===N(e.attributes.name)))return!0}}return!1}(ee,P)&&(X||ee.type!==i.Text||ee.isStyle||ee.textContent.replace(/^\s+|\s+$/gm,"").length)?I():-2;var te=Object.assign(ee,{id:r});if(s.add(e,te),-2===r)return null;V&&V(e);var re=!S;if(te.type===i.Element){re=re&&!te.needBlock,delete te.needBlock;var ne=e.shadowRoot;ne&&c(ne)&&(te.isShadowHost=!0)}if((te.type===i.Document||te.type===i.Element)&&re){P.headWhitespace&&te.type===i.Element&&"head"===te.tagName&&(X=!1);for(var ie={doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:S,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y},se=0,oe=Array.from(e.childNodes);se<oe.length;se++)(ue=D(oe[se],ie))&&te.childNodes.push(ue);if(o(e)&&e.shadowRoot)for(var ae=0,ce=Array.from(e.shadowRoot.childNodes);ae<ce.length;ae++){var ue;(ue=D(ce[ae],ie))&&(c(e.shadowRoot)&&(ue.isShadow=!0),te.childNodes.push(ue))}}return e.parentNode&&a(e.parentNode)&&c(e.parentNode)&&(te.isShadow=!0),te.type===i.Element&&"iframe"===te.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var i,s=!1;try{i=n.document.readyState}catch(e){return}if("complete"===i){var o="about:blank";if(n.location.href!==o||e.src===o||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){s||(t(),s=!0)},r);e.addEventListener("load",function(){clearTimeout(a),s=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&q){var r=D(t,{doc:t,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:!1,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y});r&&q(e,r)}},W),te.type===i.Element&&"link"===te.tagName&&"stylesheet"===te.attributes.rel&&function(e,t,r){var n,i=!1;try{n=e.sheet}catch(e){return}if(!n){var s=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(s),i=!0,t()})}}(e,function(){if(z){var t=D(e,{doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:!1,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y});t&&z(e,t)}},Z),te}var x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function P(e,t){void 0===t&&(t={});var r=1,n=1;function i(e){var t=e.match(/\n/g);t&&(r+=t.length);var i=e.lastIndexOf("\n");n=-1===i?n+e.length:e.length-i}function s(){var e={line:r,column:n};return function(t){return t.position=new o(e),h(),t}}var o=function(e){this.start=e,this.end={line:r,column:n},this.source=t.source};o.prototype.content=e;var a=[];function c(i){var s=new Error("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(i));if(s.reason=i,s.filename=t.source,s.line=r,s.column=n,s.source=e,!t.silent)throw s;a.push(s)}function u(){return p(/^{\s*/)}function l(){return p(/^}/)}function d(){var t,r=[];for(h(),m(r);e.length&&"}"!==e.charAt(0)&&(t=T()||_());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return i(n),e=e.slice(n.length),r}}function h(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=f();)!1!==t&&e.push(t),t=f();return e}function f(){var t=s();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var o=e.slice(2,r-2);return n+=2,i(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function g(){var e=p(/^([^{]+)/);if(e)return R(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function y(){var e=s(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=R(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:r.replace(x,""),value:n?R(n[0]).replace(x,""):""});return p(/^[;\s]*/),i}}function v(){var e,t=[];if(!u())return c("missing '{'");for(m(t);e=y();)!1!==e&&(t.push(e),m(t)),e=y();return l()?t:c("missing '}'")}function I(){for(var e,t=[],r=s();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:v()})}var b,S=k("import"),w=k("charset"),C=k("namespace");function k(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=s(),n=p(t);if(n){var i={type:e};return i[e]=n[1].trim(),r(i)}}}function T(){if("@"===e[0])return function(){var e=s(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,i=t[1];if(!u())return c("@keyframes missing '{'");for(var o=m();n=I();)o.push(n),o=o.concat(m());return l()?e({type:"keyframes",name:i,vendor:r,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=s(),t=p(/^@media *([^{]+)/);if(t){var r=R(t[1]);if(!u())return c("@media missing '{'");var n=m().concat(d());return l()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=s(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:R(t[1]),media:R(t[2])})}()||function(){var e=s(),t=p(/^@supports *([^{]+)/);if(t){var r=R(t[1]);if(!u())return c("@supports missing '{'");var n=m().concat(d());return l()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||S()||w()||C()||function(){var e=s(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=R(t[1]),n=R(t[2]);if(!u())return c("@document missing '{'");var i=m().concat(d());return l()?e({type:"document",document:n,vendor:r,rules:i}):c("@document missing '}'")}}()||function(){var e=s();if(p(/^@page */)){var t=g()||[];if(!u())return c("@page missing '{'");for(var r,n=m();r=y();)n.push(r),n=n.concat(m());return l()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=s();if(p(/^@host\s*/)){if(!u())return c("@host missing '{'");var t=m().concat(d());return l()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=s();if(p(/^@font-face\s*/)){if(!u())return c("@font-face missing '{'");for(var t,r=m();t=y();)r.push(t),r=r.concat(m());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function _(){var e=s(),t=g();return t?(m(),e({type:"rule",selectors:t,declarations:v()})):c("selector missing")}return F((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:a}}))}function R(e){return e?e.replace(/^\s+|\s+$/g,""):""}function F(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,i=0,s=Object.keys(e);i<s.length;i++){var o=e[s[i]];Array.isArray(o)?o.forEach(function(e){F(e,n)}):o&&"object"==typeof o&&F(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var L={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"},j=/([^\\]):hover/,B=new RegExp(j.source,"g");function U(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=P(e,{silent:!0});if(!n.stylesheet)return e;var i=[];if(n.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){j.test(e)&&i.push(e)})}),0===i.length)return e;var s=new RegExp(i.filter(function(e,t){return i.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("|"),"g"),o=e.replace(s,function(e){var t=e.replace(B,"$1.\\:hover");return"".concat(e,", ").concat(t)});return null==t||t.stylesWithHoverClass.set(e,o),o}function V(){return{stylesWithHoverClass:new Map}}function q(e,t){var r=t.doc,n=t.mirror,s=t.skipChild,a=void 0!==s&&s,c=t.hackCss,u=void 0===c||c,l=t.afterAppend,d=t.cache,p=function(e,t){var r=t.doc,n=t.hackCss,s=t.cache;switch(e.type){case i.Document:return r.implementation.createDocument(null,"",null);case i.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case i.Element:var o,a=function(e){var t=L[e.tagName]?L[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);o=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",a):r.createElement(a);var c={};for(var u in e.attributes)if(Object.prototype.hasOwnProperty.call(e.attributes,u)){var l=e.attributes[u];if("option"!==a||"selected"!==u||!1!==l)if(!0===l&&(l=""),u.startsWith("rr_"))c[u]=l;else{var d="textarea"===a&&"value"===u,p="style"===a&&"_cssText"===u;if(p&&n&&"string"==typeof l&&(l=U(l,s)),!d&&!p||"string"!=typeof l)try{if(e.isSVG&&"xlink:href"===u)o.setAttributeNS("http://www.w3.org/1999/xlink",u,l.toString());else if("onload"===u||"onclick"===u||"onmouse"===u.substring(0,7))o.setAttribute("_"+u,l.toString());else{if("meta"===a&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===u){o.setAttribute("csp-content",l.toString());continue}"link"===a&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===a&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===a&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(u,l.toString()))}}catch(e){}else{for(var h=r.createTextNode(l),m=0,f=Array.from(o.childNodes);m<f.length;m++){var g=f[m];g.nodeType===o.TEXT_NODE&&o.removeChild(g)}o.appendChild(h)}}}var y=function(t){var r=c[t];if("canvas"===a&&"rr_dataURL"===t){var n=document.createElement("img");n.onload=function(){var e=o.getContext("2d");e&&e.drawImage(n,0,0,n.width,n.height)},n.src=r.toString(),o.RRNodeType&&(o.rr_dataURL=r.toString())}else if("img"===a&&"rr_dataURL"===t){var i=o;i.currentSrc.startsWith("data:")||(i.setAttribute("rrweb-original-src",e.attributes.src),i.src=r.toString())}if("rr_width"===t)o.style.width=r.toString();else if("rr_height"===t)o.style.height=r.toString();else if("rr_mediaCurrentTime"===t&&"number"==typeof r)o.currentTime=r;else if("rr_mediaState"===t)switch(r){case"played":o.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":o.pause()}};for(var v in c)y(v);if(e.isShadowHost)if(o.shadowRoot)for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);else o.attachShadow({mode:"open"});return o;case i.Text:return r.createTextNode(e.isStyle&&n?U(e.textContent,s):e.textContent);case i.CDATA:return r.createCDATASection(e.textContent);case i.Comment:return r.createComment(e.textContent);default:return null}}(e,{doc:r,hackCss:u,cache:d});if(!p)return null;if(e.rootId&&n.getNode(e.rootId)!==r&&n.replace(e.rootId,r),e.type===i.Document&&(r.close(),r.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==i.DocumentType&&(e.childNodes[0].type===i.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),p=r),n.add(p,e),(e.type===i.Document||e.type===i.Element)&&!a)for(var h=0,m=e.childNodes;h<m.length;h++){var f=m[h],g=q(f,{doc:r,mirror:n,skipChild:!1,hackCss:u,afterAppend:l,cache:d});g?(f.isShadow&&o(p)&&p.shadowRoot?p.shadowRoot.appendChild(g):p.appendChild(g),l&&l(g,f.id)):console.warn("Failed to rebuild",f)}return p}function G(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const W="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let z={map:{},getId:()=>(console.error(W),-1),getNode:()=>(console.error(W),null),removeNodeFromMap(){console.error(W)},has:()=>(console.error(W),!1),reset(){console.error(W)}};function H(e,t,r={}){let n=null,i=0;return function(...s){const o=Date.now();i||!1!==r.leading||(i=o);const a=t-(o-i),c=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(c,s)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(c,s)},a))}}function Z(e,t,r,n,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>Z(e,t,s||{},!0)}function K(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch(e){return()=>{}}}function Y(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function J(e,t,r,n){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(E(i,t,n))return!0;if(r){if(e.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function Q(e,t){return-1!==t.getId(e)}function X(e,t){return-2===t.getId(e)}function ee(e,t){if(a(e))return!1;const r=t.getId(e);return!t.has(r)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||ee(e.parentNode,t))}function te(e){return Boolean(e.changedTouches)}function re(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),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}function ne(e){const t={},r=(e,r)=>{const n={value:e,parent:r,children:[]};return t[e.node.id]=n,n},n=[];for(const i of e){const{nextId:e,parentId:s}=i;if(e&&e in t){const s=t[e];if(s.parent){const e=s.parent.children.indexOf(s);s.parent.children.splice(e,0,r(i,s.parent))}else{const e=n.indexOf(s);n.splice(e,0,r(i,null))}continue}if(s in t){const e=t[s];e.children.push(r(i,e));continue}n.push(r(i,null))}return n}function ie(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)ie(e.children[r],t)}function se(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function oe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ae(e,t){var r,n;const i=null===(n=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===n?void 0:n.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=i.getBoundingClientRect(),o=ae(i,t),a=s.height/i.clientHeight;return{x:s.x*o.relativeScale+o.x,y:s.y*o.relativeScale+o.y,relativeScale:a,absoluteScale:o.absoluteScale*a}}function ce(e){return Boolean(null==e?void 0:e.shadowRoot)}function ue(e,t){const r=e[t[0]];return 1===t.length?r:ue(r.cssRules[t[1]].cssRules,t.slice(2))}function le(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function de(e){const t=new Set,r=[];for(let n=e.length;n--;){const i=e[n];t.has(i.id)||(r.push(i),t.add(i.id))}return r}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(z=new Proxy(z,{get:(e,t,r)=>("map"===t&&console.error(W),Reflect.get(e,t,r))}));class pe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var he=(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))(he||{}),me=(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))(me||{}),fe=(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))(fe||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{}),ye=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(ye||{});function ve(e){return"__ln"in e}class Ie{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&ve(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&ve(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const be=(e,t)=>`${e}@${t}`;class Se{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Ie,r=e=>{let t=e,r=-2;for(;-2===r;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},n=n=>{var i,s,o,c;let u=null;(null===(s=null===(i=n.getRootNode)||void 0===i?void 0:i.call(n))||void 0===s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(u=n.getRootNode().host);let l=u;for(;(null===(c=null===(o=null==l?void 0:l.getRootNode)||void 0===o?void 0:o.call(l))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&l.getRootNode().host;)l=l.getRootNode().host;const d=!(this.doc.contains(n)||l&&this.doc.contains(l));if(!n.parentNode||d)return;const p=a(n.parentNode)?this.mirror.getId(u):this.mirror.getId(n.parentNode),h=r(n);if(-1===p||-1===h)return t.addNode(n);const m=D(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:e=>{se(e,this.mirror)&&this.iframeManager.addIframe(e),oe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ce(n)&&this.shadowDomManager.addShadowRoot(n.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});m&&e.push({parentId:p,nextId:h,node:m})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))Ce(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||n(e);for(const e of Array.from(this.addedSet.values()))Te(this.droppedSet,e)||Ce(this.removes,e,this.mirror)?Te(this.movedSet,e)?n(e):this.droppedSet.add(e):n(e);let i=null;for(;t.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=r(i.value);-1!==t&&-1!==n&&(e=i)}if(!e)for(let n=t.length-1;n>=0;n--){const i=t.get(n);if(i){const t=this.mirror.getId(i.value.parentNode);if(-1===r(i.value))continue;if(-1!==t){e=i;break}{const t=i.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=i;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}i=e.previous,t.removeNode(e.value),n(e.value)}const s={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!X(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;J(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(r=h({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),J(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let n=this.attributes.find(t=>t.node===e.target);if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;e.attributeName="rr_src"}if(n||(n={node:e.target,attributes:{}},this.attributes.push(n)),"style"===e.attributeName){const r=this.doc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue),void 0!==n.attributes.style&&null!==n.attributes.style||(n.attributes.style={});const i=n.attributes.style;for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n===r.style.getPropertyValue(e)&&s===r.style.getPropertyPriority(e)||(i[e]=""===s?n:[n,s])}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(i[e]=!1)}else n.attributes[e.attributeName]=O(this.doc,t.tagName,e.attributeName,r);break}case"childList":if(J(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),n=a(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);J(e.target,this.blockClass,this.blockSelector,!1)||X(t,this.mirror)||!Q(t,this.mirror)||(this.addedSet.has(t)?(we(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||ee(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[be(r,n)]?we(this.movedSet,t):this.removes.push({parentId:n,id:r,isShadow:!(!a(e.target)||!c(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(X(e,this.mirror))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[be(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);J(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function we(e,t){e.delete(t),t.childNodes.forEach(t=>we(e,t))}function Ce(e,t,r){return 0!==e.length&&ke(e,t,r)}function ke(e,t,r){const{parentNode:n}=t;if(!n)return!1;const i=r.getId(n);return!!e.some(e=>e.id===i)||ke(e,n,r)}function Te(e,t){return 0!==e.size&&_e(e,t)}function _e(e,t){const{parentNode:r}=t;return!!r&&(!!e.has(r)||_e(e,r))}const Ae=[],Oe="undefined"!=typeof CSSGroupingRule,Ee="undefined"!=typeof CSSMediaRule,Me="undefined"!=typeof CSSSupportsRule,Ne="undefined"!=typeof CSSConditionRule;function De(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function xe(e,t){var r,n;const i=new Se;Ae.push(i),i.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const o=null===(n=null===(r=null===window||void 0===window?void 0:window.Zone)||void 0===r?void 0:r.__symbol__)||void 0===n?void 0:n.call(r,"MutationObserver");o&&window[o]&&(s=window[o]);const a=new s(i.processMutations.bind(i));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Pe({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){return G("scroll",H(s=>{const o=De(s);if(!o||J(o,n,i,!0))return;const a=r.getId(o);if(o===t){const r=t.scrollingElement||t.documentElement;e({id:a,x:r.scrollLeft,y:r.scrollTop})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})},s.scroll||100),t)}function Re(e,t){const r=Object.assign({},e);return t||delete r.userTriggered,r}const Fe=["INPUT","TEXTAREA","SELECT"],Le=new WeakMap;function je(e){return function(e,t){if(Oe&&e.parentRule instanceof CSSGroupingRule||Ee&&e.parentRule instanceof CSSMediaRule||Me&&e.parentRule instanceof CSSSupportsRule||Ne&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function Be(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Ue({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;o="#document"===r.nodeName?e.getId(r):e.getId(r.host);const a="#document"===r.nodeName?null===(n=r.defaultView)||void 0===n?void 0:n.Document:null===(s=null===(i=r.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===s?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&c?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var r;const n=null===(r=c.set)||void 0===r?void 0:r.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return n}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function Ve(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:u,styleDeclarationCb:l,canvasMutationCb:d,fontCb:p,selectionCb:h}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),u(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),p(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)}}(e,t);const n=xe(e,e.doc),i=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const c=H(t=>{const r=Date.now()-o;e(a.map(e=>(e.timeOffset-=r,e)),t),a=[],o=null},s),u=H(e=>{const t=De(e),{clientX:r,clientY:i}=te(e)?e.changedTouches[0]:e;o||(o=Date.now()),a.push({x:r,y:i,id:n.getId(t),timeOffset:Date.now()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?me.Drag:e instanceof MouseEvent?me.MouseMove:me.TouchMove)},i,{trailing:!1}),l=[G("mousemove",u,r),G("touchmove",u,r),G("drag",u,r)];return()=>{l.forEach(e=>e())}}(e),s=function({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const o=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];return Object.keys(fe).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(s=>{const o=s.toLowerCase(),c=(t=>s=>{const o=De(s);if(J(o,n,i,!0))return;const a=te(s)?s.changedTouches[0]:s;if(!a)return;const c=r.getId(o),{clientX:u,clientY:l}=a;e({type:fe[t],id:c,x:u,y:l})})(s);a.push(G(o,c,t))}),()=>{a.forEach(e=>e())}}(e),o=Pe(e),a=function({viewportResizeCb:e}){let t=-1,r=-1;return G("resize",H(()=>{const n=Y(),i=$();t===n&&r===i||(e({width:Number(i),height:Number(n)}),t=n,r=i)},200),window)}(e),c=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,maskInputOptions:o,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function l(e){let r=De(e);const c=e.isTrusted;if(r&&"OPTION"===r.tagName&&(r=r.parentElement),!r||!r.tagName||Fe.indexOf(r.tagName)<0||J(r,n,i,!0))return;const l=r.type;if(r.classList.contains(s))return;let p=r.value,m=!1;"radio"===l||"checkbox"===l?m=r.checked:(o[r.tagName.toLowerCase()]||o[l])&&(p=h({maskInputOptions:o,tagName:r.tagName,type:l,value:p,maskInputFn:a})),d(r,Re({text:p,isChecked:m,userTriggered:c},u));const f=r.name;"radio"===l&&f&&m&&t.querySelectorAll(`input[type="radio"][name="${f}"]`).forEach(e=>{e!==r&&d(e,Re({text:e.value,isChecked:!m,userTriggered:!1},u))})}function d(t,n){const i=Le.get(t);if(!i||i.text!==n.text||i.isChecked!==n.isChecked){Le.set(t,n);const i=r.getId(t);e(Object.assign(Object.assign({},n),{id:i}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>G(e,l,t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...g.map(e=>Z(e[0],e[1],{set(){l({target:this})}},!1,m))),()=>{p.forEach(e=>e())}}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i}){const s=s=>H(i=>{const o=De(i);if(!o||J(o,t,r,!0))return;const{currentTime:a,volume:c,muted:u,playbackRate:l}=o;e({type:s,id:n.getId(o),currentTime:a,volume:c,muted:u,playbackRate:l})},i.media||500),o=[G("play",s(0)),G("pause",s(1)),G("seeked",s(2)),G("volumechange",s(3)),G("ratechange",s(4))];return()=>{o.forEach(e=>e())}}(e),l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(n,s){const{id:o,styleId:a}=Be(this,t,r.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:n,index:s}]}),i.apply(this,[n,s])};const s=n.CSSStyleSheet.prototype.deleteRule;let o,a;n.CSSStyleSheet.prototype.deleteRule=function(n){const{id:i,styleId:o}=Be(this,t,r.styleMirror);return(i&&-1!==i||o&&-1!==o)&&e({id:i,styleId:o,removes:[{index:n}]}),s.apply(this,[n])},n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(n){const{id:i,styleId:s}=Be(this,t,r.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replace:n}),o.apply(this,[n])}),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(n){const{id:i,styleId:s}=Be(this,t,r.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replaceSync:n}),a.apply(this,[n])});const c={};Oe?c.CSSGroupingRule=n.CSSGroupingRule:(Ee&&(c.CSSMediaRule=n.CSSMediaRule),Ne&&(c.CSSConditionRule=n.CSSConditionRule),Me&&(c.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(c).forEach(([n,i])=>{u[n]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=function(i,s){const{id:o,styleId:a}=Be(this.parentStyleSheet,t,r.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:i,index:[...je(this),s||0]}]}),u[n].insertRule.apply(this,[i,s])},i.prototype.deleteRule=function(i){const{id:s,styleId:o}=Be(this.parentStyleSheet,t,r.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,removes:[{index:[...je(this),i]}]}),u[n].deleteRule.apply(this,[i])}}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})}}(e,{win:r}),d=Ue(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(i,o,a){var c;if(r.has(i))return s.apply(this,[i,o,a]);const{id:u,styleId:l}=Be(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,set:{property:i,value:o,priority:a},index:je(this.parentRule)}),s.apply(this,[i,o,a])};const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(i){var s;if(r.has(i))return o.apply(this,[i]);const{id:a,styleId:c}=Be(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:i},index:je(this.parentRule)}),o.apply(this,[i])},()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o}}(e,{win:r}),m=e.collectFonts?function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(e,t,r){const n=new s(e,t,r);return i.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const o=K(t.fonts,"add",function(t){return function(r){return setTimeout(()=>{const t=i.get(r);t&&(e(t),i.delete(r))},0),t.apply(this,[r])}});return n.push(()=>{r.FontFace=s}),n.push(o),()=>{n.forEach(e=>e())}}(e):()=>{},f=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e;let o=!0;const a=()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:o,startOffset:c,endContainer:u,endOffset:l}=s;J(o,n,i,!0)||J(u,n,i,!0)||a.push({start:r.getId(o),startOffset:c,end:r.getId(u),endOffset:l})}s({ranges:a})};return a(),G("selectionchange",a)}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,r,t.options));return()=>{Ae.forEach(e=>e.reset()),n.disconnect(),i(),s(),o(),a(),c(),u(),l(),d(),p(),m(),f(),g.forEach(e=>e())}}class qe{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,r,n){const i=r||this.getIdToRemoteIdMap(e),s=n||this.getRemoteIdToIdMap(e);let o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),s.set(o,t)),o}getIds(e,t){const r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;return n.get(t)||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ge{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new qe(I),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new qe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(r=this.loadListener)||void 0===r||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const r=this.transformCrossOriginEvent(t,e.data.event);r&&this.wrappedEmit(r,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var r;switch(t.type){case he.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:he.IncrementalSnapshot,data:{source:me.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case he.Meta:case he.Load:case he.DomContentLoaded:return!1;case he.Plugin:return t;case he.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case he.IncrementalSnapshot:switch(t.data.source){case me.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case me.Drag:case me.TouchMove:case me.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case me.ViewportResize:return!1;case me.MediaInteraction:case me.MouseInteraction:case me.Scroll:case me.CanvasMutation:case me.Input:return this.replaceIds(t.data,e,["id"]),t;case me.StyleSheetRule:case me.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case me.Font:return t;case me.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case me.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(r=t.data.styles)||void 0===r||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,r,n){for(const i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(r,t[i]):t[i]=e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class We{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(K(Element.prototype,"attachShadow",function(e){return function(r){const n=e.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),n}}))}addShadowRoot(e,t){c(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),xe(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Pe(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Ue({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(K(e.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(n){const i=r.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),i}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}}function ze(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})}for(var He="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ze="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ke=0;Ke<64;Ke++)Ze[He.charCodeAt(Ke)]=Ke;const Ye=new Map,$e=(e,t,r)=>{if(!e||!Xe(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=Ye.get(e);return r||(r=new Map,Ye.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i};function Je(e,t,r){if(e instanceof Array)return e.map(e=>Je(e,t,r));if(null===e)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){const t=e.constructor.name,r=function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;t<n;t+=3)i+=He[r[t]>>2],i+=He[(3&r[t])<<4|r[t+1]>>4],i+=He[(15&r[t+1])<<2|r[t+2]>>6],i+=He[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:r}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Je(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Je(e.data,t,r),e.width,e.height]}:Xe(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:$e(e,t,r)}:e}const Qe=(e,t,r)=>[...e].map(e=>Je(e,t,r)),Xe=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function et(e,t,r){const n=[];try{const i=K(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...i){return J(this,t,r,!0)||"__context"in this||(this.__context=n),e.apply(this,[n,...i])}});n.push(i)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function tt(e,t,r,n,i,s,o){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=K(e,s,function(e){return function(...a){const c=e.apply(this,a);if($e(c,o,this),!J(this.canvas,n,i,!0)){const e=Qe([...a],o,this),n={type:t,property:s,args:e};r(this.canvas,n)}return c}});a.push(c)}catch(n){const i=Z(e,s,{set(e){r(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(i)}return a}var rt=null;try{var nt="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");rt=nt.Worker}catch(pn){}var it,st,ot=(it="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",st=!1,"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?function(e,t,r){var n=void 0===t?null:t,i=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==r&&r),s=i.indexOf("\n",10)+1,o=i.substring(s)+(n?"//# sourceMappingURL="+n:"");return function(e){return new rt(o,Object.assign({},e,{eval:!0}))}}(it,null,st):function(e){var t;return function(r){return t=t||function(e,t,r){var n=void 0===t?null:t,i=function(e,t){var r=atob(e);if(t){for(var n=new Uint8Array(r.length),i=0,s=r.length;i<s;++i)n[i]=r.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return r}(e,void 0!==r&&r),s=i.indexOf("\n",10)+1,o=i.substring(s)+(n?"//# sourceMappingURL="+n:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}(e,null,false),new Worker(t,r)}}(it));class at{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:s,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,n,i),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,i){const s=et(t,r,n),o=new Map,a=new ot;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:r,type:n,width:i,height:s}=e.data;this.mutationCb({id:t,type:ge["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}]})};const c=1e3/e;let u,l=0;const d=e=>{l&&e-l<c||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{J(t,r,n,!0)||e.push(t)}),e})().forEach(e=>ze(this,void 0,void 0,function*(){var t;const r=this.mirror.getId(e);if(o.get(r))return;if(o.set(r,!0),["webgl","webgl2"].includes(e.__context)){const r=e.getContext(e.__context);!1===(null===(t=null==r?void 0:r.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==r||r.clear(r.COLOR_BUFFER_BIT))}const n=yield createImageBitmap(e);a.postMessage({id:r,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])}))),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=et(e,t,r),i=function(e,t,r,n){const i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const s=K(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...s){return J(this.canvas,r,n,!0)||setTimeout(()=>{const r=Qe([...s],t,this);e(this.canvas,{type:ge["2D"],property:o,args:r})},0),i.apply(this,s)}});i.push(s)}catch(r){const n=Z(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:ge["2D"],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r),s=function(e,t,r,n){const i=[];return i.push(...tt(t.WebGLRenderingContext.prototype,ge.WebGL,e,r,n,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...tt(t.WebGL2RenderingContext.prototype,ge.WebGL2,e,r,n,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,this.mirror);this.resetObservers=()=>{n(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||-1===t)return;const n=r.map(e=>{const t=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["type"]);return t}),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}class ct{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new pe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const r={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const r=Array.from(t.rules||CSSRule);n.push({styleId:e,rules:r.map((e,t)=>({rule:l(e),index:t}))})}r.styleIds.push(e)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function ut(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let lt,dt,pt,ht=!1;const mt=p();function ft(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:l,maskInputOptions:p,slimDOMOptions:h,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:v={},dataURLOptions:I={},mousemoveWait:b,recordCanvas:S=!1,recordCrossOriginIframes:w=!1,userTriggeredOnInput:C=!1,collectFonts:k=!1,inlineImages:T=!1,plugins:_,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:O=new Set([])}=e,E=!w||window.parent===window;let M=!1;if(!E)try{window.parent.document,M=!1}catch(e){M=!0}if(E&&!t)throw new Error("emit function is required");void 0!==b&&void 0===v.mousemove&&(v.mousemove=b),mt.reset();const N=!0===l?{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}:void 0!==p?p:{password:!0},x=!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===h,headMetaDescKeywords:"all"===h}:h||{};let P;re();let R=0;const F=e=>{for(const t of _||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&(e=y(e)),e};lt=(e,i)=>{var s;if(!(null===(s=Ae[0])||void 0===s?void 0:s.isFrozen())||e.type===he.FullSnapshot||e.type===he.IncrementalSnapshot&&e.data.source===me.Mutation||Ae.forEach(e=>e.unfreeze()),E)null==t||t(F(e),i);else if(M){const t={type:"rrweb",event:F(e),isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===he.FullSnapshot)P=e,R=0;else if(e.type===he.IncrementalSnapshot){if(e.data.source===me.Mutation&&e.data.isAttachIframe)return;R++;const t=n&&R>=n,i=r&&e.timestamp-P.timestamp>r;(t||i)&&dt(!0)}};const L=e=>{lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Mutation},e)}))},j=e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Scroll},e)})),B=e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.CanvasMutation},e)})),U=new ct({mutationCb:L,adoptedStyleSheetCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.AdoptedStyleSheet},e)}))}),V=new Ge({mirror:mt,mutationCb:L,stylesheetManager:U,recordCrossOriginIframes:w,wrappedEmit:lt});for(const e of _||[])e.getMirror&&e.getMirror({nodeMirror:mt,crossOriginIframeMirror:V.crossOriginIframeMirror,crossOriginIframeStyleMirror:V.crossOriginIframeStyleMirror});pt=new at({recordCanvas:S,mutationCb:B,win:window,blockClass:i,blockSelector:s,mirror:mt,sampling:v.canvas,dataURLOptions:I});const q=new We({mutationCb:L,scrollCb:j,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:N,dataURLOptions:I,maskTextFn:f,maskInputFn:m,recordCanvas:S,inlineImages:T,sampling:v,slimDOMOptions:x,iframeManager:V,stylesheetManager:U,canvasManager:pt,keepIframeSrcFn:A},mirror:mt});dt=(e=!1)=>{var t,r,n,o,l,p;lt(ut({type:he.Meta,data:{href:window.location.href,width:$(),height:Y()}}),e),U.reset(),Ae.forEach(e=>e.lock());const h=function(e,t){var r=t||{},n=r.mirror,i=void 0===n?new d:n,s=r.blockClass,o=r.blockSelector,a=r.maskTextClass,c=r.maskTextSelector,u=r.inlineStylesheet,l=r.inlineImages,p=r.recordCanvas,h=r.maskAllInputs,m=void 0!==h&&h,f=r.slimDOM,g=void 0!==f&&f,y=r.keepIframeSrcFn;return D(e,{doc:e,mirror:i,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===o?null:o,maskTextClass:void 0===a?"rr-mask":a,maskTextSelector:void 0===c?null:c,skipChild:!1,inlineStylesheet:void 0===u||u,maskInputOptions:!0===m?{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}:!1===m?{password:!0}:m,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===g,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===g?{}:g,dataURLOptions:r.dataURLOptions,inlineImages:void 0!==l&&l,recordCanvas:void 0!==p&&p,preserveWhiteSpace:r.preserveWhiteSpace,onSerialize:r.onSerialize,onIframeLoad:r.onIframeLoad,iframeLoadTimeout:r.iframeLoadTimeout,onStylesheetLoad:r.onStylesheetLoad,stylesheetLoadTimeout:r.stylesheetLoadTimeout,keepIframeSrcFn:void 0===y?function(){return!1}:y,newlyAddedElement:!1})}(document,{mirror:mt,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:N,maskTextFn:f,slimDOM:x,dataURLOptions:I,recordCanvas:S,inlineImages:T,onSerialize:e=>{se(e,mt)&&V.addIframe(e),oe(e,mt)&&U.trackLinkElement(e),ce(e)&&q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{V.attachIframe(e,t),q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{U.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!h)return console.warn("Failed to snapshot the document");lt(ut({type:he.FullSnapshot,data:{node:h,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(r=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===r?void 0:r.scrollLeft)||(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(l=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===l?void 0:l.scrollTop)||(null===(p=null===document||void 0===document?void 0:document.body)||void 0===p?void 0:p.scrollTop)||0}}})),Ae.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&U.adoptStyleSheets(document.adoptedStyleSheets,mt.getId(document))};try{const e=[];e.push(G("DOMContentLoaded",()=>{lt(ut({type:he.DomContentLoaded,data:{}}))}));const t=e=>{var t;return Ve({mutationCb:L,mousemoveCb:(e,t)=>lt(ut({type:he.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.MouseInteraction},e)})),scrollCb:j,viewportResizeCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.ViewportResize},e)})),inputCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Input},e)})),mediaInteractionCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.MediaInteraction},e)})),styleSheetRuleCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.StyleSheetRule},e)})),styleDeclarationCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.StyleDeclaration},e)})),canvasMutationCb:B,fontCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Font},e)})),selectionCb:e=>{lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Selection},e)}))},blockClass:i,ignoreClass:o,maskTextClass:a,maskTextSelector:c,maskInputOptions:N,inlineStylesheet:u,sampling:v,recordCanvas:S,inlineImages:T,userTriggeredOnInput:C,collectFonts:k,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:s,slimDOMOptions:x,dataURLOptions:I,mirror:mt,iframeManager:V,stylesheetManager:U,shadowDomManager:q,canvasManager:pt,ignoreCSSAttributes:O,plugins:(null===(t=null==_?void 0:_.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>lt(ut({type:he.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},g)};V.addLoadListener(r=>{e.push(t(r.contentDocument))});const r=()=>{dt(),e.push(t(document)),ht=!0};return"interactive"===document.readyState||"complete"===document.readyState?r():e.push(G("load",()=>{lt(ut({type:he.Load,data:{}})),r()},window)),()=>{e.forEach(e=>e()),ht=!1}}catch(e){console.warn(e)}}ft.addCustomEvent=(e,t)=>{if(!ht)throw new Error("please add custom event after start recording");lt(ut({type:he.Custom,data:{tag:e,payload:t}}))},ft.freezePage=()=>{Ae.forEach(e=>e.freeze())},ft.takeFullSnapshot=e=>{if(!ht)throw new Error("please take full snapshot after start recording");dt(e)},ft.mirror=mt;const{addCustomEvent:gt}=ft,{freezePage:yt}=ft;var vt=Uint8Array,It=Uint16Array,bt=Uint32Array,St=new vt([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]),wt=new vt([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]),Ct=new vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kt=function(e,t){for(var r=new It(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new bt(r[30]);for(n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return[r,i]},Tt=kt(St,2),_t=Tt[0],At=Tt[1];_t[28]=258,At[258]=28;for(var Ot=kt(wt,0),Et=Ot[0],Mt=Ot[1],Nt=new It(32768),Dt=0;Dt<32768;++Dt){var xt=(43690&Dt)>>>1|(21845&Dt)<<1;xt=(61680&(xt=(52428&xt)>>>2|(13107&xt)<<2))>>>4|(3855&xt)<<4,Nt[Dt]=((65280&xt)>>>8|(255&xt)<<8)>>>1}var Pt=function(e,t,r){for(var n=e.length,i=0,s=new It(t);i<n;++i)++s[e[i]-1];var o,a=new It(t);for(i=0;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;if(r){o=new It(1<<t);var c=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,p=d|(1<<l)-1;d<=p;++d)o[Nt[d]>>>c]=u}else for(o=new It(n),i=0;i<n;++i)o[i]=Nt[a[e[i]-1]++]>>>15-e[i];return o},Rt=new vt(288);for(Dt=0;Dt<144;++Dt)Rt[Dt]=8;for(Dt=144;Dt<256;++Dt)Rt[Dt]=9;for(Dt=256;Dt<280;++Dt)Rt[Dt]=7;for(Dt=280;Dt<288;++Dt)Rt[Dt]=8;var Ft=new vt(32);for(Dt=0;Dt<32;++Dt)Ft[Dt]=5;var Lt=Pt(Rt,9,0),jt=Pt(Rt,9,1),Bt=Pt(Ft,5,0),Ut=Pt(Ft,5,1),Vt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},qt=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>>(7&t)&r},Gt=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>>(7&t)},Wt=function(e){return(e/8|0)+(7&e&&1)},zt=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof It?It:e instanceof bt?bt:vt)(r-t);return n.set(e.subarray(t,r)),n},Ht=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8},Zt=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},Kt=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,s=r.slice();if(!i)return[new vt(0),0];if(1==i){var o=new vt(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],u=0,l=1,d=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=r[r[u].f<r[d].f?u++:d++],c=r[u!=l&&r[u].f<r[d].f?u++:d++],r[l++]={s:-1,f:a.f+c.f,l:a,r:c};var p=s[0].s;for(n=1;n<i;++n)s[n].s>p&&(p=s[n].s);var h=new It(p+1),m=Yt(r[l-1],h,0);if(m>t){n=0;var f=0,g=m-t,y=1<<g;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});n<i;++n){var v=s[n].s;if(!(h[v]>t))break;f+=y-(1<<m-h[v]),h[v]=t}for(f>>>=g;f>0;){var I=s[n].s;h[I]<t?f-=1<<t-h[I]++-1:++n}for(;n>=0&&f;--n){var b=s[n].s;h[b]==t&&(--h[b],++f)}m=t}return[new vt(h),m]},Yt=function(e,t,r){return-1==e.s?Math.max(Yt(e.l,t,r+1),Yt(e.r,t,r+1)):t[e.s]=r},$t=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new It(++t),n=0,i=e[0],s=1,o=function(e){r[n++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=e[a]}return[r.subarray(0,n),t]},Jt=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Qt=function(e,t,r){var n=r.length,i=Wt(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;s<n;++s)e[i+s+4]=r[s];return 8*(i+4+n)},Xt=function(e,t,r,n,i,s,o,a,c,u,l){Ht(t,l++,r),++i[256];for(var d=Kt(i,15),p=d[0],h=d[1],m=Kt(s,15),f=m[0],g=m[1],y=$t(p),v=y[0],I=y[1],b=$t(f),S=b[0],w=b[1],C=new It(19),k=0;k<v.length;++k)C[31&v[k]]++;for(k=0;k<S.length;++k)C[31&S[k]]++;for(var T=Kt(C,7),_=T[0],A=T[1],O=19;O>4&&!_[Ct[O-1]];--O);var E,M,N,D,x=u+5<<3,P=Jt(i,Rt)+Jt(s,Ft)+o,R=Jt(i,p)+Jt(s,f)+o+14+3*O+Jt(C,_)+(2*C[16]+3*C[17]+7*C[18]);if(x<=P&&x<=R)return Qt(t,l,e.subarray(c,c+u));if(Ht(t,l,1+(R<P)),l+=2,R<P){E=Pt(p,h,0),M=p,N=Pt(f,g,0),D=f;var F=Pt(_,A,0);for(Ht(t,l,I-257),Ht(t,l+5,w-1),Ht(t,l+10,O-4),l+=14,k=0;k<O;++k)Ht(t,l+3*k,_[Ct[k]]);l+=3*O;for(var L=[v,S],j=0;j<2;++j){var B=L[j];for(k=0;k<B.length;++k){var U=31&B[k];Ht(t,l,F[U]),l+=_[U],U>15&&(Ht(t,l,B[k]>>>5&127),l+=B[k]>>>12)}}}else E=Lt,M=Rt,N=Bt,D=Ft;for(k=0;k<a;++k)if(n[k]>255){U=n[k]>>>18&31,Zt(t,l,E[U+257]),l+=M[U+257],U>7&&(Ht(t,l,n[k]>>>23&31),l+=St[U]);var V=31&n[k];Zt(t,l,N[V]),l+=D[V],V>3&&(Zt(t,l,n[k]>>>5&8191),l+=wt[V])}else Zt(t,l,E[n[k]]),l+=M[n[k]];return Zt(t,l,E[256]),l+M[256]},er=new bt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tr=new vt(0);function rr(e,t){void 0===t&&(t={});var r=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,s=r.length,o=0;o!=s;){for(var a=Math.min(o+5552,s);o<a;++o)i+=n+=r[o];n%=65521,i%=65521}e=n,t=i},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();r.p(e);var n,i,s,o,a,c=(s=2,o=4,function(e,t,r,n,i,s){var o=e.length,a=new vt(n+o+5*(1+Math.floor(o/7e3))+i),c=a.subarray(n,a.length-i),u=0;if(!t||o<8)for(var l=0;l<=o;l+=65535){var d=l+65535;d<o?u=Qt(c,u,e.subarray(l,d)):(c[l]=s,u=Qt(c,u,e.subarray(l,o)))}else{for(var p=er[t-1],h=p>>>13,m=8191&p,f=(1<<r)-1,g=new It(32768),y=new It(f+1),v=Math.ceil(r/3),I=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<I)&f},S=new bt(25e3),w=new It(288),C=new It(32),k=0,T=0,_=(l=0,0),A=0,O=0;l<o;++l){var E=b(l),M=32767&l,N=y[E];if(g[M]=N,y[E]=M,A<=l){var D=o-l;if((k>7e3||_>24576)&&D>423){u=Xt(e,c,0,S,w,C,T,_,O,l-O,u),_=k=T=0,O=l;for(var x=0;x<286;++x)w[x]=0;for(x=0;x<30;++x)C[x]=0}var P=2,R=0,F=m,L=M-N&32767;if(D>2&&E==b(l-L))for(var j=Math.min(h,D)-1,B=Math.min(32767,l),U=Math.min(258,D);L<=B&&--F&&M!=N;){if(e[l+P]==e[l+P-L]){for(var V=0;V<U&&e[l+V]==e[l+V-L];++V);if(V>P){if(P=V,R=L,V>j)break;var q=Math.min(L,V-2),G=0;for(x=0;x<q;++x){var W=l-L+x+32768&32767,z=W-g[W]+32768&32767;z>G&&(G=z,N=W)}}}L+=(M=N)-(N=g[M])+32768&32767}if(R){S[_++]=268435456|At[P]<<18|Mt[R];var H=31&At[P],Z=31&Mt[R];T+=St[H]+wt[Z],++w[257+H],++C[Z],A=l+P,++k}else S[_++]=e[l],++w[e[l]]}}u=Xt(e,c,s,S,w,C,T,_,O,l-O,u),s||(u=Qt(c,u,tr))}return zt(a,0,n+Wt(u)+i)}(n=e,null==(i=t).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+i.mem,s,o,!a));return function(e,t){var r=t.level,n=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)}(c,t),function(e,t,r){for(;r;++t)e[t]=r,r>>>=8}(c,c.length-4,r.d()),c}function nr(e,t){var r=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new vt(e.length+(e.length>>>1)),i=0,s=function(e){n[i++]=e},o=0;o<r;++o){if(i+5>n.length){var a=new vt(i+8+(r-o<<1));a.set(n),n=a}var c=e.charCodeAt(o);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return zt(n,0,i)}function ir(e,t){var r="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((31&i)<<6|63&e[n++]):i<240?r+=String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}return r}const sr="v1",or=e=>{const t=Object.assign(Object.assign({},e),{v:sr});return ir(rr(nr(JSON.stringify(t))),!0)},ar=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const n=JSON.parse(ir(function(e,t,r){var n=e.length,i=!t||r,s=!r||r.i;r||(r={}),t||(t=new vt(3*n));var o=function(e){var r=t.length;if(e>r){var n=new vt(Math.max(2*r,e));n.set(t),t=n}},a=r.f||0,c=r.p||0,u=r.b||0,l=r.l,d=r.d,p=r.m,h=r.n,m=8*n;do{if(!l){r.f=a=qt(e,c,1);var f=qt(e,c+1,3);if(c+=3,!f){var g=e[(A=Wt(c)+4)-4]|e[A-3]<<8,y=A+g;if(y>n){if(s)throw"unexpected EOF";break}i&&o(u+g),t.set(e.subarray(A,y),u),r.b=u+=g,r.p=c=8*y;continue}if(1==f)l=jt,d=Ut,p=9,h=5;else{if(2!=f)throw"invalid block type";var v=qt(e,c,31)+257,I=qt(e,c+10,15)+4,b=v+qt(e,c+5,31)+1;c+=14;for(var S=new vt(b),w=new vt(19),C=0;C<I;++C)w[Ct[C]]=qt(e,c+3*C,7);c+=3*I;var k=Vt(w),T=(1<<k)-1;if(!s&&c+b*(k+7)>m)break;var _=Pt(w,k,1);for(C=0;C<b;){var A,O=_[qt(e,c,T)];if(c+=15&O,(A=O>>>4)<16)S[C++]=A;else{var E=0,M=0;for(16==A?(M=3+qt(e,c,3),c+=2,E=S[C-1]):17==A?(M=3+qt(e,c,7),c+=3):18==A&&(M=11+qt(e,c,127),c+=7);M--;)S[C++]=E}}var N=S.subarray(0,v),D=S.subarray(v);p=Vt(N),h=Vt(D),l=Pt(N,p,1),d=Pt(D,h,1)}if(c>m)throw"unexpected EOF"}i&&o(u+131072);for(var x=(1<<p)-1,P=(1<<h)-1,R=p+h+18;s||c+R<m;){var F=(E=l[Gt(e,c)&x])>>>4;if((c+=15&E)>m)throw"unexpected EOF";if(!E)throw"invalid length/literal";if(F<256)t[u++]=F;else{if(256==F){l=null;break}var L=F-254;if(F>264){var j=St[C=F-257];L=qt(e,c,(1<<j)-1)+_t[C],c+=j}var B=d[Gt(e,c)&P],U=B>>>4;if(!B)throw"invalid distance";if(c+=15&B,D=Et[U],U>3&&(j=wt[U],D+=Gt(e,c)&(1<<j)-1,c+=j),c>m)throw"unexpected EOF";i&&o(u+131072);for(var V=u+L;u<V;u+=4)t[u]=t[u-D],t[u+1]=t[u+1-D],t[u+2]=t[u+2-D],t[u+3]=t[u+3-D];u=V}}r.l=l,r.p=c,r.b=u,l&&(a=1,r.m=p,r.d=d,r.n=h)}while(!a);return u==t.length?t:zt(t,0,u)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(t=nr(e,!0)),t.subarray(2,-4)),r)));if(n.v===sr)return n;throw new Error(`These events were packed with packer ${n.v} which is incompatible with current packer ${sr}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}var t,r};class cr{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const ur=/(^|@)\S+:\d+/,lr=/^\s*at .*(\S+:\d+|\(native\))/m,dr=/^(eval@)?(\[native code])?$/,pr={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(lr))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(lr)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const r=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=r?t.replace(r[0],""):t;const n=t.split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),s=n.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new cr({functionName:s,fileName:o,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(dr)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new cr({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new cr({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[];for(let e=2,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new cr({fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[];for(let e=0,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new cr({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(ur)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new cr({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function hr(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let r=e.localName;if(!r)break;r=r.toLowerCase();const n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(let e=0;e<n.children.length;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===r&&i.push(t)}i.length>1&&(r+=`:eq(${i.indexOf(e)})`),t=r+(t?">"+t:""),e=n}return t}function mr(e){return"[object Object]"===Object.prototype.toString.call(e)}function fr(e,t){if(0===t)return!0;const r=Object.keys(e);for(const n of r)if(mr(e[n])&&fr(e[n],t-1))return!0;return!1}function gr(e,t){const r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);const n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){const r=n.indexOf(this);~r?n.splice(r+1):n.push(this),~r?i.splice(r,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(mr(s=t)&&Object.keys(s).length>r.numOfKeysLimit||"function"==typeof s||mr(s)&&fr(s,r.depthOfLimit))return function(e){let t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=`${t.slice(0,r.stringLengthLimit)}...`),t}(t);var s;if(t instanceof Event){const e={};for(const r in t){const n=t[r];Array.isArray(n)?e[r]=hr(n.length?n[0]:null):e[r]=n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}const yr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function vr(e,t,r){const n=r?Object.assign({},yr,r):yr,i=n.logger;if(!i)return()=>{};let s;s="string"==typeof i?t[i]:i;let o=0;const a=[];if(n.level.includes("error")&&window){const t=t=>{const r=t.message,i=t.error,s=pr.parse(i).map(e=>e.toString()),o=[gr(r,n.stringifyOptions)];e({level:"error",trace:s,payload:o})};window.addEventListener("error",t),a.push(()=>{window&&window.removeEventListener("error",t)})}for(const e of n.level)a.push(c(s,e));return()=>{a.forEach(e=>e())};function c(t,r){return t[r]?K(t,r,t=>(...i)=>{t.apply(this,i);try{const t=pr.parse(new Error).map(e=>e.toString()).splice(1),s=i.map(e=>gr(e,n.stringifyOptions));o++,o<n.lengthThreshold?e({level:r,trace:t,payload:s}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[gr("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}}):()=>{}}}const Ir="rrweb/console@1",br=e=>({name:Ir,observer:vr,options:e}),Sr="__rrweb_original__",wr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class Cr{constructor(e){this.config=Object.assign(wr,e)}getConsoleLogger(){const e={};for(const t of this.config.level)e[t]="trace"===t?e=>{(console.log[Sr]?console.log[Sr]:console.log)(...e.payload.map(e=>JSON.parse(e)),this.formatMessage(e))}:e=>{(console[t][Sr]?console[t][Sr]:console[t])(...e.payload.map(e=>JSON.parse(e)),this.formatMessage(e))};return e}formatMessage(e){if(0===e.trace.length)return"";const t="\n\tat ";let r=t;return r+=e.trace.join(t),r}}const kr=e=>{const t=(null==e?void 0:e.replayLogger)||new Cr(e).getConsoleLogger();return{handler(e,r,n){let i=null;if(e.type===he.IncrementalSnapshot&&e.data.source===me.Log?i=e.data:e.type===he.Plugin&&e.data.plugin===Ir&&(i=e.data.payload),i)try{"function"==typeof t[i.level]&&t[i.level](i)}catch(e){n.replayer.config.showWarning&&console.warn(e)}}}};var Tr;!function(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"}(Tr||(Tr={}));var _r=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Ar(e){const t=[];for(const r in e){const n=e[r];if("string"!=typeof n)continue;const i=Dr(r);t.push(`${i}: ${n};`)}return t.join(" ")}const Or=/-([a-z])/g,Er=/^--[a-zA-Z0-9-]+$/,Mr=e=>Er.test(e)?e:e.replace(Or,(e,t)=>t?t.toUpperCase():""),Nr=/\B([A-Z])/g,Dr=e=>e.replace(Nr,"-$1").toLowerCase();class xr{constructor(...e){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=Ur.ELEMENT_NODE,this.TEXT_NODE=Ur.TEXT_NODE}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){const e=this.parentNode;if(!e)return null;const t=e.childNodes,r=t.indexOf(this);return t[r+1]||null}contains(e){if(e===this)return!0;for(const t of this.childNodes)if(t.contains(e))return!0;return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Pr(e){return class extends e{constructor(e,t,r){super(),this.nodeType=Ur.DOCUMENT_TYPE_NODE,this.RRNodeType=Tr.DocumentType,this.textContent=null,this.name=e,this.publicId=t,this.systemId=r,this.nodeName=e}toString(){return"RRDocumentType"}}}function Rr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.ELEMENT_NODE,this.RRNodeType=Tr.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.childNodes=[this.ownerDocument.createTextNode(e)]}get classList(){return new Br(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},r=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach(function(e){if(e){const n=e.split(r);n.length>1&&(t[Mr(n[0].trim())]=n[1].trim())}}),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(r,n,i)=>{if(t.test(r))return;const s=Mr(r);n?e[s]=n:delete e[s],"important"===i&&(e[s]+=" !important"),this.attributes.style=Ar(e)},e.removeProperty=r=>{if(t.test(r))return"";const n=Mr(r),i=e[n]||"";return delete e[n],this.attributes.style=Ar(e),i},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,r){this.setAttribute(t,r)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return this.childNodes.push(e),e.parentNode=this,e.parentElement=this,e}insertBefore(e,t){if(null===t)return this.appendChild(e);const r=this.childNodes.indexOf(t);if(-1==r)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(r,0,e),e.parentElement=this,e.parentNode=this,e}removeChild(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(t,1),e.parentElement=null,e.parentNode=null,e}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function Fr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.TEXT_NODE,this.nodeName="#text",this.RRNodeType=Tr.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Lr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=Tr.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function jr(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=Ur.CDATA_SECTION_NODE,this.RRNodeType=Tr.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class Br{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter(t=>-1===e.indexOf(t)),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}var Ur;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ur||(Ur={}));const Vr={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},qr={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Gr(e,t,r,n){const i=e.childNodes,s=t.childNodes;n=n||t.mirror||t.ownerDocument.mirror,(i.length>0||s.length>0)&&Wr(Array.from(i),s,e,r,n);let o=null,a=null;switch(t.RRNodeType){case Tr.Document:a=t.scrollData;break;case Tr.Element:{const i=e,s=t;switch(function(e,t,r){const n=e.attributes,i=t.attributes;for(const n in i){const s=i[n],o=r.getMeta(t);if(o&&"isSVG"in o&&o.isSVG&&Vr[n])e.setAttributeNS(Vr[n],n,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===n){const t=document.createElement("img");t.src=s,t.onload=()=>{const r=e.getContext("2d");r&&r.drawImage(t,0,0,t.width,t.height)}}else e.setAttribute(n,s)}for(const{name:t}of Array.from(n))t in i||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(i,s,n),a=s.scrollData,o=s.inputData,s.tagName){case"AUDIO":case"VIDEO":{const t=e,r=s;void 0!==r.paused&&(r.paused?t.pause():t.play()),void 0!==r.muted&&(t.muted=r.muted),void 0!==r.volume&&(t.volume=r.volume),void 0!==r.currentTime&&(t.currentTime=r.currentTime),void 0!==r.playbackRate&&(t.playbackRate=r.playbackRate);break}case"CANVAS":{const n=t;if(null!==n.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=i.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=n.rr_dataURL}n.canvasMutations.forEach(t=>r.applyCanvas(t.event,t.mutation,e))}break;case"STYLE":{const e=i.sheet;e&&t.rules.forEach(t=>r.applyStyleSheetMutation(t,e))}}if(s.shadowRoot){i.shadowRoot||i.attachShadow({mode:"open"});const e=i.shadowRoot.childNodes,t=s.shadowRoot.childNodes;(e.length>0||t.length>0)&&Wr(Array.from(e),t,i.shadowRoot,r,n)}break}case Tr.Text:case Tr.Comment:case Tr.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}if(a&&r.applyScroll(a,!0),o&&r.applyInput(o),"IFRAME"===t.nodeName){const i=e.contentDocument,s=t;if(i){const e=n.getMeta(s.contentDocument);e&&r.mirror.add(i,Object.assign({},e)),Gr(i,s.contentDocument,r,n)}}}function Wr(e,t,r,n,i){var s;let o,a,c=0,u=e.length-1,l=0,d=t.length-1,p=e[c],h=e[u],m=t[l],f=t[d];for(;c<=u&&l<=d;){const g=n.mirror.getId(p),y=n.mirror.getId(h),v=i.getId(m),I=i.getId(f);if(void 0===p)p=e[++c];else if(void 0===h)h=e[--u];else if(-1!==g&&g===v)Gr(p,m,n,i),p=e[++c],m=t[++l];else if(-1!==y&&y===I)Gr(h,f,n,i),h=e[--u],f=t[--d];else if(-1!==g&&g===I)r.insertBefore(p,h.nextSibling),Gr(p,f,n,i),p=e[++c],f=t[--d];else if(-1!==y&&y===v)r.insertBefore(h,p),Gr(h,m,n,i),h=e[--u],m=t[++l];else{if(!o){o={};for(let t=c;t<=u;t++){const r=e[t];r&&n.mirror.hasNode(r)&&(o[n.mirror.getId(r)]=t)}}if(a=o[i.getId(m)],a){const t=e[a];r.insertBefore(t,p),Gr(t,m,n,i),e[a]=void 0}else{const t=zr(m,n.mirror,i);"#document"===r.nodeName&&(null===(s=n.mirror.getMeta(t))||void 0===s?void 0:s.type)===Tr.Element&&r.documentElement&&(r.removeChild(r.documentElement),e[c]=void 0,p=void 0),r.insertBefore(t,p||null),Gr(t,m,n,i)}m=t[++l]}}if(c>u){const e=t[d+1];let s=null;for(e&&r.childNodes.forEach(t=>{n.mirror.getId(t)===i.getId(e)&&(s=t)});l<=d;++l){const e=zr(t[l],n.mirror,i);r.insertBefore(e,s),Gr(e,t[l],n,i)}}else if(l>d)for(;c<=u;c++){const t=e[c];t&&(r.removeChild(t),n.mirror.removeNodeFromMap(t))}}function zr(e,t,r){const n=r.getId(e),i=r.getMeta(e);let s=null;if(n>-1&&(s=t.getNode(n)),null!==s)return s;switch(e.RRNodeType){case Tr.Document:s=new Document;break;case Tr.DocumentType:s=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Tr.Element:{let t=e.tagName.toLowerCase();t=qr[t]||t,s=i&&"isSVG"in i&&(null==i?void 0:i.isSVG)?document.createElementNS(Vr.svg,t):document.createElement(e.tagName);break}case Tr.Text:s=document.createTextNode(e.data);break;case Tr.Comment:s=document.createComment(e.data);break;case Tr.CDATA:s=document.createCDATASection(e.data)}return i&&t.add(s,Object.assign({},i)),s}class Hr extends(function(e){return class t extends e{constructor(){super(...arguments),this.nodeType=Ur.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=Tr.Document,this.textContent=null}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===Tr.Element&&"HTML"===e.tagName)||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find(e=>e.RRNodeType===Tr.Element&&"BODY"===e.tagName))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find(e=>e.RRNodeType===Tr.Element&&"HEAD"===e.tagName))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===Tr.Element||t===Tr.DocumentType)&&this.childNodes.some(e=>e.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===Tr.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return e.parentElement=null,e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){const r=e.RRNodeType;if((r===Tr.Element||r===Tr.DocumentType)&&this.childNodes.some(e=>e.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===Tr.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(null===t)return this.appendChild(e);const n=this.childNodes.indexOf(t);if(-1==n)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(n,0,e),e.parentElement=null,e.parentNode=this,e}removeChild(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(t,1),e.parentElement=null,e.parentNode=null,e}open(){this.childNodes=[]}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,r,n){return new t}createDocumentType(e,t,r){const n=new(Pr(xr))(e,t,r);return n.ownerDocument=this,n}createElement(e){const t=new(Rr(xr))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(Fr(xr))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Lr(xr))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(jr(xr))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(xr)){constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new nn,this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,r){return new Hr}createDocumentType(e,t,r){const n=new Zr(e,t,r);return n.ownerDocument=this,n}createElement(e){const t=e.toUpperCase();let r;switch(t){case"AUDIO":case"VIDEO":r=new Yr(t);break;case"IFRAME":r=new Qr(t,this.mirror);break;case"CANVAS":r=new $r(t);break;case"STYLE":r=new Jr(t);break;default:r=new Kr(t)}return r.ownerDocument=this,r}createComment(e){const t=new en(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new tn(e);return t.ownerDocument=this,t}createTextNode(e){const t=new Xr(e);return t.ownerDocument=this,t}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Zr=Pr(xr);class Kr extends(Rr(xr)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class Yr extends(function(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}(Kr)){}class $r extends Kr{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class Jr extends Kr{constructor(){super(...arguments),this.rules=[]}}class Qr extends Kr{constructor(e,t){super(e),this.contentDocument=new Hr,this.contentDocument.mirror=t}}const Xr=Fr(xr),en=Lr(xr),tn=jr(xr);function rn(e,t,r,n){let i;switch(e.nodeType){case Ur.DOCUMENT_NODE:n&&"IFRAME"===n.nodeName?i=n.contentDocument:(i=t,i.compatMode=e.compatMode);break;case Ur.DOCUMENT_TYPE_NODE:{const r=e;i=t.createDocumentType(r.name,r.publicId,r.systemId);break}case Ur.ELEMENT_NODE:{const r=e,n=(s=r)instanceof HTMLFormElement?"FORM":s.tagName.toUpperCase();i=t.createElement(n);const o=i;for(const{name:e,value:t}of Array.from(r.attributes))o.attributes[e]=t;r.scrollLeft&&(o.scrollLeft=r.scrollLeft),r.scrollTop&&(o.scrollTop=r.scrollTop);break}case Ur.TEXT_NODE:i=t.createTextNode(e.textContent||"");break;case Ur.CDATA_SECTION_NODE:i=t.createCDATASection(e.data);break;case Ur.COMMENT_NODE:i=t.createComment(e.textContent||"");break;case Ur.DOCUMENT_FRAGMENT_NODE:i=n.attachShadow({mode:"open"});break;default:return null}var s;let o=r.getMeta(e);return t instanceof Hr&&(o||(o=sn(i,t.unserializedId),r.add(e,o)),t.mirror.add(i,Object.assign({},o))),i}class nn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function sn(e,t){switch(e.RRNodeType){case Tr.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case Tr.DocumentType:{const r=e;return{id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId}}case Tr.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case Tr.Text:case Tr.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case Tr.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function on(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map(function(e){e(r)}),(n=e.get("*"))&&n.slice().map(function(e){e(t,r)})}}}function an(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const r=e.HTMLElement||e.Element,n={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||a,scrollIntoView:r.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,s=(o=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(o)?1:0);var o;function a(e,t){this.scrollLeft=e,this.scrollTop=t}function c(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(e,t){return"Y"===t?e.clientHeight+s<e.scrollHeight:"X"===t?e.clientWidth+s<e.scrollWidth:void 0}function l(t,r){const n=e.getComputedStyle(t,null)["overflow"+r];return"auto"===n||"scroll"===n}function d(e){const t=u(e,"Y")&&l(e,"Y"),r=u(e,"X")&&l(e,"X");return t||r}function p(t){let r,n,s,o=(i()-t.startTime)/468;var a;o=o>1?1:o,a=o,r=.5*(1-Math.cos(Math.PI*a)),n=t.startX+(t.x-t.startX)*r,s=t.startY+(t.y-t.startY)*r,t.method.call(t.scrollable,n,s),n===t.x&&s===t.y||e.requestAnimationFrame(p.bind(e,t))}function h(r,s,o){let c,u,l,d;const h=i();r===t.body?(c=e,u=e.scrollX||e.pageXOffset,l=e.scrollY||e.pageYOffset,d=n.scroll):(c=r,u=r.scrollLeft,l=r.scrollTop,d=a),p({scrollable:c,method:d,startTime:h,startX:u,startY:l,x:s,y:o})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?h.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):n.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(c(arguments[0])?n.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},r.prototype.scroll=r.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===c(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void n.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},r.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):n.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},r.prototype.scrollIntoView=function(){if(!0===c(arguments[0]))return void n.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const r=function(e){for(;e!==t.body&&!1===d(e);)e=e.parentNode||e.host;return e}(this),i=r.getBoundingClientRect(),s=this.getBoundingClientRect();r!==t.body?(h.call(this,r,r.scrollLeft+s.left-i.left,r.scrollTop+s.top-i.top),"fixed"!==e.getComputedStyle(r).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:s.left,top:s.top,behavior:"smooth"})}}class cn{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed,this.liveMode=t.liveMode}addAction(e){if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)return void this.actions.push(e);const t=this.findActionIndex(e);this.actions.splice(t,0,e)}start(){this.timeOffset=0;let e=performance.now();const t=()=>{const r=performance.now();for(this.timeOffset+=(r-e)*this.speed,e=r;this.actions.length;){const e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}(this.actions.length>0||this.liveMode)&&(this.raf=requestAnimationFrame(t))};this.raf=requestAnimationFrame(t)}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}toggleLiveMode(e){this.liveMode=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){const n=Math.floor((t+r)/2);if(this.actions[n].delay<e.delay)t=n+1;else{if(!(this.actions[n].delay>e.delay))return n+1;r=n-1}}return t}}function un(e,t){if(e.type===he.IncrementalSnapshot&&e.data.source===me.MouseMove&&e.data.positions&&e.data.positions.length){const r=e.data.positions[0].timeOffset,n=e.timestamp+r;return e.delay=n-t,n-t}return e.delay=e.timestamp-t,e.delay}function ln(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}var dn;!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(dn||(dn={}));var pn={type:"xstate.init"};function hn(e){return void 0===e?[]:[].concat(e)}function mn(e){return{type:"xstate.assign",assignment:e}}function fn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function gn(e){return function(t){return e===t}}function yn(e){return"string"==typeof e?{type:e}:e}function vn(e,t){return{value:e,context:t,actions:[],changed:!1,matches:gn(e)}}function In(e,t,r){var n=t,i=!1;return[e.filter(function(e){if("xstate.assign"===e.type){i=!0;var t=Object.assign({},n);return"function"==typeof e.assignment?t=e.assignment(n,r):Object.keys(e.assignment).forEach(function(i){t[i]="function"==typeof e.assignment[i]?e.assignment[i](n,r):e.assignment[i]}),n=t,!1}return!0}),n,i]}function bn(e,t){void 0===t&&(t={});var r=ln(In(hn(e.states[e.initial].entry).map(function(e){return fn(e,t.actions)}),e.context,pn),2),n=r[0],i=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:gn(e.initial)},transition:function(t,r){var n,i,o="string"==typeof t?{value:t,context:e.context}:t,a=o.value,c=o.context,u=yn(r),l=e.states[a];if(l.on){var d=hn(l.on[u.type]);try{for(var p=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),h=p.next();!h.done;h=p.next()){var m=h.value;if(void 0===m)return vn(a,c);var f="string"==typeof m?{target:m}:m,g=f.target,y=f.actions,v=void 0===y?[]:y,I=f.cond,b=void 0===I?function(){return!0}:I,S=void 0===g,w=null!=g?g:a,C=e.states[w];if(b(c,u)){var k=ln(In((S?hn(v):[].concat(l.exit,v,C.entry).filter(function(e){return e})).map(function(e){return fn(e,s._options.actions)}),c,u),3),T=k[0],_=k[1],A=k[2],O=null!=g?g:a;return{value:O,context:_,actions:T,changed:g!==a||T.length>0||A,matches:gn(O)}}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}return vn(a,c)}};return s}var Sn=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function wn(e){var t=e.initialState,r=dn.NotStarted,n=new Set,i={_machine:e,send:function(i){r===dn.Running&&(t=e.transition(t,i),Sn(t,yn(i)),n.forEach(function(e){return e(t)}))},subscribe:function(e){return n.add(e),e(t),{unsubscribe:function(){return n.delete(e)}}},start:function(n){if(n){var s="object"==typeof n?n:{context:e.config.context,value:n};t={value:s.value,actions:[],context:s.context,matches:gn(s.value)}}return r=dn.Running,Sn(t,pn),i},stop:function(){return r=dn.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}const Cn=new Map;function kn(e,t){let r=Cn.get(e);return r||(r=new Map,Cn.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function Tn(e,t,r){return n=>ze(this,void 0,void 0,function*(){if(n&&"object"==typeof n&&"rr_type"in n){if(r&&(r.isUnchanged=!1),"ImageBitmap"===n.rr_type&&"args"in n){const i=yield Tn(e,t,r)(n.args);return yield createImageBitmap.apply(null,i)}if("index"in n){if(r||null===t)return n;const{rr_type:e,index:i}=n;return kn(t,e)[i]}if("args"in n){const{rr_type:i,args:s}=n;return new(0,window[i])(...yield Promise.all(s.map(Tn(e,t,r))))}if("base64"in n)return function(e){var t,r,n,i,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),l=new Uint8Array(u);for(t=0;t<a;t+=4)r=Ze[e.charCodeAt(t)],n=Ze[e.charCodeAt(t+1)],i=Ze[e.charCodeAt(t+2)],s=Ze[e.charCodeAt(t+3)],l[c++]=r<<2|n>>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&s;return u}(n.base64);if("src"in n){const t=e.get(n.src);if(t)return t;{const t=new Image;return t.src=n.src,e.set(n.src,t),t}}if("data"in n&&"Blob"===n.rr_type){const i=yield Promise.all(n.data.map(Tn(e,t,r)));return new Blob(i,{type:n.type})}}else if(Array.isArray(n))return yield Promise.all(n.map(Tn(e,t,r)));return n})}const _n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function An({mutation:e,target:t,type:r,imageMap:n,errorHandler:i}){return ze(this,void 0,void 0,function*(){try{const i=function(e,t){try{return t===ge.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,r);if(!i)return;if(e.setter)return void(i[e.property]=e.args[0]);const s=i[e.property],o=yield Promise.all(e.args.map(Tn(n,i)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:r}=t.constructor;if(!_n.includes(r))return;const n=kn(e,r);n.includes(t)||n.push(t)}(i,s.apply(i,o))}catch(t){i(e,t)}})}function On({event:e,mutation:t,target:r,imageMap:n,errorHandler:i}){return ze(this,void 0,void 0,function*(){try{const i=r.getContext("2d");if(t.setter)return void(i[t.property]=t.args[0]);const s=i[t.property];if("drawImage"===t.property&&"string"==typeof t.args[0])n.get(e),s.apply(i,t.args);else{const e=yield Promise.all(t.args.map(Tn(n,i)));s.apply(i,e)}}catch(e){i(t,e)}})}function En({event:e,mutation:t,target:r,imageMap:n,canvasEventMap:i,errorHandler:s}){return ze(this,void 0,void 0,function*(){try{const o=i.get(e)||t,a="commands"in o?o.commands:[o];if([ge.WebGL,ge.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const i=a[e];yield An({mutation:i,type:t.type,target:r,imageMap:n,errorHandler:s})}return}for(let t=0;t<a.length;t++){const i=a[t];yield On({event:e,mutation:i,target:r,imageMap:n,errorHandler:s})}}catch(e){s(t,e)}})}const Mn=on||s,Nn="[replayer]",Dn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function xn(e){return e.type==he.IncrementalSnapshot&&(e.data.source==me.TouchMove||e.data.source==me.MouseInteraction&&e.data.type==fe.TouchStart)}class Pn{constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new Hr,this.mouseTail=null,this.tailPositions=[],this.emitter=Mn(),this.legacy_missingNodeRetryMap={},this.cache=V(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=p(),this.styleMirror=new pe,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case he.DomContentLoaded:case he.Load:case he.Custom:continue;case he.FullSnapshot:case he.Meta:case he.Plugin:case he.IncrementalSnapshot:}this.getCastFn(t,!0)()}!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null},this.getCastFn=(e,t=!1)=>{let r;switch(e.type){case he.DomContentLoaded:case he.Load:break;case he.Custom:r=()=>{this.emitter.emit(ye.CustomEvent,e)};break;case he.Meta:r=()=>this.emitter.emit(ye.Resize,{width:e.data.width,height:e.data.height});break;case he.FullSnapshot:r=()=>{var r;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(r=this.iframe.contentWindow)||void 0===r||r.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case he.IncrementalSnapshot:r=()=>{if(this.applyIncremental(e,t),!t&&(e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay,r={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:r}),this.emitter.emit(ye.SkipStart,r)}}}}return()=>{r&&r();for(const r of this.config.plugins||[])r.handler&&r.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const n=this.service.state.context.events.length-1;if(e===this.service.state.context.events[n]){const t=()=>{n<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(ye.Finish))};e.type===he.IncrementalSnapshot&&e.data.source===me.MouseMove&&e.data.positions.length?setTimeout(()=>{t()},Math.max(0,50-e.data.positions[0].timeOffset)):t()}this.emitter.emit(ye.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Dn,useVirtualDom:!0};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(ye.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(ye.Flush,()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,r)=>{En({event:e,mutation:t,target:r,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===me.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===me.StyleDeclaration&&this.applyStyleDeclaration(e,t)}};if(this.iframe.contentDocument&&Gr(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const r=this.legacy_missingNodeRetryMap[t],n=zr(r.node,this.mirror,this.virtualDom.mirror);Gr(n,r.node,e,this.virtualDom.mirror),r.node=n}catch(e){this.config.showWarning&&console.warn(e)}this.constructedStyleMutations.forEach(e=>{this.applyStyleSheetMutation(e)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(e=>{this.applyAdoptedStyleSheet(e)}),this.adoptedStyleSheets=[]}this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(ye.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});const n=new cn([],{speed:this.config.speed,liveMode:this.config.liveMode});this.service=function(e,{getCastFn:t,applyEventsSynchronously:r,emitter:n}){const i=bn({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:mn({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:mn((e,t)=>{let r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})}),play(e){var i;const{timer:s,events:o,baselineTime:a,lastPlayedEvent:c}=e;s.clear();for(const e of o)un(e,a);const u=function(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.type===he.Meta&&n.timestamp<=t)return e.slice(r)}return e}(o,a);let l=null==c?void 0:c.timestamp;(null==c?void 0:c.type)===he.IncrementalSnapshot&&c.data.source===me.MouseMove&&(l=c.timestamp+(null===(i=c.data.positions[0])||void 0===i?void 0:i.timeOffset)),a<(l||0)&&n.emit(ye.PlayBack);const d=new Array;for(const e of u)if(!(l&&l<a&&(e.timestamp<=l||e===c)))if(e.timestamp<a)d.push(e);else{const r=t(e,!1);s.addAction({doAction:()=>{r()},delay:e.delay})}r(d),n.emit(ye.Flush),s.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:mn(e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null})),startLive:mn({baselineTime:(e,t)=>(e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:mn((e,r)=>{const{baselineTime:n,timer:i,events:s}=e;if("ADD_EVENT"===r.type){const{event:e}=r.payload;un(e,n);let o=s.length-1;if(!s[o]||s[o].timestamp<=e.timestamp)s.push(e);else{let t=-1,r=0;for(;r<=o;){const t=Math.floor((r+o)/2);s[t].timestamp<=e.timestamp?r=t+1:o=t-1}-1===t&&(t=r),s.splice(t,0,e)}const a=e.timestamp<n,c=t(e,a);a?c():i.isActive()&&i.addAction({doAction:()=>{c()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:s})})}});return wn(i)}({events:e.map(e=>t&&t.unpackFn?t.unpackFn(e):e).sort((e,t)=>e.timestamp-t.timestamp),timer:n,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(e=>{this.emitter.emit(ye.StateChange,{player:e})}),this.speedService=wn(bn({id:"speed",context:{normalSpeed:-1,timer:n},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:mn({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe(e=>{this.emitter.emit(ye.StateChange,{speed:e})});const i=this.service.state.context.events.find(e=>e.type===he.Meta),s=this.service.state.context.events.find(e=>e.type===he.FullSnapshot);if(i){const{width:e,height:t}=i.data;setTimeout(()=>{this.emitter.emit(ye.Resize,{width:e,height:t})},0)}s&&setTimeout(()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=s,this.rebuildFullSnapshot(s),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(s.data.initialOffset))},1),this.service.state.context.events.find(xn)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(r=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===r||r.classList.remove("rrweb-paused"),this.emitter.emit(ye.Start)}pause(e){var t,r;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(r=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===r||r.classList.add("rrweb-paused"),this.emitter.emit(ye.Pause)}resume(e=0){console.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(ye.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(ye.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;xn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=V()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(an(this.iframe.contentWindow,this.iframe.contentDocument),re(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const r=[],n=(e,t)=>{this.collectIframeAndAttachDocument(r,e);for(const r of this.config.plugins||[])r.onBuild&&r.onBuild(e,{id:t,replayer:this})};(function(e,t){var r=t.doc,n=t.onVisit,s=t.hackCss,o=void 0===s||s,a=t.afterAppend,c=t.cache,u=t.mirror,l=void 0===u?new d:u,p=q(e,{doc:r,mirror:l,skipChild:!1,hackCss:o,afterAppend:a,cache:c});(function(e,t){function r(e){t(e)}for(var n=0,i=e.getIds();n<i.length;n++){var s=i[n];e.has(s)&&r(e.getNode(s))}})(l,function(e){n&&n(e),function(e,t){var r=t.getMeta(e);if((null==r?void 0:r.type)===i.Element){var n=e;for(var s in r.attributes)if(Object.prototype.hasOwnProperty.call(r.attributes,s)&&s.startsWith("rr_")){var o=r.attributes[s];"rr_scrollLeft"===s&&(n.scrollLeft=o),"rr_scrollTop"===s&&(n.scrollTop=o)}}}(e,l)})})(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of r)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==e);const{documentElement:s,head:o}=this.iframe.contentDocument;this.insertStyleRules(s,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(ye.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;const n=(i=this.config.blockClass,[`.${i} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var i;if(this.config.pauseAnimation&&n.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const r=this.virtualDom.createElement("style");this.virtualDom.mirror.add(r,sn(r,this.virtualDom.unserializedId)),e.insertBefore(r,t),r.rules.push({source:me.StyleSheetRule,adds:n.map((e,t)=>({rule:e,index:t}))})}else{const i=document.createElement("style");e.insertBefore(i,t);for(let e=0;e<n.length;e++)null===(r=i.sheet)||void 0===r||r.insertRule(n[e],e)}}attachDocumentToIframe(e,t){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,n=[],s=(e,s)=>{this.collectIframeAndAttachDocument(n,e);const o=r.getMeta(e);if((null==o?void 0:o.type)===i.Element&&"HTML"===(null==o?void 0:o.tagName.toUpperCase())){const{documentElement:e,head:r}=t.contentDocument;this.insertStyleRules(e,r)}for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:s,replayer:this})};q(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:s,cache:this.cache}),s(t.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==e)}collectIframeAndAttachDocument(e,t){if(se(t,this.mirror)){const r=this.newDocumentQueue.find(e=>e.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let r,n=this.service.state;const i=()=>{n=this.service.state};this.emitter.on(ye.Start,i),this.emitter.on(ye.Pause,i);const s=()=>{this.emitter.off(ye.Start,i),this.emitter.off(ye.Pause,i)};t.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{t.sheet||(e.add(t),t.addEventListener("load",()=>{e.delete(t),0===e.size&&-1!==r&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(ye.LoadStylesheetEnd),r&&clearTimeout(r),s())}))}),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(ye.LoadStylesheetStart),r=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),r=-1,s()},this.config.loadTimeout))}}preloadAllImages(){return ze(this,void 0,void 0,function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(ye.Start,e),this.emitter.on(ye.Pause,e);const t=[];for(const e of this.service.state.context.events)e.type===he.IncrementalSnapshot&&e.data.source===me.CanvasMutation&&(t.push(this.deserializeAndPreloadCanvasEvents(e.data,e)),("commands"in e.data?e.data.commands:[e.data]).forEach(t=>{this.preloadImages(t,e)}));return Promise.all(t)})}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),r=t.getContext("2d"),n=null==r?void 0:r.createImageData(t.width,t.height);null==n||n.data,JSON.parse(e.args[0]),null==r||r.putImageData(n,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return ze(this,void 0,void 0,function*(){if(!this.canvasEventMap.has(t)){const r={isUnchanged:!0};if("commands"in e){const n=yield Promise.all(e.commands.map(e=>ze(this,void 0,void 0,function*(){const t=yield Promise.all(e.args.map(Tn(this.imageMap,null,r)));return Object.assign(Object.assign({},e),{args:t})})));!1===r.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:n}))}else{const n=yield Promise.all(e.args.map(Tn(this.imageMap,null,r)));!1===r.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:n}))}}})}applyIncremental(e,t){var r,n,i;const{data:s}=e;switch(s.source){case me.Mutation:try{this.applyMutation(s,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,s)}break;case me.Drag:case me.TouchMove:case me.MouseMove:if(t){const e=s.positions[s.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:s}}else s.positions.forEach(r=>{const n={doAction:()=>{this.moveAndHover(r.x,r.y,r.id,t,s)},delay:r.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(n)}),this.timer.addAction({doAction(){},delay:e.delay-(null===(r=s.positions[0])||void 0===r?void 0:r.timeOffset)});break;case me.MouseInteraction:{if(-1===s.id||t)break;const e=new Event(fe[s.type].toLowerCase()),r=this.mirror.getNode(s.id);if(!r)return this.debugNodeNotFound(s,s.id);this.emitter.emit(ye.MouseInteraction,{type:s.type,target:r});const{triggerFocus:n}=this.config;switch(s.type){case fe.Blur:"blur"in r&&r.blur();break;case fe.Focus:n&&r.focus&&r.focus({preventScroll:!0});break;case fe.Click:case fe.TouchStart:case fe.TouchEnd:t?(s.type===fe.TouchStart?this.touchActive=!0:s.type===fe.TouchEnd&&(this.touchActive=!1),this.mousePos={x:s.x,y:s.y,id:s.id,debugData:s}):(s.type===fe.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(s.x,s.y,s.id,t,s),s.type===fe.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):s.type===fe.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):s.type===fe.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case fe.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:r.dispatchEvent(e)}break}case me.Scroll:if(-1===s.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);e.scrollData=s;break}this.applyScroll(s,t);break;case me.ViewportResize:this.emitter.emit(ye.Resize,{width:s.width,height:s.height});break;case me.Input:if(-1===s.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);e.inputData=s;break}this.applyInput(s);break;case me.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(s.id):this.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);const t=e;try{s.currentTime&&(t.currentTime=s.currentTime),s.volume&&(t.volume=s.volume),s.muted&&(t.muted=s.muted),1===s.type&&t.pause(),0===s.type&&t.play(),4===s.type&&(t.playbackRate=s.playbackRate)}catch(e){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case me.StyleSheetRule:case me.StyleDeclaration:this.usingVirtualDom?s.styleId?this.constructedStyleMutations.push(s):s.id&&(null===(n=this.virtualDom.mirror.getNode(s.id))||void 0===n||n.rules.push(s)):this.applyStyleSheetMutation(s);break;case me.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(s.id);if(!t)return this.debugNodeNotFound(s,s.id);t.canvasMutations.push({event:e,mutation:s})}else{const t=this.mirror.getNode(s.id);if(!t)return this.debugNodeNotFound(s,s.id);En({event:e,mutation:s,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case me.Font:try{const e=new FontFace(s.family,s.buffer?new Uint8Array(JSON.parse(s.fontSource)):s.fontSource,s.descriptors);null===(i=this.iframe.contentDocument)||void 0===i||i.fonts.add(e)}catch(e){this.config.showWarning&&console.warn(e)}break;case me.Selection:if(t){this.lastSelectionData=s;break}this.applySelection(s);break;case me.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(s):this.applyAdoptedStyleSheet(s)}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,function(e,t=function(){return new _r}(),r=new Hr){(function e(n,i){const s=rn(n,r,t,i);if(null!==s)if("IFRAME"!==(null==i?void 0:i.nodeName)&&n.nodeType!==Ur.DOCUMENT_FRAGMENT_NODE&&(null==i||i.appendChild(s),s.parentNode=i,s.parentElement=i),"IFRAME"===n.nodeName){const t=n.contentDocument;t&&e(t,s)}else n.nodeType!==Ur.DOCUMENT_NODE&&n.nodeType!==Ur.ELEMENT_NODE&&n.nodeType!==Ur.DOCUMENT_FRAGMENT_NODE||(n.nodeType===Ur.ELEMENT_NODE&&n.shadowRoot&&e(n.shadowRoot,s),n.childNodes.forEach(t=>e(t,s)))})(e,null)}(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],r=rn(t.node,this.virtualDom,this.mirror);r&&(t.node=r)}catch(e){this.config.showWarning&&console.warn(e)}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes.forEach(t=>{var n;const i=r.getNode(t.id);if(!i){if(e.removes.find(e=>e.id===t.parentId))return;return this.warnNodeNotFound(e,t.id)}let s=r.getNode(t.parentId);if(!s)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&ce(s)&&(s=s.shadowRoot),r.removeNodeFromMap(i),s)try{s.removeChild(i),this.usingVirtualDom&&"#text"===i.nodeName&&"STYLE"===s.nodeName&&(null===(n=s.rules)||void 0===n?void 0:n.length)>0&&(s.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",s,i,e)}});const n=Object.assign({},this.legacy_missingNodeRetryMap),s=[],o=e=>{var t;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let o=r.getNode(e.parentId);if(!o)return e.node.type===i.Document?this.newDocumentQueue.push(e):s.push(e);e.node.isShadow&&(ce(o)||o.attachShadow({mode:"open"}),o=o.shadowRoot);let a=null,c=null;if(e.previousId&&(a=r.getNode(e.previousId)),e.nextId&&(c=r.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=r.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return s.push(e);if(e.node.rootId&&!r.getNode(e.node.rootId))return;const u=e.node.rootId?r.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(se(o,r))return void this.attachDocumentToIframe(e,o);const l=(e,t)=>{for(const r of this.config.plugins||[])r.onBuild&&r.onBuild(e,{id:t,replayer:this})},d=q(e.node,{doc:u,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:l});if(-1===e.previousId||-1===e.nextId)return void(n[e.node.id]={node:d,mutation:e});const p=r.getMeta(o);if(p&&p.type===i.Element&&"textarea"===p.tagName&&e.node.type===i.Text){const e=Array.isArray(o.childNodes)?o.childNodes:Array.from(o.childNodes);for(const t of e)t.nodeType===o.TEXT_NODE&&o.removeChild(t)}if(a&&a.nextSibling&&a.nextSibling.parentNode)o.insertBefore(d,a.nextSibling);else if(c&&c.parentNode)o.contains(c)?o.insertBefore(d,c):o.insertBefore(d,null);else{if(o===u)for(;u.firstChild;)u.removeChild(u.firstChild);o.appendChild(d)}if(l(d,e.node.id),this.usingVirtualDom&&"#text"===d.nodeName&&"STYLE"===o.nodeName&&(null===(t=o.rules)||void 0===t?void 0:t.length)>0&&(o.rules=[]),se(d,this.mirror)){const e=this.mirror.getId(d),t=this.newDocumentQueue.find(t=>t.parentId===e);t&&(this.attachDocumentToIframe(t,d),this.newDocumentQueue=this.newDocumentQueue.filter(e=>e!==t))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(n,o,d,e)};e.adds.forEach(e=>{o(e)});const a=Date.now();for(;s.length;){const e=ne(s);if(s.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e)r.getNode(t.value.parentId)?ie(t,e=>{o(e)}):this.debug("Drop resolve tree since there is no parent for the root node.",t)}Object.keys(n).length&&Object.assign(this.legacy_missingNodeRetryMap,n),de(e.texts).forEach(t=>{var n;const i=r.getNode(t.id);if(!i){if(e.removes.find(e=>e.id===t.id))return;return this.warnNodeNotFound(e,t.id)}if(i.textContent=t.value,this.usingVirtualDom){const e=i.parentNode;(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.length)>0&&(e.rules=[])}}),e.attributes.forEach(t=>{const n=r.getNode(t.id);if(!n){if(e.removes.find(e=>e.id===t.id))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const i=t.attributes[e];if(null===i)n.removeAttribute(e);else if("string"==typeof i)try{if("_cssText"===e&&("LINK"===n.nodeName||"STYLE"===n.nodeName))try{const e=r.getMeta(n);Object.assign(e.attributes,t.attributes);const i=q(e,{doc:n.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache}),s=n.nextSibling,o=n.parentNode;if(i&&o){o.removeChild(n),o.insertBefore(i,s),r.replace(t.id,i);break}}catch(e){}n.setAttribute(e,i)}catch(e){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=i,t=n;for(const r in e)if(!1===e[r])t.style.removeProperty(r);else if(e[r]instanceof Array){const n=e[r];t.style.setProperty(r,n[0],n[1])}else{const n=e[r];t.style.setProperty(r,n)}}}})}applyScroll(e,t){var r,n;const s=this.mirror.getNode(e.id);if(!s)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(s);if(s===this.iframe.contentDocument)null===(r=this.iframe.contentWindow)||void 0===r||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if((null==o?void 0:o.type)===i.Document)null===(n=s.defaultView)||void 0===n||n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{s.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,r=e.ranges.map(({start:e,startOffset:r,end:n,endOffset:i})=>{const s=this.mirror.getNode(e),o=this.mirror.getNode(n);if(!s||!o)return;const a=new Range;a.setStart(s,r),a.setEnd(o,i);const c=s.ownerDocument,u=null==c?void 0:c.getSelection();return u&&t.add(u),{range:a,selection:u}});t.forEach(e=>e.removeAllRanges()),r.forEach(e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))})}catch(e){}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),r&&(e.source===me.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===me.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,n,i,s;if(null===(r=e.adds)||void 0===r||r.forEach(({rule:e,index:r})=>{try{if(Array.isArray(r)){const{positions:n,index:i}=le(r);ue(t.cssRules,n).insertRule(e,i)}else{const n=void 0===r?void 0:Math.min(r,t.cssRules.length);null==t||t.insertRule(e,n)}}catch(e){}}),null===(n=e.removes)||void 0===n||n.forEach(({index:e})=>{try{if(Array.isArray(e)){const{positions:r,index:n}=le(e);ue(t.cssRules,r).deleteRule(n||0)}else null==t||t.deleteRule(e)}catch(e){}}),e.replace)try{null===(i=t.replace)||void 0===i||i.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(s=t.replaceSync)||void 0===s||s.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){e.set&&ue(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&ue(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const r=this.mirror.getNode(e.id);if(!r)return;null===(t=e.styles)||void 0===t||t.forEach(e=>{var t;let n=null,i=null;if(ce(r)?i=(null===(t=r.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===r.nodeName&&(i=r.defaultView),i)try{n=new i.CSSStyleSheet,this.styleMirror.add(n,e.styleId),this.applyStyleSheetRule({source:me.StyleSheetRule,adds:e.rules},n)}catch(e){}});let n=0;const i=(e,t)=>{const r=t.map(e=>this.styleMirror.getStyle(e)).filter(e=>null!==e);ce(e)?e.shadowRoot.adoptedStyleSheets=r:"#document"===e.nodeName&&(e.adoptedStyleSheets=r),r.length!==t.length&&n<10&&(setTimeout(()=>i(e,t),0+100*n),n++)};i(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,n){const{previousId:i,nextId:s}=n,o=i&&e[i],a=s&&e[s];if(o){const{node:n,mutation:i}=o;t.insertBefore(n,r),delete e[i.node.id],delete this.legacy_missingNodeRetryMap[i.node.id],(i.previousId||i.nextId)&&this.legacy_resolveMissingNode(e,t,n,i)}if(a){const{node:n,mutation:i}=a;t.insertBefore(n,r.nextSibling),delete e[i.node.id],delete this.legacy_missingNodeRetryMap[i.node.id],(i.previousId||i.nextId)&&this.legacy_resolveMissingNode(e,t,n,i)}}moveAndHover(e,t,r,n,i){const s=this.mirror.getNode(r);if(!s)return this.debugNodeNotFound(i,r);const o=ae(s,this.iframe),a=e*o.absoluteScale+o.x,c=t*o.absoluteScale+o.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,n||this.drawMouseTail({x:a,y:c}),this.hoverElements(s)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:r,strokeStyle:n,duration:i}=!0===this.config.mouseTail?Dn:Object.assign({},Dn,this.config.mouseTail),s=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=r,e.lineCap=t,e.strokeStyle=n,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(t=>e.lineTo(t.x,t.y)),e.stroke())};this.tailPositions.push(e),s(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(t=>t!==e),s()},i/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach(e=>{e.classList.remove(":hover")});let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type===he.IncrementalSnapshot&&e.data.source>me.Mutation&&e.data.source<=me.Input}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(ye.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(Nn,`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&console.warn(Nn,...e)}debug(...e){this.config.showDebug&&console.log(Nn,...e)}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(8156);return n.default})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FlowGridSDK=t():e.FlowGridSDK=t()}(this,()=>(()=>{var e={8156(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.resetCartId=t.getOrCreateCartId=t.getOrCreateAnonId=t.ConsentManager=t.IdentityManager=t.getUTMHistory=t.getUTM=t.getWebId=t.getSessionId=t.getVisitorId=t.getCookie=t.Forecasting=t.SecurityAnalytics=t.AlertsAnalytics=t.PathAnalytics=t.AcquisitionAnalytics=t.SupportAnalytics=t.MultiPathFunnels=t.Monetization=t.ChurnAnalytics=t.Cohorts=t.Engagement=t.FlowGridTransport=t.Subscriptions=t.SearchAnalytics=t.CustomerLTV=t.WishlistTracking=t.Promotions=t.Refunds=t.Purchases=t.Checkout=t.CartTracking=t.Products=t.SessionReplay=t.Performance=t.PerformanceTracking=t.Heatmaps=t.Attribution=t.Retention=t.Funnels=t.Identify=t.Events=t.Sessions=t.PageViews=t.Experiment=t.TrackPrompt=t.TrackFeature=t.Activation=t.default=t.FlowGrid=void 0,t.attachConsentBanner=t.setupConsent=void 0;var i=r(7138);Object.defineProperty(t,"FlowGrid",{enumerable:!0,get:function(){return i.FlowGrid}});var s=r(7138);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n(s).default}});var o=r(7244);Object.defineProperty(t,"Activation",{enumerable:!0,get:function(){return o.Activation}}),Object.defineProperty(t,"TrackFeature",{enumerable:!0,get:function(){return o.TrackFeature}}),Object.defineProperty(t,"TrackPrompt",{enumerable:!0,get:function(){return o.TrackPrompt}}),Object.defineProperty(t,"Experiment",{enumerable:!0,get:function(){return o.Experiment}});var a=r(8597);Object.defineProperty(t,"PageViews",{enumerable:!0,get:function(){return a.PageViews}}),Object.defineProperty(t,"Sessions",{enumerable:!0,get:function(){return a.Sessions}}),Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return a.Events}}),Object.defineProperty(t,"Identify",{enumerable:!0,get:function(){return a.Identify}}),Object.defineProperty(t,"Funnels",{enumerable:!0,get:function(){return a.Funnels}}),Object.defineProperty(t,"Retention",{enumerable:!0,get:function(){return a.Retention}}),Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return a.Attribution}}),Object.defineProperty(t,"Heatmaps",{enumerable:!0,get:function(){return a.Heatmaps}}),Object.defineProperty(t,"PerformanceTracking",{enumerable:!0,get:function(){return a.PerformanceTracking}}),Object.defineProperty(t,"Performance",{enumerable:!0,get:function(){return a.PerformanceTracking}}),Object.defineProperty(t,"SessionReplay",{enumerable:!0,get:function(){return a.SessionReplay}});var c=r(5405);Object.defineProperty(t,"Products",{enumerable:!0,get:function(){return c.Products}}),Object.defineProperty(t,"CartTracking",{enumerable:!0,get:function(){return c.CartTracking}}),Object.defineProperty(t,"Checkout",{enumerable:!0,get:function(){return c.Checkout}}),Object.defineProperty(t,"Purchases",{enumerable:!0,get:function(){return c.Purchases}}),Object.defineProperty(t,"Refunds",{enumerable:!0,get:function(){return c.Refunds}}),Object.defineProperty(t,"Promotions",{enumerable:!0,get:function(){return c.Promotions}}),Object.defineProperty(t,"WishlistTracking",{enumerable:!0,get:function(){return c.WishlistTracking}}),Object.defineProperty(t,"CustomerLTV",{enumerable:!0,get:function(){return c.CustomerLTV}}),Object.defineProperty(t,"SearchAnalytics",{enumerable:!0,get:function(){return c.SearchAnalytics}}),Object.defineProperty(t,"Subscriptions",{enumerable:!0,get:function(){return c.Subscriptions}});var u=r(5975);Object.defineProperty(t,"FlowGridTransport",{enumerable:!0,get:function(){return u.FlowGridTransport}});var l=r(7736);Object.defineProperty(t,"Engagement",{enumerable:!0,get:function(){return l.Engagement}}),Object.defineProperty(t,"Cohorts",{enumerable:!0,get:function(){return l.Cohorts}}),Object.defineProperty(t,"ChurnAnalytics",{enumerable:!0,get:function(){return l.ChurnAnalytics}}),Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return l.Monetization}}),Object.defineProperty(t,"MultiPathFunnels",{enumerable:!0,get:function(){return l.MultiPathFunnels}}),Object.defineProperty(t,"SupportAnalytics",{enumerable:!0,get:function(){return l.SupportAnalytics}}),Object.defineProperty(t,"AcquisitionAnalytics",{enumerable:!0,get:function(){return l.AcquisitionAnalytics}}),Object.defineProperty(t,"PathAnalytics",{enumerable:!0,get:function(){return l.PathAnalytics}}),Object.defineProperty(t,"AlertsAnalytics",{enumerable:!0,get:function(){return l.AlertsAnalytics}}),Object.defineProperty(t,"SecurityAnalytics",{enumerable:!0,get:function(){return l.SecurityAnalytics}}),Object.defineProperty(t,"Forecasting",{enumerable:!0,get:function(){return l.Forecasting}});var d=r(4211);Object.defineProperty(t,"getCookie",{enumerable:!0,get:function(){return d.getCookie}}),Object.defineProperty(t,"getVisitorId",{enumerable:!0,get:function(){return d.getVisitorId}}),Object.defineProperty(t,"getSessionId",{enumerable:!0,get:function(){return d.getSessionId}}),Object.defineProperty(t,"getWebId",{enumerable:!0,get:function(){return d.getWebId}}),Object.defineProperty(t,"getUTM",{enumerable:!0,get:function(){return d.getUTM}}),Object.defineProperty(t,"getUTMHistory",{enumerable:!0,get:function(){return d.getUTMHistory}});var p=r(5558);Object.defineProperty(t,"IdentityManager",{enumerable:!0,get:function(){return p.IdentityManager}});var h=r(4513);Object.defineProperty(t,"ConsentManager",{enumerable:!0,get:function(){return h.ConsentManager}});var m=r(1134);Object.defineProperty(t,"getOrCreateAnonId",{enumerable:!0,get:function(){return m.getOrCreateAnonId}}),Object.defineProperty(t,"getOrCreateCartId",{enumerable:!0,get:function(){return m.getOrCreateCartId}}),Object.defineProperty(t,"resetCartId",{enumerable:!0,get:function(){return m.resetCartId}}),Object.defineProperty(t,"setupConsent",{enumerable:!0,get:function(){return m.setupConsent}}),Object.defineProperty(t,"attachConsentBanner",{enumerable:!0,get:function(){return m.attachConsentBanner}})},5975(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlowGridTransport=void 0;const n=r(4211);class i{constructor(e,t,r,n,i,s){if(!e?.trim()||!t?.trim())throw new Error("SDK init failed: webId and endpoint are required.");this.webId=e.trim(),this.endpoint=this.normalizeEndpoint(t),this.apiKey=r,this.identityManager=i,this.visitorId=n??"",this.transportConfig={botDetection:s?.botDetection??"block",respectDNT:s?.respectDNT??!0,sampleRate:s?.sampleRate??1},this.drainEventBuffer()}static setConsent(e){Object.assign(i.consent,e)}static hasConsent(e){return i.consent[e]??!1}static isLikelyBot(){return!("undefined"==typeof navigator||!navigator.webdriver&&!/bot|crawl|spider|headless|phantom|puppeteer/i.test(navigator.userAgent))}isDNTEnabled(){return"undefined"!=typeof navigator&&(!!navigator.globalPrivacyControl||"1"===navigator.doNotTrack)}static getDeviceContext(){if("undefined"==typeof window||"undefined"==typeof navigator)return{};const e=window.location,t="undefined"!=typeof document?document:void 0;return{_screen_width:window.screen?.width,_screen_height:window.screen?.height,_device_type:/Mobi|Android/i.test(navigator.userAgent)?"mobile":"desktop",_language:navigator.language,_url:e?.href,_page:e?.pathname,_referrer:t?.referrer||void 0,_title:t?.title||void 0,...i.getUtmContext()}}static getUtmContext(){if("undefined"==typeof window)return{};let e=null;try{e=new URLSearchParams(window.location?.search??"")}catch{e=null}const t={};for(const r of i.ATTRIBUTION_KEYS){const i=e?.get(r)||(0,n.getCookie)(`__flowgrid_${r}`);i&&(t[`_${r}`]=i)}return t}sendViaBeacon(e,t={}){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return!1;const r=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",n=t.type||"event",s=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(n)}`,o=JSON.stringify({web_id:this.webId,visitor_id:r,event_name:e,properties:{...t,...i.getDeviceContext()}});return navigator.sendBeacon(s,new Blob([o],{type:"application/json"}))}async postRaw(e,t,r={}){if(!1===i.consent.analytics)return;if(!1!==this.transportConfig.respectDNT&&this.isDNTEnabled())return;const n=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(e)}`,s=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",o=JSON.stringify({web_id:this.webId,visitor_id:s,...t}),a=!0===r.useBeacon,c=o.length,u=a&&c<=6e4;if(a&&c>6e4){const t=JSON.stringify({...JSON.parse(o),api_key:this.apiKey});try{"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(n,new Blob([t],{type:"application/json"}))||"undefined"==typeof console||console.warn(`[Flowgrid] ${e} beacon rejected (payload ${c} bytes)`)}catch(t){"undefined"!=typeof console&&console.warn(`[Flowgrid] ${e} beacon error:`,t)}return}try{const t=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:o,...u?{keepalive:!0}:{}});t.ok||"undefined"==typeof console||console.warn(`[Flowgrid] ${e} rejected: ${t.status} ${t.statusText} (${c} bytes)`)}catch(t){"undefined"!=typeof console&&console.warn(`[Flowgrid] ${e} network error (${c} bytes):`,t)}}bufferEvent(e,t,r){if("undefined"!=typeof localStorage)try{const n=localStorage.getItem(i.EVENT_BUFFER_KEY),s=n?JSON.parse(n):[];if(s.length>=i.MAX_BUFFER_EVENTS)return;const o=JSON.stringify([...s,{url:e,method:t,body:r}]);if((new TextEncoder).encode(o).length>i.MAX_BUFFER_SIZE)return;s.push({url:e,method:t,body:r}),localStorage.setItem(i.EVENT_BUFFER_KEY,JSON.stringify(s))}catch{}}drainEventBuffer(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(i.EVENT_BUFFER_KEY);if(!e)return;const t=JSON.parse(e);localStorage.removeItem(i.EVENT_BUFFER_KEY);for(const e of t)fetch(e.url,{method:e.method,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:e.body}).catch(()=>{})}catch{}}async init(e,t={},r="POST"){if(!i.hasConsent("analytics"))return{};if(this.transportConfig.respectDNT&&this.isDNTEnabled())return{};if("block"===this.transportConfig.botDetection&&i.isLikelyBot())return{};this.validateInput(e,t),"tag"===this.transportConfig.botDetection&&i.isLikelyBot()&&(t={...t,_bot:!0});const n={...i.getDeviceContext(),...t},s=n.type||"event",o=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(s)}`,a=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",c=JSON.stringify({web_id:this.webId,visitor_id:a,event_name:e,properties:n});return this.executeRequest(o,r,"GET"===r?void 0:c)}async initFeature(e,t){if(this.validateInput(e,t),!t.type)throw new Error("Feature events must include a type property");const r=`${this.endpoint}/api/v1/sdk/functions?call=${encodeURIComponent(t.type)}`,n=this.identityManager?this.identityManager.getVisitorId():this.visitorId??"",i=JSON.stringify({web_id:this.webId,visitor_id:n,event_name:e,properties:t});return this.executeRequest(r,"POST",i)}async executeRequest(e,t,r,n){let s=0;for(;s<=i.MAX_RETRIES;){const o=new AbortController,a=setTimeout(()=>o.abort(),i.TIMEOUT_MS);try{const c=await fetch(e,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,...n},body:r,signal:o.signal});if(clearTimeout(a),c.status>=500&&s<i.MAX_RETRIES){s++,await this.backoff(s);continue}if(!c.ok){const e=await this.safeRead(c);throw new Error(`SDK request failed (${c.status} ${c.statusText}) ${e}`)}return await c.json()}catch(n){if(clearTimeout(a),n instanceof Error&&("AbortError"===n.name||n.message.includes("fetch"))&&s<i.MAX_RETRIES){s++,await this.backoff(s);continue}if(s>=i.MAX_RETRIES&&(r&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(e,new Blob([r],{type:"application/json"}))||this.bufferEvent(e,t,r)),n instanceof Error&&"AbortError"===n.name)throw new Error("SDK request timed out");throw n}}throw new Error("SDK request exhausted retries without resolution")}backoff(e){const t=Math.min(1e3*Math.pow(2,e-1),3e4),r=Math.random()*t;return new Promise(e=>setTimeout(e,r))}validateInput(e,t){if(!e||"string"!=typeof e||!e.trim())throw new Error("Event name must be a non-empty string");if(e.length>100)throw new Error("Event name must be less than 100 characters");let r;try{r=JSON.stringify({web_id:this.webId,visitor_id:this.visitorId??"",event_name:e,properties:t})}catch{throw new Error("Properties must be JSON serializable")}if((new TextEncoder).encode(r).length>i.MAX_PAYLOAD_SIZE)throw new Error("Event payload too large (max 10KB)");const n=["password","token","secret","apikey","authorization"],s=r.toLowerCase();for(const e of n)s.includes(e)&&console.warn(`SDK Warning: Properties may contain sensitive data (${e}).`)}normalizeEndpoint(e){let t=e.trim();return t.startsWith("http://")||t.startsWith("https://")||(t=`https://${t}`),t.replace(/\/+$/,"")}async safeRead(e){try{return await e.text()}catch{return""}}}t.FlowGridTransport=i,i.MAX_PAYLOAD_SIZE=1e4,i.TIMEOUT_MS=1e4,i.MAX_RETRIES=3,i.MAX_BUFFER_EVENTS=100,i.MAX_BUFFER_SIZE=5e4,i.EVENT_BUFFER_KEY="fg_event_buffer",i.consent={analytics:!0,marketing:!0},i.ATTRIBUTION_KEYS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","ref","via","source"]},4513(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentManager=void 0;var n=r(1906);Object.defineProperty(t,"ConsentManager",{enumerable:!0,get:function(){return n.ConsentManager}})},1906(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConsentManager=void 0;const r="fg_tracking_consent",n={necessary:!0,analytics:!1,marketing:!1,preferences:!0};t.ConsentManager=class{constructor(e){this.config={cookieName:e?.cookieName??"fg_consent",cookieDays:e?.cookieDays??365,cookieDomain:e?.cookieDomain,respectDNT:e?.respectDNT??!0,requireExplicitConsent:e?.requireExplicitConsent??!0,onChange:e?.onChange,defaultPreferences:{...n,...e?.defaultPreferences,necessary:!0}};const t=this.loadFromCookie();t?this.preferences=t:this.isDNTEnabled()&&this.config.respectDNT?this.preferences={necessary:!0,analytics:!1,marketing:!1,preferences:!1}:this.config.requireExplicitConsent?this.preferences={...this.config.defaultPreferences}:this.preferences={necessary:!0,analytics:!0,marketing:!0,preferences:!0}}hasConsented(){return null!==this.loadFromCookie()}getPreferences(){return{...this.preferences}}hasCategory(e){return this.preferences[e]??!1}acceptAll(){this.setPreferences({necessary:!0,analytics:!0,marketing:!0,preferences:!0})}rejectNonEssential(){this.setPreferences({necessary:!0,analytics:!1,marketing:!1,preferences:!1})}update(e){this.setPreferences({...this.preferences,...e,necessary:!0})}reset(){this.deleteCookie(),this.preferences={...this.config.defaultPreferences}}setPreferences(e){this.preferences,this.preferences={...e,necessary:!0},this.saveToCookie(),this.config.onChange&&this.config.onChange(this.preferences)}isDNTEnabled(){return"undefined"!=typeof navigator&&(!!navigator.globalPrivacyControl||"1"===navigator.doNotTrack)}loadFromCookie(){if("undefined"==typeof document)return null;const e=document.cookie.match(new RegExp("(^| )"+this.config.cookieName+"=([^;]+)"));if(!e)return null;try{const t=JSON.parse(decodeURIComponent(e[2]));return"object"==typeof t&&null!==t&&"boolean"==typeof t.necessary?{...n,...t,necessary:!0}:null}catch{return null}}saveToCookie(){if("undefined"==typeof document)return;const e=encodeURIComponent(JSON.stringify(this.preferences)),t=24*this.config.cookieDays*60*60,n=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"",i="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";document.cookie=`${this.config.cookieName}=${e}; Path=/; Max-Age=${t}; SameSite=Lax${i}${n}`;const s=this.preferences.analytics?"true":"false";document.cookie=`${r}=${s}; Path=/; Max-Age=${t}; SameSite=Lax${i}${n}`}deleteCookie(){if("undefined"==typeof document)return;const e=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"";document.cookie=`${this.config.cookieName}=; Path=/; Max-Age=0${e}`,document.cookie=`${r}=; Path=/; Max-Age=0${e}`}}},2412(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Attribution=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async trackTouchpoint(e){return await this.init("attribution_touchpoint",{type:"attribution_touchpoint",userId:e.userId,channel:e.channel,campaign:e.campaign,medium:e.medium,source:e.source,content:e.content,term:e.term,referrer:e.referrer,landingPage:e.landingPage,...e.properties,timestamp:(new Date).toISOString()})}async recordConversion(e){return await this.init("attribution_conversion",{type:"attribution_conversion",userId:e.userId,conversionType:e.conversionType,value:e.value,conversionId:e.conversionId,...e.properties,timestamp:(new Date).toISOString()})}captureFromUrl(e){if(!(0,i.isBrowser)())return null;const t=(0,i.getWindow)(),r=(0,i.getDocument)();if(!t||!r)return null;const n=new URLSearchParams(t.location.search),s={utmSource:n.get("utm_source")??void 0,utmMedium:n.get("utm_medium")??void 0,utmCampaign:n.get("utm_campaign")??void 0,utmTerm:n.get("utm_term")??void 0,utmContent:n.get("utm_content")??void 0},o=r.referrer||void 0;if(!(s.utmSource||s.utmMedium||s.utmCampaign||o))return null;const a={userId:e,channel:s.utmSource||(o?"referral":"direct"),campaign:s.utmCampaign,medium:s.utmMedium,source:s.utmSource,content:s.utmContent,term:s.utmTerm,referrer:o,landingPage:t.location.pathname};return this.trackTouchpoint(a),a}}t.Attribution=s,t.default=s},9648(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Events=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("custom_event",{type:"custom_event",eventName:e.eventName,category:e.category||"general",action:e.action,label:e.label,value:e.value,nonInteraction:e.nonInteraction||!1,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackBatch(e){const t=e.events.map(e=>({...e,timestamp:(new Date).toISOString()}));return await this.init("batch_events",{type:"batch_events",events:t,count:t.length,timestamp:(new Date).toISOString()})}async trackClick(e){return await this.init("click_event",{type:"click_event",...e,timestamp:(new Date).toISOString()})}async trackForm(e){return await this.init("form_event",{type:"form_event",...e,timestamp:(new Date).toISOString()})}async trackSearch(e){return await this.init("search_event",{type:"search_event",query:e.query,category:e.category,resultsCount:e.resultsCount,resultClicked:e.resultClicked,clickedPosition:e.clickedPosition,filters:e.filters,timestamp:(new Date).toISOString()})}async trackError(e){return await this.init("error_event",{type:"error_event",message:e.message,stack:e.stack,errorType:e.type,fatal:e.fatal||!1,context:e.context,userAction:e.userAction,timestamp:(new Date).toISOString()})}}t.Events=i,t.default=i},4492(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Funnels=void 0;const n=r(5975);class i extends n.FlowGridTransport{async define(e){return await this.init("define_funnel",{type:"define_funnel",funnelId:e.funnelId,name:e.name,description:e.description,steps:e.steps,timestamp:(new Date).toISOString()})}async trackStep(e){return await this.init("funnel_step",{type:"funnel_step",funnelId:e.funnelId,step:e.step,stepNumber:e.stepNumber,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackComplete(e,t,r){return await this.init("funnel_complete",{type:"funnel_complete",funnelId:e,userId:t,...r,timestamp:(new Date).toISOString()})}async trackAbandon(e,t,r,n){return await this.init("funnel_abandon",{type:"funnel_abandon",funnelId:e,lastStep:t,userId:r,reason:n,timestamp:(new Date).toISOString()})}async analyze(e,t){return await this.init("analyze_funnel",{type:"query",funnelId:e,filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}async compare(e,t,r){return await this.init("compare_funnel",{type:"query",funnelId:e,baselineFilter:t,comparisonFilter:r,timestamp:(new Date).toISOString()})}async list(){return await this.init("list_funnels",{type:"query",timestamp:(new Date).toISOString()})}}t.Funnels=i,t.default=i},5004(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Heatmaps=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{constructor(){super(...arguments),this.lastMovementTime=0,this.lastScrollTime=0}async trackClick(e){return await this.init("heatmap_click",{type:"heatmap_click",pageUrl:e.pageUrl,x:e.x,y:e.y,normalizedX:e.x/e.viewportWidth,normalizedY:e.y/e.viewportHeight,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight,elementSelector:e.elementSelector,elementText:e.elementText?.substring(0,50),userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async trackMovement(e){const t=Date.now();return t-this.lastMovementTime<s.MOVEMENT_THROTTLE_MS?{eventName:"heatmap_movement",properties:{},response:{recorded:!1,interactionId:""},timestamp:(new Date).toISOString()}:(this.lastMovementTime=t,await this.init("heatmap_movement",{type:"heatmap_movement",pageUrl:e.pageUrl,path:e.path,viewport:e.viewport,sessionId:e.sessionId,timestamp:(new Date).toISOString()}))}async trackScroll(e){const t=Date.now();return t-this.lastScrollTime<s.SCROLL_THROTTLE_MS?{eventName:"heatmap_scroll",properties:{},response:{recorded:!1,interactionId:""},timestamp:(new Date).toISOString()}:(this.lastScrollTime=t,await this.init("heatmap_scroll",{type:"heatmap_scroll",pageUrl:e.pageUrl,maxScrollDepth:e.maxScrollDepth,pageHeight:e.pageHeight,viewportHeight:e.viewportHeight,timeAtDepths:e.timeAtDepths,sessionId:e.sessionId,timestamp:(new Date).toISOString()}))}async trackRageClick(e,t,r,n){return await this.init("heatmap_rage_click",{type:"heatmap_rage_click",pageUrl:e,x:t,y:r,clickCount:n,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)(),n=r=>{const n=r.target;var i;this.trackClick({pageUrl:t.location.pathname,x:r.clientX,y:r.clientY+t.scrollY,viewportWidth:t.innerWidth,viewportHeight:t.innerHeight,elementSelector:(i=n,i?i.id?`#${i.id}`:`${i.tagName.toLowerCase()}${i.className&&"string"==typeof i.className?"."+i.className.trim().split(/\s+/).slice(0,2).join("."):""}`:""),elementText:(n?.textContent||"").trim().slice(0,50),userId:e.userId,sessionId:e.sessionId})};r.addEventListener("click",n,{capture:!0,passive:!0});let s=0,o=!1;const a=()=>{o=!1;const n=r.documentElement;this.trackScroll({pageUrl:t.location.pathname,maxScrollDepth:s,pageHeight:n.scrollHeight,viewportHeight:t.innerHeight,sessionId:e.sessionId})},c=()=>{const e=r.documentElement,n=t.scrollY||e.scrollTop,i=Math.max(1,e.scrollHeight-t.innerHeight),c=Math.min(100,Math.round(n/i*100));c>s&&(s=c),o||(o=!0,t.addEventListener("pagehide",a,{once:!0}))};let u;if(t.addEventListener("scroll",c,{passive:!0}),e.movement){let n=[];const i=Date.now(),s=r=>{if(n.push({x:r.clientX,y:r.clientY,t:Date.now()-i}),n.length>=50){const r=n;n=[],this.trackMovement({pageUrl:t.location.pathname,path:r,viewport:{width:t.innerWidth,height:t.innerHeight},sessionId:e.sessionId})}};r.addEventListener("mousemove",s,{passive:!0}),u=()=>r.removeEventListener("mousemove",s)}return(0,i.combineTeardowns)(()=>r.removeEventListener("click",n,{capture:!0}),()=>t.removeEventListener("scroll",c),()=>t.removeEventListener("pagehide",a),u)}}t.Heatmaps=s,s.MOVEMENT_THROTTLE_MS=100,s.SCROLL_THROTTLE_MS=500,t.default=s},7565(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identify=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async user(e){return await this.init("identify_user",{type:"identify",userId:e.userId,anonymousId:e.anonymousId,traits:e.traits||{},timestamp:(new Date).toISOString()})}async updateTraits(e,t){return await this.init("update_traits",{type:"update_traits",userId:e,traits:t,timestamp:(new Date).toISOString()})}async alias(e){return await this.init("alias_user",{type:"alias",previousId:e.previousId,userId:e.userId,timestamp:(new Date).toISOString()})}async group(e){return await this.init("group_user",{type:"group",userId:e.userId,groupId:e.groupId,traits:e.traits||{},timestamp:(new Date).toISOString()})}async reset(e){return await this.init("reset_identity",{type:"reset",userId:e,timestamp:(new Date).toISOString()})}autoTrackForms(e={}){if(!(0,i.isBrowser)())return()=>{};if(!n.FlowGridTransport.hasConsent("analytics"))return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)(),s=e.debounceMs??800,o=e.excludePath??/\/(checkout|account\/settings|admin)(\/|$)/i,a=/(password|cardnumber|creditcard|\bcard\b|cvv|cvc|ssn|\bpin\b|securitycode)/i,c=/(message|comment|note|feedback|search|query)/i,u=[{re:/(email|emailaddress)/,trait:"email",pii:!0,identify:!0},{re:/(phone|tel|mobile|cell)/,trait:"phone",pii:!0,identify:!1},{re:/(firstname|fname|givenname)/,trait:"firstName",pii:!1,identify:!1},{re:/(lastname|lname|surname|familyname)/,trait:"lastName",pii:!1,identify:!1},{re:/(company|organi[sz]ation|businessname)/,trait:"company",pii:!1,identify:!1},{re:/(streetaddress|addressline|^address$|^street$)/,trait:"address",pii:!1,identify:!1},{re:/(^city$|town)/,trait:"city",pii:!1,identify:!1},{re:/(postcode|postalcode|zipcode|^zip$)/,trait:"postcode",pii:!1,identify:!1},{re:/(fullname|^name$|username|yourname|contactname|displayname)/,trait:"firstName",pii:!1,identify:!1}],l={},d=new WeakSet,p=new WeakMap,h=[],m=e=>{const t=(e=>[e.name,e.id,e.getAttribute("placeholder"),e.getAttribute("autocomplete")].filter(Boolean).join(" ").toLowerCase().replace(/[\s_-]/g,""))(e);return t?((e,t)=>{const r=e;return"password"===r.type||"hidden"===r.type||"ignore"===e.getAttribute("data-analytics")||!(!e.classList||!e.classList.contains("no-track"))||a.test(t)})(e,t)?{blocked:!0}:c.test(t)?null:u.find(e=>e.re.test(t))??null:null},f=()=>(this.identityManager?this.identityManager.getVisitorId():this.visitorId)||"",g=()=>this.identityManager?this.identityManager.getSessionId():null,y=()=>{const e=f();if(!this.webId||!e)return;if(!(l.email||l.emailHash||l.firstName||l.lastName||l.phone))return;const r={email:l.email??null,email_hash:l.emailHash??null,phone:l.phone??null,phone_hash:l.phoneHash??null,first_name:l.firstName??null,last_name:l.lastName??null,company:l.company??null,address:l.address??null,city:l.city??null,postcode:l.postcode??null},n=`${this.endpoint}/api/v1/identity/identify`,i=JSON.stringify({web_id:this.webId,visitor_id:e,session_id:g(),path_name:t.location.pathname,traits:r});try{"undefined"!=typeof navigator&&navigator.sendBeacon&&navigator.sendBeacon(n,new Blob([i],{type:"application/json"}))||fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:i,keepalive:!0}).catch(()=>{})}catch{}},v=e=>{const r=m(e);if(!r||"blocked"in r)return;const n=(e.value||"").trim();n&&(r.pii?(async e=>{try{const r=(new TextEncoder).encode(String(e).trim().toLowerCase()),n=await t.crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch{return null}})("phone"===r.trait?n.replace(/[^\d+]/g,""):n).then(e=>{"email"===r.trait?(l.email=n,e&&(l.emailHash=e)):"phone"===r.trait&&e&&(l.phoneHash=e),(r.identify||l.email)&&y()}):(l[r.trait]=n,l.email&&y()))},I=e=>{if(d.has(e))return;const t=m(e);if(!t||"blocked"in t)return;d.add(e);const r=()=>v(e),n=()=>{clearTimeout(p.get(e)),p.set(e,setTimeout(()=>v(e),s))};e.addEventListener("blur",r,{passive:!0}),e.addEventListener("input",n,{passive:!0}),h.push(()=>{e.removeEventListener("blur",r),e.removeEventListener("input",n)})},b=()=>{o.test(t.location.pathname)||r.querySelectorAll("input, textarea, select").forEach(I)},S=e=>{const r=e.target;if(!r||"FORM"!==r.tagName)return;if(o.test(t.location.pathname))return;let n=!1;r.querySelectorAll("input, textarea, select").forEach(e=>{const t=m(e);if(!t||"blocked"in t||"phone"!==t.trait)return;const r=(e.value||"").trim();r&&(l.phone=r,n=!0)}),n&&y()};r.addEventListener("submit",S,!0),h.push(()=>r.removeEventListener("submit",S,!0)),b();let w=null;try{w=new MutationObserver(()=>b()),r.body&&w.observe(r.body,{childList:!0,subtree:!0})}catch{}return()=>{if(w)try{w.disconnect()}catch{}for(const e of h)try{e()}catch{}}}}t.Identify=s,t.default=s},8597(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.revokeReplayConsent=t.grantReplayConsent=t.hasReplayConsent=t.SessionReplay=t.Performance=t.PerformanceTracking=t.Heatmaps=t.Attribution=t.Retention=t.Funnels=t.Identify=t.Events=t.Sessions=t.PageViews=void 0;var n=r(1265);Object.defineProperty(t,"PageViews",{enumerable:!0,get:function(){return n.PageViews}});var i=r(6636);Object.defineProperty(t,"Sessions",{enumerable:!0,get:function(){return i.Sessions}});var s=r(9648);Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return s.Events}});var o=r(7565);Object.defineProperty(t,"Identify",{enumerable:!0,get:function(){return o.Identify}});var a=r(4492);Object.defineProperty(t,"Funnels",{enumerable:!0,get:function(){return a.Funnels}});var c=r(755);Object.defineProperty(t,"Retention",{enumerable:!0,get:function(){return c.Retention}});var u=r(2412);Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return u.Attribution}});var l=r(5004);Object.defineProperty(t,"Heatmaps",{enumerable:!0,get:function(){return l.Heatmaps}});var d=r(39);Object.defineProperty(t,"PerformanceTracking",{enumerable:!0,get:function(){return d.PerformanceTracking}}),Object.defineProperty(t,"Performance",{enumerable:!0,get:function(){return d.PerformanceTracking}});var p=r(8206);Object.defineProperty(t,"SessionReplay",{enumerable:!0,get:function(){return p.SessionReplay}}),Object.defineProperty(t,"hasReplayConsent",{enumerable:!0,get:function(){return p.hasReplayConsent}}),Object.defineProperty(t,"grantReplayConsent",{enumerable:!0,get:function(){return p.grantReplayConsent}}),Object.defineProperty(t,"revokeReplayConsent",{enumerable:!0,get:function(){return p.revokeReplayConsent}})},1265(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageViews=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async track(e){return await this.init("page_view",{type:"page_view",url:e.url,path:e.path,title:e.title||"",referrer:e.referrer||"",userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackScrollDepth(e){return await this.init("scroll_depth",{type:"scroll_depth",path:e.path,scrollDepth:Math.min(100,Math.max(0,e.scrollDepth)),timeAtDepth:e.timeAtDepth,timestamp:(new Date).toISOString()})}async trackTimeOnPage(e){return await this.init("time_on_page",{type:"time_on_page",path:e.path,duration:e.duration,engaged:e.engaged??!1,timestamp:(new Date).toISOString()})}async trackExit(e,t,r){return await this.init("page_exit",{type:"page_exit",path:e,duration:t,scrollDepth:r,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)();let n=t.location.pathname,s=Date.now(),o=0;const a=new Set,c=()=>{this.track({url:t.location.href,path:t.location.pathname,title:r.title,referrer:r.referrer,userId:e.userId,sessionId:e.sessionId})},u=()=>{const e=Math.round((Date.now()-s)/1e3);e<=0||this.trackTimeOnPage({path:n,duration:e,engaged:o>10})},l=()=>{t.location.pathname!==n&&(u(),n=t.location.pathname,s=Date.now(),o=0,a.clear(),c())},d=t.history.pushState,p=t.history.replaceState;t.history.pushState=function(...e){const r=d.apply(this,e);return t.dispatchEvent(new Event("flowgrid:locationchange")),r},t.history.replaceState=function(...e){const r=p.apply(this,e);return t.dispatchEvent(new Event("flowgrid:locationchange")),r};const h=()=>l(),m=()=>l();t.addEventListener("popstate",h),t.addEventListener("flowgrid:locationchange",m);const f=()=>{const e=r.documentElement,i=t.scrollY||e.scrollTop,s=Math.max(1,e.scrollHeight-t.innerHeight),c=Math.min(100,Math.round(i/s*100));c>o&&(o=c);for(const e of[25,50,75,100])c>=e&&!a.has(e)&&(a.add(e),this.trackScrollDepth({path:n,scrollDepth:e}))};t.addEventListener("scroll",f,{passive:!0});const g=()=>{"hidden"===r.visibilityState&&u()};return r.addEventListener("visibilitychange",g),t.addEventListener("pagehide",u),c(),(0,i.combineTeardowns)(()=>t.removeEventListener("popstate",h),()=>t.removeEventListener("flowgrid:locationchange",m),()=>t.removeEventListener("scroll",f),()=>r.removeEventListener("visibilitychange",g),()=>t.removeEventListener("pagehide",u),()=>{t.history.pushState=d,t.history.replaceState=p})}}t.PageViews=s,t.default=s},39(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.Performance=t.PerformanceTracking=void 0;const a=r(5975),c=r(7890);class u extends a.FlowGridTransport{async trackWebVitals(e){return await this.init("web_vitals",{type:"web_vitals",...e,timestamp:(new Date).toISOString()})}async trackPageLoad(e){return await this.init("page_load",{type:"page_load",...e,timestamp:(new Date).toISOString()})}async trackResource(e){return await this.init("resource_timing",{type:"resource_timing",...e,timestamp:(new Date).toISOString()})}async trackApiCall(e,t,r,n){return await this.init("api_timing",{type:"api_timing",endpoint:e,duration:t,success:r,statusCode:n,timestamp:(new Date).toISOString()})}autoTrack(e={}){if(!(0,c.isBrowser)())return()=>{};const t=(0,c.getWindow)(),n=t.location.pathname,i=[];let s=!1;Promise.resolve().then(()=>o(r(8796))).then(t=>{if(s)return;const r=t=>{const r=t.name.toLowerCase(),i={pageUrl:n,userId:e.userId};i[r]=t.value,this.trackWebVitals(i)};t.onLCP?.(r),t.onCLS?.(r),t.onINP?.(r),t.onFCP?.(r),t.onTTFB?.(r),t.onFID?.(r)}).catch(()=>{}),i.push(()=>{s=!0});const a=()=>{const e=t.performance?.getEntriesByType?.("navigation")?.[0];e&&this.trackPageLoad({pageUrl:n,dnsTime:Math.max(0,e.domainLookupEnd-e.domainLookupStart),tcpTime:Math.max(0,e.connectEnd-e.connectStart),ttfb:Math.max(0,e.responseStart-e.requestStart),domContentLoaded:e.domContentLoadedEventEnd,loadTime:e.loadEventEnd,domInteractive:e.domInteractive,transferSize:e.transferSize})};if("complete"===t.document.readyState)a();else{const e=()=>a();t.addEventListener("load",e,{once:!0}),i.push(()=>t.removeEventListener("load",e))}if(e.resources&&"function"==typeof t.PerformanceObserver){const r=e.minDuration??200,s=new t.PerformanceObserver(e=>{for(const t of e.getEntries()){if(t.duration<r)continue;const e=t.initiatorType;this.trackResource({resourceUrl:t.name,resourceType:["script","stylesheet","image","font","fetch","xhr"].includes(e)?e:"other",duration:Math.round(t.duration),transferSize:t.transferSize,pageUrl:n})}});try{s.observe({type:"resource",buffered:!0}),i.push(()=>s.disconnect())}catch{}}return(0,c.combineTeardowns)(...i)}}t.PerformanceTracking=u,t.Performance=u,t.default=u},8206(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.SessionReplay=void 0,t.hasReplayConsent=l,t.grantReplayConsent=function(){if((0,c.isBrowser)())try{localStorage.setItem(u,"granted")}catch{}},t.revokeReplayConsent=function(){if((0,c.isBrowser)())try{localStorage.removeItem(u)}catch{}};const a=r(5975),c=r(7890),u="flowgrid:replayConsent";function l(){if(!(0,c.isBrowser)())return!1;try{return"granted"===localStorage.getItem(u)}catch{return!1}}const d="flowgrid:replaySessionId",p="rrweb@2";class h extends a.FlowGridTransport{constructor(){super(...arguments),this.disabled=!1,this.active=null,this.state="idle"}async start(e={}){if(!1===e.enabled||this.disabled)return this.setState("disabled",e),()=>{};if(this.active&&!this.active.stopped)return this.emitStatus(this.active.options),()=>this.stop("manual");if(!(0,c.isBrowser)())return()=>{};if(!0===e.requireConsent&&!l()&&!a.FlowGridTransport.hasConsent("analytics"))return this.setState("disabled",e),()=>{};this.setState("starting",e);const t=e.sampleRate??1;if(t<1&&Math.random()>t)return this.setState("sampled_out",e),()=>{};let n;try{n=await Promise.resolve().then(()=>o(r(6546)))}catch(t){return"undefined"!=typeof console&&console.error("[FlowGrid] Session replay failed to load rrweb:",t),this.handleError(this.toError(t),{phase:"import"},e),()=>{}}const i=(0,c.getDocument)();if(!i)return()=>{};const s=e.sessionId??this.resolveSessionId(),u=this.normalizeOptions(e),d=Date.now(),p={sessionId:s,userId:e.userId??this.boundUserId,startedAtMs:d,startedAt:new Date(d).toISOString(),sequence:0,buffer:[],bufferBytes:0,totalBytes:0,droppedEvents:0,stopped:!1,initialSnapshotCaptured:!1,flushTimer:setInterval(()=>{this.flush("interval")},u.flushIntervalMs),durationGuard:setTimeout(()=>this.stop("max_duration"),u.maxDurationMs),onVisibility:()=>{"hidden"===i.visibilityState&&this.flush("visibility_hidden",{useBeacon:!0})},onPageHide:()=>{this.flush("pagehide",{useBeacon:!0})},options:u};this.active=p;try{p.stopRecording=n.record({emit:e=>this.captureEvent(e),maskAllInputs:u.maskAllInputs,maskTextClass:u.maskTextClass??"fg-mask",blockClass:u.blockClass??"fg-block",ignoreClass:u.ignoreClass??"fg-ignore",checkoutEveryNth:200,checkoutEveryNms:3e4,inlineImages:!1,collectFonts:!1})}catch(e){return this.handleError(this.toError(e),{phase:"record",sessionId:s},u),p.stopped=!0,this.cleanupActive("stop"),this.active=null,()=>{}}return i.addEventListener("visibilitychange",p.onVisibility),window.addEventListener("pagehide",p.onPageHide),this.setState("recording",u),()=>this.stop("manual")}enable(e={}){return this.disabled=!1,this.start({...e,enabled:!0})}disable(){this.disabled=!0,this.stop("manual"),this.setState("disabled",this.active?.options)}stop(e="stop"){const t=this.active;t&&!t.stopped&&(t.stopped=!0,this.cleanupActive(e),this.flush(e,{useBeacon:!0,isFinal:!0}),this.setState("stopped",t.options,e),this.active=null)}async flush(e="manual",t={}){const r=this.active;if(!r||0===r.buffer.length)return;const n=r.buffer,i=n.length,s=r.bufferBytes,o=r.sequence++;r.buffer=[],r.bufferBytes=0;const a=(new Date).toISOString(),c=this.createIdempotencyKey(r.sessionId,o,s),u={sessionId:r.sessionId,userId:r.userId,sequence:o,eventsCount:i,byteSize:s,reason:e,isFinal:!0===t.isFinal,droppedEvents:r.droppedEvents,capturedAt:a,idempotencyKey:c};try{await this.postReplayChunk(r.sessionId,n,{userId:r.userId,sequence:o,useBeacon:t.useBeacon,startedAt:r.startedAt,capturedAt:a,pageUrl:this.getPageUrl(),isFinal:u.isFinal,reason:e,privacy:this.createPrivacyMetadata(r.options,"sampled_in"),droppedEvents:r.droppedEvents,recorderVersion:p},c),r.options.onFlush?.(u),this.emitStatus(r.options,e)}catch(e){this.handleError(this.toError(e),{phase:"flush",sessionId:r.sessionId},r.options)}}identify(e){this.boundUserId=e,this.active&&(this.active.userId=e,this.emitStatus(this.active.options))}getStatus(){return this.createStatus(this.active?.options)}async sendChunk(e,t,r={}){0!==t.length&&await this.postReplayChunk(e,t,r)}async postReplayChunk(e,t,r,n=this.createIdempotencyKey(e,r.sequence??0,this.measureEvents(t))){await this.postRaw("replay_chunk",{type:"replay_chunk",session_id:e,user_id:r.userId,sequence:r.sequence??0,started_at:r.startedAt,captured_at:r.capturedAt??(new Date).toISOString(),events:t,page_url:r.pageUrl??this.getPageUrl(),idempotency_key:n,compression:"none",is_final:!0===r.isFinal,chunk_kind:r.isFinal?"final":"partial",flush_reason:r.reason??"manual",dropped_events:r.droppedEvents??0,recorder_version:r.recorderVersion??p,privacy:r.privacy??this.createPrivacyMetadata(void 0,"sampled_in")},{useBeacon:r.useBeacon})}captureEvent(e){const t=this.active;if(!t||t.stopped)return;let r=0;try{r=JSON.stringify(e).length}catch{return t.droppedEvents++,void t.options.onDrop?.({sessionId:t.sessionId,reason:"serialization_error",droppedEvents:t.droppedEvents})}return t.totalBytes+r>t.options.maxBytes?(t.droppedEvents++,t.options.onDrop?.({sessionId:t.sessionId,reason:"max_bytes",droppedEvents:t.droppedEvents,byteSize:t.totalBytes+r,maxBytes:t.options.maxBytes}),void this.stop("max_bytes")):(t.totalBytes+=r,t.buffer.push(e),t.bufferBytes+=r,t.initialSnapshotCaptured||2!==e.type?void(t.bufferBytes>=t.options.flushBytes&&this.flush("size")):(t.initialSnapshotCaptured=!0,void Promise.resolve().then(()=>{this.flush("manual")})))}cleanupActive(e){const t=this.active;if(!t)return;const r=(0,c.getDocument)();clearInterval(t.flushTimer),clearTimeout(t.durationGuard),r?.removeEventListener("visibilitychange",t.onVisibility),window.removeEventListener("pagehide",t.onPageHide);try{t.stopRecording?.()}catch(e){this.handleError(this.toError(e),{phase:"stop",sessionId:t.sessionId},t.options)}this.emitStatus(t.options,e)}normalizeOptions(e){return{...e,flushIntervalMs:e.flushIntervalMs??5e3,flushBytes:e.flushBytes??524288,maxDurationMs:e.maxDurationMs??18e5,maxBytes:e.maxBytes??10485760,maskAllInputs:e.maskAllInputs??!0}}createStatus(e,t){const r=this.active;return{state:this.state,sessionId:r?.sessionId,userId:r?.userId??this.boundUserId,startedAt:r?.startedAt,sequence:r?.sequence??0,bufferedEvents:r?.buffer.length??0,bufferedBytes:r?.bufferBytes??0,totalBytes:r?.totalBytes??0,droppedEvents:r?.droppedEvents??0,recorderVersion:p,lastFlushReason:t,lastError:this.lastError}}setState(e,t,r){this.state=e,this.emitStatus(t,r)}emitStatus(e,t){e?.onStatus?.(this.createStatus(e,t))}handleError(e,t,r){this.lastError=e.message,this.state="error",r?.onError?.(e,t),this.emitStatus(r)}createPrivacyMetadata(e,t="sampled_in"){const r=l()||a.FlowGridTransport.hasConsent("analytics");return{masking_mode:!1===e?.maskAllInputs?"selective":"all_inputs",blocked_selectors:this.selectorList(e?.blockClass??"fg-block"),redacted_fields:this.selectorList(e?.maskTextClass??"fg-mask"),consent_state:r?"granted":"denied",sampling_state:t}}selectorList(e){return"string"==typeof e?[e]:[e.source]}getPageUrl(){try{return"undefined"!=typeof location?location.href:""}catch{return""}}createIdempotencyKey(e,t,r){return`${this.webId}:${e}:${t}:${r}`}measureEvents(e){try{return JSON.stringify(e).length}catch{return 0}}toError(e){return e instanceof Error?e:new Error(String(e))}resolveSessionId(){try{const e=sessionStorage.getItem(d);if(e)return e;const t=this.generateId();return sessionStorage.setItem(d,t),t}catch{return this.generateId()}}generateId(){const e="undefined"!=typeof crypto?crypto:void 0;return e?.randomUUID?e.randomUUID():`rep_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}}t.SessionReplay=h,t.default=h},755(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Retention=void 0;const n=r(5975);class i extends n.FlowGridTransport{async trackActivity(e){return await this.init("user_activity",{type:"user_activity",userId:e.userId,action:e.action||"active",sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async trackLifecycleChange(e,t,r){return await this.init("lifecycle_change",{type:"lifecycle_change",userId:e,stage:t,previousStage:r,timestamp:(new Date).toISOString()})}}t.Retention=i,t.default=i},6636(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sessions=void 0;const n=r(5975),i=r(7890);class s extends n.FlowGridTransport{async start(e={}){return await this.init("session_start",{type:"session_start",user:e.user,device:e.device,location:e.location,source:e.source||e.utm?.utmSource,medium:e.medium||e.utm?.utmMedium,campaign:e.campaign||e.utm?.utmCampaign,utm:e.utm,landingPage:e.landingPage||("undefined"!=typeof window?window.location.href:""),referrer:e.referrer||("undefined"!=typeof document?document.referrer:""),...e.properties,timestamp:(new Date).toISOString()})}async update(e,t){return await this.init("session_update",{type:"session_update",sessionId:e,...t,timestamp:(new Date).toISOString()})}async end(e){return await this.init("session_end",{type:"session_end",sessionId:e,timestamp:(new Date).toISOString()})}async heartbeat(e){return await this.init("session_heartbeat",{type:"session_heartbeat",sessionId:e,timestamp:(new Date).toISOString()})}autoTrack(e={},t={}){if(!(0,i.isBrowser)())return()=>{};const r=(0,i.getWindow)(),n=(0,i.getDocument)(),s=t.heartbeatMs??3e4,o="flowgrid:sessionId";let a;try{a=r.sessionStorage.getItem(o)||void 0}catch{}const c=a?Promise.resolve(a):this.start(e).then(e=>{a=e.response.sessionId;try{r.sessionStorage.setItem(o,a)}catch{}return a}).catch(()=>{}),u=r.setInterval(()=>{a&&"visible"===n.visibilityState&&this.heartbeat(a)},s),l=()=>{a&&this.end(a)};return r.addEventListener("pagehide",l),(0,i.combineTeardowns)(()=>r.clearInterval(u),()=>r.removeEventListener("pagehide",l),()=>{c.then(()=>{a&&this.end(a)})},()=>{try{r.sessionStorage.removeItem(o)}catch{}})}}t.Sessions=s,t.default=s},9286(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Activation=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init(e.eventName,{...e.properties,type:"activation",timestamp:(new Date).toISOString()})}async trackOnboardingStep(e){return await this.init("onboarding_step",{type:"activation",subtype:"onboarding_step",userId:e.userId,stepId:e.stepId,stepName:e.stepName,stepOrder:e.stepOrder,totalSteps:e.totalSteps,progress:Math.round(e.stepOrder/e.totalSteps*100),timeSpent:e.timeSpent,skipped:e.skipped||!1,...e.properties,timestamp:(new Date).toISOString()})}async completeOnboarding(e,t,r,n){return await this.init("onboarding_completed",{type:"activation",subtype:"onboarding_complete",userId:e,totalTimeSpent:t,stepsCompleted:r,stepsSkipped:n,completionRate:Math.round(r/(r+n)*100),timestamp:(new Date).toISOString()})}async trackFirstAction(e){return await this.init("first_action",{type:"activation",subtype:"first_action",userId:e.userId,actionName:e.actionName,timeSinceSignup:e.timeSinceSignup,source:e.source,...e.properties,timestamp:(new Date).toISOString()})}async trackSignup(e,t,r,n){return await this.init("signup_completed",{type:"activation",subtype:"signup",userId:e,method:t,source:r,...n,timestamp:(new Date).toISOString()})}}t.Activation=i,t.default=i},6045(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Experiment=t.HOLDOUT_PCT=void 0;const n=r(5975),i=r(4211);function s(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=16777619*t>>>0;return t}t.HOLDOUT_PCT=5;const o="fg_exp_assignments",a="fg_exp_assignments";class c extends n.FlowGridTransport{constructor(){super(...arguments),this.experiments={},this.assignments={}}parseAssignmentCookie(e){if(!e)return{};try{const t=decodeURIComponent(e),r=JSON.parse(t);return r&&"object"==typeof r?r:{}}catch{return{}}}readAssignmentCookie(){return this.parseAssignmentCookie((0,i.getCookie)(a))}writeAssignmentCookie(){try{if("undefined"==typeof document)return;const e=encodeURIComponent(JSON.stringify(this.assignments)),t=31536e3,r="Lax",n="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";document.cookie=`${a}=${e}; Path=/; Max-Age=${t}; SameSite=${r}${n}`}catch{}}loadAssignments(){try{if("undefined"!=typeof localStorage){const e=localStorage.getItem(o);if(e){const t=JSON.parse(e);if(t&&"object"==typeof t)return t}}}catch{}const e=this.readAssignmentCookie();return Object.keys(e).length>0?e:{}}saveAssignments(){try{"undefined"!=typeof localStorage&&localStorage.setItem(o,JSON.stringify(this.assignments))}catch{}this.writeAssignmentCookie()}injectAssignments(e){this.assignments={...this.assignments,...e}}getAssignments(){return{...this.assignments}}hydrateFromCookies(e){const t=e.get(a),r="string"==typeof t?t:t?.value??null,n=this.parseAssignmentCookie(r??null);Object.keys(n).length>0&&this.injectAssignments(n)}hydrateFromCookieHeader(e){if(!e)return;const t=e.split(/;\s*/),r=`${a}=`,n=t.find(e=>e.startsWith(r));if(!n)return;const i=this.parseAssignmentCookie(n.slice(r.length));Object.keys(i).length>0&&this.injectAssignments(i)}serializeAssignmentCookie(){const e=encodeURIComponent(JSON.stringify(this.assignments));return`${a}=${e}; Path=/; Max-Age=31536000; SameSite=Lax`}clearAssignments(){this.assignments={};try{"undefined"!=typeof localStorage&&localStorage.removeItem(o)}catch{}try{"undefined"!=typeof document&&(document.cookie=`${a}=; Path=/; Max-Age=0; SameSite=Lax`)}catch{}}getOrCreateAnonId(){try{if("undefined"!=typeof localStorage){const e=localStorage.getItem(c.ANON_ID_KEY);if(e)return e;const t="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return localStorage.setItem(c.ANON_ID_KEY,t),t}}catch{}return"anon_"+s(String(Math.random())).toString(36)}deterministicAssign(e,t,r){const n=s(e+t);let i=0;for(const e of r)i+=e.weight;const o=n%1e4/1e4*i;let a=0;for(const e of r)if(a+=e.weight,o<a)return e.id;return r[r.length-1].id}assignVariant(e,r,n={},i=[]){this.assignments=this.loadAssignments();const o=this.assignments[e],a=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId(),c="string"==typeof n.status?n.status:void 0,u="string"==typeof n.winner_id?n.winner_id:void 0;if("complete"===c&&u&&r.some(e=>e.id===u)){if(o===u)return;return this.assignments[e]=u,this.saveAssignments(),void this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e,userId:a,variantId:u,source:"shipped_winner",assignmentSource:"sdk_init",timestamp:(new Date).toISOString()}).catch(()=>{})}if(o&&r.some(e=>e.id===o))return;if(function(e,r=t.HOLDOUT_PCT){return!(r<=0)&&(r>=100||s("holdout::"+e)%1e4/100<r)}(a))return;const l="string"==typeof n.exclusion_group?n.exclusion_group:void 0;if(l&&!function(e,t,r,n){const i=Array.from(new Set([...n,t])).sort();return i.length<=1||i[s("exclusion::"+r+"::"+e)%i.length]===t}(a,e,l,i))return;const d=this.deterministicAssign(a,e,r);this.assignments[e]=d,this.saveAssignments(),this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e,userId:a,variantId:d,source:"random",assignmentSource:"sdk_init",timestamp:(new Date).toISOString()}).catch(()=>{})}computeExclusionGroupMembers(e){const t=new Map;for(const r of e){const e="string"==typeof r.properties?.exclusion_group?r.properties.exclusion_group:void 0;e&&(t.has(e)||t.set(e,[]),t.get(e).push(r.experiment_id))}return t}assignFromLocalConfigs(e){const t=this.computeExclusionGroupMembers(e.map(e=>({experiment_id:e.id,properties:e.properties})));for(const r of e){this.experiments[r.id]={variants:r.variants,properties:r.properties||{},verified:!1};const e="string"==typeof r.properties?.exclusion_group?r.properties.exclusion_group:void 0;this.assignVariant(r.id,r.variants,r.properties||{},e?t.get(e)??[]:[])}}async verifyExperiments(e){const t={web_id:this.webId,experiments:e.map(e=>({experiment_id:e.id,variants:e.variants,properties:e.properties||{}}))};try{const r=await fetch(`${this.endpoint}/api/v1/experiments/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.ok&&Array.isArray(n.data)){const e=this.computeExclusionGroupMembers(n.data);for(const t of n.data)if("error"!==t.action){this.experiments[t.experiment_id]={variants:t.variants,properties:t.properties??{},verified:!0};const r="string"==typeof t.properties?.exclusion_group?t.properties.exclusion_group:void 0;this.assignVariant(t.experiment_id,t.variants,t.properties??{},r?e.get(r)??[]:[])}}else this.assignFromLocalConfigs(e)}catch{this.assignFromLocalConfigs(e)}}async initExperiments(e){this.assignments=this.loadAssignments(),e.length>0&&await this.verifyExperiments(e)}getLocalVariant(e){return this.assignments=this.loadAssignments(),this.assignments[e]??null}async trackLocalConversion(e,t="conversion",r=1){const n=this.getLocalVariant(e);if(!n)return;const i=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId();await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:e,userId:i,variantId:n,metricName:t,value:r,timestamp:(new Date).toISOString()})}async trackLocalExposure(e){const t=this.getLocalVariant(e);if(!t)return;const r=this.identityManager?.getVisitorId?.()||this.visitorId||this.getOrCreateAnonId();await this.trackExposure(e,r,t)}async track(e){return await this.init(e.eventName,{...e.properties,type:"experiment",subtype:"custom",variant:e.variant,timestamp:(new Date).toISOString()})}async define(e){return await this.init("experiment_definition",{type:"experiment",subtype:"definition",...e,timestamp:(new Date).toISOString()})}async assign(e){return await this.init("experiment_assignment",{type:"experiment",subtype:"assignment",experimentId:e.experimentId,userId:e.userId,variantId:e.variantId,source:e.source||"random",timestamp:(new Date).toISOString()})}async trackConversion(e){return await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:e.experimentId,userId:e.userId,variantId:e.variantId,metricName:e.metricName,value:e.value,timestamp:(new Date).toISOString()})}async trackExposure(e,t,r){return await this.init("experiment_exposure",{type:"experiment",subtype:"exposure",experimentId:e,userId:t,variantId:r,timestamp:(new Date).toISOString()})}}t.Experiment=c,c.ANON_ID_KEY="fg_anon_id",t.default=c},7244(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Experiment=t.TrackPrompt=t.TrackFeature=t.Activation=void 0;var n=r(9286);Object.defineProperty(t,"Activation",{enumerable:!0,get:function(){return n.Activation}});var i=r(1944);Object.defineProperty(t,"TrackFeature",{enumerable:!0,get:function(){return i.TrackFeature}});var s=r(2078);Object.defineProperty(t,"TrackPrompt",{enumerable:!0,get:function(){return s.TrackPrompt}});var o=r(6045);Object.defineProperty(t,"Experiment",{enumerable:!0,get:function(){return o.Experiment}})},1944(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackFeature=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init("create_tracking",{type:"feature_usage",subtype:"create_custom",userId:e.userId,category:e.category,action:e.action,...e.properties,timestamp:(new Date).toISOString()})}async trackUsage(e){return await this.init(e.eventName??"feature_usage",{type:"feature_usage",subtype:e.action,featureId:e.featureId,featureName:e.featureName,userId:e.userId,action:e.action,duration:e.duration,success:e.success,category:e.category,...e.properties,timestamp:(new Date).toISOString()})}}t.TrackFeature=i,t.default=i},2078(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackPrompt=void 0;const n=r(5975);class i extends n.FlowGridTransport{async create(e){return await this.init(e.eventName,{...e.properties,type:"prompt",timestamp:(new Date).toISOString()})}async trackSubmission(e){return await this.init("prompt_submitted",{type:"prompt",subtype:"submission",promptId:e.promptId,userId:e.userId,promptType:e.promptType,model:e.model,inputTokens:e.inputTokens,conversationId:e.conversationId,...e.properties,timestamp:(new Date).toISOString()})}async trackResponse(e){return await this.init("prompt_response",{type:"prompt",subtype:"response",promptId:e.promptId,responseTime:e.responseTime,outputTokens:e.outputTokens,completed:e.completed,error:e.error,qualityScore:e.qualityScore,timestamp:(new Date).toISOString()})}async trackFeedback(e){return await this.init("prompt_feedback",{type:"prompt",subtype:"feedback",promptId:e.promptId,userId:e.userId,feedbackType:e.feedbackType,rating:e.rating,comment:e.comment,timestamp:(new Date).toISOString()})}async trackConversation(e,t,r,n){return await this.init("prompt_conversation",{type:"prompt",subtype:"conversation",conversationId:e,userId:t,turnCount:r,totalDuration:n,timestamp:(new Date).toISOString()})}}t.TrackPrompt=i,t.default=i},9927(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CartTracking=void 0;const n=r(5975);class i extends n.FlowGridTransport{async addItem(e){const t=e.product.price*e.quantity-(e.product.discount||0);return await this.init("add_to_cart",{type:"ecommerce",subtype:"add_to_cart",product:e.product,quantity:e.quantity,lineTotal:t,cartId:e.cartId,userId:e.userId,source:e.source,...e.properties,timestamp:(new Date).toISOString()})}async removeItem(e){return await this.init("remove_from_cart",{type:"ecommerce",subtype:"remove_from_cart",product:e.product,quantity:e.quantity,cartId:e.cartId,userId:e.userId,reason:e.reason||"user_action",timestamp:(new Date).toISOString()})}async updateItem(e){return await this.init("update_cart_item",{type:"ecommerce",subtype:"update_cart_item",product:e.product,previousQuantity:e.previousQuantity,newQuantity:e.newQuantity,quantityChange:e.newQuantity-e.previousQuantity,cartId:e.cartId,timestamp:(new Date).toISOString()})}async view(e){return await this.init("view_cart",{type:"ecommerce",subtype:"view_cart",cartId:e.cart.cartId,cart:e.cart,cartValue:e.cart.total,itemCount:e.cart.itemCount,userId:e.userId,timestamp:(new Date).toISOString()})}async abandon(e,t){return await this.init("cart_abandoned",{type:"ecommerce",subtype:"cart_abandoned",cart:e,cartValue:e.total,itemCount:e.itemCount,reason:t,timestamp:(new Date).toISOString()})}async applyCoupon(e,t,r,n){return await this.init("apply_coupon",{type:"ecommerce",subtype:"apply_coupon",cartId:e,couponCode:t,success:r,discount:n,timestamp:(new Date).toISOString()})}}t.CartTracking=i,t.default=i},3661(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Checkout=void 0;const n=r(5975);class i extends n.FlowGridTransport{async begin(e){return await this.init("begin_checkout",{type:"ecommerce",subtype:"begin_checkout",cart:e.cart,cartValue:e.cart.total,itemCount:e.cart.itemCount,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async step(e){return await this.init("checkout_step",{type:"ecommerce",subtype:"checkout_step",step:e.step,stepNumber:e.stepNumber,cart:e.cart,option:e.option,userId:e.userId,timestamp:(new Date).toISOString()})}async addShipping(e){return await this.init("add_shipping_info",{type:"ecommerce",subtype:"shipping_info",cart:e.cart,shipping:e.shipping,shippingMethod:e.shipping.method,shippingCost:e.shipping.cost,userId:e.userId,timestamp:(new Date).toISOString()})}async addPayment(e){return await this.init("add_payment_info",{type:"ecommerce",subtype:"payment_info",cart:e.cart,payment:e.payment,paymentMethod:e.payment.method,userId:e.userId,timestamp:(new Date).toISOString()})}async abandon(e,t,r){return await this.init("checkout_abandoned",{type:"ecommerce",subtype:"checkout_abandoned",cart:e,step:t,cartValue:e.total,reason:r,timestamp:(new Date).toISOString()})}async paymentAttempt(e,t,r,n){return await this.init("payment_attempt",{type:"ecommerce",subtype:"payment_attempt",success:e,cart:t,payment:r,errorCode:n,timestamp:(new Date).toISOString()})}}t.Checkout=i,t.default=i},5405(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subscriptions=t.SearchAnalytics=t.CustomerLTV=t.WishlistTracking=t.Promotions=t.Refunds=t.Purchases=t.Checkout=t.CartTracking=t.Products=void 0;var n=r(1253);Object.defineProperty(t,"Products",{enumerable:!0,get:function(){return n.Products}});var i=r(9927);Object.defineProperty(t,"CartTracking",{enumerable:!0,get:function(){return i.CartTracking}});var s=r(3661);Object.defineProperty(t,"Checkout",{enumerable:!0,get:function(){return s.Checkout}});var o=r(3241);Object.defineProperty(t,"Purchases",{enumerable:!0,get:function(){return o.Purchases}});var a=r(7530);Object.defineProperty(t,"Refunds",{enumerable:!0,get:function(){return a.Refunds}});var c=r(4183);Object.defineProperty(t,"Promotions",{enumerable:!0,get:function(){return c.Promotions}});var u=r(5926);Object.defineProperty(t,"WishlistTracking",{enumerable:!0,get:function(){return u.WishlistTracking}});var l=r(9227);Object.defineProperty(t,"CustomerLTV",{enumerable:!0,get:function(){return l.CustomerLTV}});var d=r(4589);Object.defineProperty(t,"SearchAnalytics",{enumerable:!0,get:function(){return d.SearchAnalytics}});var p=r(3847);Object.defineProperty(t,"Subscriptions",{enumerable:!0,get:function(){return p.Subscriptions}})},9227(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomerLTV=void 0;const n=r(5975);class i extends n.FlowGridTransport{async recordAcquisitionCost(e){return await this.init("record_acquisition_cost",{type:"ecommerce",subtype:"acquisition_cost",userId:e.userId,cost:e.cost,channel:e.channel,campaign:e.campaign,timestamp:(new Date).toISOString()})}async updateSegment(e,t){return await this.init("update_customer_segment",{type:"ecommerce",subtype:"update_customer_segment",userId:e,segment:t,timestamp:(new Date).toISOString()})}}t.CustomerLTV=i,t.default=i},1253(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Products=void 0;const n=r(5975);class i extends n.FlowGridTransport{async view(e){return await this.init("product_view",{type:"ecommerce",subtype:"product_view",product:{productId:e.productId,name:e.name,brand:e.brand,category:e.category,variant:e.variant,price:e.price,currency:e.currency,url:e.url,imageUrl:e.imageUrl,rating:e.rating,reviewCount:e.reviewCount,stockStatus:e.stockStatus,attributes:e.attributes},source:e.source,searchQuery:e.searchQuery,userId:e.userId,sessionId:e.sessionId,...e.properties,timestamp:(new Date).toISOString()})}async impression(e){return await this.init("product_impression",{type:"ecommerce",subtype:"product_impression",list:e.list,productCount:e.list.products.length,userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async click(e){return await this.init("product_click",{type:"ecommerce",subtype:"product_click",product:e.product,listId:e.listId,position:e.position,userId:e.userId,timestamp:(new Date).toISOString()})}async quickView(e,t){return await this.init("product_quick_view",{type:"ecommerce",subtype:"product_quick_view",product:e,listId:t,timestamp:(new Date).toISOString()})}async interaction(e,t,r){return await this.init("product_interaction",{type:"ecommerce",subtype:"product_interaction",productId:e,action:t,...r,timestamp:(new Date).toISOString()})}}t.Products=i,t.default=i},4183(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Promotions=void 0;const n=r(5975);class i extends n.FlowGridTransport{async view(e){return await this.init("promotion_view",{type:"ecommerce",subtype:"promotion_view",promotionId:e.promotionId,name:e.name,creative:e.creative,position:e.position,page:e.page,userId:e.userId,timestamp:(new Date).toISOString()})}async click(e){return await this.init("promotion_click",{type:"ecommerce",subtype:"promotion_click",promotionId:e.promotionId,name:e.name,creative:e.creative,position:e.position,destinationUrl:e.destinationUrl,userId:e.userId,timestamp:(new Date).toISOString()})}async couponUsed(e){return await this.init("coupon_used",{type:"ecommerce",subtype:"coupon_used",code:e.code,orderId:e.orderId,discountValue:e.discountValue,discountType:e.discountType,orderValueBefore:e.orderValueBefore,orderValueAfter:e.orderValueAfter,savings:e.orderValueBefore-e.orderValueAfter,userId:e.userId,timestamp:(new Date).toISOString()})}async couponAttempt(e,t,r){return await this.init("coupon_attempt",{type:"ecommerce",subtype:"coupon_attempt",code:e,success:t,failureReason:r,timestamp:(new Date).toISOString()})}}t.Promotions=i,t.default=i},3241(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Purchases=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){const t=e.order;return await this.init("purchase",{type:"ecommerce",subtype:"purchase",order:{orderId:t.orderId,items:t.items,subtotal:t.subtotal,discountTotal:t.discountTotal,shippingTotal:t.shippingTotal,taxTotal:t.taxTotal,total:t.total,currency:t.currency,shipping:t.shipping,payment:t.payment,coupons:t.coupons,affiliation:t.affiliation},revenue:t.total,itemCount:t.items.reduce((e,t)=>e+t.quantity,0),userId:e.userId,sessionId:e.sessionId,attribution:e.attribution,...e.properties,timestamp:(new Date).toISOString()})}async statusChange(e,t,r){return await this.init("order_status_change",{type:"ecommerce",subtype:"order_status_change",orderId:e,newStatus:t,previousStatus:r,timestamp:(new Date).toISOString()})}async shipped(e,t){return await this.init("order_shipped",{type:"ecommerce",subtype:"order_shipped",orderId:e,shipping:t,timestamp:(new Date).toISOString()})}async delivered(e,t){return await this.init("order_delivered",{type:"ecommerce",subtype:"order_delivered",orderId:e,deliveredAt:t||(new Date).toISOString(),timestamp:(new Date).toISOString()})}}t.Purchases=i,t.default=i},7530(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Refunds=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("refund",{type:"ecommerce",subtype:"refund",orderId:e.orderId,refundId:e.refundId,items:e.items,amount:e.amount,currency:e.currency,reason:e.reason,isFullRefund:e.isFullRefund,userId:e.userId,initiatedBy:e.initiatedBy,...e.properties,timestamp:(new Date).toISOString()})}async request(e,t,r){return await this.init("refund_requested",{type:"ecommerce",subtype:"refund_requested",orderId:e,items:t,reason:r,timestamp:(new Date).toISOString()})}async approve(e,t){return await this.init("refund_approved",{type:"ecommerce",subtype:"refund_approved",refundId:e,approvedAmount:t,timestamp:(new Date).toISOString()})}async deny(e,t){return await this.init("refund_denied",{type:"ecommerce",subtype:"refund_denied",refundId:e,denialReason:t,timestamp:(new Date).toISOString()})}async complete(e,t){return await this.init("refund_completed",{type:"ecommerce",subtype:"refund_completed",refundId:e,processedAmount:t,timestamp:(new Date).toISOString()})}}t.Refunds=i,t.default=i},4589(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAnalytics=void 0;const n=r(5975);class i extends n.FlowGridTransport{async track(e){return await this.init("site_search",{type:"ecommerce",subtype:"site_search",query:e.query,resultsCount:e.resultsCount,hasResults:e.resultsCount>0,category:e.category,filters:e.filters,sortBy:e.sortBy,page:e.page||1,userId:e.userId,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}async trackClick(e){return await this.init("search_result_click",{type:"ecommerce",subtype:"search_result_click",query:e.query,product:e.product,position:e.position,page:e.page||1,timestamp:(new Date).toISOString()})}async trackRefinement(e,t,r){return await this.init("search_refinement",{type:"ecommerce",subtype:"search_refinement",originalQuery:e,refinedQuery:t,refinementType:r,timestamp:(new Date).toISOString()})}async trackSuggestion(e,t,r){return await this.init("search_suggestion",{type:"ecommerce",subtype:"search_suggestion",partialQuery:e,selectedSuggestion:t,suggestionPosition:r,timestamp:(new Date).toISOString()})}}t.SearchAnalytics=i,t.default=i},3847(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subscriptions=void 0;const n=r(5975);class i extends n.FlowGridTransport{async start(e){return await this.init("subscription_start",{type:"ecommerce",subtype:"subscription_start",subscriptionId:e.subscriptionId,userId:e.userId,plan:e.plan,mrr:e.mrr,billingCycle:e.billingCycle,trialDays:e.trialDays,coupon:e.coupon,isTrialing:(e.trialDays||0)>0,...e.properties,timestamp:(new Date).toISOString()})}async change(e){const t=e.newMrr.amount-e.previousMrr.amount;return await this.init("subscription_change",{type:"ecommerce",subtype:"subscription_change",subscriptionId:e.subscriptionId,userId:e.userId,previousPlan:e.previousPlan,newPlan:e.newPlan,previousMrr:e.previousMrr,newMrr:e.newMrr,mrrChange:t,changeType:e.changeType,timestamp:(new Date).toISOString()})}async cancel(e){return await this.init("subscription_cancel",{type:"ecommerce",subtype:"subscription_cancel",subscriptionId:e.subscriptionId,userId:e.userId,plan:e.plan,lostMrr:e.lostMrr,reason:e.reason,feedback:e.feedback,immediate:e.immediate,timestamp:(new Date).toISOString()})}async renew(e,t,r){return await this.init("subscription_renew",{type:"ecommerce",subtype:"subscription_renew",subscriptionId:e,userId:t,mrr:r,timestamp:(new Date).toISOString()})}async trialConverted(e,t,r,n){return await this.init("trial_converted",{type:"ecommerce",subtype:"trial_converted",subscriptionId:e,userId:t,plan:r,mrr:n,timestamp:(new Date).toISOString()})}async trialExpired(e,t){return await this.init("trial_expired",{type:"ecommerce",subtype:"trial_expired",subscriptionId:e,userId:t,timestamp:(new Date).toISOString()})}}t.Subscriptions=i,t.default=i},5926(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WishlistTracking=void 0;const n=r(5975);class i extends n.FlowGridTransport{async add(e){return await this.init("add_to_wishlist",{type:"ecommerce",subtype:"add_to_wishlist",product:e.product,wishlistId:e.wishlistId,userId:e.userId,source:e.source,timestamp:(new Date).toISOString()})}async remove(e){return await this.init("remove_from_wishlist",{type:"ecommerce",subtype:"remove_from_wishlist",product:e.product,wishlistId:e.wishlistId,userId:e.userId,reason:e.reason||"user_action",timestamp:(new Date).toISOString()})}async view(e){return await this.init("view_wishlist",{type:"ecommerce",subtype:"view_wishlist",wishlistId:e.wishlistId,itemCount:e.items.length,timestamp:(new Date).toISOString()})}async moveToCart(e,t){return await this.init("wishlist_to_cart",{type:"ecommerce",subtype:"wishlist_to_cart",product:e,wishlistId:t,timestamp:(new Date).toISOString()})}async share(e,t){return await this.init("share_wishlist",{type:"ecommerce",subtype:"share_wishlist",wishlistId:e,method:t,timestamp:(new Date).toISOString()})}}t.WishlistTracking=i,t.default=i},991(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AcquisitionAnalytics=void 0,t.calculateCAC=function(e,t,r){return 0===t?{amount:0,currency:r}:{amount:Math.round(e/t*100)/100,currency:r}},t.calculateROAS=function(e,t){return 0===t?0:Math.round(e/t*100)/100},t.calculateLTVCACRatio=function(e,t){return 0===t?0:Math.round(e/t*100)/100},t.parseUTMParams=function(e){const t={};try{const r=new URL(e),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];for(const e of n){const n=r.searchParams.get(e);n&&(t[e.replace("utm_","")]=n)}}catch{}return t},t.classifySource=function(e,t){if(!e&&!t)return"direct";const r=e?.toLowerCase()??"",n=t?.toLowerCase()??"";return n.includes("cpc")||n.includes("paid")?r.includes("facebook")||r.includes("instagram")||r.includes("linkedin")?"paid_social":"paid_search":r.includes("facebook")||r.includes("twitter")||r.includes("linkedin")?"organic_social":"email"===n?"email":"referral"===n?"referral":"affiliate"===n?"affiliate":"organic"};const n=r(5975);class i extends n.FlowGridTransport{async trackAcquisition(e){return await this.initFeature("acquisition.acquired",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async trackLifecycleTransition(e){return await this.initFeature("acquisition.lifecycle_transition",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async createCampaign(e){return await this.initFeature("acquisition.create_campaign",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}async trackCampaignSpend(e){return await this.initFeature("acquisition.campaign_spend",{type:"acquisition",...e,timestamp:(new Date).toISOString()})}}t.AcquisitionAnalytics=i},1765(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlertsAnalytics=void 0,t.calculateStdDev=function(e){if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,r=e.map(e=>Math.pow(e-t,2)),n=r.reduce((e,t)=>e+t,0)/r.length;return Math.sqrt(n)},t.calculateZScore=function(e,t,r){return 0===r?0:(e-t)/r},t.isAnomaly=function(e,t=.5){const r=4-2*t;return Math.abs(e)>r},t.calculateAnomalyScore=function(e){const t=Math.abs(e);return t<=2?t/10:t<=3?.2+.3*(t-2):t<=4?.5+.3*(t-3):Math.min(.8+.1*(t-4),1)},t.classifySeverity=function(e){return e<.25?"info":e<.5?"warning":e<.75?"high":"critical"},t.checkAlertCondition=function(e,t,r,n,i){switch(t){case"exceeds":return e>r;case"drops_below":return e<r;case"changes_by":return void 0!==n&&void 0!==i&&100*Math.abs((e-n)/n)>=i;case"no_data":return 0===e||null===e;default:return!1}};const n=r(5975);class i extends n.FlowGridTransport{async createAlert(e){return await this.initFeature("alerts.create",{type:"alerts",...e,alertId:e.alertId??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"_"),enabled:e.enabled??!0,timestamp:(new Date).toISOString()})}async updateAlert(e,t){return await this.initFeature("alerts.update",{type:"alerts",alertId:e,...t,timestamp:(new Date).toISOString()})}async deleteAlert(e){return await this.initFeature("alerts.delete",{type:"alerts",alertId:e,timestamp:(new Date).toISOString()})}async toggleAlert(e,t){return await this.initFeature("alerts.toggle",{type:"alerts",alertId:e,enabled:t,timestamp:(new Date).toISOString()})}async listAlerts(e){return await this.initFeature("alerts.list",{type:"alerts",enabled:e,timestamp:(new Date).toISOString()})}async acknowledgeAlert(e,t){return await this.initFeature("alerts.acknowledge",{type:"alerts",instanceId:e,acknowledgedBy:t,timestamp:(new Date).toISOString()})}async resolveAlert(e,t){return await this.initFeature("alerts.resolve",{type:"alerts",instanceId:e,notes:t,timestamp:(new Date).toISOString()})}async muteAlert(e,t){return await this.initFeature("alerts.mute",{type:"alerts",alertId:e,durationMinutes:t,timestamp:(new Date).toISOString()})}async detectAnomalies(e){return await this.initFeature("alerts.detect_anomalies",{type:"alerts",...e,timestamp:(new Date).toISOString()})}async configureNotification(e){return await this.initFeature("alerts.configure_notification",{type:"alerts",...e,timestamp:(new Date).toISOString()})}async testNotification(e){return await this.initFeature("alerts.test_notification",{type:"alerts",channel:e,timestamp:(new Date).toISOString()})}}t.AlertsAnalytics=i},9746(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChurnAnalytics=void 0,t.calculateChurnRiskScore=function(e){const t=.25,r=.2,n=.15,i=.1,s=.1,o=.1,a=.05,c=.05;let u=0;return u+=100*Math.min(e.daysSinceLastActivity/30,1)*t,u+=Math.max(0,-e.usageTrend)*r,u+=Math.max(0,-e.sessionFrequencyChange)*n,u+=Math.max(0,-e.featureUsageChange)*i,u+=Math.min(10*e.supportTickets,100)*s,void 0!==e.npsScore&&(u+=(100-10*e.npsScore)*o),u+=Math.min(25*e.paymentFailures,100)*a,void 0!==e.daysUntilRenewal&&(u+=Math.max(0,100-e.daysUntilRenewal)*c),Math.round(Math.min(u,100))},t.classifyRiskLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"critical"},t.generateRecommendations=function(e){const t=[],r={daysSinceLastActivity:"Send a re-engagement email or push notification",usageTrend:"Schedule a product walkthrough or training session",sessionFrequencyChange:"Offer incentives to increase usage frequency",featureUsageChange:"Highlight underutilized features via in-app messaging",supportTickets:"Escalate to customer success for personalized support",npsScore:"Conduct a follow-up call to address concerns",paymentFailures:"Reach out to resolve payment issues proactively",daysUntilRenewal:"Start renewal conversation early with value recap"};for(const n of e.slice(0,3))r[n.factor]&&t.push(r[n.factor]);return t};const n=r(5975);class i extends n.FlowGridTransport{async trackUsageDecay(e){return await this.initFeature("churn.usage_decay",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackNPS(e){return await this.initFeature("churn.nps",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackChurn(e){return await this.initFeature("churn.churn_event",{type:"churn",...e,timestamp:(new Date).toISOString()})}async trackPreventionAction(e){return await this.initFeature("churn.prevention_action",{type:"churn",...e,timestamp:(new Date).toISOString()})}async updatePreventionOutcome(e,t,r){return await this.initFeature("churn.update_prevention_outcome",{type:"churn",userId:e,actionType:t,outcome:r,timestamp:(new Date).toISOString()})}}t.ChurnAnalytics=i},9774(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cohorts=void 0,t.evaluateCohortRules=function(e,t){let r=!0,n="and";for(const s of t){const t=i(e[s.attribute],s.operator,s.value);r="and"===n?r&&t:r||t,n=s.logicalOperator??"and"}return r},t.generateCohortId=s;const n=r(5975);function i(e,t,r){switch(t){case"equals":return e===r;case"not_equals":return e!==r;case"contains":return String(e).includes(String(r));case"not_contains":return!String(e).includes(String(r));case"gt":return Number(e)>Number(r);case"gte":return Number(e)>=Number(r);case"lt":return Number(e)<Number(r);case"lte":return Number(e)<=Number(r);case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"exists":return null!=e;case"not_exists":return null==e;case"between":if(Array.isArray(r)&&2===r.length){const t=Number(e);return t>=Number(r[0])&&t<=Number(r[1])}return!1;default:return!1}}function s(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}class o extends n.FlowGridTransport{async createCohort(e){const t=e.cohortId??s(e.name);return await this.initFeature("cohorts.create",{type:"cohorts",cohortId:t,name:e.name,description:e.description,cohortType:e.type,rules:e.rules,dynamic:e.dynamic??!0,timeWindow:e.timeWindow,timestamp:(new Date).toISOString()})}async updateCohort(e,t){const{type:r,...n}=t;return await this.initFeature("cohorts.update",{type:"cohorts",cohortId:e,cohortType:r,...n,timestamp:(new Date).toISOString()})}async deleteCohort(e){return await this.initFeature("cohorts.delete",{type:"cohorts",cohortId:e,timestamp:(new Date).toISOString()})}async listCohorts(e){return await this.initFeature("cohorts.list",{type:"cohorts",filter:e,timestamp:(new Date).toISOString()})}async isUserInCohort(e,t){return await this.initFeature("cohorts.check_membership",{type:"cohorts",userId:e,cohortId:t,timestamp:(new Date).toISOString()})}async createSegment(e){return await this.initFeature("cohorts.create_segment",{type:"cohorts",...e,timestamp:(new Date).toISOString()})}async compareCohorts(e){return await this.initFeature("cohorts.compare",{type:"cohorts",...e,timestamp:(new Date).toISOString()})}}t.Cohorts=o},4805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Engagement=void 0,t.calculateEngagementScore=function(e,t,r,n){const i=.25,s=.25,o=.3,a=.2;return Math.round(100*(e*i+t*s+r*o+n*a))/100},t.classifyEngagementLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"power"},t.calculateSessionDepthScore=s;const n=r(5975),i=r(7890);function s(e,t,r){const n=30*Math.min(e/10,1),i=40*Math.min(t/5,1),s=30*Math.min(r/20,1);return Math.round(n+i+s)}class o extends n.FlowGridTransport{async trackDwellTime(e){return await this.initFeature("engagement.dwell_time",{type:"engagement",featureId:e.featureId,userId:e.userId,sessionId:e.sessionId,dwellTimeMs:e.dwellTimeMs,wasActive:e.wasActive??!0,...e.properties,timestamp:(new Date).toISOString()})}async trackSessionDepth(e){const t=s(e.pagesVisited,e.featuresUsed,e.actionsTaken);return await this.initFeature("engagement.session_depth",{type:"engagement",sessionId:e.sessionId,userId:e.userId,pagesVisited:e.pagesVisited,featuresUsed:e.featuresUsed,actionsTaken:e.actionsTaken,durationMs:e.durationMs,depthScore:t,timestamp:(new Date).toISOString()})}async trackContentConsumption(e){return await this.initFeature("engagement.content_consumption",{type:"engagement",contentId:e.contentId,contentType:e.contentType,userId:e.userId,percentageConsumed:e.percentageConsumed,timeSpentMs:e.timeSpentMs,completed:e.completed??e.percentageConsumed>=90,...e.properties,timestamp:(new Date).toISOString()})}async trackUserActivity(e){return await this.initFeature("engagement.user_activity",{type:"engagement",userId:e.userId,activityType:e.activityType,durationMs:e.durationMs,sessionId:e.sessionId,timestamp:(new Date).toISOString()})}autoTrackDwell(e,t={}){if(!(0,i.isBrowser)())return()=>{};const r=(0,i.getDocument)();if(!r)return()=>{};let n=0,s="visible"===r.visibilityState?Date.now():0;const o=()=>{const e=Date.now();"visible"===r.visibilityState?s=e:s&&(n+=e-s,s=0)};r.addEventListener("visibilitychange",o);let a=!1;return()=>{a||(a=!0,r.removeEventListener("visibilitychange",o),s&&(n+=Date.now()-s,s=0),n>0&&this.trackDwellTime({featureId:e,dwellTimeMs:n,userId:t.userId,sessionId:t.sessionId,wasActive:!0}))}}autoTrack(e={}){if(!(0,i.isBrowser)())return()=>{};const t=(0,i.getWindow)(),r=(0,i.getDocument)();if(!t||!r)return()=>{};const n=e.idleAfterMs??3e4,s=e.pollMs??5e3;let o=e.sessionId;if(!o)try{o=t.sessionStorage.getItem("flowgrid:sessionId")||void 0}catch{}o||(o=`eng_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`);const a=Date.now();let c=1;const u=new Set;let l=0,d=Date.now(),p="visible"===r.visibilityState?"active":"idle",h=Date.now();const m=t.history.pushState,f=t.history.replaceState,g=()=>{c++};t.history.pushState=function(...e){const t=m.apply(this,e);return g(),t},t.history.replaceState=function(...e){const t=f.apply(this,e);return g(),t},t.addEventListener("popstate",g);const y=e=>{l++,d=Date.now();const t=e.target,r=t?.closest?.("[data-flowgrid-feature]")?.getAttribute("data-flowgrid-feature");r&&u.add(r)};r.addEventListener("click",y,{capture:!0}),r.addEventListener("keydown",y,{capture:!0}),r.addEventListener("scroll",y,{capture:!0,passive:!0});const v=t=>{if(t===p)return;const r=Date.now(),n=r-h,i=p;p=t,h=r,n>0&&e.userId&&this.trackUserActivity({userId:e.userId,activityType:i,durationMs:n,sessionId:o})},I=()=>{const e=Date.now();let t;t="visible"!==r.visibilityState?"idle":e-d<n?"active":"passive",v(t)},b=t.setInterval(I,s),S=()=>I();r.addEventListener("visibilitychange",S);let w=!1;const C=()=>{if(w)return;w=!0,v("visible"===r.visibilityState?p:"idle");const t=Date.now()-a;t<=0||this.trackSessionDepth({sessionId:o,userId:e.userId,pagesVisited:c,featuresUsed:u.size,actionsTaken:l,durationMs:t})};return t.addEventListener("pagehide",C),(0,i.combineTeardowns)(()=>t.clearInterval(b),()=>r.removeEventListener("visibilitychange",S),()=>r.removeEventListener("click",y,!0),()=>r.removeEventListener("keydown",y,!0),()=>r.removeEventListener("scroll",y,!0),()=>t.removeEventListener("popstate",g),()=>t.removeEventListener("pagehide",C),()=>{t.history.pushState=m,t.history.replaceState=f},()=>C())}}t.Engagement=o},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Forecasting=void 0,t.calculateMAPE=function(e,t){if(e.length!==t.length||0===e.length)return 0;let r=0,n=0;for(let i=0;i<e.length;i++)0!==e[i]&&(r+=Math.abs((e[i]-t[i])/e[i]),n++);return n>0?Math.round(r/n*1e4)/100:0},t.calculateRMSE=function(e,t){if(e.length!==t.length||0===e.length)return 0;let r=0;for(let n=0;n<e.length;n++)r+=Math.pow(e[n]-t[n],2);return Math.round(100*Math.sqrt(r/e.length))/100},t.calculateR2=function(e,t){if(e.length!==t.length||0===e.length)return 0;const r=e.reduce((e,t)=>e+t,0)/e.length;let n=0,i=0;for(let s=0;s<e.length;s++)n+=Math.pow(e[s]-t[s],2),i+=Math.pow(e[s]-r,2);return 0!==i?Math.round(1e4*(1-n/i))/1e4:0},t.classifyTrend=function(e,t,r=5){if(0===e)return t>0?"growing":"stable";const n=(t-e)/e*100;return n>r?"growing":n<-r?"declining":"stable"},t.calculateAvgGrowthRate=function(e){if(e.length<2)return 0;let t=0,r=0;for(let n=1;n<e.length;n++)0!==e[n-1]&&(t+=(e[n]-e[n-1])/e[n-1],r++);return r>0?Math.round(t/r*1e4)/100:0},t.applyConfidenceInterval=function(e,t,r=.95){const n=({.9:1.645,.95:1.96,.99:2.576}[r]??1.96)*t;return{lower:Math.max(0,e-n),upper:e+n}};const n=r(5975);class i extends n.FlowGridTransport{async forecastActiveUsers(e){return await this.initFeature("forecasting.active_users",{type:"forecasting",...e,model:e.model??"ensemble",includeConfidence:e.includeConfidence??!0,timestamp:(new Date).toISOString()})}async forecastRevenue(e){return await this.initFeature("forecasting.revenue",{type:"forecasting",...e,metric:"revenue",currency:e.currency??"USD",timestamp:(new Date).toISOString()})}async forecastMRR(e){return await this.initFeature("forecasting.mrr",{type:"forecasting",...e,metric:"mrr",timestamp:(new Date).toISOString()})}async forecastFeatureAdoption(e){return await this.initFeature("forecasting.feature_adoption",{type:"forecasting",...e,metric:"feature_usage",timestamp:(new Date).toISOString()})}async forecastChurn(e){return await this.initFeature("forecasting.churn",{type:"forecasting",...e,metric:"churn_rate",timestamp:(new Date).toISOString()})}async forecastSignups(e){return await this.initFeature("forecasting.signups",{type:"forecasting",...e,metric:"signups",timestamp:(new Date).toISOString()})}async compareScenarios(e){return await this.initFeature("forecasting.scenarios",{type:"forecasting",...e,timestamp:(new Date).toISOString()})}async forecastCustomMetric(e,t){return await this.initFeature("forecasting.custom",{type:"forecasting",...t,metric:"custom",customMetricName:e,timestamp:(new Date).toISOString()})}}t.Forecasting=i},7736(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.classifySecurityRiskLevel=t.SecurityAnalytics=t.checkAlertCondition=t.classifySeverity=t.calculateAnomalyScore=t.isAnomaly=t.calculateZScore=t.calculateStdDev=t.AlertsAnalytics=t.findCommonSubPaths=t.calculatePathSimilarity=t.isDeadEnd=t.calculateExitRate=t.stringToPath=t.pathToString=t.PathAnalytics=t.classifySource=t.parseUTMParams=t.calculateLTVCACRatio=t.calculateROAS=t.calculateCAC=t.AcquisitionAnalytics=t.formatDuration=t.classifyCSAT=t.calculateAvgResponseTime=t.calculateFCRRate=t.SupportAnalytics=t.generatePathId=t.calculateMicroConversionScore=t.findBestPath=t.calculateDropOffRate=t.calculateConversionRate=t.MultiPathFunnels=t.calculateLTV=t.monthlyToAnnual=t.calculateGRR=t.calculateNRR=t.calculateARPU=t.Monetization=t.generateRecommendations=t.classifyRiskLevel=t.calculateChurnRiskScore=t.ChurnAnalytics=t.generateCohortId=t.evaluateCohortRules=t.Cohorts=t.calculateSessionDepthScore=t.classifyEngagementLevel=t.calculateEngagementScore=t.Engagement=void 0,t.applyConfidenceInterval=t.calculateAvgGrowthRate=t.classifyTrend=t.calculateR2=t.calculateRMSE=t.calculateMAPE=t.Forecasting=t.determineEventSeverity=t.isSuspiciousLoginPattern=t.calculateFailedLoginRate=void 0;var n=r(4805);Object.defineProperty(t,"Engagement",{enumerable:!0,get:function(){return n.Engagement}}),Object.defineProperty(t,"calculateEngagementScore",{enumerable:!0,get:function(){return n.calculateEngagementScore}}),Object.defineProperty(t,"classifyEngagementLevel",{enumerable:!0,get:function(){return n.classifyEngagementLevel}}),Object.defineProperty(t,"calculateSessionDepthScore",{enumerable:!0,get:function(){return n.calculateSessionDepthScore}});var i=r(9774);Object.defineProperty(t,"Cohorts",{enumerable:!0,get:function(){return i.Cohorts}}),Object.defineProperty(t,"evaluateCohortRules",{enumerable:!0,get:function(){return i.evaluateCohortRules}}),Object.defineProperty(t,"generateCohortId",{enumerable:!0,get:function(){return i.generateCohortId}});var s=r(9746);Object.defineProperty(t,"ChurnAnalytics",{enumerable:!0,get:function(){return s.ChurnAnalytics}}),Object.defineProperty(t,"calculateChurnRiskScore",{enumerable:!0,get:function(){return s.calculateChurnRiskScore}}),Object.defineProperty(t,"classifyRiskLevel",{enumerable:!0,get:function(){return s.classifyRiskLevel}}),Object.defineProperty(t,"generateRecommendations",{enumerable:!0,get:function(){return s.generateRecommendations}});var o=r(7867);Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return o.Monetization}}),Object.defineProperty(t,"calculateARPU",{enumerable:!0,get:function(){return o.calculateARPU}}),Object.defineProperty(t,"calculateNRR",{enumerable:!0,get:function(){return o.calculateNRR}}),Object.defineProperty(t,"calculateGRR",{enumerable:!0,get:function(){return o.calculateGRR}}),Object.defineProperty(t,"monthlyToAnnual",{enumerable:!0,get:function(){return o.monthlyToAnnual}}),Object.defineProperty(t,"calculateLTV",{enumerable:!0,get:function(){return o.calculateLTV}});var a=r(8329);Object.defineProperty(t,"MultiPathFunnels",{enumerable:!0,get:function(){return a.MultiPathFunnels}}),Object.defineProperty(t,"calculateConversionRate",{enumerable:!0,get:function(){return a.calculateConversionRate}}),Object.defineProperty(t,"calculateDropOffRate",{enumerable:!0,get:function(){return a.calculateDropOffRate}}),Object.defineProperty(t,"findBestPath",{enumerable:!0,get:function(){return a.findBestPath}}),Object.defineProperty(t,"calculateMicroConversionScore",{enumerable:!0,get:function(){return a.calculateMicroConversionScore}}),Object.defineProperty(t,"generatePathId",{enumerable:!0,get:function(){return a.generatePathId}});var c=r(1247);Object.defineProperty(t,"SupportAnalytics",{enumerable:!0,get:function(){return c.SupportAnalytics}}),Object.defineProperty(t,"calculateFCRRate",{enumerable:!0,get:function(){return c.calculateFCRRate}}),Object.defineProperty(t,"calculateAvgResponseTime",{enumerable:!0,get:function(){return c.calculateAvgResponseTime}}),Object.defineProperty(t,"classifyCSAT",{enumerable:!0,get:function(){return c.classifyCSAT}}),Object.defineProperty(t,"formatDuration",{enumerable:!0,get:function(){return c.formatDuration}});var u=r(991);Object.defineProperty(t,"AcquisitionAnalytics",{enumerable:!0,get:function(){return u.AcquisitionAnalytics}}),Object.defineProperty(t,"calculateCAC",{enumerable:!0,get:function(){return u.calculateCAC}}),Object.defineProperty(t,"calculateROAS",{enumerable:!0,get:function(){return u.calculateROAS}}),Object.defineProperty(t,"calculateLTVCACRatio",{enumerable:!0,get:function(){return u.calculateLTVCACRatio}}),Object.defineProperty(t,"parseUTMParams",{enumerable:!0,get:function(){return u.parseUTMParams}}),Object.defineProperty(t,"classifySource",{enumerable:!0,get:function(){return u.classifySource}});var l=r(5284);Object.defineProperty(t,"PathAnalytics",{enumerable:!0,get:function(){return l.PathAnalytics}}),Object.defineProperty(t,"pathToString",{enumerable:!0,get:function(){return l.pathToString}}),Object.defineProperty(t,"stringToPath",{enumerable:!0,get:function(){return l.stringToPath}}),Object.defineProperty(t,"calculateExitRate",{enumerable:!0,get:function(){return l.calculateExitRate}}),Object.defineProperty(t,"isDeadEnd",{enumerable:!0,get:function(){return l.isDeadEnd}}),Object.defineProperty(t,"calculatePathSimilarity",{enumerable:!0,get:function(){return l.calculatePathSimilarity}}),Object.defineProperty(t,"findCommonSubPaths",{enumerable:!0,get:function(){return l.findCommonSubPaths}});var d=r(1765);Object.defineProperty(t,"AlertsAnalytics",{enumerable:!0,get:function(){return d.AlertsAnalytics}}),Object.defineProperty(t,"calculateStdDev",{enumerable:!0,get:function(){return d.calculateStdDev}}),Object.defineProperty(t,"calculateZScore",{enumerable:!0,get:function(){return d.calculateZScore}}),Object.defineProperty(t,"isAnomaly",{enumerable:!0,get:function(){return d.isAnomaly}}),Object.defineProperty(t,"calculateAnomalyScore",{enumerable:!0,get:function(){return d.calculateAnomalyScore}}),Object.defineProperty(t,"classifySeverity",{enumerable:!0,get:function(){return d.classifySeverity}}),Object.defineProperty(t,"checkAlertCondition",{enumerable:!0,get:function(){return d.checkAlertCondition}});var p=r(1924);Object.defineProperty(t,"SecurityAnalytics",{enumerable:!0,get:function(){return p.SecurityAnalytics}}),Object.defineProperty(t,"classifySecurityRiskLevel",{enumerable:!0,get:function(){return p.classifyRiskLevel}}),Object.defineProperty(t,"calculateFailedLoginRate",{enumerable:!0,get:function(){return p.calculateFailedLoginRate}}),Object.defineProperty(t,"isSuspiciousLoginPattern",{enumerable:!0,get:function(){return p.isSuspiciousLoginPattern}}),Object.defineProperty(t,"determineEventSeverity",{enumerable:!0,get:function(){return p.determineEventSeverity}});var h=r(8119);Object.defineProperty(t,"Forecasting",{enumerable:!0,get:function(){return h.Forecasting}}),Object.defineProperty(t,"calculateMAPE",{enumerable:!0,get:function(){return h.calculateMAPE}}),Object.defineProperty(t,"calculateRMSE",{enumerable:!0,get:function(){return h.calculateRMSE}}),Object.defineProperty(t,"calculateR2",{enumerable:!0,get:function(){return h.calculateR2}}),Object.defineProperty(t,"classifyTrend",{enumerable:!0,get:function(){return h.classifyTrend}}),Object.defineProperty(t,"calculateAvgGrowthRate",{enumerable:!0,get:function(){return h.calculateAvgGrowthRate}}),Object.defineProperty(t,"applyConfidenceInterval",{enumerable:!0,get:function(){return h.applyConfidenceInterval}})},7867(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0,t.calculateARPU=function(e,t,r){const n=t>0?e/t:0;return{amount:Math.round(100*n)/100,currency:r}},t.calculateNRR=function(e,t,r,n){return 0===e?0:Math.round((e+t-r-n)/e*1e4)/100},t.calculateGRR=function(e,t,r){return 0===e?0:Math.round((e-t-r)/e*1e4)/100},t.monthlyToAnnual=function(e){return{amount:12*e.amount,currency:e.currency}},t.calculateLTV=function(e,t,r){if(t<=0)return{amount:60*e,currency:r};const n=e/t;return{amount:Math.round(100*n)/100,currency:r}};const n=r(5975);class i extends n.FlowGridTransport{async trackRevenue(e){const{type:t,...r}=e;return await this.initFeature("monetization.revenue",{type:"monetization",revenueType:t,...r,timestamp:(new Date).toISOString()})}async trackExpansion(e,t,r,n){return await this.initFeature("monetization.expansion",{type:"monetization",userId:e,fromPlan:t,toPlan:r,additionalRevenue:n,revenueType:"expansion",timestamp:(new Date).toISOString()})}async trackContraction(e,t,r,n){return await this.initFeature("monetization.contraction",{type:"monetization",userId:e,fromPlan:t,toPlan:r,reducedRevenue:n,revenueType:"downgrade",timestamp:(new Date).toISOString()})}}t.Monetization=i},8329(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiPathFunnels=void 0,t.calculateConversionRate=function(e,t){return 0===e?0:Math.round(t/e*1e4)/100},t.calculateDropOffRate=function(e,t){return 0===e?0:Math.round((e-t)/e*1e4)/100},t.findBestPath=function(e){return 0===e.length?null:e.reduce((e,t)=>t.completionRate>e.completionRate?t:e)},t.calculateMicroConversionScore=function(e,t){let r=0,n=0;for(const i of t){const t=i.weight??1;r+=t;const s=e.find(e=>e.id===i.id);s&&(n+=t*s.completionRate)}return r>0?Math.round(n/r*100)/100:0},t.generatePathId=i;const n=r(5975);function i(e){return e.join("_").toLowerCase().replace(/[^a-z0-9_]/g,"")}class s extends n.FlowGridTransport{async defineFunnel(e){const t=e.funnelId??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"_"),r=e.paths.map(e=>({...e,pathId:e.pathId??i(e.steps)}));return await this.initFeature("multi_path_funnels.define",{type:"multi_path_funnels",funnelId:t,name:e.name,description:e.description,paths:r,microConversions:e.microConversions,goalEvent:e.goalEvent,timestamp:(new Date).toISOString()})}async updateFunnel(e,t){return await this.initFeature("multi_path_funnels.update",{type:"multi_path_funnels",funnelId:e,...t,timestamp:(new Date).toISOString()})}async deleteFunnel(e){return await this.initFeature("multi_path_funnels.delete",{type:"multi_path_funnels",funnelId:e,timestamp:(new Date).toISOString()})}async trackStep(e){return await this.initFeature("multi_path_funnels.track_step",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async trackMicroConversion(e){return await this.initFeature("multi_path_funnels.track_micro_conversion",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async trackGoal(e,t,r){return await this.initFeature("multi_path_funnels.track_goal",{type:"multi_path_funnels",funnelId:e,userId:t,...r,timestamp:(new Date).toISOString()})}async analyzeFunnel(e){return await this.initFeature("multi_path_funnels.analyze",{type:"multi_path_funnels",...e,timestamp:(new Date).toISOString()})}async comparePaths(e,t){return await this.initFeature("multi_path_funnels.compare_paths",{type:"multi_path_funnels",funnelId:e,filter:t,timestamp:(new Date).toISOString()})}async listFunnels(){return await this.initFeature("multi_path_funnels.list",{type:"multi_path_funnels",timestamp:(new Date).toISOString()})}}t.MultiPathFunnels=s},5284(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathAnalytics=void 0,t.pathToString=i,t.stringToPath=s,t.calculateExitRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.isDeadEnd=function(e,t,r=50){return e>r&&!t},t.calculatePathSimilarity=function(e,t){const r=new Set(e),n=new Set(t),i=new Set([...r].filter(e=>n.has(e))),s=new Set([...r,...n]);return i.size/s.size},t.findCommonSubPaths=function(e,t=2){const r=new Map;for(const n of e)for(let e=0;e<=n.length-t;e++)for(let s=e+t;s<=n.length;s++){const t=i(n.slice(e,s));r.set(t,(r.get(t)??0)+1)}return Array.from(r.entries()).filter(([,e])=>e>1).map(([e,t])=>({subPath:s(e),count:t})).sort((e,t)=>t.count-e.count)};const n=r(5975);function i(e){return e.join(" → ")}function s(e){return e.split(" → ").map(e=>e.trim())}class o extends n.FlowGridTransport{async trackTransition(e){return await this.initFeature("paths.transition",{type:"paths",...e,timestamp:(new Date).toISOString()})}async trackFeatureSequence(e){return await this.initFeature("paths.feature_sequence",{type:"paths",...e,timestamp:(new Date).toISOString()})}async definePath(e){return await this.initFeature("paths.define_path",{type:"paths",...e,timestamp:(new Date).toISOString()})}async comparePaths(e,t){return await this.initFeature("paths.compare_paths",{type:"paths",paths:e,filter:t,timestamp:(new Date).toISOString()})}}t.PathAnalytics=o},1924(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityAnalytics=void 0,t.classifyRiskLevel=function(e){return e<25?"low":e<50?"medium":e<75?"high":"critical"},t.calculateFailedLoginRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.isSuspiciousLoginPattern=function(e,t,r=5){return e>=r&&t<=15},t.determineEventSeverity=i;const n=r(5975);function i(e,t){return["suspicious_activity"].includes(e)?"critical":["role_change","permission_change","data_deletion","api_key_revoked"].includes(e)?"high":["login_failure","password_reset","data_export"].includes(e)?t?"medium":"high":"low"}class s extends n.FlowGridTransport{async trackLoginAttempt(e){const t=e.success?"login_success":"login_failure",r=i(t,e.success);return await this.initFeature("security.login_attempt",{type:"security",...e,eventType:t,severity:r,timestamp:(new Date).toISOString()})}async trackLogout(e,t){return await this.initFeature("security.logout",{type:"security",userId:e,sessionId:t,eventType:"logout",timestamp:(new Date).toISOString()})}async trackPasswordChange(e,t=!1){return await this.initFeature("security.password_change",{type:"security",userId:e,forced:t,eventType:"password_change",timestamp:(new Date).toISOString()})}async trackRoleChange(e){return await this.initFeature("security.role_change",{type:"security",...e,eventType:"role_change",timestamp:(new Date).toISOString()})}async trackPermissionChange(e){return await this.initFeature("security.permission_change",{type:"security",...e,eventType:"permission_change",timestamp:(new Date).toISOString()})}async trackDataAccess(e){return await this.initFeature("security.data_access",{type:"security",...e,eventType:"data_access",timestamp:(new Date).toISOString()})}async trackDataExport(e,t,r){return await this.initFeature("security.data_export",{type:"security",userId:e,resourceType:t,recordCount:r,eventType:"data_export",timestamp:(new Date).toISOString()})}async trackSuspiciousActivity(e,t,r){return await this.initFeature("security.suspicious_activity",{type:"security",userId:e,activityType:t,details:r,eventType:"suspicious_activity",severity:"critical",timestamp:(new Date).toISOString()})}async trackComplianceEvent(e){return await this.initFeature("security.compliance_event",{type:"security",...e,timestamp:(new Date).toISOString()})}}t.SecurityAnalytics=s},1247(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupportAnalytics=void 0,t.calculateFCRRate=function(e,t){return 0===t?0:Math.round(e/t*1e4)/100},t.calculateAvgResponseTime=function(e){if(0===e.length)return 0;const t=e.reduce((e,t)=>e+t,0);return Math.round(t/e.length)},t.classifyCSAT=function(e){return e<2?"poor":e<3?"fair":e<4?"good":"excellent"},t.formatDuration=function(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:e<864e5?`${Math.round(e/36e5)}h`:`${Math.round(e/864e5)}d`};const n=r(5975);class i extends n.FlowGridTransport{async trackTicket(e){return await this.initFeature("support.ticket_created",{type:"support",...e,status:"open",createdAt:(new Date).toISOString(),timestamp:(new Date).toISOString()})}async updateTicket(e){return await this.initFeature("support.ticket_updated",{type:"support",...e,timestamp:(new Date).toISOString()})}async trackResponse(e,t,r){return await this.initFeature("support.ticket_response",{type:"support",ticketId:e,agentId:t,responseTimeMs:r,timestamp:(new Date).toISOString()})}async trackResolution(e,t,r){return await this.initFeature("support.ticket_resolved",{type:"support",ticketId:e,resolutionTimeMs:t,interactionCount:r,firstContactResolution:1===r,timestamp:(new Date).toISOString()})}async trackCSAT(e){return await this.initFeature("support.csat",{type:"support",...e,timestamp:(new Date).toISOString()})}async trackFeatureComplaint(e){return await this.initFeature("support.feature_complaint",{type:"support",...e,timestamp:(new Date).toISOString()})}}t.SupportAnalytics=i},7138(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return s(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.FlowGrid=void 0;const a=r(5975),c=r(5558),u=r(7244),l=r(8597),d=r(5405),p=r(938),h=r(4895),m=r(1075);let f=null,g=null;function y(){return f&&g?Promise.resolve():Promise.all([Promise.resolve().then(()=>o(r(7736))),Promise.resolve().then(()=>o(r(658)))]).then(([e,t])=>{f=e,g=t})}const v={handled:!1},I=["productId","name","brand","category","variant","price","currency","quantity","discount","coupon","position","url","imageUrl","rating","reviewCount","stockStatus","attributes"];function b(e){return{handled:!0,value:e}}function S(e,t){const r=e[t];return"string"==typeof r&&r.length>0?r:void 0}function w(e,t){const r=e[t];return"number"==typeof r&&Number.isFinite(r)?r:void 0}function C(e,t){const r=e[t];return"boolean"==typeof r?r:void 0}function k(e,t){const r=e[t];return function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(r)?r:void 0}function T(e,t){const r=e[t];return null!=r&&!("string"==typeof r&&0===r.length)}function _(e,t){const r={},n=new Set([...t,"domain"]);for(const[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return r}function A(e){const t=k(e,"product");if(t)return{...t,currency:t.currency??"USD"};if(!T(e,"productId")||!T(e,"name")||!T(e,"price"))return;const r={currency:"USD"};for(const t of I)void 0!==e[t]&&(r[t]=e[t]);return r}class O{static init(e){if(O._instance)return"undefined"!=typeof console&&console.warn("[FlowGrid] init() called more than once — returning existing instance."),O._instance;if(!e?.webId||!e?.apiKey)throw new Error("FlowGrid.init: `webId` and `apiKey` are required.");e.consent&&O.setConsent(e.consent);const t=new O(e.webId,e.endpoint??"https://core.flow-grid.xyz",e.apiKey,e.visitorId,e.identityManager,e.transport);O._instance=t,y(),e.user?.userId&&t.identifyUser(e.user.userId,e.user.traits);const r=e.autoTrack,n=e.replay,i=!1===r?{sessions:!1,pageViews:!1,performance:!1,heatmaps:!1,attribution:!1,engagement:!1,replay:!1}:!0===r||void 0===r?{sessions:!1,pageViews:!1,performance:!1,heatmaps:!1,attribution:!1}:r;return void 0!==n&&(i.replay=n),t._autoTrackStop=t.autoTrack({...i,userId:e.user?.userId??i.userId}),t}static instance(){return O._instance}static loadEnterprise(){return y()}static reset(){if(O._instance?._autoTrackStop)try{O._instance._autoTrackStop()}catch{}O._instance=null}constructor(e,t,r,n,i,s){this._autoTrackStop=null,this._raw=new Map,this._wrapped=new Map,this.webId=e,this.endpoint=t,this.apiKey=r,this.visitorId=n,this.identityManager=i??new c.IdentityManager(n?{visitorId:n}:void 0),this.config=s}raw(e,t){let r=this._raw.get(e);return r||(r=new t(this.webId,this.endpoint,this.apiKey,this.visitorId,this.identityManager,this.config),this._raw.set(e,r)),r}wrap(e,t,r){let n=this._wrapped.get(e);return n||(n=new r(this.raw(e,t)),this._wrapped.set(e,n)),n}get activation(){return this.wrap("activation",u.Activation,p.ActivationTracker)}get features(){return this.wrap("features",u.TrackFeature,p.FeatureTracker)}get prompts(){return this.wrap("prompts",u.TrackPrompt,p.PromptTracker)}get experiments(){return this.wrap("experiments",u.Experiment,p.ExperimentTracker)}get pageViews(){return this.wrap("pageViews",l.PageViews,h.PageViewTracker)}get sessions(){return this.wrap("sessions",l.Sessions,h.SessionTracker)}get events(){return this.wrap("events",l.Events,h.EventTracker)}get identify(){return this.wrap("identify",l.Identify,h.IdentifyTracker)}get funnels(){return this.wrap("funnels",l.Funnels,h.FunnelTracker)}get retention(){return this.wrap("retention",l.Retention,h.RetentionTracker)}get attribution(){return this.wrap("attribution",l.Attribution,h.AttributionTracker)}get heatmaps(){return this.wrap("heatmaps",l.Heatmaps,h.HeatmapTracker)}get performance(){return this.wrap("performance",l.PerformanceTracking,h.PerformanceTracker)}get replay(){return this.wrap("replay",l.SessionReplay,h.ReplayTracker)}get products(){return this.wrap("products",d.Products,m.ProductTracker)}get cart(){return this.wrap("cart",d.CartTracking,m.CartTracker)}get checkout(){return this.wrap("checkout",d.Checkout,m.CheckoutTracker)}get purchases(){return this.wrap("purchases",d.Purchases,m.PurchaseTracker)}get refunds(){return this.wrap("refunds",d.Refunds,m.RefundTracker)}get promotions(){return this.wrap("promotions",d.Promotions,m.PromotionTracker)}get wishlist(){return this.wrap("wishlist",d.WishlistTracking,m.WishlistTracker)}get ltv(){return this.wrap("ltv",d.CustomerLTV,m.LTVTracker)}get search(){return this.wrap("search",d.SearchAnalytics,m.SearchTracker)}get subscriptions(){return this.wrap("subscriptions",d.Subscriptions,m.SubscriptionTracker)}_requireEnterprise(){const e=f,t=g;if(!e||!t)throw new Error("[FlowGrid] Enterprise features are still loading. await FlowGrid.loadEnterprise() before accessing enterprise namespaces directly.");return{ent:e,entT:t}}get engagement(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("engagement",e.Engagement,t.EngagementTracker)}get cohorts(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("cohorts",e.Cohorts,t.CohortTracker)}get churn(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("churn",e.ChurnAnalytics,t.ChurnTracker)}get monetization(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("monetization",e.Monetization,t.MonetizationTracker)}get multiPathFunnels(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("multiPathFunnels",e.MultiPathFunnels,t.MultiPathFunnelTracker)}get support(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("support",e.SupportAnalytics,t.SupportTracker)}get acquisition(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("acquisition",e.AcquisitionAnalytics,t.AcquisitionTracker)}get paths(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("paths",e.PathAnalytics,t.PathTracker)}get alerts(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("alerts",e.AlertsAnalytics,t.AlertTracker)}get security(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("security",e.SecurityAnalytics,t.SecurityTracker)}get forecasting(){const{ent:e,entT:t}=this._requireEnterprise();return this.wrap("forecasting",e.Forecasting,t.ForecastingTracker)}track(e,t={},r={}){const n=this.withTrackContext(t,r),i=this.dispatchTrack(e,n,Boolean(r.domain),r.domain);return i.handled?i.value:this.events.track(e,t,r)}withTrackContext(e,t){return{...e,...void 0!==t.userId&&void 0===e.userId?{userId:t.userId}:{},...void 0!==t.sessionId&&void 0===e.sessionId?{sessionId:t.sessionId}:{}}}requireTrackProperties(e,t,r,n){const i=r.filter(e=>!T(t,e));if(0===i.length)return!0;if(n)throw new Error(`FlowGrid.track("${e}") missing required properties: ${i.join(", ")}`);return!1}dispatchTrack(e,t,r,n){const i=[];n&&"activation"!==n||i.push(()=>this.dispatchActivationTrack(e,t,r)),n&&"feature"!==n||i.push(()=>this.dispatchFeatureTrack(e,t,r)),n&&"prompt"!==n||i.push(()=>this.dispatchPromptTrack(e,t,r)),n&&"experiment"!==n||i.push(()=>this.dispatchExperimentTrack(e,t,r)),n&&"analytics"!==n&&"funnel"!==n&&"retention"!==n&&"attribution"!==n||i.push(()=>this.dispatchAnalyticsTrack(e,t,r,n)),n&&"ecommerce"!==n||i.push(()=>this.dispatchEcommerceTrack(e,t,r)),n&&"engagement"!==n&&"churn"!==n&&"monetization"!==n&&"support"!==n&&"acquisition"!==n&&"paths"!==n&&"security"!==n&&"multiPathFunnels"!==n||i.push(()=>this.dispatchEnterpriseTrack(e,t,r,n));for(const e of i){const t=e();if(t.handled)return t}return v}dispatchActivationTrack(e,t,r){switch(e){case"signup_completed":return this.requireTrackProperties(e,t,["userId","method"],r)?b(this.activation.signup(S(t,"userId"),S(t,"method"),S(t,"source"),_(t,["userId","method","source"]))):v;case"onboarding_step":return this.requireTrackProperties(e,t,["userId","stepId","stepName","stepOrder","totalSteps"],r)?b(this.activation.onboardingStep(S(t,"userId"),S(t,"stepId"),S(t,"stepName"),w(t,"stepOrder"),w(t,"totalSteps"),{skipped:C(t,"skipped"),timeSpent:w(t,"timeSpent"),properties:_(t,["userId","stepId","stepName","stepOrder","totalSteps","skipped","timeSpent"])})):v;case"onboarding_completed":return this.requireTrackProperties(e,t,["userId","totalTimeSpent","stepsCompleted"],r)?b(this.activation.onboardingComplete(S(t,"userId"),w(t,"totalTimeSpent"),w(t,"stepsCompleted"),w(t,"stepsSkipped")??0)):v;case"first_action":return this.requireTrackProperties(e,t,["userId","actionName","timeSinceSignup"],r)?b(this.activation.firstAction(S(t,"userId"),S(t,"actionName"),w(t,"timeSinceSignup"),_(t,["userId","actionName","timeSinceSignup"]))):v;default:return r?b(this.activation.event(e,t)):v}}dispatchFeatureTrack(e,t,r){const n={feature_viewed:"viewed",feature_used:"used",feature_completed:"completed",feature_abandoned:"abandoned"}[e]??("feature_usage"===e?t.action:void 0);return"feature_usage"===e||n?this.requireTrackProperties(e,t,["featureId","featureName"],r)?b(this.features.client.trackUsage({...t,action:"string"==typeof n?n:"used",eventName:e})):v:r&&this.requireTrackProperties(e,t,["userId","featureName"],!0)?b(this.features.create(S(t,"userId"),e,S(t,"featureName"),_(t,["userId","featureName"]))):v}dispatchPromptTrack(e,t,r){switch(e){case"prompt_submitted":return this.requireTrackProperties(e,t,["promptId","promptType"],r)?b(this.prompts.client.trackSubmission(t)):v;case"prompt_response":return this.requireTrackProperties(e,t,["promptId","responseTime","completed"],r)?b(this.prompts.client.trackResponse(t)):v;case"prompt_feedback":return this.requireTrackProperties(e,t,["promptId","feedbackType"],r)?b(this.prompts.client.trackFeedback(t)):v;case"prompt_conversation":return this.requireTrackProperties(e,t,["conversationId","userId","turnCount","totalDuration"],r)?b(this.prompts.conversation(S(t,"conversationId"),S(t,"userId"),w(t,"turnCount"),w(t,"totalDuration"))):v;default:return r||e.startsWith("prompt_")?b(this.prompts.event(e,t)):v}}dispatchExperimentTrack(e,t,r){switch(e){case"experiment_assignment":return this.requireTrackProperties(e,t,["experimentId","userId","variantId"],r)?b(this.experiments.client.assign(t)):v;case"experiment_exposure":return this.requireTrackProperties(e,t,["experimentId","userId","variantId"],r)?b(this.experiments.exposure(S(t,"experimentId"),S(t,"userId"),S(t,"variantId"))):v;case"experiment_conversion":return this.requireTrackProperties(e,t,["experimentId","userId","variantId","metricName"],r)?b(this.experiments.client.trackConversion({...t,value:w(t,"value")??1})):v;default:return(r||e.startsWith("experiment_"))&&this.requireTrackProperties(e,t,["variant"],r)?b(this.experiments.client.track({eventName:e,variant:S(t,"variant"),properties:_(t,["variant"])})):v}}dispatchAnalyticsTrack(e,t,r,n){switch(e){case"click_event":return this.requireTrackProperties(e,t,["elementId","elementText"],r)?b(this.events.client.trackClick(t)):v;case"form_event":return this.requireTrackProperties(e,t,["formId","formName"],r)?b(this.events.client.trackForm(t)):v;case"search_event":return this.requireTrackProperties(e,t,["query","category"],r)?b(this.events.client.trackSearch(t)):v;case"error_event":return this.requireTrackProperties(e,t,["message","type"],r)?b(this.events.client.trackError(t)):v;case"funnel_step":return this.requireTrackProperties(e,t,["funnelId","step","stepNumber"],r)?b(this.funnels.client.trackStep(t)):v;case"funnel_complete":return this.requireTrackProperties(e,t,["funnelId"],r)?b(this.funnels.complete(S(t,"funnelId"),S(t,"userId"),_(t,["funnelId","userId"]))):v;case"funnel_abandon":return this.requireTrackProperties(e,t,["funnelId","lastStep"],r)?b(this.funnels.abandon(S(t,"funnelId"),S(t,"lastStep"),S(t,"userId"),S(t,"reason"))):v;case"user_activity":return n&&"retention"!==n?v:this.requireTrackProperties(e,t,["userId"],r)?b(this.retention.client.trackActivity(t)):v;case"attribution_touchpoint":return this.requireTrackProperties(e,t,["userId","channel"],r)?b(this.attribution.client.trackTouchpoint(t)):v;case"attribution_conversion":return this.requireTrackProperties(e,t,["userId","conversionType"],r)?b(this.attribution.client.recordConversion(t)):v;default:return v}}dispatchEcommerceTrack(e,t,r){switch(e){case"product_view":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}return b(this.products.client.view({...n,..._(t,["product",...I])}))}case"product_impression":return this.requireTrackProperties(e,t,["list"],r)?b(this.products.client.impression(t)):v;case"product_click":{const n=A(t);return n&&this.requireTrackProperties(e,t,["listId","position"],r)?b(this.products.client.click({...t,product:n})):v}case"add_to_cart":case"remove_from_cart":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}const i={..._(t,["product",...I]),product:n,quantity:w(t,"quantity")??1};return b("add_to_cart"===e?this.cart.client.addItem(i):this.cart.client.removeItem(i))}case"update_cart_item":{const n=A(t);return n&&this.requireTrackProperties(e,t,["previousQuantity","newQuantity"],r)?b(this.cart.client.updateItem({..._(t,["product",...I]),product:n})):v}case"view_cart":return this.requireTrackProperties(e,t,["cart"],r)?b(this.cart.client.view(t)):v;case"begin_checkout":return this.requireTrackProperties(e,t,["cart"],r)?b(this.checkout.client.begin(t)):v;case"checkout_step":return this.requireTrackProperties(e,t,["step","stepNumber","cart"],r)?b(this.checkout.client.step(t)):v;case"add_shipping_info":return this.requireTrackProperties(e,t,["cart","shipping"],r)?b(this.checkout.client.addShipping(t)):v;case"add_payment_info":return this.requireTrackProperties(e,t,["cart","payment"],r)?b(this.checkout.client.addPayment(t)):v;case"purchase":return this.requireTrackProperties(e,t,["order"],r)?b(this.purchases.client.track(t)):v;case"refund":return this.requireTrackProperties(e,t,["orderId","refundId","amount","currency"],r)?b(this.refunds.client.track(t)):v;case"refund_requested":return this.requireTrackProperties(e,t,["orderId"],r)?b(this.refunds.client.request(S(t,"orderId"),t.items,S(t,"reason"))):v;case"refund_approved":return this.requireTrackProperties(e,t,["refundId","approvedAmount"],r)?b(this.refunds.client.approve(S(t,"refundId"),w(t,"approvedAmount"))):v;case"refund_denied":return this.requireTrackProperties(e,t,["refundId","reason"],r)?b(this.refunds.client.deny(S(t,"refundId"),S(t,"reason"))):v;case"refund_completed":return this.requireTrackProperties(e,t,["refundId","processedAmount"],r)?b(this.refunds.client.complete(S(t,"refundId"),w(t,"processedAmount"))):v;case"promotion_view":return this.requireTrackProperties(e,t,["promotionId","name","creative","position"],r)?b(this.promotions.client.view(t)):v;case"promotion_click":return this.requireTrackProperties(e,t,["promotionId","name","creative","position"],r)?b(this.promotions.client.click(t)):v;case"coupon_used":return this.requireTrackProperties(e,t,["code","orderId","discountValue","discountType","orderValueBefore","orderValueAfter"],r)?b(this.promotions.client.couponUsed(t)):v;case"add_to_wishlist":case"remove_from_wishlist":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}const i={..._(t,["product",...I]),product:n};return b("add_to_wishlist"===e?this.wishlist.client.add(i):this.wishlist.client.remove(i))}case"view_wishlist":return this.requireTrackProperties(e,t,["wishlist"],r)?b(this.wishlist.client.view(k(t,"wishlist"))):v;case"wishlist_to_cart":{const n=A(t);if(!n){if(r)throw new Error(`FlowGrid.track("${e}") missing required properties: product or productId, name, price`);return v}return b(this.wishlist.client.moveToCart(n,S(t,"wishlistId")))}case"share_wishlist":return this.requireTrackProperties(e,t,["wishlistId","method"],r)?b(this.wishlist.client.share(S(t,"wishlistId"),S(t,"method"))):v;case"subscription_start":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","mrr","billingCycle"],r)?b(this.subscriptions.client.start(t)):v;case"subscription_change":return this.requireTrackProperties(e,t,["subscriptionId","userId","previousPlan","newPlan","previousMrr","newMrr","changeType"],r)?b(this.subscriptions.client.change(t)):v;case"subscription_cancel":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","lostMrr"],r)?b(this.subscriptions.client.cancel(t)):v;case"subscription_renew":return this.requireTrackProperties(e,t,["subscriptionId","userId","mrr"],r)?b(this.subscriptions.client.renew(S(t,"subscriptionId"),S(t,"userId"),k(t,"mrr"))):v;case"trial_converted":return this.requireTrackProperties(e,t,["subscriptionId","userId","plan","mrr"],r)?b(this.subscriptions.client.trialConverted(S(t,"subscriptionId"),S(t,"userId"),S(t,"plan"),k(t,"mrr"))):v;case"trial_expired":return this.requireTrackProperties(e,t,["subscriptionId","userId"],r)?b(this.subscriptions.client.trialExpired(S(t,"subscriptionId"),S(t,"userId"))):v;case"record_acquisition_cost":return this.requireTrackProperties(e,t,["userId","cost","channel"],r)?b(this.ltv.client.recordAcquisitionCost(t)):v;case"update_customer_segment":return this.requireTrackProperties(e,t,["userId","newSegment"],r)?b(this.ltv.client.updateSegment(S(t,"userId"),S(t,"newSegment"))):v;case"site_search":return this.requireTrackProperties(e,t,["query","resultsCount"],r)?b(this.search.client.track(t)):v;case"search_result_click":{const n=A(t);return n&&this.requireTrackProperties(e,t,["query","position"],r)?b(this.search.client.trackClick({...t,product:n})):v}case"search_refinement":return this.requireTrackProperties(e,t,["originalQuery","refinedQuery","refinementType"],r)?b(this.search.client.trackRefinement(S(t,"originalQuery"),S(t,"refinedQuery"),S(t,"refinementType"))):v;case"search_suggestion":return this.requireTrackProperties(e,t,["partialQuery","selectedSuggestion","suggestionPosition"],r)?b(this.search.client.trackSuggestion(S(t,"partialQuery"),S(t,"selectedSuggestion"),w(t,"suggestionPosition"))):v;default:return v}}dispatchEnterpriseTrack(e,t,r,n){if(!f||!g)return v;switch(e){case"engagement.dwell_time":case"engagement_dwell_time":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["featureId","dwellTimeMs"],r)?b(this.engagement.client.trackDwellTime(t)):v;case"engagement.session_depth":case"engagement_session_depth":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["sessionId","pagesVisited","featuresUsed","actionsTaken","durationMs"],r)?b(this.engagement.client.trackSessionDepth(t)):v;case"engagement.content_consumption":case"engagement_content_consumption":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["contentId","contentType","percentageConsumed","timeSpentMs"],r)?b(this.engagement.client.trackContentConsumption(t)):v;case"engagement.user_activity":case"engagement_user_activity":return n&&"engagement"!==n?v:this.requireTrackProperties(e,t,["userId","activityType","durationMs"],r)?b(this.engagement.client.trackUserActivity(t)):v;case"churn.usage_decay":case"churn_usage_decay":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","metric","periods"],r)?b(this.churn.client.trackUsageDecay(t)):v;case"churn.nps":case"churn_nps":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","score"],r)?b(this.churn.client.trackNPS(t)):v;case"churn.churn_event":case"churn_churn_event":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","churnType"],r)?b(this.churn.client.trackChurn(t)):v;case"churn.prevention_action":case"churn_prevention_action":return n&&"churn"!==n?v:this.requireTrackProperties(e,t,["userId","actionType"],r)?b(this.churn.client.trackPreventionAction(t)):v;case"monetization.revenue":case"monetization_revenue":return n&&"monetization"!==n?v:this.requireTrackProperties(e,t,["userId","amount","currency","type"],r)?b(this.monetization.client.trackRevenue(t)):v;case"support.ticket_created":case"support_ticket_created":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","userId","subject","category","priority","channel"],r)?b(this.support.client.trackTicket(t)):v;case"support.ticket_updated":case"support_ticket_updated":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","status"],r)?b(this.support.client.updateTicket(t)):v;case"support.csat":case"support_csat":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["ticketId","userId","score"],r)?b(this.support.client.trackCSAT(t)):v;case"support.feature_complaint":case"support_feature_complaint":return n&&"support"!==n?v:this.requireTrackProperties(e,t,["userId","featureId","complaintType","severity"],r)?b(this.support.client.trackFeatureComplaint(t)):v;case"acquisition.acquired":case"acquisition_acquired":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["userId","source"],r)?b(this.acquisition.client.trackAcquisition(t)):v;case"acquisition.lifecycle_transition":case"acquisition_lifecycle_transition":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["userId","fromStage","toStage"],r)?b(this.acquisition.client.trackLifecycleTransition(t)):v;case"acquisition.campaign_spend":case"acquisition_campaign_spend":return n&&"acquisition"!==n?v:this.requireTrackProperties(e,t,["campaignId","amount","date"],r)?b(this.acquisition.client.trackCampaignSpend(t)):v;case"paths.transition":case"paths_transition":return n&&"paths"!==n?v:this.requireTrackProperties(e,t,["userId","fromScreen","toScreen"],r)?b(this.paths.client.trackTransition(t)):v;case"paths.feature_sequence":case"paths_feature_sequence":return n&&"paths"!==n?v:this.requireTrackProperties(e,t,["userId","feature","order"],r)?b(this.paths.client.trackFeatureSequence(t)):v;case"security.login_attempt":case"security_login_attempt":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","success"],r)?b(this.security.client.trackLoginAttempt(t)):v;case"security.role_change":case"security_role_change":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","changedBy","previousRole","newRole"],r)?b(this.security.client.trackRoleChange(t)):v;case"security.permission_change":case"security_permission_change":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","changedBy","permission","action"],r)?b(this.security.client.trackPermissionChange(t)):v;case"security.data_access":case"security_data_access":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","resourceType","accessType"],r)?b(this.security.client.trackDataAccess(t)):v;case"security.compliance_event":case"security_compliance_event":return n&&"security"!==n?v:this.requireTrackProperties(e,t,["userId","eventType"],r)?b(this.security.client.trackComplianceEvent(t)):v;case"multi_path_funnels.track_step":case"multi_path_funnels_track_step":return n&&"multiPathFunnels"!==n?v:this.requireTrackProperties(e,t,["funnelId","step","userId"],r)?b(this.multiPathFunnels.client.trackStep(t)):v;case"multi_path_funnels.track_micro_conversion":case"multi_path_funnels_track_micro_conversion":return n&&"multiPathFunnels"!==n?v:this.requireTrackProperties(e,t,["conversionId","userId"],r)?b(this.multiPathFunnels.client.trackMicroConversion(t)):v;default:return v}}experiment(e,t){return this.experiments.exposure(e,t.userId,t.variant)}identifyUser(e,t,r){return this.identify.user(e,t,r)}defineFeature(e,t,r={}){const n=(n,i)=>this.track("feature_usage",{featureId:e,featureName:t,action:n,...r.category?{category:r.category}:{},...i??{}},{domain:"feature"});return{featureId:e,featureName:t,viewed:e=>n("viewed",e),used:e=>n("used",e),completed:e=>n("completed",e),abandoned:e=>n("abandoned",e),track:(e,t)=>n(e,t)}}page(e,t,r){return this.pageViews.view(e,t,r)}autoTrack(e={}){const t=[],r={userId:e.userId};if(!0===e.sessions&&t.push(this.sessions.autoTrack(r.userId?{user:{userId:r.userId}}:{})),!0===e.pageViews&&t.push(this.pageViews.autoTrack(r)),!0===e.performance||!1!==e.performance&&"object"==typeof e.performance){const n="object"==typeof e.performance?e.performance:{};t.push(this.performance.autoTrack({...n,userId:r.userId}))}if(!0===e.heatmaps||!1!==e.heatmaps&&"object"==typeof e.heatmaps){const n="object"==typeof e.heatmaps?e.heatmaps:{};t.push(this.heatmaps.autoTrack({...n,userId:r.userId}))}if(!1!==e.engagement){const n="object"==typeof e.engagement?e.engagement:{};let i=null,s=!1;y().then(()=>{s||(i=this.engagement.client.autoTrack({...n,userId:r.userId}))}),t.push(()=>{if(s=!0,i)try{i()}catch{}})}if(!0===e.attribution&&r.userId&&this.attribution.captureFromUrl(r.userId),!0===e.passiveIdentity||!1!==e.passiveIdentity&&"object"==typeof e.passiveIdentity){const r="object"==typeof e.passiveIdentity?e.passiveIdentity:{};t.push(this.identify.client.autoTrackForms(r))}if(!1!==e.replay){const n="object"==typeof e.replay?e.replay:{};let i=null,s=!1;this.replay.start({userId:r.userId,...n}).then(e=>{if(s)try{e()}catch{}else i=e}),t.push(()=>{if(s=!0,i)try{i()}catch{}})}return()=>{for(const e of t)try{e()}catch{}}}}t.FlowGrid=O,O._instance=null,O.setConsent=a.FlowGridTransport.setConsent.bind(a.FlowGridTransport),O.hasConsent=a.FlowGridTransport.hasConsent.bind(a.FlowGridTransport),t.default=O},5568(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setupConsent=s,t.attachConsentBanner=function(e){if("undefined"==typeof document)return null;const{bannerId:t="cookie-banner",acceptId:r="accept-btn",rejectId:n="reject-btn",manager:i,...o}=e??{},a=document.getElementById(t);if(!a)return null;const c=i??s(o),u=()=>{a.style.display=""},l=()=>{a.style.display="none"},d=a.querySelector(`#${r}`),p=a.querySelector(`#${n}`),h=()=>{c.acceptAll(),l()},m=()=>{c.rejectNonEssential(),l()};return d?.addEventListener("click",h),p?.addEventListener("click",m),c.hasConsented()?l():u(),{manager:c,show:u,hide:l,destroy(){d?.removeEventListener("click",h),p?.removeEventListener("click",m)}}};const n=r(4513),i=r(5975);function s(e){const t=e?.onChange,r=new n.ConsentManager({...e,onChange:e=>{o(e),t?.(e)}});return o(r.getPreferences()),r}function o(e){i.FlowGridTransport.setConsent({analytics:e.analytics,marketing:e.marketing})}},4806(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getOrCreateAnonId=function(){if("undefined"==typeof localStorage)return"anon";try{const e=localStorage.getItem(r);if(e)return e;const t=i();return localStorage.setItem(r,t),t}catch{return"anon"}},t.getOrCreateCartId=function(){if("undefined"==typeof sessionStorage)return"cart_anon";try{const e=sessionStorage.getItem(n);if(e)return e;const t=`cart_${i()}`;return sessionStorage.setItem(n,t),t}catch{return"cart_anon"}},t.resetCartId=function(){try{"undefined"!=typeof sessionStorage&&sessionStorage.removeItem(n)}catch{}};const r="fg_anon_id",n="fg_cart_id";function i(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},1134(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attachConsentBanner=t.setupConsent=t.resetCartId=t.getOrCreateCartId=t.getOrCreateAnonId=void 0;var n=r(4806);Object.defineProperty(t,"getOrCreateAnonId",{enumerable:!0,get:function(){return n.getOrCreateAnonId}}),Object.defineProperty(t,"getOrCreateCartId",{enumerable:!0,get:function(){return n.getOrCreateCartId}}),Object.defineProperty(t,"resetCartId",{enumerable:!0,get:function(){return n.resetCartId}});var i=r(5568);Object.defineProperty(t,"setupConsent",{enumerable:!0,get:function(){return i.setupConsent}}),Object.defineProperty(t,"attachConsentBanner",{enumerable:!0,get:function(){return i.attachConsentBanner}})},642(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AttributionTracker=void 0,t.AttributionTracker=class{constructor(e){this.client=e}touchpoint(e,t,r){return this.client.trackTouchpoint({userId:e,channel:t,properties:r})}conversion(e,t,r){return this.client.recordConversion({userId:e,conversionType:t,properties:r})}captureFromUrl(e){return this.client.captureFromUrl(e)}}},7486(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTracker=void 0,t.EventTracker=class{constructor(e){this.client=e}track(e,t,r){return this.client.track({eventName:e,properties:t,userId:r?.userId,sessionId:r?.sessionId})}batch(e){return this.client.trackBatch({events:e})}click(e,t,r){return this.client.trackClick({elementId:e,elementText:t,properties:r})}form(e,t,r){return this.client.trackForm({formId:e,formName:t,properties:r})}search(e,t,r){return this.client.trackSearch({query:e,category:t,properties:r})}error(e,t,r){return this.client.trackError({message:e,type:t,properties:r})}}},8946(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FunnelTracker=void 0,t.FunnelTracker=class{constructor(e){this.client=e}define(e){return this.client.define(e)}step(e,t,r,n,i){return this.client.trackStep({funnelId:e,step:t,stepNumber:r,userId:n,properties:i})}complete(e,t,r){return this.client.trackComplete(e,t,r)}abandon(e,t,r,n){return this.client.trackAbandon(e,t,r,n)}}},8202(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeatmapTracker=void 0,t.HeatmapTracker=class{constructor(e){this.client=e}click(e,t,r,n,i){return this.client.trackClick({pageUrl:e,x:t,y:r,viewportWidth:n,viewportHeight:i})}movement(e,t,r){return this.client.trackMovement({pageUrl:e,path:t,viewport:r})}scroll(e,t,r,n){return this.client.trackScroll({pageUrl:e,maxScrollDepth:t,pageHeight:r,viewportHeight:n})}autoTrack(e){return this.client.autoTrack(e)}}},4767(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifyTracker=void 0,t.IdentifyTracker=class{constructor(e){this.client=e}user(e,t,r){return this.client.user({userId:e,anonymousId:r,traits:t})}updateTraits(e,t){return this.client.updateTraits(e,t)}alias(e,t){return this.client.alias({previousId:e,userId:t})}group(e,t,r){return this.client.group({userId:e,groupId:t,traits:r})}}},4895(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReplayTracker=t.PerformanceTracker=t.HeatmapTracker=t.AttributionTracker=t.RetentionTracker=t.FunnelTracker=t.IdentifyTracker=t.SessionTracker=t.PageViewTracker=t.EventTracker=void 0;var n=r(7486);Object.defineProperty(t,"EventTracker",{enumerable:!0,get:function(){return n.EventTracker}});var i=r(1179);Object.defineProperty(t,"PageViewTracker",{enumerable:!0,get:function(){return i.PageViewTracker}});var s=r(7046);Object.defineProperty(t,"SessionTracker",{enumerable:!0,get:function(){return s.SessionTracker}});var o=r(4767);Object.defineProperty(t,"IdentifyTracker",{enumerable:!0,get:function(){return o.IdentifyTracker}});var a=r(8946);Object.defineProperty(t,"FunnelTracker",{enumerable:!0,get:function(){return a.FunnelTracker}});var c=r(3545);Object.defineProperty(t,"RetentionTracker",{enumerable:!0,get:function(){return c.RetentionTracker}});var u=r(642);Object.defineProperty(t,"AttributionTracker",{enumerable:!0,get:function(){return u.AttributionTracker}});var l=r(8202);Object.defineProperty(t,"HeatmapTracker",{enumerable:!0,get:function(){return l.HeatmapTracker}});var d=r(213);Object.defineProperty(t,"PerformanceTracker",{enumerable:!0,get:function(){return d.PerformanceTracker}});var p=r(84);Object.defineProperty(t,"ReplayTracker",{enumerable:!0,get:function(){return p.ReplayTracker}})},1179(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PageViewTracker=void 0,t.PageViewTracker=class{constructor(e){this.client=e}view(e,t,r){const n=function(){const e="undefined"!=typeof window&&"undefined"!=typeof document;return{url:e?window.location.href:"",path:e?window.location.pathname:"",title:e?document.title:void 0,referrer:e?document.referrer:void 0}}(),i=e&&/^https?:\/\//i.test(e),s=i?e:n.url,o=i?new URL(e).pathname:e??n.path;return this.client.track({url:s,path:o,title:r?.title??n.title,referrer:r?.referrer??n.referrer,userId:r?.userId,sessionId:r?.sessionId,properties:t})}scroll(e,t,r){return this.client.trackScrollDepth({path:e,scrollDepth:t,timeAtDepth:r})}time(e,t){return this.client.trackTimeOnPage({path:e,duration:t})}exit(e,t,r){return this.client.trackExit(e,t,r)}autoTrack(e){return this.client.autoTrack(e)}}},213(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PerformanceTracker=void 0,t.PerformanceTracker=class{constructor(e){this.client=e}webVitals(e,t){return this.client.trackWebVitals({pageUrl:e,...t})}pageLoad(e,t){return this.client.trackPageLoad({pageUrl:e,...t})}resource(e,t,r,n){return this.client.trackResource({pageUrl:e,resourceUrl:t,resourceType:r,duration:n})}autoTrack(e){return this.client.autoTrack(e)}}},84(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReplayTracker=void 0,t.ReplayTracker=class{constructor(e){this.client=e}start(e){return this.client.start(e??{})}enable(e){return this.client.enable(e??{})}disable(){this.client.disable()}stop(e){this.client.stop(e)}flush(e){return this.client.flush(e??"manual")}identify(e){this.client.identify(e)}status(){return this.client.getStatus()}sendChunk(e,t,r){return this.client.sendChunk(e,t,r??{})}}},3545(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetentionTracker=void 0,t.RetentionTracker=class{constructor(e){this.client=e}active(e,t){return this.client.trackActivity({userId:e,properties:t})}}},7046(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTracker=void 0,t.SessionTracker=class{constructor(e){this.client=e}start(e){return this.client.start(e)}update(e,t){return this.client.update(e,t)}end(e){return this.client.end(e)}heartbeat(e){return this.client.heartbeat(e)}autoTrack(e,t){return this.client.autoTrack(e,t)}}},2300(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivationTracker=void 0,t.ActivationTracker=class{constructor(e){this.client=e}signup(e,t,r,n){return this.client.trackSignup(e,t,r,n)}onboardingStep(e,t,r,n,i,s){return this.client.trackOnboardingStep({userId:e,stepId:t,stepName:r,stepOrder:n,totalSteps:i,...s})}onboardingComplete(e,t,r,n=0){return this.client.completeOnboarding(e,t,r,n)}firstAction(e,t,r,n){return this.client.trackFirstAction({userId:e,actionName:t,timeSinceSignup:r,properties:n})}event(e,t={}){return this.client.create({eventName:e,properties:t})}}},2115(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExperimentTracker=void 0,t.ExperimentTracker=class{constructor(e){this.client=e}define(e){return this.client.define(e)}init(e){return this.client.initExperiments(e)}variant(e){return this.client.getLocalVariant(e)}assign(e,t,r,n="targeted"){return this.client.assign({experimentId:e,userId:t,variantId:r,source:n})}exposure(e,t,r){return this.client.trackExposure(e,t,r)}exposureAuto(e){return this.client.trackLocalExposure(e)}conversion(e,t,r,n,i=1){return this.client.trackConversion({experimentId:e,userId:t,variantId:r,metricName:n,value:i})}localConversion(e,t="conversion",r=1){return this.client.trackLocalConversion(e,t,r)}hydrateFromCookies(e){this.client.hydrateFromCookies(e)}hydrateFromCookieHeader(e){this.client.hydrateFromCookieHeader(e)}injectAssignments(e){this.client.injectAssignments(e)}getAssignments(){return this.client.getAssignments()}serializeAssignmentCookie(){return this.client.serializeAssignmentCookie()}clearAssignments(){this.client.clearAssignments()}}},76(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FeatureTracker=void 0,t.FeatureTracker=class{constructor(e){this.client=e}record(e,t,r="used",n){return this.client.trackUsage({featureId:e,featureName:t,action:r,properties:n})}viewed(e,t,r){return this.record(e,t,"viewed",r)}used(e,t,r){return this.record(e,t,"used",r)}completed(e,t,r){return this.record(e,t,"completed",r)}abandoned(e,t,r){return this.record(e,t,"abandoned",r)}create(e,t,r,n){return this.client.create({userId:e,action:t,properties:{featureName:r,...n}})}}},938(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromptTracker=t.FeatureTracker=t.ExperimentTracker=t.ActivationTracker=void 0;var n=r(2300);Object.defineProperty(t,"ActivationTracker",{enumerable:!0,get:function(){return n.ActivationTracker}});var i=r(2115);Object.defineProperty(t,"ExperimentTracker",{enumerable:!0,get:function(){return i.ExperimentTracker}});var s=r(76);Object.defineProperty(t,"FeatureTracker",{enumerable:!0,get:function(){return s.FeatureTracker}});var o=r(8794);Object.defineProperty(t,"PromptTracker",{enumerable:!0,get:function(){return o.PromptTracker}})},8794(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromptTracker=void 0,t.PromptTracker=class{constructor(e){this.client=e}submitted(e,t,r){return this.client.trackSubmission({promptId:e,promptType:t,properties:r})}responded(e,t,r,n){return this.client.trackResponse({promptId:e,responseTime:t,completed:r,properties:n})}feedback(e,t,r){return this.client.trackFeedback({promptId:e,feedbackType:t,properties:r})}conversation(e,t,r,n){return this.client.trackConversation(e,t,r,n)}event(e,t={}){return this.client.create({eventName:e,properties:t})}}},6149(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CartTracker=void 0,t.CartTracker=class{constructor(e){this.client=e}add(e,t=1,r){return this.client.addItem({product:e,quantity:t,cartId:r})}remove(e,t=1,r){return this.client.removeItem({product:e,quantity:t,cartId:r})}update(e,t,r,n){return this.client.updateItem({product:e,previousQuantity:t,newQuantity:r,cartId:n})}view(e){return this.client.view({cart:e})}}},5267(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CheckoutTracker=void 0,t.CheckoutTracker=class{constructor(e){this.client=e}begin(e){return this.client.begin({cart:e})}step(e,t,r){return this.client.step({step:e,stepNumber:t,cart:r})}shipping(e,t){return this.client.addShipping({cart:e,shipping:t})}payment(e,t){return this.client.addPayment({cart:e,payment:t})}}},1075(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchTracker=t.LTVTracker=t.SubscriptionTracker=t.WishlistTracker=t.PromotionTracker=t.RefundTracker=t.PurchaseTracker=t.CheckoutTracker=t.CartTracker=t.ProductTracker=void 0;var n=r(1235);Object.defineProperty(t,"ProductTracker",{enumerable:!0,get:function(){return n.ProductTracker}});var i=r(6149);Object.defineProperty(t,"CartTracker",{enumerable:!0,get:function(){return i.CartTracker}});var s=r(5267);Object.defineProperty(t,"CheckoutTracker",{enumerable:!0,get:function(){return s.CheckoutTracker}});var o=r(1971);Object.defineProperty(t,"PurchaseTracker",{enumerable:!0,get:function(){return o.PurchaseTracker}});var a=r(1500);Object.defineProperty(t,"RefundTracker",{enumerable:!0,get:function(){return a.RefundTracker}});var c=r(5573);Object.defineProperty(t,"PromotionTracker",{enumerable:!0,get:function(){return c.PromotionTracker}});var u=r(9392);Object.defineProperty(t,"WishlistTracker",{enumerable:!0,get:function(){return u.WishlistTracker}});var l=r(8857);Object.defineProperty(t,"SubscriptionTracker",{enumerable:!0,get:function(){return l.SubscriptionTracker}});var d=r(5865);Object.defineProperty(t,"LTVTracker",{enumerable:!0,get:function(){return d.LTVTracker}});var p=r(7583);Object.defineProperty(t,"SearchTracker",{enumerable:!0,get:function(){return p.SearchTracker}})},5865(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LTVTracker=void 0,t.LTVTracker=class{constructor(e){this.client=e}acquisitionCost(e,t,r){return this.client.recordAcquisitionCost({userId:e,cost:t,channel:r})}segment(e,t){return this.client.updateSegment(e,t)}}},1235(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProductTracker=void 0,t.ProductTracker=class{constructor(e){this.client=e}view(e,t){return this.client.view({...e,properties:t})}impression(e,t,r){return this.client.impression({list:{listId:e,listName:t,products:r}})}click(e,t,r){return this.client.click({product:e,listId:t,position:r})}}},5573(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionTracker=void 0,t.PromotionTracker=class{constructor(e){this.client=e}view(e,t,r,n){return this.client.view({promotionId:e,name:t,creative:r,position:n})}click(e,t,r,n){return this.client.click({promotionId:e,name:t,creative:r,position:n})}coupon(e,t,r,n,i,s){return this.client.couponUsed({code:e,orderId:t,discountValue:r,discountType:n,orderValueBefore:i,orderValueAfter:s})}}},1971(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PurchaseTracker=void 0,t.PurchaseTracker=class{constructor(e){this.client=e}complete(e){return this.client.track({order:e})}}},1500(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RefundTracker=void 0,t.RefundTracker=class{constructor(e){this.client=e}request(e,t,r){return this.client.request(e,t,r)}approve(e,t){return this.client.approve(e,t)}deny(e,t){return this.client.deny(e,t)}complete(e,t,r,n,i,s=!1){return this.client.track({orderId:e,refundId:t,amount:r,currency:n,reason:i,isFullRefund:s})}}},7583(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchTracker=void 0,t.SearchTracker=class{constructor(e){this.client=e}query(e,t,r){return this.client.track({query:e,resultsCount:t,...r})}click(e,t,r){return this.client.trackClick({query:e,product:t,position:r})}refine(e,t,r){return this.client.trackRefinement(e,t,r)}suggestion(e,t,r){return this.client.trackSuggestion(e,t,r)}}},8857(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubscriptionTracker=void 0,t.SubscriptionTracker=class{constructor(e){this.client=e}start(e,t,r,n,i){return this.client.start({subscriptionId:e,userId:t,plan:r,mrr:n,billingCycle:i})}change(e,t,r,n,i,s,o){return this.client.change({subscriptionId:e,userId:t,previousPlan:r,newPlan:n,previousMrr:i,newMrr:s,changeType:o})}cancel(e,t,r,n,i=!1){return this.client.cancel({subscriptionId:e,userId:t,plan:r,lostMrr:n,immediate:i})}renew(e,t,r){return this.client.renew(e,t,r)}trialConverted(e,t,r,n){return this.client.trialConverted(e,t,r,n)}trialExpired(e,t){return this.client.trialExpired(e,t)}}},9392(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WishlistTracker=void 0,t.WishlistTracker=class{constructor(e){this.client=e}add(e,t){return this.client.add({product:e,wishlistId:t})}remove(e,t){return this.client.remove({product:e,wishlistId:t})}view(e){return this.client.view(e)}moveToCart(e,t){return this.client.moveToCart(e,t)}share(e,t){return this.client.share(e,t)}}},8949(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AcquisitionTracker=void 0,t.AcquisitionTracker=class{constructor(e){this.client=e}acquired(e,t,r){return this.client.trackAcquisition({userId:e,source:t,properties:r})}campaign(e){return this.client.createCampaign(e)}spend(e,t,r){return this.client.trackCampaignSpend({campaignId:e,amount:t,date:r})}lifecycle(e,t,r){return this.client.trackLifecycleTransition({userId:e,fromStage:t,toStage:r})}}},2215(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlertTracker=void 0,t.AlertTracker=class{constructor(e){this.client=e}create(e){return this.client.createAlert(e)}update(e,t){return this.client.updateAlert(e,t)}delete(e){return this.client.deleteAlert(e)}acknowledge(e,t){return this.client.acknowledgeAlert(e,t)}resolve(e,t){return this.client.resolveAlert(e,t)}mute(e,t){return this.client.muteAlert(e,t)}}},7708(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChurnTracker=void 0,t.ChurnTracker=class{constructor(e){this.client=e}decay(e,t,r){return this.client.trackUsageDecay({userId:e,metric:t,periods:r})}nps(e,t,r){return this.client.trackNPS({userId:e,score:t,feedback:r})}churned(e,t,r){return this.client.trackChurn({userId:e,churnType:t,reason:r})}prevention(e,t,r){return this.client.trackPreventionAction({userId:e,actionType:t,details:r})}}},6360(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CohortTracker=void 0,t.CohortTracker=class{constructor(e){this.client=e}create(e){return this.client.createCohort(e)}segment(e){return this.client.createSegment(e)}isMember(e,t){return this.client.isUserInCohort(e,t)}}},2231(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementTracker=void 0,t.EngagementTracker=class{constructor(e){this.client=e}dwell(e,t,r){return this.client.trackDwellTime({featureId:e,dwellTimeMs:t,properties:r})}sessionDepth(e,t,r,n,i){return this.client.trackSessionDepth({sessionId:e,pagesVisited:t,featuresUsed:r,actionsTaken:n,durationMs:i})}contentConsumption(e,t,r,n){return this.client.trackContentConsumption({contentId:e,contentType:t,percentageConsumed:r,timeSpentMs:n})}activity(e,t,r){return this.client.trackUserActivity({userId:e,activityType:t,durationMs:r})}autoTrackDwell(e,t){return this.client.autoTrackDwell(e,t)}autoTrack(e){return this.client.autoTrack(e)}}},5481(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForecastingTracker=void 0,t.ForecastingTracker=class{constructor(e){this.client=e}activeUsers(e,t,r){return this.client.forecastActiveUsers({metric:e,periods:t,granularity:r})}revenue(e,t){return this.client.forecastRevenue({periods:e,granularity:t})}featureAdoption(e,t,r){return this.client.forecastFeatureAdoption({featureId:e,periods:t,granularity:r})}churn(e,t){return this.client.forecastChurn({periods:e,granularity:t})}}},658(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForecastingTracker=t.SecurityTracker=t.AlertTracker=t.PathTracker=t.AcquisitionTracker=t.SupportTracker=t.MultiPathFunnelTracker=t.MonetizationTracker=t.ChurnTracker=t.CohortTracker=t.EngagementTracker=void 0;var n=r(2231);Object.defineProperty(t,"EngagementTracker",{enumerable:!0,get:function(){return n.EngagementTracker}});var i=r(6360);Object.defineProperty(t,"CohortTracker",{enumerable:!0,get:function(){return i.CohortTracker}});var s=r(7708);Object.defineProperty(t,"ChurnTracker",{enumerable:!0,get:function(){return s.ChurnTracker}});var o=r(3345);Object.defineProperty(t,"MonetizationTracker",{enumerable:!0,get:function(){return o.MonetizationTracker}});var a=r(9731);Object.defineProperty(t,"MultiPathFunnelTracker",{enumerable:!0,get:function(){return a.MultiPathFunnelTracker}});var c=r(9481);Object.defineProperty(t,"SupportTracker",{enumerable:!0,get:function(){return c.SupportTracker}});var u=r(8949);Object.defineProperty(t,"AcquisitionTracker",{enumerable:!0,get:function(){return u.AcquisitionTracker}});var l=r(3222);Object.defineProperty(t,"PathTracker",{enumerable:!0,get:function(){return l.PathTracker}});var d=r(2215);Object.defineProperty(t,"AlertTracker",{enumerable:!0,get:function(){return d.AlertTracker}});var p=r(1890);Object.defineProperty(t,"SecurityTracker",{enumerable:!0,get:function(){return p.SecurityTracker}});var h=r(5481);Object.defineProperty(t,"ForecastingTracker",{enumerable:!0,get:function(){return h.ForecastingTracker}})},3345(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MonetizationTracker=void 0,t.MonetizationTracker=class{constructor(e){this.client=e}revenue(e,t,r,n,i){return this.client.trackRevenue({userId:e,amount:t,currency:r,type:n,properties:i})}}},9731(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiPathFunnelTracker=void 0,t.MultiPathFunnelTracker=class{constructor(e){this.client=e}define(e){return this.client.defineFunnel(e)}step(e,t,r,n){return this.client.trackStep({funnelId:e,step:t,userId:r,properties:n})}microConversion(e,t,r){return this.client.trackMicroConversion({conversionId:e,userId:t,properties:r})}}},3222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathTracker=void 0,t.PathTracker=class{constructor(e){this.client=e}transition(e,t,r,n){return this.client.trackTransition({userId:e,fromScreen:t,toScreen:r,properties:n})}sequence(e,t,r){return this.client.trackFeatureSequence({userId:e,feature:t,order:r})}define(e){return this.client.definePath(e)}}},1890(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityTracker=void 0,t.SecurityTracker=class{constructor(e){this.client=e}login(e,t,r){return this.client.trackLoginAttempt({userId:e,success:t,properties:r})}roleChange(e,t,r,n){return this.client.trackRoleChange({userId:e,changedBy:t,previousRole:r,newRole:n})}permissionChange(e,t,r,n){return this.client.trackPermissionChange({userId:e,changedBy:t,permission:r,action:n})}dataAccess(e,t,r,n){return this.client.trackDataAccess({userId:e,resourceType:t,accessType:r,properties:n})}compliance(e,t,r){return this.client.trackComplianceEvent({userId:e,eventType:t,properties:r})}}},9481(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupportTracker=void 0,t.SupportTracker=class{constructor(e){this.client=e}ticket(e,t,r,n,i,s){return this.client.trackTicket({ticketId:e,userId:t,subject:r,category:n,priority:i,channel:s})}update(e,t,r){return this.client.updateTicket({ticketId:e,status:t,properties:r})}csat(e,t,r,n){return this.client.trackCSAT({ticketId:e,userId:t,score:r,feedback:n})}featureComplaint(e,t,r,n){return this.client.trackFeatureComplaint({userId:e,featureId:t,complaintType:r,severity:n})}}},7890(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWindow=function(){return"undefined"!=typeof window?window:void 0},t.getDocument=function(){return"undefined"!=typeof document?document:void 0},t.isBrowser=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},t.combineTeardowns=function(...e){return()=>{for(const t of e)if("function"==typeof t)try{t()}catch{}}}},5558(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityManager=void 0;const n=r(4211),i="fg_visitor_id",s="fg_session_id",o="fg_session_touch";t.IdentityManager=class{constructor(e){this.visitorId="",this.sessionId="",this.memoryStore={},this.config={visitorId:e?.visitorId??"",cookieDomain:e?.cookieDomain??"",visitorMaxAgeDays:e?.visitorMaxAgeDays??365,sessionTimeoutMinutes:e?.sessionTimeoutMinutes??30,storage:e?.storage??(this.detectBrowser()?"cookie":"memory"),serverCookies:e?.serverCookies,compat:e?.compat??!0},this.visitorId=this.resolveVisitorId(),this.sessionId=""}getVisitorId(){return this.visitorId||(this.visitorId=this.resolveVisitorId()),this.visitorId}getSessionId(){if("memory"===this.config.storage)return this.getMemorySessionId();if(!this.detectBrowser())return this.getMemorySessionId();try{const e=sessionStorage.getItem(s),t=sessionStorage.getItem(o);if(e&&t){if(Date.now()-parseInt(t,10)<60*this.config.sessionTimeoutMinutes*1e3)return sessionStorage.setItem(o,String(Date.now())),this.sessionId=e,e}const r=this.generateSessionId();return sessionStorage.setItem(s,r),sessionStorage.setItem(o,String(Date.now())),this.sessionId=r,r}catch{return this.getMemorySessionId()}}setVisitorId(e){this.visitorId=e,this.persistVisitorId(e)}clearSession(){if(this.sessionId="",delete this.memoryStore[s],delete this.memoryStore[o],this.detectBrowser())try{sessionStorage.removeItem(s),sessionStorage.removeItem(o)}catch{}}clearAll(){if(this.visitorId="",this.sessionId="",this.memoryStore={},this.detectBrowser())try{this.deleteCookie(this.visitorCookieName),this.deleteCookie(i),localStorage.removeItem(this.visitorCookieName),localStorage.removeItem(i),localStorage.removeItem("fg_exp_assignments"),sessionStorage.removeItem(s),sessionStorage.removeItem(o)}catch{}}isBrowser(){return this.detectBrowser()}get visitorCookieName(){return this.config.compat?"visitor_id":i}resolveVisitorId(){if(this.config.visitorId)return this.config.visitorId;if(this.detectBrowser()){const e=(0,n.getVisitorId)();if(e){const t=this.readCookie(i)||this.readLocalStorage(i);return t&&t!==e&&this.removeLegacyCookie(),this.persistVisitorId(e),e}}if(this.config.compat){const e=this.readCookie(i)||this.readLocalStorage(i);if(e)return this.persistVisitorId(e),this.removeLegacyCookie(),e}const e=this.readCookie(this.visitorCookieName);if(e)return e;if(this.detectBrowser())try{const e=localStorage.getItem(this.visitorCookieName);if(e)return e}catch{}if(this.config.serverCookies){const e=this.readServerCookie(this.visitorCookieName);if(e)return e}if(this.memoryStore[this.visitorCookieName])return this.memoryStore[this.visitorCookieName];const t=this.generateVisitorId();return this.persistVisitorId(t),t}readLocalStorage(e){if(!this.detectBrowser())return null;try{return localStorage.getItem(e)}catch{return null}}removeLegacyCookie(){if(this.deleteCookie(i),this.detectBrowser())try{localStorage.removeItem(i)}catch{}}persistVisitorId(e){const t=this.visitorCookieName;if("memory"!==this.config.storage)if(this.detectBrowser()){this.writeCookie(t,e,this.config.visitorMaxAgeDays);try{localStorage.setItem(t,e)}catch{}}else this.memoryStore[t]=e;else this.memoryStore[t]=e}getMemorySessionId(){const e=this.memoryStore[s],t=this.memoryStore[o];if(e&&t&&Date.now()-parseInt(t,10)<60*this.config.sessionTimeoutMinutes*1e3)return this.memoryStore[o]=String(Date.now()),this.sessionId=e,e;const r=this.generateSessionId();return this.memoryStore[s]=r,this.memoryStore[o]=String(Date.now()),this.sessionId=r,r}readCookie(e){return this.config.serverCookies?this.readServerCookie(e):this.detectBrowser()?(0,n.getCookie)(e):null}readServerCookie(e){if(!this.config.serverCookies)return null;const t=this.config.serverCookies.get(e);return t?"object"==typeof t&&"value"in t?t.value||null:"string"==typeof t&&t||null:null}writeCookie(e,t,r){if(!this.detectBrowser())return;const n=24*r*60*60,i=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"",s="https:"===location.protocol?"; Secure":"";document.cookie=`${e}=${encodeURIComponent(t)}; Path=/; Max-Age=${n}; SameSite=Lax${s}${i}`}deleteCookie(e){if(!this.detectBrowser())return;const t=this.config.cookieDomain?`; Domain=${this.config.cookieDomain}`:"";document.cookie=`${e}=; Path=/; Max-Age=0${t}`}generateVisitorId(){return`fg_${this.uuidV4()}`}generateSessionId(){return`fgs_${Date.now()}_${this.randomHex(8)}`}uuidV4(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}randomHex(e){const t=new Uint8Array(e);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}detectBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}}},4211(e,t){"use strict";function r(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]+)"));return t?t[2]:null}Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=r,t.getVisitorId=function(){try{return r("visitor_id")||localStorage.getItem("visitor_id")}catch{return r("visitor_id")}},t.getSessionId=function(){try{return sessionStorage.getItem("session_id")}catch{return null}},t.getWebId=function(){try{return localStorage.getItem("web_id")}catch{return null}},t.getUTM=function(){return{utmSource:r("__flowgrid_utm_source")||void 0,utmMedium:r("__flowgrid_utm_medium")||void 0,utmCampaign:r("__flowgrid_utm_campaign")||void 0,utmTerm:r("__flowgrid_utm_term")||void 0,utmContent:r("__flowgrid_utm_content")||void 0,ref:r("__flowgrid_ref")||void 0,source:r("__flowgrid_source")||void 0,via:r("__flowgrid_via")||void 0}},t.getUTMHistory=function(){try{const e=localStorage.getItem("utm_history")||r("utm_history");return e?JSON.parse(e):[]}catch{return[]}}},8796(e,t){!function(e){"use strict";let t=-1;const r=e=>{addEventListener("pageshow",r=>{r.persisted&&(t=r.timeStamp,e(r))},!0)},n=(e,t,r,n)=>{let i,s;return o=>{t.value>=0&&(o||n)&&(s=t.value-(i??0),(s||void 0===i)&&(i=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},o=()=>s()?.activationStart??0,a=(e,r=-1)=>{const n=s();let i="navigate";return t>=0?i="back-forward-cache":n&&(document.prerendering||o()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:r,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:i}},c=new WeakMap;function u(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class l{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const d=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},p=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let h=-1;const m=new Set,f=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,g=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of m)e();isFinite(h)||(h="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",g,!0))}},y=()=>{if(h<0){const e=o(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;h=t??f(),addEventListener("visibilitychange",g,!0),addEventListener("prerenderingchange",g,!0),r(()=>{setTimeout(()=>{h=f()})})}return{get firstHiddenTime(){return h},onHidden(e){m.add(e)}}},v=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},I=[1800,3e3],b=(e,t={})=>{v(()=>{const s=y();let c,u=a("FCP");const l=d("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(l.disconnect(),t.startTime<s.firstHiddenTime&&(u.value=Math.max(t.startTime-o(),0),u.entries.push(t),c(!0)))});l&&(c=n(e,u,I,t.reportAllChanges),r(r=>{u=a("FCP"),c=n(e,u,I,t.reportAllChanges),i(()=>{u.value=performance.now()-r.timeStamp,c(!0)})}))})},S=[.1,.25];let w=0,C=1/0,k=0;const T=e=>{for(const t of e)t.interactionId&&(C=Math.min(C,t.interactionId),k=Math.max(k,t.interactionId),w=k?(k-C)/7+1:0)};let _;const A=()=>_?w:performance.interactionCount??0;let O=0;class E{l=[];u=new Map;p;m;v(){O=A(),this.l.length=0,this.u.clear()}T(){const e=Math.min(this.l.length-1,Math.floor((A()-O)/50));return this.l[e]}h(e){if(this.p?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.l.at(-1);let r=this.u.get(e.interactionId);if(r||this.l.length<10||e.duration>t.L){if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],L:e.duration},this.u.set(r.id,r),this.l.push(r)),this.l.sort((e,t)=>t.L-e.L),this.l.length>10){const e=this.l.splice(10);for(const t of e)this.u.delete(t.id)}this.m?.(r)}}}const M=e=>{const t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=p(e);let i=-1;const s=()=>{r(i),n()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),i=t(()=>{removeEventListener("visibilitychange",s,{capture:!0}),n()})}},N=[200,500];class D{p;h(e){this.p?.(e)}}const x=[2500,4e3],P=[800,1800],R=e=>{document.prerendering?v(()=>R(e)):"complete"!==document.readyState?addEventListener("load",()=>R(e),!0):setTimeout(e)};e.CLSThresholds=S,e.FCPThresholds=I,e.INPThresholds=N,e.LCPThresholds=x,e.TTFBThresholds=P,e.onCLS=(e,t={})=>{const s=y();b(p(()=>{let o,c=a("CLS",0);const p=u(t,l),h=e=>{for(const t of e)p.h(t);p.i>c.value&&(c.value=p.i,c.entries=p.o,o())},m=d("layout-shift",h);m&&(o=n(e,c,S,t.reportAllChanges),s.onHidden(()=>{h(m.takeRecords()),o(!0)}),r(()=>{p.i=0,c=a("CLS",0),o=n(e,c,S,t.reportAllChanges),i(o)}),setTimeout(o))}))},e.onFCP=b,e.onINP=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=y();v(()=>{"interactionCount"in performance||_||(_=d("event",T,{durationThreshold:0}));let s,o=a("INP");const c=u(t,E),l=e=>{M(()=>{for(const t of e)c.h(t);const t=c.T();t&&t.L!==o.value&&(o.value=t.L,o.entries=t.entries,s())})},p=d("event",l,{durationThreshold:t.durationThreshold??40});s=n(e,o,N,t.reportAllChanges),p&&(p.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{l(p.takeRecords()),s(!0)}),r(()=>{c.v(),o=a("INP"),s=n(e,o,N,t.reportAllChanges)}))})},e.onLCP=(e,t={})=>{v(()=>{const s=y();let c,l=a("LCP");const h=u(t,D),m=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)h.h(t),t.startTime<s.firstHiddenTime&&(l.value=Math.max(t.startTime-o(),0),l.entries=[t],c())},f=d("largest-contentful-paint",m);if(f){c=n(e,l,x,t.reportAllChanges);const s=p(()=>{m(f.takeRecords()),f.disconnect(),c(!0)}),o=e=>{e.isTrusted&&(M(s),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});r(r=>{l=a("LCP"),c=n(e,l,x,t.reportAllChanges),i(()=>{l.value=performance.now()-r.timeStamp,c(!0)})})}})},e.onTTFB=(e,t={})=>{let i=a("TTFB"),c=n(e,i,P,t.reportAllChanges);R(()=>{const u=s();u&&(i.value=Math.max(u.responseStart-o(),0),i.entries=[u],c(!0),r(()=>{i=a("TTFB",0),c=n(e,i,P,t.reportAllChanges),c(!0)}))})}}(t)},6546(e,t,r){"use strict";r.r(t),r.d(t,{EventType:()=>he,IncrementalSource:()=>me,MouseInteractions:()=>fe,PLUGIN_NAME:()=>Ir,Replayer:()=>Pn,ReplayerEvents:()=>ye,addCustomEvent:()=>gt,freezePage:()=>yt,getRecordConsolePlugin:()=>br,getReplayConsolePlugin:()=>kr,mirror:()=>z,pack:()=>or,record:()=>ft,unpack:()=>ar,utils:()=>n});var n={};r.r(n),r.d(n,{StyleSheetMirror:()=>pe,_mirror:()=>z,getBaseDimension:()=>ae,getNestedRule:()=>ue,getPositionsAndIndex:()=>le,getWindowHeight:()=>Y,getWindowWidth:()=>$,hasShadowRoot:()=>ce,hookSetter:()=>Z,isAncestorRemoved:()=>ee,isBlocked:()=>J,isIgnored:()=>X,isSerialized:()=>Q,isSerializedIframe:()=>se,isSerializedStylesheet:()=>oe,isTouchEvent:()=>te,iterateResolveTree:()=>ie,on:()=>G,patch:()=>K,polyfill:()=>re,queueToResolveTrees:()=>ne,throttle:()=>H,uniqueTextMutations:()=>de});var i,s={};function o(e){return e.nodeType===e.ELEMENT_NODE}function a(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function c(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function u(e){try{var t=e.rules||e.cssRules;return t?((r=Array.from(t).map(l).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),r):null}catch(e){return null}var r}function l(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=u(e.styleSheet)||t}catch(e){}return t}r.r(s),r.d(s,{default:()=>on}),function(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"}(i||(i={}));var d=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function p(){return new d}function h(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,i=e.value,s=e.maskInputFn,o=i||"";return(t[r.toLowerCase()]||t[n])&&(o=s?s(o):"*".repeat(o.length)),o}var m,f,g="__rrweb_original__",y=1,v=new RegExp("[^a-z0-9-_:]");function I(){return y++}var b=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,S=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,w=/^(data:)([^,]*),(.*)/i;function C(e,t){return(e||"").replace(b,function(e,r,n,i,s,o){var a,c=n||s||o,u=r||i||"";if(!c)return e;if(!S.test(c))return"url(".concat(u).concat(c).concat(u,")");if(w.test(c))return"url(".concat(u).concat(c).concat(u,")");if("/"===c[0])return"url(".concat(u).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(u,")");var l=t.split("/"),d=c.split("/");l.pop();for(var p=0,h=d;p<h.length;p++){var m=h[p];"."!==m&&(".."===m?l.pop():l.push(m))}return"url(".concat(u).concat(l.join("/")).concat(u,")")})}var k=/^[^ \t\n\r\u000c]+/,T=/^[, \t\n\r\u000c]+/;function _(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function A(){var e=document.createElement("a");return e.href="",e.href}function O(e,t,r,n){return"src"===r||"href"===r&&n&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&n&&"#"!==n[0]?_(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,i=e.exec(t.substring(r));return i?(n=i[0],r+=n.length,n):""}for(var i=[];n(T),!(r>=t.length);){var s=n(k);if(","===s.slice(-1))s=_(e,s.substring(0,s.length-1)),i.push(s);else{var o="";s=_(e,s);for(var a=!1;;){var c=t.charAt(r);if(""===c){i.push((s+o).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){r+=1,i.push((s+o).trim());break}"("===c&&(a=!0)}o+=c,r+=1}}}return i.join(", ")}(e,n):"style"===r&&n?C(n,A()):"object"===t&&"data"===r&&n?_(e,n):n:_(e,n)}function E(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&E(e.parentNode,t,r);for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}return!!r&&E(e.parentNode,t,r)}function M(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(E(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function N(e){return void 0===e?"":e.toLowerCase()}function D(e,t){var r,n=t.doc,s=t.mirror,l=t.blockClass,d=t.blockSelector,p=t.maskTextClass,y=t.maskTextSelector,b=t.skipChild,S=void 0!==b&&b,w=t.inlineStylesheet,k=void 0===w||w,T=t.maskInputOptions,_=void 0===T?{}:T,E=t.maskTextFn,x=t.maskInputFn,P=t.slimDOMOptions,R=t.dataURLOptions,F=void 0===R?{}:R,L=t.inlineImages,j=void 0!==L&&L,B=t.recordCanvas,U=void 0!==B&&B,V=t.onSerialize,q=t.onIframeLoad,G=t.iframeLoadTimeout,W=void 0===G?5e3:G,z=t.onStylesheetLoad,H=t.stylesheetLoadTimeout,Z=void 0===H?5e3:H,K=t.keepIframeSrcFn,Y=void 0===K?function(){return!1}:K,$=t.newlyAddedElement,J=void 0!==$&&$,Q=t.preserveWhiteSpace,X=void 0===Q||Q,ee=function(e,t){var r=t.doc,n=t.mirror,s=t.blockClass,o=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.inlineStylesheet,d=t.maskInputOptions,p=void 0===d?{}:d,y=t.maskTextFn,I=t.maskInputFn,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=t.recordCanvas,T=t.keepIframeSrcFn,_=t.newlyAddedElement,E=void 0!==_&&_,N=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:i.Document,childNodes:[],compatMode:e.compatMode}:{type:i.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:i.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:N};case e.ELEMENT_NODE:return function(e,t){for(var r=t.doc,n=t.inlineStylesheet,s=t.maskInputOptions,o=void 0===s?{}:s,a=t.maskInputFn,c=t.dataURLOptions,l=void 0===c?{}:c,d=t.inlineImages,p=t.recordCanvas,y=t.keepIframeSrcFn,I=t.newlyAddedElement,b=void 0!==I&&I,S=t.rootId,w=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}return!!r&&e.matches(r)}(e,t.blockClass,t.blockSelector),k=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return v.test(t)?"div":t}(e),T={},_=e.attributes.length,E=0;E<_;E++){var M=e.attributes[E];T[M.name]=O(r,k,M.name,M.value)}if("link"===k&&n){var N=Array.from(r.styleSheets).find(function(t){return t.href===e.href}),D=null;N&&(D=u(N)),D&&(delete T.rel,delete T.href,T._cssText=C(D,N.href))}if("style"===k&&e.sheet&&!(e.innerText||e.textContent||"").trim().length&&(D=u(e.sheet))&&(T._cssText=C(D,A())),"input"===k||"textarea"===k||"select"===k){var x=e.value,P=e.checked;"radio"!==T.type&&"checkbox"!==T.type&&"submit"!==T.type&&"button"!==T.type&&x?T.value=h({type:T.type,tagName:k,value:x,maskInputOptions:o,maskInputFn:a}):P&&(T.checked=P)}if("option"===k&&(e.selected&&!o.select?T.selected=!0:delete T.selected),"canvas"===k&&p)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var i=t.getImageData,s=g in i?i[g]:i;if(new Uint32Array(s.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(T.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){var R=e.toDataURL(l.type,l.quality),F=document.createElement("canvas");F.width=e.width,F.height=e.height,R!==F.toDataURL(l.type,l.quality)&&(T.rr_dataURL=R)}if("img"===k&&d){m||(m=r.createElement("canvas"),f=m.getContext("2d"));var L=e,j=L.crossOrigin;L.crossOrigin="anonymous";var B=function(){try{m.width=L.naturalWidth,m.height=L.naturalHeight,f.drawImage(L,0,0),T.rr_dataURL=m.toDataURL(l.type,l.quality)}catch(e){console.warn("Cannot inline img src=".concat(L.currentSrc,"! Error: ").concat(e))}j?T.crossOrigin=j:L.removeAttribute("crossorigin")};L.complete&&0!==L.naturalWidth?B():L.onload=B}if("audio"!==k&&"video"!==k||(T.rr_mediaState=e.paused?"paused":"played",T.rr_mediaCurrentTime=e.currentTime),b||(e.scrollLeft&&(T.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(T.rr_scrollTop=e.scrollTop)),w){var U=e.getBoundingClientRect(),V=U.width,q=U.height;T={class:T.class,rr_width:"".concat(V,"px"),rr_height:"".concat(q,"px")}}return"iframe"!==k||y(T.src)||(e.contentDocument||(T.rr_src=T.src),delete T.src),{type:i.Element,tagName:k,attributes:T,childNodes:[],isSVG:(G=e,Boolean("svg"===G.tagName||G.ownerSVGElement)||void 0),needBlock:w,rootId:S};var G}(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:p,maskInputFn:I,dataURLOptions:S,inlineImages:w,recordCanvas:k,keepIframeSrcFn:T,newlyAddedElement:E,rootId:N});case e.TEXT_NODE:return function(e,t){var r,n,s=t.maskTextClass,o=t.maskTextSelector,a=t.maskTextFn,c=t.rootId,u=e.parentNode&&e.parentNode.tagName,l=e.textContent,d="STYLE"===u||void 0,p="SCRIPT"===u||void 0;if(d&&l){try{e.nextSibling||e.previousSibling||(null===(r=e.parentNode.sheet)||void 0===r?void 0:r.cssRules)&&(l=(n=e.parentNode.sheet).cssRules?Array.from(n.cssRules).map(function(e){return e.cssText||""}).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=C(l,A())}return p&&(l="SCRIPT_PLACEHOLDER"),!d&&!p&&l&&M(e,s,o)&&(l=a?a(l):l.replace(/[\S]/g,"*")),{type:i.Text,textContent:l||"",isStyle:d,rootId:c}}(e,{maskTextClass:a,maskTextSelector:c,maskTextFn:y,rootId:N});case e.CDATA_SECTION_NODE:return{type:i.CDATA,textContent:"",rootId:N};case e.COMMENT_NODE:return{type:i.Comment,textContent:e.textContent||"",rootId:N};default:return!1}}(e,{doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,dataURLOptions:F,inlineImages:j,recordCanvas:U,keepIframeSrcFn:Y,newlyAddedElement:J});if(!ee)return console.warn(e,"not serialized"),null;r=s.hasNode(e)?s.getId(e):!function(e,t){if(t.comment&&e.type===i.Comment)return!0;if(e.type===i.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(N(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===N(e.attributes.name)||"icon"===N(e.attributes.rel)||"apple-touch-icon"===N(e.attributes.rel)||"shortcut icon"===N(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&N(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(N(e.attributes.property).match(/^(og|twitter|fb):/)||N(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===N(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===N(e.attributes.name)||"googlebot"===N(e.attributes.name)||"bingbot"===N(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===N(e.attributes.name)||"generator"===N(e.attributes.name)||"framework"===N(e.attributes.name)||"publisher"===N(e.attributes.name)||"progid"===N(e.attributes.name)||N(e.attributes.property).match(/^article:/)||N(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===N(e.attributes.name)||"yandex-verification"===N(e.attributes.name)||"csrf-token"===N(e.attributes.name)||"p:domain_verify"===N(e.attributes.name)||"verify-v1"===N(e.attributes.name)||"verification"===N(e.attributes.name)||"shopify-checkout-api-token"===N(e.attributes.name)))return!0}}return!1}(ee,P)&&(X||ee.type!==i.Text||ee.isStyle||ee.textContent.replace(/^\s+|\s+$/gm,"").length)?I():-2;var te=Object.assign(ee,{id:r});if(s.add(e,te),-2===r)return null;V&&V(e);var re=!S;if(te.type===i.Element){re=re&&!te.needBlock,delete te.needBlock;var ne=e.shadowRoot;ne&&c(ne)&&(te.isShadowHost=!0)}if((te.type===i.Document||te.type===i.Element)&&re){P.headWhitespace&&te.type===i.Element&&"head"===te.tagName&&(X=!1);for(var ie={doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:S,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y},se=0,oe=Array.from(e.childNodes);se<oe.length;se++)(ue=D(oe[se],ie))&&te.childNodes.push(ue);if(o(e)&&e.shadowRoot)for(var ae=0,ce=Array.from(e.shadowRoot.childNodes);ae<ce.length;ae++){var ue;(ue=D(ce[ae],ie))&&(c(e.shadowRoot)&&(ue.isShadow=!0),te.childNodes.push(ue))}}return e.parentNode&&a(e.parentNode)&&c(e.parentNode)&&(te.isShadow=!0),te.type===i.Element&&"iframe"===te.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var i,s=!1;try{i=n.document.readyState}catch(e){return}if("complete"===i){var o="about:blank";if(n.location.href!==o||e.src===o||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){s||(t(),s=!0)},r);e.addEventListener("load",function(){clearTimeout(a),s=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&q){var r=D(t,{doc:t,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:!1,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y});r&&q(e,r)}},W),te.type===i.Element&&"link"===te.tagName&&"stylesheet"===te.attributes.rel&&function(e,t,r){var n,i=!1;try{n=e.sheet}catch(e){return}if(!n){var s=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(s),i=!0,t()})}}(e,function(){if(z){var t=D(e,{doc:n,mirror:s,blockClass:l,blockSelector:d,maskTextClass:p,maskTextSelector:y,skipChild:!1,inlineStylesheet:k,maskInputOptions:_,maskTextFn:E,maskInputFn:x,slimDOMOptions:P,dataURLOptions:F,inlineImages:j,recordCanvas:U,preserveWhiteSpace:X,onSerialize:V,onIframeLoad:q,iframeLoadTimeout:W,onStylesheetLoad:z,stylesheetLoadTimeout:Z,keepIframeSrcFn:Y});t&&z(e,t)}},Z),te}var x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function P(e,t){void 0===t&&(t={});var r=1,n=1;function i(e){var t=e.match(/\n/g);t&&(r+=t.length);var i=e.lastIndexOf("\n");n=-1===i?n+e.length:e.length-i}function s(){var e={line:r,column:n};return function(t){return t.position=new o(e),h(),t}}var o=function(e){this.start=e,this.end={line:r,column:n},this.source=t.source};o.prototype.content=e;var a=[];function c(i){var s=new Error("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(i));if(s.reason=i,s.filename=t.source,s.line=r,s.column=n,s.source=e,!t.silent)throw s;a.push(s)}function u(){return p(/^{\s*/)}function l(){return p(/^}/)}function d(){var t,r=[];for(h(),m(r);e.length&&"}"!==e.charAt(0)&&(t=T()||_());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return i(n),e=e.slice(n.length),r}}function h(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=f();)!1!==t&&e.push(t),t=f();return e}function f(){var t=s();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var o=e.slice(2,r-2);return n+=2,i(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function g(){var e=p(/^([^{]+)/);if(e)return R(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function y(){var e=s(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=R(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:r.replace(x,""),value:n?R(n[0]).replace(x,""):""});return p(/^[;\s]*/),i}}function v(){var e,t=[];if(!u())return c("missing '{'");for(m(t);e=y();)!1!==e&&(t.push(e),m(t)),e=y();return l()?t:c("missing '}'")}function I(){for(var e,t=[],r=s();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:v()})}var b,S=k("import"),w=k("charset"),C=k("namespace");function k(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=s(),n=p(t);if(n){var i={type:e};return i[e]=n[1].trim(),r(i)}}}function T(){if("@"===e[0])return function(){var e=s(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,i=t[1];if(!u())return c("@keyframes missing '{'");for(var o=m();n=I();)o.push(n),o=o.concat(m());return l()?e({type:"keyframes",name:i,vendor:r,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=s(),t=p(/^@media *([^{]+)/);if(t){var r=R(t[1]);if(!u())return c("@media missing '{'");var n=m().concat(d());return l()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=s(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:R(t[1]),media:R(t[2])})}()||function(){var e=s(),t=p(/^@supports *([^{]+)/);if(t){var r=R(t[1]);if(!u())return c("@supports missing '{'");var n=m().concat(d());return l()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||S()||w()||C()||function(){var e=s(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=R(t[1]),n=R(t[2]);if(!u())return c("@document missing '{'");var i=m().concat(d());return l()?e({type:"document",document:n,vendor:r,rules:i}):c("@document missing '}'")}}()||function(){var e=s();if(p(/^@page */)){var t=g()||[];if(!u())return c("@page missing '{'");for(var r,n=m();r=y();)n.push(r),n=n.concat(m());return l()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=s();if(p(/^@host\s*/)){if(!u())return c("@host missing '{'");var t=m().concat(d());return l()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=s();if(p(/^@font-face\s*/)){if(!u())return c("@font-face missing '{'");for(var t,r=m();t=y();)r.push(t),r=r.concat(m());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function _(){var e=s(),t=g();return t?(m(),e({type:"rule",selectors:t,declarations:v()})):c("selector missing")}return F((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:a}}))}function R(e){return e?e.replace(/^\s+|\s+$/g,""):""}function F(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,i=0,s=Object.keys(e);i<s.length;i++){var o=e[s[i]];Array.isArray(o)?o.forEach(function(e){F(e,n)}):o&&"object"==typeof o&&F(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var L={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"},j=/([^\\]):hover/,B=new RegExp(j.source,"g");function U(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=P(e,{silent:!0});if(!n.stylesheet)return e;var i=[];if(n.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){j.test(e)&&i.push(e)})}),0===i.length)return e;var s=new RegExp(i.filter(function(e,t){return i.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("|"),"g"),o=e.replace(s,function(e){var t=e.replace(B,"$1.\\:hover");return"".concat(e,", ").concat(t)});return null==t||t.stylesWithHoverClass.set(e,o),o}function V(){return{stylesWithHoverClass:new Map}}function q(e,t){var r=t.doc,n=t.mirror,s=t.skipChild,a=void 0!==s&&s,c=t.hackCss,u=void 0===c||c,l=t.afterAppend,d=t.cache,p=function(e,t){var r=t.doc,n=t.hackCss,s=t.cache;switch(e.type){case i.Document:return r.implementation.createDocument(null,"",null);case i.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case i.Element:var o,a=function(e){var t=L[e.tagName]?L[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);o=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",a):r.createElement(a);var c={};for(var u in e.attributes)if(Object.prototype.hasOwnProperty.call(e.attributes,u)){var l=e.attributes[u];if("option"!==a||"selected"!==u||!1!==l)if(!0===l&&(l=""),u.startsWith("rr_"))c[u]=l;else{var d="textarea"===a&&"value"===u,p="style"===a&&"_cssText"===u;if(p&&n&&"string"==typeof l&&(l=U(l,s)),!d&&!p||"string"!=typeof l)try{if(e.isSVG&&"xlink:href"===u)o.setAttributeNS("http://www.w3.org/1999/xlink",u,l.toString());else if("onload"===u||"onclick"===u||"onmouse"===u.substring(0,7))o.setAttribute("_"+u,l.toString());else{if("meta"===a&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===u){o.setAttribute("csp-content",l.toString());continue}"link"===a&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===a&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===a&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(u,l.toString()))}}catch(e){}else{for(var h=r.createTextNode(l),m=0,f=Array.from(o.childNodes);m<f.length;m++){var g=f[m];g.nodeType===o.TEXT_NODE&&o.removeChild(g)}o.appendChild(h)}}}var y=function(t){var r=c[t];if("canvas"===a&&"rr_dataURL"===t){var n=document.createElement("img");n.onload=function(){var e=o.getContext("2d");e&&e.drawImage(n,0,0,n.width,n.height)},n.src=r.toString(),o.RRNodeType&&(o.rr_dataURL=r.toString())}else if("img"===a&&"rr_dataURL"===t){var i=o;i.currentSrc.startsWith("data:")||(i.setAttribute("rrweb-original-src",e.attributes.src),i.src=r.toString())}if("rr_width"===t)o.style.width=r.toString();else if("rr_height"===t)o.style.height=r.toString();else if("rr_mediaCurrentTime"===t&&"number"==typeof r)o.currentTime=r;else if("rr_mediaState"===t)switch(r){case"played":o.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":o.pause()}};for(var v in c)y(v);if(e.isShadowHost)if(o.shadowRoot)for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);else o.attachShadow({mode:"open"});return o;case i.Text:return r.createTextNode(e.isStyle&&n?U(e.textContent,s):e.textContent);case i.CDATA:return r.createCDATASection(e.textContent);case i.Comment:return r.createComment(e.textContent);default:return null}}(e,{doc:r,hackCss:u,cache:d});if(!p)return null;if(e.rootId&&n.getNode(e.rootId)!==r&&n.replace(e.rootId,r),e.type===i.Document&&(r.close(),r.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==i.DocumentType&&(e.childNodes[0].type===i.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),p=r),n.add(p,e),(e.type===i.Document||e.type===i.Element)&&!a)for(var h=0,m=e.childNodes;h<m.length;h++){var f=m[h],g=q(f,{doc:r,mirror:n,skipChild:!1,hackCss:u,afterAppend:l,cache:d});g?(f.isShadow&&o(p)&&p.shadowRoot?p.shadowRoot.appendChild(g):p.appendChild(g),l&&l(g,f.id)):console.warn("Failed to rebuild",f)}return p}function G(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const W="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let z={map:{},getId:()=>(console.error(W),-1),getNode:()=>(console.error(W),null),removeNodeFromMap(){console.error(W)},has:()=>(console.error(W),!1),reset(){console.error(W)}};function H(e,t,r={}){let n=null,i=0;return function(...s){const o=Date.now();i||!1!==r.leading||(i=o);const a=t-(o-i),c=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(c,s)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(c,s)},a))}}function Z(e,t,r,n,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>Z(e,t,s||{},!0)}function K(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch(e){return()=>{}}}function Y(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function J(e,t,r,n){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(E(i,t,n))return!0;if(r){if(e.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function Q(e,t){return-1!==t.getId(e)}function X(e,t){return-2===t.getId(e)}function ee(e,t){if(a(e))return!1;const r=t.getId(e);return!t.has(r)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||ee(e.parentNode,t))}function te(e){return Boolean(e.changedTouches)}function re(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),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}function ne(e){const t={},r=(e,r)=>{const n={value:e,parent:r,children:[]};return t[e.node.id]=n,n},n=[];for(const i of e){const{nextId:e,parentId:s}=i;if(e&&e in t){const s=t[e];if(s.parent){const e=s.parent.children.indexOf(s);s.parent.children.splice(e,0,r(i,s.parent))}else{const e=n.indexOf(s);n.splice(e,0,r(i,null))}continue}if(s in t){const e=t[s];e.children.push(r(i,e));continue}n.push(r(i,null))}return n}function ie(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)ie(e.children[r],t)}function se(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function oe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ae(e,t){var r,n;const i=null===(n=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===n?void 0:n.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=i.getBoundingClientRect(),o=ae(i,t),a=s.height/i.clientHeight;return{x:s.x*o.relativeScale+o.x,y:s.y*o.relativeScale+o.y,relativeScale:a,absoluteScale:o.absoluteScale*a}}function ce(e){return Boolean(null==e?void 0:e.shadowRoot)}function ue(e,t){const r=e[t[0]];return 1===t.length?r:ue(r.cssRules[t[1]].cssRules,t.slice(2))}function le(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function de(e){const t=new Set,r=[];for(let n=e.length;n--;){const i=e[n];t.has(i.id)||(r.push(i),t.add(i.id))}return r}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(z=new Proxy(z,{get:(e,t,r)=>("map"===t&&console.error(W),Reflect.get(e,t,r))}));class pe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var he=(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))(he||{}),me=(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))(me||{}),fe=(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))(fe||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{}),ye=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(ye||{});function ve(e){return"__ln"in e}class Ie{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&ve(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&ve(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const be=(e,t)=>`${e}@${t}`;class Se{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Ie,r=e=>{let t=e,r=-2;for(;-2===r;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},n=n=>{var i,s,o,c;let u=null;(null===(s=null===(i=n.getRootNode)||void 0===i?void 0:i.call(n))||void 0===s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(u=n.getRootNode().host);let l=u;for(;(null===(c=null===(o=null==l?void 0:l.getRootNode)||void 0===o?void 0:o.call(l))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&l.getRootNode().host;)l=l.getRootNode().host;const d=!(this.doc.contains(n)||l&&this.doc.contains(l));if(!n.parentNode||d)return;const p=a(n.parentNode)?this.mirror.getId(u):this.mirror.getId(n.parentNode),h=r(n);if(-1===p||-1===h)return t.addNode(n);const m=D(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:e=>{se(e,this.mirror)&&this.iframeManager.addIframe(e),oe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ce(n)&&this.shadowDomManager.addShadowRoot(n.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});m&&e.push({parentId:p,nextId:h,node:m})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))Ce(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||n(e);for(const e of Array.from(this.addedSet.values()))Te(this.droppedSet,e)||Ce(this.removes,e,this.mirror)?Te(this.movedSet,e)?n(e):this.droppedSet.add(e):n(e);let i=null;for(;t.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=r(i.value);-1!==t&&-1!==n&&(e=i)}if(!e)for(let n=t.length-1;n>=0;n--){const i=t.get(n);if(i){const t=this.mirror.getId(i.value.parentNode);if(-1===r(i.value))continue;if(-1!==t){e=i;break}{const t=i.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=i;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}i=e.previous,t.removeNode(e.value),n(e.value)}const s={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!X(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;J(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(r=h({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),J(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let n=this.attributes.find(t=>t.node===e.target);if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;e.attributeName="rr_src"}if(n||(n={node:e.target,attributes:{}},this.attributes.push(n)),"style"===e.attributeName){const r=this.doc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue),void 0!==n.attributes.style&&null!==n.attributes.style||(n.attributes.style={});const i=n.attributes.style;for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n===r.style.getPropertyValue(e)&&s===r.style.getPropertyPriority(e)||(i[e]=""===s?n:[n,s])}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(i[e]=!1)}else n.attributes[e.attributeName]=O(this.doc,t.tagName,e.attributeName,r);break}case"childList":if(J(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),n=a(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);J(e.target,this.blockClass,this.blockSelector,!1)||X(t,this.mirror)||!Q(t,this.mirror)||(this.addedSet.has(t)?(we(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||ee(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[be(r,n)]?we(this.movedSet,t):this.removes.push({parentId:n,id:r,isShadow:!(!a(e.target)||!c(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(X(e,this.mirror))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[be(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);J(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function we(e,t){e.delete(t),t.childNodes.forEach(t=>we(e,t))}function Ce(e,t,r){return 0!==e.length&&ke(e,t,r)}function ke(e,t,r){const{parentNode:n}=t;if(!n)return!1;const i=r.getId(n);return!!e.some(e=>e.id===i)||ke(e,n,r)}function Te(e,t){return 0!==e.size&&_e(e,t)}function _e(e,t){const{parentNode:r}=t;return!!r&&(!!e.has(r)||_e(e,r))}const Ae=[],Oe="undefined"!=typeof CSSGroupingRule,Ee="undefined"!=typeof CSSMediaRule,Me="undefined"!=typeof CSSSupportsRule,Ne="undefined"!=typeof CSSConditionRule;function De(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function xe(e,t){var r,n;const i=new Se;Ae.push(i),i.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const o=null===(n=null===(r=null===window||void 0===window?void 0:window.Zone)||void 0===r?void 0:r.__symbol__)||void 0===n?void 0:n.call(r,"MutationObserver");o&&window[o]&&(s=window[o]);const a=new s(i.processMutations.bind(i));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Pe({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){return G("scroll",H(s=>{const o=De(s);if(!o||J(o,n,i,!0))return;const a=r.getId(o);if(o===t){const r=t.scrollingElement||t.documentElement;e({id:a,x:r.scrollLeft,y:r.scrollTop})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})},s.scroll||100),t)}function Re(e,t){const r=Object.assign({},e);return t||delete r.userTriggered,r}const Fe=["INPUT","TEXTAREA","SELECT"],Le=new WeakMap;function je(e){return function(e,t){if(Oe&&e.parentRule instanceof CSSGroupingRule||Ee&&e.parentRule instanceof CSSMediaRule||Me&&e.parentRule instanceof CSSSupportsRule||Ne&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function Be(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Ue({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;o="#document"===r.nodeName?e.getId(r):e.getId(r.host);const a="#document"===r.nodeName?null===(n=r.defaultView)||void 0===n?void 0:n.Document:null===(s=null===(i=r.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===s?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&c?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var r;const n=null===(r=c.set)||void 0===r?void 0:r.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return n}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function Ve(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:u,styleDeclarationCb:l,canvasMutationCb:d,fontCb:p,selectionCb:h}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),u(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),p(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)}}(e,t);const n=xe(e,e.doc),i=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const c=H(t=>{const r=Date.now()-o;e(a.map(e=>(e.timeOffset-=r,e)),t),a=[],o=null},s),u=H(e=>{const t=De(e),{clientX:r,clientY:i}=te(e)?e.changedTouches[0]:e;o||(o=Date.now()),a.push({x:r,y:i,id:n.getId(t),timeOffset:Date.now()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?me.Drag:e instanceof MouseEvent?me.MouseMove:me.TouchMove)},i,{trailing:!1}),l=[G("mousemove",u,r),G("touchmove",u,r),G("drag",u,r)];return()=>{l.forEach(e=>e())}}(e),s=function({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const o=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];return Object.keys(fe).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(s=>{const o=s.toLowerCase(),c=(t=>s=>{const o=De(s);if(J(o,n,i,!0))return;const a=te(s)?s.changedTouches[0]:s;if(!a)return;const c=r.getId(o),{clientX:u,clientY:l}=a;e({type:fe[t],id:c,x:u,y:l})})(s);a.push(G(o,c,t))}),()=>{a.forEach(e=>e())}}(e),o=Pe(e),a=function({viewportResizeCb:e}){let t=-1,r=-1;return G("resize",H(()=>{const n=Y(),i=$();t===n&&r===i||(e({width:Number(i),height:Number(n)}),t=n,r=i)},200),window)}(e),c=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,maskInputOptions:o,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function l(e){let r=De(e);const c=e.isTrusted;if(r&&"OPTION"===r.tagName&&(r=r.parentElement),!r||!r.tagName||Fe.indexOf(r.tagName)<0||J(r,n,i,!0))return;const l=r.type;if(r.classList.contains(s))return;let p=r.value,m=!1;"radio"===l||"checkbox"===l?m=r.checked:(o[r.tagName.toLowerCase()]||o[l])&&(p=h({maskInputOptions:o,tagName:r.tagName,type:l,value:p,maskInputFn:a})),d(r,Re({text:p,isChecked:m,userTriggered:c},u));const f=r.name;"radio"===l&&f&&m&&t.querySelectorAll(`input[type="radio"][name="${f}"]`).forEach(e=>{e!==r&&d(e,Re({text:e.value,isChecked:!m,userTriggered:!1},u))})}function d(t,n){const i=Le.get(t);if(!i||i.text!==n.text||i.isChecked!==n.isChecked){Le.set(t,n);const i=r.getId(t);e(Object.assign(Object.assign({},n),{id:i}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>G(e,l,t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...g.map(e=>Z(e[0],e[1],{set(){l({target:this})}},!1,m))),()=>{p.forEach(e=>e())}}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i}){const s=s=>H(i=>{const o=De(i);if(!o||J(o,t,r,!0))return;const{currentTime:a,volume:c,muted:u,playbackRate:l}=o;e({type:s,id:n.getId(o),currentTime:a,volume:c,muted:u,playbackRate:l})},i.media||500),o=[G("play",s(0)),G("pause",s(1)),G("seeked",s(2)),G("volumechange",s(3)),G("ratechange",s(4))];return()=>{o.forEach(e=>e())}}(e),l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(n,s){const{id:o,styleId:a}=Be(this,t,r.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:n,index:s}]}),i.apply(this,[n,s])};const s=n.CSSStyleSheet.prototype.deleteRule;let o,a;n.CSSStyleSheet.prototype.deleteRule=function(n){const{id:i,styleId:o}=Be(this,t,r.styleMirror);return(i&&-1!==i||o&&-1!==o)&&e({id:i,styleId:o,removes:[{index:n}]}),s.apply(this,[n])},n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(n){const{id:i,styleId:s}=Be(this,t,r.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replace:n}),o.apply(this,[n])}),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(n){const{id:i,styleId:s}=Be(this,t,r.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replaceSync:n}),a.apply(this,[n])});const c={};Oe?c.CSSGroupingRule=n.CSSGroupingRule:(Ee&&(c.CSSMediaRule=n.CSSMediaRule),Ne&&(c.CSSConditionRule=n.CSSConditionRule),Me&&(c.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(c).forEach(([n,i])=>{u[n]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=function(i,s){const{id:o,styleId:a}=Be(this.parentStyleSheet,t,r.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:i,index:[...je(this),s||0]}]}),u[n].insertRule.apply(this,[i,s])},i.prototype.deleteRule=function(i){const{id:s,styleId:o}=Be(this.parentStyleSheet,t,r.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,removes:[{index:[...je(this),i]}]}),u[n].deleteRule.apply(this,[i])}}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})}}(e,{win:r}),d=Ue(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(i,o,a){var c;if(r.has(i))return s.apply(this,[i,o,a]);const{id:u,styleId:l}=Be(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,set:{property:i,value:o,priority:a},index:je(this.parentRule)}),s.apply(this,[i,o,a])};const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(i){var s;if(r.has(i))return o.apply(this,[i]);const{id:a,styleId:c}=Be(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:i},index:je(this.parentRule)}),o.apply(this,[i])},()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o}}(e,{win:r}),m=e.collectFonts?function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(e,t,r){const n=new s(e,t,r);return i.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const o=K(t.fonts,"add",function(t){return function(r){return setTimeout(()=>{const t=i.get(r);t&&(e(t),i.delete(r))},0),t.apply(this,[r])}});return n.push(()=>{r.FontFace=s}),n.push(o),()=>{n.forEach(e=>e())}}(e):()=>{},f=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e;let o=!0;const a=()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:o,startOffset:c,endContainer:u,endOffset:l}=s;J(o,n,i,!0)||J(u,n,i,!0)||a.push({start:r.getId(o),startOffset:c,end:r.getId(u),endOffset:l})}s({ranges:a})};return a(),G("selectionchange",a)}(e),g=[];for(const t of e.plugins)g.push(t.observer(t.callback,r,t.options));return()=>{Ae.forEach(e=>e.reset()),n.disconnect(),i(),s(),o(),a(),c(),u(),l(),d(),p(),m(),f(),g.forEach(e=>e())}}class qe{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,r,n){const i=r||this.getIdToRemoteIdMap(e),s=n||this.getRemoteIdToIdMap(e);let o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),s.set(o,t)),o}getIds(e,t){const r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;return n.get(t)||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ge{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new qe(I),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new qe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(r=this.loadListener)||void 0===r||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const r=this.transformCrossOriginEvent(t,e.data.event);r&&this.wrappedEmit(r,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var r;switch(t.type){case he.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:he.IncrementalSnapshot,data:{source:me.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case he.Meta:case he.Load:case he.DomContentLoaded:return!1;case he.Plugin:return t;case he.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case he.IncrementalSnapshot:switch(t.data.source){case me.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case me.Drag:case me.TouchMove:case me.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case me.ViewportResize:return!1;case me.MediaInteraction:case me.MouseInteraction:case me.Scroll:case me.CanvasMutation:case me.Input:return this.replaceIds(t.data,e,["id"]),t;case me.StyleSheetRule:case me.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case me.Font:return t;case me.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case me.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(r=t.data.styles)||void 0===r||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,r,n){for(const i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(r,t[i]):t[i]=e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class We{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(K(Element.prototype,"attachShadow",function(e){return function(r){const n=e.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),n}}))}addShadowRoot(e,t){c(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),xe(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Pe(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Ue({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(K(e.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(n){const i=r.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),i}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}}function ze(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})}for(var He="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ze="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ke=0;Ke<64;Ke++)Ze[He.charCodeAt(Ke)]=Ke;const Ye=new Map,$e=(e,t,r)=>{if(!e||!Xe(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=Ye.get(e);return r||(r=new Map,Ye.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i};function Je(e,t,r){if(e instanceof Array)return e.map(e=>Je(e,t,r));if(null===e)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){const t=e.constructor.name,r=function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;t<n;t+=3)i+=He[r[t]>>2],i+=He[(3&r[t])<<4|r[t+1]>>4],i+=He[(15&r[t+1])<<2|r[t+2]>>6],i+=He[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:r}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Je(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Je(e.data,t,r),e.width,e.height]}:Xe(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:$e(e,t,r)}:e}const Qe=(e,t,r)=>[...e].map(e=>Je(e,t,r)),Xe=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function et(e,t,r){const n=[];try{const i=K(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...i){return J(this,t,r,!0)||"__context"in this||(this.__context=n),e.apply(this,[n,...i])}});n.push(i)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function tt(e,t,r,n,i,s,o){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=K(e,s,function(e){return function(...a){const c=e.apply(this,a);if($e(c,o,this),!J(this.canvas,n,i,!0)){const e=Qe([...a],o,this),n={type:t,property:s,args:e};r(this.canvas,n)}return c}});a.push(c)}catch(n){const i=Z(e,s,{set(e){r(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(i)}return a}var rt=null;try{var nt="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");rt=nt.Worker}catch(pn){}var it,st,ot=(it="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",st=!1,"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?function(e,t,r){var n=void 0===t?null:t,i=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==r&&r),s=i.indexOf("\n",10)+1,o=i.substring(s)+(n?"//# sourceMappingURL="+n:"");return function(e){return new rt(o,Object.assign({},e,{eval:!0}))}}(it,null,st):function(e){var t;return function(r){return t=t||function(e,t,r){var n=void 0===t?null:t,i=function(e,t){var r=atob(e);if(t){for(var n=new Uint8Array(r.length),i=0,s=r.length;i<s;++i)n[i]=r.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return r}(e,void 0!==r&&r),s=i.indexOf("\n",10)+1,o=i.substring(s)+(n?"//# sourceMappingURL="+n:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}(e,null,false),new Worker(t,r)}}(it));class at{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:s,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,n,i),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,i){const s=et(t,r,n),o=new Map,a=new ot;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:r,type:n,width:i,height:s}=e.data;this.mutationCb({id:t,type:ge["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}]})};const c=1e3/e;let u,l=0;const d=e=>{l&&e-l<c||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{J(t,r,n,!0)||e.push(t)}),e})().forEach(e=>ze(this,void 0,void 0,function*(){var t;const r=this.mirror.getId(e);if(o.get(r))return;if(o.set(r,!0),["webgl","webgl2"].includes(e.__context)){const r=e.getContext(e.__context);!1===(null===(t=null==r?void 0:r.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==r||r.clear(r.COLOR_BUFFER_BIT))}const n=yield createImageBitmap(e);a.postMessage({id:r,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])}))),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=et(e,t,r),i=function(e,t,r,n){const i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const s=K(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...s){return J(this.canvas,r,n,!0)||setTimeout(()=>{const r=Qe([...s],t,this);e(this.canvas,{type:ge["2D"],property:o,args:r})},0),i.apply(this,s)}});i.push(s)}catch(r){const n=Z(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:ge["2D"],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r),s=function(e,t,r,n){const i=[];return i.push(...tt(t.WebGLRenderingContext.prototype,ge.WebGL,e,r,n,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...tt(t.WebGL2RenderingContext.prototype,ge.WebGL2,e,r,n,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,this.mirror);this.resetObservers=()=>{n(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||-1===t)return;const n=r.map(e=>{const t=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["type"]);return t}),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}class ct{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new pe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const r={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const r=Array.from(t.rules||CSSRule);n.push({styleId:e,rules:r.map((e,t)=>({rule:l(e),index:t}))})}r.styleIds.push(e)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function ut(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let lt,dt,pt,ht=!1;const mt=p();function ft(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:l,maskInputOptions:p,slimDOMOptions:h,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:v={},dataURLOptions:I={},mousemoveWait:b,recordCanvas:S=!1,recordCrossOriginIframes:w=!1,userTriggeredOnInput:C=!1,collectFonts:k=!1,inlineImages:T=!1,plugins:_,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:O=new Set([])}=e,E=!w||window.parent===window;let M=!1;if(!E)try{window.parent.document,M=!1}catch(e){M=!0}if(E&&!t)throw new Error("emit function is required");void 0!==b&&void 0===v.mousemove&&(v.mousemove=b),mt.reset();const N=!0===l?{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}:void 0!==p?p:{password:!0},x=!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===h,headMetaDescKeywords:"all"===h}:h||{};let P;re();let R=0;const F=e=>{for(const t of _||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&(e=y(e)),e};lt=(e,i)=>{var s;if(!(null===(s=Ae[0])||void 0===s?void 0:s.isFrozen())||e.type===he.FullSnapshot||e.type===he.IncrementalSnapshot&&e.data.source===me.Mutation||Ae.forEach(e=>e.unfreeze()),E)null==t||t(F(e),i);else if(M){const t={type:"rrweb",event:F(e),isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===he.FullSnapshot)P=e,R=0;else if(e.type===he.IncrementalSnapshot){if(e.data.source===me.Mutation&&e.data.isAttachIframe)return;R++;const t=n&&R>=n,i=r&&e.timestamp-P.timestamp>r;(t||i)&&dt(!0)}};const L=e=>{lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Mutation},e)}))},j=e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Scroll},e)})),B=e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.CanvasMutation},e)})),U=new ct({mutationCb:L,adoptedStyleSheetCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.AdoptedStyleSheet},e)}))}),V=new Ge({mirror:mt,mutationCb:L,stylesheetManager:U,recordCrossOriginIframes:w,wrappedEmit:lt});for(const e of _||[])e.getMirror&&e.getMirror({nodeMirror:mt,crossOriginIframeMirror:V.crossOriginIframeMirror,crossOriginIframeStyleMirror:V.crossOriginIframeStyleMirror});pt=new at({recordCanvas:S,mutationCb:B,win:window,blockClass:i,blockSelector:s,mirror:mt,sampling:v.canvas,dataURLOptions:I});const q=new We({mutationCb:L,scrollCb:j,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:N,dataURLOptions:I,maskTextFn:f,maskInputFn:m,recordCanvas:S,inlineImages:T,sampling:v,slimDOMOptions:x,iframeManager:V,stylesheetManager:U,canvasManager:pt,keepIframeSrcFn:A},mirror:mt});dt=(e=!1)=>{var t,r,n,o,l,p;lt(ut({type:he.Meta,data:{href:window.location.href,width:$(),height:Y()}}),e),U.reset(),Ae.forEach(e=>e.lock());const h=function(e,t){var r=t||{},n=r.mirror,i=void 0===n?new d:n,s=r.blockClass,o=r.blockSelector,a=r.maskTextClass,c=r.maskTextSelector,u=r.inlineStylesheet,l=r.inlineImages,p=r.recordCanvas,h=r.maskAllInputs,m=void 0!==h&&h,f=r.slimDOM,g=void 0!==f&&f,y=r.keepIframeSrcFn;return D(e,{doc:e,mirror:i,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===o?null:o,maskTextClass:void 0===a?"rr-mask":a,maskTextSelector:void 0===c?null:c,skipChild:!1,inlineStylesheet:void 0===u||u,maskInputOptions:!0===m?{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}:!1===m?{password:!0}:m,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===g,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===g?{}:g,dataURLOptions:r.dataURLOptions,inlineImages:void 0!==l&&l,recordCanvas:void 0!==p&&p,preserveWhiteSpace:r.preserveWhiteSpace,onSerialize:r.onSerialize,onIframeLoad:r.onIframeLoad,iframeLoadTimeout:r.iframeLoadTimeout,onStylesheetLoad:r.onStylesheetLoad,stylesheetLoadTimeout:r.stylesheetLoadTimeout,keepIframeSrcFn:void 0===y?function(){return!1}:y,newlyAddedElement:!1})}(document,{mirror:mt,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:N,maskTextFn:f,slimDOM:x,dataURLOptions:I,recordCanvas:S,inlineImages:T,onSerialize:e=>{se(e,mt)&&V.addIframe(e),oe(e,mt)&&U.trackLinkElement(e),ce(e)&&q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{V.attachIframe(e,t),q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{U.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!h)return console.warn("Failed to snapshot the document");lt(ut({type:he.FullSnapshot,data:{node:h,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(r=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===r?void 0:r.scrollLeft)||(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(l=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===l?void 0:l.scrollTop)||(null===(p=null===document||void 0===document?void 0:document.body)||void 0===p?void 0:p.scrollTop)||0}}})),Ae.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&U.adoptStyleSheets(document.adoptedStyleSheets,mt.getId(document))};try{const e=[];e.push(G("DOMContentLoaded",()=>{lt(ut({type:he.DomContentLoaded,data:{}}))}));const t=e=>{var t;return Ve({mutationCb:L,mousemoveCb:(e,t)=>lt(ut({type:he.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.MouseInteraction},e)})),scrollCb:j,viewportResizeCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.ViewportResize},e)})),inputCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Input},e)})),mediaInteractionCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.MediaInteraction},e)})),styleSheetRuleCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.StyleSheetRule},e)})),styleDeclarationCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.StyleDeclaration},e)})),canvasMutationCb:B,fontCb:e=>lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Font},e)})),selectionCb:e=>{lt(ut({type:he.IncrementalSnapshot,data:Object.assign({source:me.Selection},e)}))},blockClass:i,ignoreClass:o,maskTextClass:a,maskTextSelector:c,maskInputOptions:N,inlineStylesheet:u,sampling:v,recordCanvas:S,inlineImages:T,userTriggeredOnInput:C,collectFonts:k,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:s,slimDOMOptions:x,dataURLOptions:I,mirror:mt,iframeManager:V,stylesheetManager:U,shadowDomManager:q,canvasManager:pt,ignoreCSSAttributes:O,plugins:(null===(t=null==_?void 0:_.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>lt(ut({type:he.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},g)};V.addLoadListener(r=>{e.push(t(r.contentDocument))});const r=()=>{dt(),e.push(t(document)),ht=!0};return"interactive"===document.readyState||"complete"===document.readyState?r():e.push(G("load",()=>{lt(ut({type:he.Load,data:{}})),r()},window)),()=>{e.forEach(e=>e()),ht=!1}}catch(e){console.warn(e)}}ft.addCustomEvent=(e,t)=>{if(!ht)throw new Error("please add custom event after start recording");lt(ut({type:he.Custom,data:{tag:e,payload:t}}))},ft.freezePage=()=>{Ae.forEach(e=>e.freeze())},ft.takeFullSnapshot=e=>{if(!ht)throw new Error("please take full snapshot after start recording");dt(e)},ft.mirror=mt;const{addCustomEvent:gt}=ft,{freezePage:yt}=ft;var vt=Uint8Array,It=Uint16Array,bt=Uint32Array,St=new vt([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]),wt=new vt([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]),Ct=new vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kt=function(e,t){for(var r=new It(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new bt(r[30]);for(n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return[r,i]},Tt=kt(St,2),_t=Tt[0],At=Tt[1];_t[28]=258,At[258]=28;for(var Ot=kt(wt,0),Et=Ot[0],Mt=Ot[1],Nt=new It(32768),Dt=0;Dt<32768;++Dt){var xt=(43690&Dt)>>>1|(21845&Dt)<<1;xt=(61680&(xt=(52428&xt)>>>2|(13107&xt)<<2))>>>4|(3855&xt)<<4,Nt[Dt]=((65280&xt)>>>8|(255&xt)<<8)>>>1}var Pt=function(e,t,r){for(var n=e.length,i=0,s=new It(t);i<n;++i)++s[e[i]-1];var o,a=new It(t);for(i=0;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;if(r){o=new It(1<<t);var c=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,p=d|(1<<l)-1;d<=p;++d)o[Nt[d]>>>c]=u}else for(o=new It(n),i=0;i<n;++i)o[i]=Nt[a[e[i]-1]++]>>>15-e[i];return o},Rt=new vt(288);for(Dt=0;Dt<144;++Dt)Rt[Dt]=8;for(Dt=144;Dt<256;++Dt)Rt[Dt]=9;for(Dt=256;Dt<280;++Dt)Rt[Dt]=7;for(Dt=280;Dt<288;++Dt)Rt[Dt]=8;var Ft=new vt(32);for(Dt=0;Dt<32;++Dt)Ft[Dt]=5;var Lt=Pt(Rt,9,0),jt=Pt(Rt,9,1),Bt=Pt(Ft,5,0),Ut=Pt(Ft,5,1),Vt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},qt=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>>(7&t)&r},Gt=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>>(7&t)},Wt=function(e){return(e/8|0)+(7&e&&1)},zt=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof It?It:e instanceof bt?bt:vt)(r-t);return n.set(e.subarray(t,r)),n},Ht=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8},Zt=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},Kt=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,s=r.slice();if(!i)return[new vt(0),0];if(1==i){var o=new vt(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],u=0,l=1,d=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=r[r[u].f<r[d].f?u++:d++],c=r[u!=l&&r[u].f<r[d].f?u++:d++],r[l++]={s:-1,f:a.f+c.f,l:a,r:c};var p=s[0].s;for(n=1;n<i;++n)s[n].s>p&&(p=s[n].s);var h=new It(p+1),m=Yt(r[l-1],h,0);if(m>t){n=0;var f=0,g=m-t,y=1<<g;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});n<i;++n){var v=s[n].s;if(!(h[v]>t))break;f+=y-(1<<m-h[v]),h[v]=t}for(f>>>=g;f>0;){var I=s[n].s;h[I]<t?f-=1<<t-h[I]++-1:++n}for(;n>=0&&f;--n){var b=s[n].s;h[b]==t&&(--h[b],++f)}m=t}return[new vt(h),m]},Yt=function(e,t,r){return-1==e.s?Math.max(Yt(e.l,t,r+1),Yt(e.r,t,r+1)):t[e.s]=r},$t=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new It(++t),n=0,i=e[0],s=1,o=function(e){r[n++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=e[a]}return[r.subarray(0,n),t]},Jt=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Qt=function(e,t,r){var n=r.length,i=Wt(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;s<n;++s)e[i+s+4]=r[s];return 8*(i+4+n)},Xt=function(e,t,r,n,i,s,o,a,c,u,l){Ht(t,l++,r),++i[256];for(var d=Kt(i,15),p=d[0],h=d[1],m=Kt(s,15),f=m[0],g=m[1],y=$t(p),v=y[0],I=y[1],b=$t(f),S=b[0],w=b[1],C=new It(19),k=0;k<v.length;++k)C[31&v[k]]++;for(k=0;k<S.length;++k)C[31&S[k]]++;for(var T=Kt(C,7),_=T[0],A=T[1],O=19;O>4&&!_[Ct[O-1]];--O);var E,M,N,D,x=u+5<<3,P=Jt(i,Rt)+Jt(s,Ft)+o,R=Jt(i,p)+Jt(s,f)+o+14+3*O+Jt(C,_)+(2*C[16]+3*C[17]+7*C[18]);if(x<=P&&x<=R)return Qt(t,l,e.subarray(c,c+u));if(Ht(t,l,1+(R<P)),l+=2,R<P){E=Pt(p,h,0),M=p,N=Pt(f,g,0),D=f;var F=Pt(_,A,0);for(Ht(t,l,I-257),Ht(t,l+5,w-1),Ht(t,l+10,O-4),l+=14,k=0;k<O;++k)Ht(t,l+3*k,_[Ct[k]]);l+=3*O;for(var L=[v,S],j=0;j<2;++j){var B=L[j];for(k=0;k<B.length;++k){var U=31&B[k];Ht(t,l,F[U]),l+=_[U],U>15&&(Ht(t,l,B[k]>>>5&127),l+=B[k]>>>12)}}}else E=Lt,M=Rt,N=Bt,D=Ft;for(k=0;k<a;++k)if(n[k]>255){U=n[k]>>>18&31,Zt(t,l,E[U+257]),l+=M[U+257],U>7&&(Ht(t,l,n[k]>>>23&31),l+=St[U]);var V=31&n[k];Zt(t,l,N[V]),l+=D[V],V>3&&(Zt(t,l,n[k]>>>5&8191),l+=wt[V])}else Zt(t,l,E[n[k]]),l+=M[n[k]];return Zt(t,l,E[256]),l+M[256]},er=new bt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tr=new vt(0);function rr(e,t){void 0===t&&(t={});var r=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,s=r.length,o=0;o!=s;){for(var a=Math.min(o+5552,s);o<a;++o)i+=n+=r[o];n%=65521,i%=65521}e=n,t=i},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();r.p(e);var n,i,s,o,a,c=(s=2,o=4,function(e,t,r,n,i,s){var o=e.length,a=new vt(n+o+5*(1+Math.floor(o/7e3))+i),c=a.subarray(n,a.length-i),u=0;if(!t||o<8)for(var l=0;l<=o;l+=65535){var d=l+65535;d<o?u=Qt(c,u,e.subarray(l,d)):(c[l]=s,u=Qt(c,u,e.subarray(l,o)))}else{for(var p=er[t-1],h=p>>>13,m=8191&p,f=(1<<r)-1,g=new It(32768),y=new It(f+1),v=Math.ceil(r/3),I=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<I)&f},S=new bt(25e3),w=new It(288),C=new It(32),k=0,T=0,_=(l=0,0),A=0,O=0;l<o;++l){var E=b(l),M=32767&l,N=y[E];if(g[M]=N,y[E]=M,A<=l){var D=o-l;if((k>7e3||_>24576)&&D>423){u=Xt(e,c,0,S,w,C,T,_,O,l-O,u),_=k=T=0,O=l;for(var x=0;x<286;++x)w[x]=0;for(x=0;x<30;++x)C[x]=0}var P=2,R=0,F=m,L=M-N&32767;if(D>2&&E==b(l-L))for(var j=Math.min(h,D)-1,B=Math.min(32767,l),U=Math.min(258,D);L<=B&&--F&&M!=N;){if(e[l+P]==e[l+P-L]){for(var V=0;V<U&&e[l+V]==e[l+V-L];++V);if(V>P){if(P=V,R=L,V>j)break;var q=Math.min(L,V-2),G=0;for(x=0;x<q;++x){var W=l-L+x+32768&32767,z=W-g[W]+32768&32767;z>G&&(G=z,N=W)}}}L+=(M=N)-(N=g[M])+32768&32767}if(R){S[_++]=268435456|At[P]<<18|Mt[R];var H=31&At[P],Z=31&Mt[R];T+=St[H]+wt[Z],++w[257+H],++C[Z],A=l+P,++k}else S[_++]=e[l],++w[e[l]]}}u=Xt(e,c,s,S,w,C,T,_,O,l-O,u),s||(u=Qt(c,u,tr))}return zt(a,0,n+Wt(u)+i)}(n=e,null==(i=t).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+i.mem,s,o,!a));return function(e,t){var r=t.level,n=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)}(c,t),function(e,t,r){for(;r;++t)e[t]=r,r>>>=8}(c,c.length-4,r.d()),c}function nr(e,t){var r=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new vt(e.length+(e.length>>>1)),i=0,s=function(e){n[i++]=e},o=0;o<r;++o){if(i+5>n.length){var a=new vt(i+8+(r-o<<1));a.set(n),n=a}var c=e.charCodeAt(o);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return zt(n,0,i)}function ir(e,t){var r="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((31&i)<<6|63&e[n++]):i<240?r+=String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}return r}const sr="v1",or=e=>{const t=Object.assign(Object.assign({},e),{v:sr});return ir(rr(nr(JSON.stringify(t))),!0)},ar=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const n=JSON.parse(ir(function(e,t,r){var n=e.length,i=!t||r,s=!r||r.i;r||(r={}),t||(t=new vt(3*n));var o=function(e){var r=t.length;if(e>r){var n=new vt(Math.max(2*r,e));n.set(t),t=n}},a=r.f||0,c=r.p||0,u=r.b||0,l=r.l,d=r.d,p=r.m,h=r.n,m=8*n;do{if(!l){r.f=a=qt(e,c,1);var f=qt(e,c+1,3);if(c+=3,!f){var g=e[(A=Wt(c)+4)-4]|e[A-3]<<8,y=A+g;if(y>n){if(s)throw"unexpected EOF";break}i&&o(u+g),t.set(e.subarray(A,y),u),r.b=u+=g,r.p=c=8*y;continue}if(1==f)l=jt,d=Ut,p=9,h=5;else{if(2!=f)throw"invalid block type";var v=qt(e,c,31)+257,I=qt(e,c+10,15)+4,b=v+qt(e,c+5,31)+1;c+=14;for(var S=new vt(b),w=new vt(19),C=0;C<I;++C)w[Ct[C]]=qt(e,c+3*C,7);c+=3*I;var k=Vt(w),T=(1<<k)-1;if(!s&&c+b*(k+7)>m)break;var _=Pt(w,k,1);for(C=0;C<b;){var A,O=_[qt(e,c,T)];if(c+=15&O,(A=O>>>4)<16)S[C++]=A;else{var E=0,M=0;for(16==A?(M=3+qt(e,c,3),c+=2,E=S[C-1]):17==A?(M=3+qt(e,c,7),c+=3):18==A&&(M=11+qt(e,c,127),c+=7);M--;)S[C++]=E}}var N=S.subarray(0,v),D=S.subarray(v);p=Vt(N),h=Vt(D),l=Pt(N,p,1),d=Pt(D,h,1)}if(c>m)throw"unexpected EOF"}i&&o(u+131072);for(var x=(1<<p)-1,P=(1<<h)-1,R=p+h+18;s||c+R<m;){var F=(E=l[Gt(e,c)&x])>>>4;if((c+=15&E)>m)throw"unexpected EOF";if(!E)throw"invalid length/literal";if(F<256)t[u++]=F;else{if(256==F){l=null;break}var L=F-254;if(F>264){var j=St[C=F-257];L=qt(e,c,(1<<j)-1)+_t[C],c+=j}var B=d[Gt(e,c)&P],U=B>>>4;if(!B)throw"invalid distance";if(c+=15&B,D=Et[U],U>3&&(j=wt[U],D+=Gt(e,c)&(1<<j)-1,c+=j),c>m)throw"unexpected EOF";i&&o(u+131072);for(var V=u+L;u<V;u+=4)t[u]=t[u-D],t[u+1]=t[u+1-D],t[u+2]=t[u+2-D],t[u+3]=t[u+3-D];u=V}}r.l=l,r.p=c,r.b=u,l&&(a=1,r.m=p,r.d=d,r.n=h)}while(!a);return u==t.length?t:zt(t,0,u)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(t=nr(e,!0)),t.subarray(2,-4)),r)));if(n.v===sr)return n;throw new Error(`These events were packed with packer ${n.v} which is incompatible with current packer ${sr}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}var t,r};class cr{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const ur=/(^|@)\S+:\d+/,lr=/^\s*at .*(\S+:\d+|\(native\))/m,dr=/^(eval@)?(\[native code])?$/,pr={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(lr))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(lr)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const r=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=r?t.replace(r[0],""):t;const n=t.split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),s=n.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new cr({functionName:s,fileName:o,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(dr)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new cr({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new cr({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[];for(let e=2,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new cr({fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[];for(let e=0,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new cr({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(ur)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new cr({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function hr(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let r=e.localName;if(!r)break;r=r.toLowerCase();const n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(let e=0;e<n.children.length;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===r&&i.push(t)}i.length>1&&(r+=`:eq(${i.indexOf(e)})`),t=r+(t?">"+t:""),e=n}return t}function mr(e){return"[object Object]"===Object.prototype.toString.call(e)}function fr(e,t){if(0===t)return!0;const r=Object.keys(e);for(const n of r)if(mr(e[n])&&fr(e[n],t-1))return!0;return!1}function gr(e,t){const r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);const n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){const r=n.indexOf(this);~r?n.splice(r+1):n.push(this),~r?i.splice(r,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(mr(s=t)&&Object.keys(s).length>r.numOfKeysLimit||"function"==typeof s||mr(s)&&fr(s,r.depthOfLimit))return function(e){let t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=`${t.slice(0,r.stringLengthLimit)}...`),t}(t);var s;if(t instanceof Event){const e={};for(const r in t){const n=t[r];Array.isArray(n)?e[r]=hr(n.length?n[0]:null):e[r]=n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}const yr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function vr(e,t,r){const n=r?Object.assign({},yr,r):yr,i=n.logger;if(!i)return()=>{};let s;s="string"==typeof i?t[i]:i;let o=0;const a=[];if(n.level.includes("error")&&window){const t=t=>{const r=t.message,i=t.error,s=pr.parse(i).map(e=>e.toString()),o=[gr(r,n.stringifyOptions)];e({level:"error",trace:s,payload:o})};window.addEventListener("error",t),a.push(()=>{window&&window.removeEventListener("error",t)})}for(const e of n.level)a.push(c(s,e));return()=>{a.forEach(e=>e())};function c(t,r){return t[r]?K(t,r,t=>(...i)=>{t.apply(this,i);try{const t=pr.parse(new Error).map(e=>e.toString()).splice(1),s=i.map(e=>gr(e,n.stringifyOptions));o++,o<n.lengthThreshold?e({level:r,trace:t,payload:s}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[gr("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}}):()=>{}}}const Ir="rrweb/console@1",br=e=>({name:Ir,observer:vr,options:e}),Sr="__rrweb_original__",wr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class Cr{constructor(e){this.config=Object.assign(wr,e)}getConsoleLogger(){const e={};for(const t of this.config.level)e[t]="trace"===t?e=>{(console.log[Sr]?console.log[Sr]:console.log)(...e.payload.map(e=>JSON.parse(e)),this.formatMessage(e))}:e=>{(console[t][Sr]?console[t][Sr]:console[t])(...e.payload.map(e=>JSON.parse(e)),this.formatMessage(e))};return e}formatMessage(e){if(0===e.trace.length)return"";const t="\n\tat ";let r=t;return r+=e.trace.join(t),r}}const kr=e=>{const t=(null==e?void 0:e.replayLogger)||new Cr(e).getConsoleLogger();return{handler(e,r,n){let i=null;if(e.type===he.IncrementalSnapshot&&e.data.source===me.Log?i=e.data:e.type===he.Plugin&&e.data.plugin===Ir&&(i=e.data.payload),i)try{"function"==typeof t[i.level]&&t[i.level](i)}catch(e){n.replayer.config.showWarning&&console.warn(e)}}}};var Tr;!function(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"}(Tr||(Tr={}));var _r=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Ar(e){const t=[];for(const r in e){const n=e[r];if("string"!=typeof n)continue;const i=Dr(r);t.push(`${i}: ${n};`)}return t.join(" ")}const Or=/-([a-z])/g,Er=/^--[a-zA-Z0-9-]+$/,Mr=e=>Er.test(e)?e:e.replace(Or,(e,t)=>t?t.toUpperCase():""),Nr=/\B([A-Z])/g,Dr=e=>e.replace(Nr,"-$1").toLowerCase();class xr{constructor(...e){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=Ur.ELEMENT_NODE,this.TEXT_NODE=Ur.TEXT_NODE}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){const e=this.parentNode;if(!e)return null;const t=e.childNodes,r=t.indexOf(this);return t[r+1]||null}contains(e){if(e===this)return!0;for(const t of this.childNodes)if(t.contains(e))return!0;return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Pr(e){return class extends e{constructor(e,t,r){super(),this.nodeType=Ur.DOCUMENT_TYPE_NODE,this.RRNodeType=Tr.DocumentType,this.textContent=null,this.name=e,this.publicId=t,this.systemId=r,this.nodeName=e}toString(){return"RRDocumentType"}}}function Rr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.ELEMENT_NODE,this.RRNodeType=Tr.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.childNodes=[this.ownerDocument.createTextNode(e)]}get classList(){return new Br(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},r=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach(function(e){if(e){const n=e.split(r);n.length>1&&(t[Mr(n[0].trim())]=n[1].trim())}}),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(r,n,i)=>{if(t.test(r))return;const s=Mr(r);n?e[s]=n:delete e[s],"important"===i&&(e[s]+=" !important"),this.attributes.style=Ar(e)},e.removeProperty=r=>{if(t.test(r))return"";const n=Mr(r),i=e[n]||"";return delete e[n],this.attributes.style=Ar(e),i},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,r){this.setAttribute(t,r)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return this.childNodes.push(e),e.parentNode=this,e.parentElement=this,e}insertBefore(e,t){if(null===t)return this.appendChild(e);const r=this.childNodes.indexOf(t);if(-1==r)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(r,0,e),e.parentElement=this,e.parentNode=this,e}removeChild(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(t,1),e.parentElement=null,e.parentNode=null,e}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function Fr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.TEXT_NODE,this.nodeName="#text",this.RRNodeType=Tr.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Lr(e){return class extends e{constructor(e){super(),this.nodeType=Ur.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=Tr.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function jr(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=Ur.CDATA_SECTION_NODE,this.RRNodeType=Tr.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class Br{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter(t=>-1===e.indexOf(t)),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}var Ur;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ur||(Ur={}));const Vr={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},qr={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Gr(e,t,r,n){const i=e.childNodes,s=t.childNodes;n=n||t.mirror||t.ownerDocument.mirror,(i.length>0||s.length>0)&&Wr(Array.from(i),s,e,r,n);let o=null,a=null;switch(t.RRNodeType){case Tr.Document:a=t.scrollData;break;case Tr.Element:{const i=e,s=t;switch(function(e,t,r){const n=e.attributes,i=t.attributes;for(const n in i){const s=i[n],o=r.getMeta(t);if(o&&"isSVG"in o&&o.isSVG&&Vr[n])e.setAttributeNS(Vr[n],n,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===n){const t=document.createElement("img");t.src=s,t.onload=()=>{const r=e.getContext("2d");r&&r.drawImage(t,0,0,t.width,t.height)}}else e.setAttribute(n,s)}for(const{name:t}of Array.from(n))t in i||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(i,s,n),a=s.scrollData,o=s.inputData,s.tagName){case"AUDIO":case"VIDEO":{const t=e,r=s;void 0!==r.paused&&(r.paused?t.pause():t.play()),void 0!==r.muted&&(t.muted=r.muted),void 0!==r.volume&&(t.volume=r.volume),void 0!==r.currentTime&&(t.currentTime=r.currentTime),void 0!==r.playbackRate&&(t.playbackRate=r.playbackRate);break}case"CANVAS":{const n=t;if(null!==n.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=i.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=n.rr_dataURL}n.canvasMutations.forEach(t=>r.applyCanvas(t.event,t.mutation,e))}break;case"STYLE":{const e=i.sheet;e&&t.rules.forEach(t=>r.applyStyleSheetMutation(t,e))}}if(s.shadowRoot){i.shadowRoot||i.attachShadow({mode:"open"});const e=i.shadowRoot.childNodes,t=s.shadowRoot.childNodes;(e.length>0||t.length>0)&&Wr(Array.from(e),t,i.shadowRoot,r,n)}break}case Tr.Text:case Tr.Comment:case Tr.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}if(a&&r.applyScroll(a,!0),o&&r.applyInput(o),"IFRAME"===t.nodeName){const i=e.contentDocument,s=t;if(i){const e=n.getMeta(s.contentDocument);e&&r.mirror.add(i,Object.assign({},e)),Gr(i,s.contentDocument,r,n)}}}function Wr(e,t,r,n,i){var s;let o,a,c=0,u=e.length-1,l=0,d=t.length-1,p=e[c],h=e[u],m=t[l],f=t[d];for(;c<=u&&l<=d;){const g=n.mirror.getId(p),y=n.mirror.getId(h),v=i.getId(m),I=i.getId(f);if(void 0===p)p=e[++c];else if(void 0===h)h=e[--u];else if(-1!==g&&g===v)Gr(p,m,n,i),p=e[++c],m=t[++l];else if(-1!==y&&y===I)Gr(h,f,n,i),h=e[--u],f=t[--d];else if(-1!==g&&g===I)r.insertBefore(p,h.nextSibling),Gr(p,f,n,i),p=e[++c],f=t[--d];else if(-1!==y&&y===v)r.insertBefore(h,p),Gr(h,m,n,i),h=e[--u],m=t[++l];else{if(!o){o={};for(let t=c;t<=u;t++){const r=e[t];r&&n.mirror.hasNode(r)&&(o[n.mirror.getId(r)]=t)}}if(a=o[i.getId(m)],a){const t=e[a];r.insertBefore(t,p),Gr(t,m,n,i),e[a]=void 0}else{const t=zr(m,n.mirror,i);"#document"===r.nodeName&&(null===(s=n.mirror.getMeta(t))||void 0===s?void 0:s.type)===Tr.Element&&r.documentElement&&(r.removeChild(r.documentElement),e[c]=void 0,p=void 0),r.insertBefore(t,p||null),Gr(t,m,n,i)}m=t[++l]}}if(c>u){const e=t[d+1];let s=null;for(e&&r.childNodes.forEach(t=>{n.mirror.getId(t)===i.getId(e)&&(s=t)});l<=d;++l){const e=zr(t[l],n.mirror,i);r.insertBefore(e,s),Gr(e,t[l],n,i)}}else if(l>d)for(;c<=u;c++){const t=e[c];t&&(r.removeChild(t),n.mirror.removeNodeFromMap(t))}}function zr(e,t,r){const n=r.getId(e),i=r.getMeta(e);let s=null;if(n>-1&&(s=t.getNode(n)),null!==s)return s;switch(e.RRNodeType){case Tr.Document:s=new Document;break;case Tr.DocumentType:s=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Tr.Element:{let t=e.tagName.toLowerCase();t=qr[t]||t,s=i&&"isSVG"in i&&(null==i?void 0:i.isSVG)?document.createElementNS(Vr.svg,t):document.createElement(e.tagName);break}case Tr.Text:s=document.createTextNode(e.data);break;case Tr.Comment:s=document.createComment(e.data);break;case Tr.CDATA:s=document.createCDATASection(e.data)}return i&&t.add(s,Object.assign({},i)),s}class Hr extends(function(e){return class t extends e{constructor(){super(...arguments),this.nodeType=Ur.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=Tr.Document,this.textContent=null}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===Tr.Element&&"HTML"===e.tagName)||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find(e=>e.RRNodeType===Tr.Element&&"BODY"===e.tagName))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find(e=>e.RRNodeType===Tr.Element&&"HEAD"===e.tagName))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===Tr.Element||t===Tr.DocumentType)&&this.childNodes.some(e=>e.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===Tr.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return e.parentElement=null,e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){const r=e.RRNodeType;if((r===Tr.Element||r===Tr.DocumentType)&&this.childNodes.some(e=>e.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===Tr.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(null===t)return this.appendChild(e);const n=this.childNodes.indexOf(t);if(-1==n)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(n,0,e),e.parentElement=null,e.parentNode=this,e}removeChild(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(t,1),e.parentElement=null,e.parentNode=null,e}open(){this.childNodes=[]}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,r,n){return new t}createDocumentType(e,t,r){const n=new(Pr(xr))(e,t,r);return n.ownerDocument=this,n}createElement(e){const t=new(Rr(xr))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(Fr(xr))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Lr(xr))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(jr(xr))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(xr)){constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new nn,this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,r){return new Hr}createDocumentType(e,t,r){const n=new Zr(e,t,r);return n.ownerDocument=this,n}createElement(e){const t=e.toUpperCase();let r;switch(t){case"AUDIO":case"VIDEO":r=new Yr(t);break;case"IFRAME":r=new Qr(t,this.mirror);break;case"CANVAS":r=new $r(t);break;case"STYLE":r=new Jr(t);break;default:r=new Kr(t)}return r.ownerDocument=this,r}createComment(e){const t=new en(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new tn(e);return t.ownerDocument=this,t}createTextNode(e){const t=new Xr(e);return t.ownerDocument=this,t}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Zr=Pr(xr);class Kr extends(Rr(xr)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class Yr extends(function(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}(Kr)){}class $r extends Kr{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class Jr extends Kr{constructor(){super(...arguments),this.rules=[]}}class Qr extends Kr{constructor(e,t){super(e),this.contentDocument=new Hr,this.contentDocument.mirror=t}}const Xr=Fr(xr),en=Lr(xr),tn=jr(xr);function rn(e,t,r,n){let i;switch(e.nodeType){case Ur.DOCUMENT_NODE:n&&"IFRAME"===n.nodeName?i=n.contentDocument:(i=t,i.compatMode=e.compatMode);break;case Ur.DOCUMENT_TYPE_NODE:{const r=e;i=t.createDocumentType(r.name,r.publicId,r.systemId);break}case Ur.ELEMENT_NODE:{const r=e,n=(s=r)instanceof HTMLFormElement?"FORM":s.tagName.toUpperCase();i=t.createElement(n);const o=i;for(const{name:e,value:t}of Array.from(r.attributes))o.attributes[e]=t;r.scrollLeft&&(o.scrollLeft=r.scrollLeft),r.scrollTop&&(o.scrollTop=r.scrollTop);break}case Ur.TEXT_NODE:i=t.createTextNode(e.textContent||"");break;case Ur.CDATA_SECTION_NODE:i=t.createCDATASection(e.data);break;case Ur.COMMENT_NODE:i=t.createComment(e.textContent||"");break;case Ur.DOCUMENT_FRAGMENT_NODE:i=n.attachShadow({mode:"open"});break;default:return null}var s;let o=r.getMeta(e);return t instanceof Hr&&(o||(o=sn(i,t.unserializedId),r.add(e,o)),t.mirror.add(i,Object.assign({},o))),i}class nn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function sn(e,t){switch(e.RRNodeType){case Tr.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case Tr.DocumentType:{const r=e;return{id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId}}case Tr.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case Tr.Text:case Tr.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case Tr.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function on(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map(function(e){e(r)}),(n=e.get("*"))&&n.slice().map(function(e){e(t,r)})}}}function an(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const r=e.HTMLElement||e.Element,n={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||a,scrollIntoView:r.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,s=(o=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(o)?1:0);var o;function a(e,t){this.scrollLeft=e,this.scrollTop=t}function c(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(e,t){return"Y"===t?e.clientHeight+s<e.scrollHeight:"X"===t?e.clientWidth+s<e.scrollWidth:void 0}function l(t,r){const n=e.getComputedStyle(t,null)["overflow"+r];return"auto"===n||"scroll"===n}function d(e){const t=u(e,"Y")&&l(e,"Y"),r=u(e,"X")&&l(e,"X");return t||r}function p(t){let r,n,s,o=(i()-t.startTime)/468;var a;o=o>1?1:o,a=o,r=.5*(1-Math.cos(Math.PI*a)),n=t.startX+(t.x-t.startX)*r,s=t.startY+(t.y-t.startY)*r,t.method.call(t.scrollable,n,s),n===t.x&&s===t.y||e.requestAnimationFrame(p.bind(e,t))}function h(r,s,o){let c,u,l,d;const h=i();r===t.body?(c=e,u=e.scrollX||e.pageXOffset,l=e.scrollY||e.pageYOffset,d=n.scroll):(c=r,u=r.scrollLeft,l=r.scrollTop,d=a),p({scrollable:c,method:d,startTime:h,startX:u,startY:l,x:s,y:o})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?h.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):n.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(c(arguments[0])?n.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},r.prototype.scroll=r.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===c(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void n.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},r.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):n.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},r.prototype.scrollIntoView=function(){if(!0===c(arguments[0]))return void n.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const r=function(e){for(;e!==t.body&&!1===d(e);)e=e.parentNode||e.host;return e}(this),i=r.getBoundingClientRect(),s=this.getBoundingClientRect();r!==t.body?(h.call(this,r,r.scrollLeft+s.left-i.left,r.scrollTop+s.top-i.top),"fixed"!==e.getComputedStyle(r).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:s.left,top:s.top,behavior:"smooth"})}}class cn{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed,this.liveMode=t.liveMode}addAction(e){if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)return void this.actions.push(e);const t=this.findActionIndex(e);this.actions.splice(t,0,e)}start(){this.timeOffset=0;let e=performance.now();const t=()=>{const r=performance.now();for(this.timeOffset+=(r-e)*this.speed,e=r;this.actions.length;){const e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}(this.actions.length>0||this.liveMode)&&(this.raf=requestAnimationFrame(t))};this.raf=requestAnimationFrame(t)}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}toggleLiveMode(e){this.liveMode=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){const n=Math.floor((t+r)/2);if(this.actions[n].delay<e.delay)t=n+1;else{if(!(this.actions[n].delay>e.delay))return n+1;r=n-1}}return t}}function un(e,t){if(e.type===he.IncrementalSnapshot&&e.data.source===me.MouseMove&&e.data.positions&&e.data.positions.length){const r=e.data.positions[0].timeOffset,n=e.timestamp+r;return e.delay=n-t,n-t}return e.delay=e.timestamp-t,e.delay}function ln(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}var dn;!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(dn||(dn={}));var pn={type:"xstate.init"};function hn(e){return void 0===e?[]:[].concat(e)}function mn(e){return{type:"xstate.assign",assignment:e}}function fn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function gn(e){return function(t){return e===t}}function yn(e){return"string"==typeof e?{type:e}:e}function vn(e,t){return{value:e,context:t,actions:[],changed:!1,matches:gn(e)}}function In(e,t,r){var n=t,i=!1;return[e.filter(function(e){if("xstate.assign"===e.type){i=!0;var t=Object.assign({},n);return"function"==typeof e.assignment?t=e.assignment(n,r):Object.keys(e.assignment).forEach(function(i){t[i]="function"==typeof e.assignment[i]?e.assignment[i](n,r):e.assignment[i]}),n=t,!1}return!0}),n,i]}function bn(e,t){void 0===t&&(t={});var r=ln(In(hn(e.states[e.initial].entry).map(function(e){return fn(e,t.actions)}),e.context,pn),2),n=r[0],i=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:gn(e.initial)},transition:function(t,r){var n,i,o="string"==typeof t?{value:t,context:e.context}:t,a=o.value,c=o.context,u=yn(r),l=e.states[a];if(l.on){var d=hn(l.on[u.type]);try{for(var p=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),h=p.next();!h.done;h=p.next()){var m=h.value;if(void 0===m)return vn(a,c);var f="string"==typeof m?{target:m}:m,g=f.target,y=f.actions,v=void 0===y?[]:y,I=f.cond,b=void 0===I?function(){return!0}:I,S=void 0===g,w=null!=g?g:a,C=e.states[w];if(b(c,u)){var k=ln(In((S?hn(v):[].concat(l.exit,v,C.entry).filter(function(e){return e})).map(function(e){return fn(e,s._options.actions)}),c,u),3),T=k[0],_=k[1],A=k[2],O=null!=g?g:a;return{value:O,context:_,actions:T,changed:g!==a||T.length>0||A,matches:gn(O)}}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}return vn(a,c)}};return s}var Sn=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function wn(e){var t=e.initialState,r=dn.NotStarted,n=new Set,i={_machine:e,send:function(i){r===dn.Running&&(t=e.transition(t,i),Sn(t,yn(i)),n.forEach(function(e){return e(t)}))},subscribe:function(e){return n.add(e),e(t),{unsubscribe:function(){return n.delete(e)}}},start:function(n){if(n){var s="object"==typeof n?n:{context:e.config.context,value:n};t={value:s.value,actions:[],context:s.context,matches:gn(s.value)}}return r=dn.Running,Sn(t,pn),i},stop:function(){return r=dn.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}const Cn=new Map;function kn(e,t){let r=Cn.get(e);return r||(r=new Map,Cn.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function Tn(e,t,r){return n=>ze(this,void 0,void 0,function*(){if(n&&"object"==typeof n&&"rr_type"in n){if(r&&(r.isUnchanged=!1),"ImageBitmap"===n.rr_type&&"args"in n){const i=yield Tn(e,t,r)(n.args);return yield createImageBitmap.apply(null,i)}if("index"in n){if(r||null===t)return n;const{rr_type:e,index:i}=n;return kn(t,e)[i]}if("args"in n){const{rr_type:i,args:s}=n;return new(0,window[i])(...yield Promise.all(s.map(Tn(e,t,r))))}if("base64"in n)return function(e){var t,r,n,i,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),l=new Uint8Array(u);for(t=0;t<a;t+=4)r=Ze[e.charCodeAt(t)],n=Ze[e.charCodeAt(t+1)],i=Ze[e.charCodeAt(t+2)],s=Ze[e.charCodeAt(t+3)],l[c++]=r<<2|n>>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&s;return u}(n.base64);if("src"in n){const t=e.get(n.src);if(t)return t;{const t=new Image;return t.src=n.src,e.set(n.src,t),t}}if("data"in n&&"Blob"===n.rr_type){const i=yield Promise.all(n.data.map(Tn(e,t,r)));return new Blob(i,{type:n.type})}}else if(Array.isArray(n))return yield Promise.all(n.map(Tn(e,t,r)));return n})}const _n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function An({mutation:e,target:t,type:r,imageMap:n,errorHandler:i}){return ze(this,void 0,void 0,function*(){try{const i=function(e,t){try{return t===ge.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,r);if(!i)return;if(e.setter)return void(i[e.property]=e.args[0]);const s=i[e.property],o=yield Promise.all(e.args.map(Tn(n,i)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:r}=t.constructor;if(!_n.includes(r))return;const n=kn(e,r);n.includes(t)||n.push(t)}(i,s.apply(i,o))}catch(t){i(e,t)}})}function On({event:e,mutation:t,target:r,imageMap:n,errorHandler:i}){return ze(this,void 0,void 0,function*(){try{const i=r.getContext("2d");if(t.setter)return void(i[t.property]=t.args[0]);const s=i[t.property];if("drawImage"===t.property&&"string"==typeof t.args[0])n.get(e),s.apply(i,t.args);else{const e=yield Promise.all(t.args.map(Tn(n,i)));s.apply(i,e)}}catch(e){i(t,e)}})}function En({event:e,mutation:t,target:r,imageMap:n,canvasEventMap:i,errorHandler:s}){return ze(this,void 0,void 0,function*(){try{const o=i.get(e)||t,a="commands"in o?o.commands:[o];if([ge.WebGL,ge.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const i=a[e];yield An({mutation:i,type:t.type,target:r,imageMap:n,errorHandler:s})}return}for(let t=0;t<a.length;t++){const i=a[t];yield On({event:e,mutation:i,target:r,imageMap:n,errorHandler:s})}}catch(e){s(t,e)}})}const Mn=on||s,Nn="[replayer]",Dn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function xn(e){return e.type==he.IncrementalSnapshot&&(e.data.source==me.TouchMove||e.data.source==me.MouseInteraction&&e.data.type==fe.TouchStart)}class Pn{constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new Hr,this.mouseTail=null,this.tailPositions=[],this.emitter=Mn(),this.legacy_missingNodeRetryMap={},this.cache=V(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=p(),this.styleMirror=new pe,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case he.DomContentLoaded:case he.Load:case he.Custom:continue;case he.FullSnapshot:case he.Meta:case he.Plugin:case he.IncrementalSnapshot:}this.getCastFn(t,!0)()}!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null},this.getCastFn=(e,t=!1)=>{let r;switch(e.type){case he.DomContentLoaded:case he.Load:break;case he.Custom:r=()=>{this.emitter.emit(ye.CustomEvent,e)};break;case he.Meta:r=()=>this.emitter.emit(ye.Resize,{width:e.data.width,height:e.data.height});break;case he.FullSnapshot:r=()=>{var r;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(r=this.iframe.contentWindow)||void 0===r||r.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case he.IncrementalSnapshot:r=()=>{if(this.applyIncremental(e,t),!t&&(e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay,r={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:r}),this.emitter.emit(ye.SkipStart,r)}}}}return()=>{r&&r();for(const r of this.config.plugins||[])r.handler&&r.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const n=this.service.state.context.events.length-1;if(e===this.service.state.context.events[n]){const t=()=>{n<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(ye.Finish))};e.type===he.IncrementalSnapshot&&e.data.source===me.MouseMove&&e.data.positions.length?setTimeout(()=>{t()},Math.max(0,50-e.data.positions[0].timeOffset)):t()}this.emitter.emit(ye.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Dn,useVirtualDom:!0};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(ye.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(ye.Flush,()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,r)=>{En({event:e,mutation:t,target:r,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===me.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===me.StyleDeclaration&&this.applyStyleDeclaration(e,t)}};if(this.iframe.contentDocument&&Gr(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const r=this.legacy_missingNodeRetryMap[t],n=zr(r.node,this.mirror,this.virtualDom.mirror);Gr(n,r.node,e,this.virtualDom.mirror),r.node=n}catch(e){this.config.showWarning&&console.warn(e)}this.constructedStyleMutations.forEach(e=>{this.applyStyleSheetMutation(e)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(e=>{this.applyAdoptedStyleSheet(e)}),this.adoptedStyleSheets=[]}this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(ye.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});const n=new cn([],{speed:this.config.speed,liveMode:this.config.liveMode});this.service=function(e,{getCastFn:t,applyEventsSynchronously:r,emitter:n}){const i=bn({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:mn({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:mn((e,t)=>{let r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})}),play(e){var i;const{timer:s,events:o,baselineTime:a,lastPlayedEvent:c}=e;s.clear();for(const e of o)un(e,a);const u=function(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.type===he.Meta&&n.timestamp<=t)return e.slice(r)}return e}(o,a);let l=null==c?void 0:c.timestamp;(null==c?void 0:c.type)===he.IncrementalSnapshot&&c.data.source===me.MouseMove&&(l=c.timestamp+(null===(i=c.data.positions[0])||void 0===i?void 0:i.timeOffset)),a<(l||0)&&n.emit(ye.PlayBack);const d=new Array;for(const e of u)if(!(l&&l<a&&(e.timestamp<=l||e===c)))if(e.timestamp<a)d.push(e);else{const r=t(e,!1);s.addAction({doAction:()=>{r()},delay:e.delay})}r(d),n.emit(ye.Flush),s.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:mn(e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null})),startLive:mn({baselineTime:(e,t)=>(e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:mn((e,r)=>{const{baselineTime:n,timer:i,events:s}=e;if("ADD_EVENT"===r.type){const{event:e}=r.payload;un(e,n);let o=s.length-1;if(!s[o]||s[o].timestamp<=e.timestamp)s.push(e);else{let t=-1,r=0;for(;r<=o;){const t=Math.floor((r+o)/2);s[t].timestamp<=e.timestamp?r=t+1:o=t-1}-1===t&&(t=r),s.splice(t,0,e)}const a=e.timestamp<n,c=t(e,a);a?c():i.isActive()&&i.addAction({doAction:()=>{c()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:s})})}});return wn(i)}({events:e.map(e=>t&&t.unpackFn?t.unpackFn(e):e).sort((e,t)=>e.timestamp-t.timestamp),timer:n,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(e=>{this.emitter.emit(ye.StateChange,{player:e})}),this.speedService=wn(bn({id:"speed",context:{normalSpeed:-1,timer:n},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:mn({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe(e=>{this.emitter.emit(ye.StateChange,{speed:e})});const i=this.service.state.context.events.find(e=>e.type===he.Meta),s=this.service.state.context.events.find(e=>e.type===he.FullSnapshot);if(i){const{width:e,height:t}=i.data;setTimeout(()=>{this.emitter.emit(ye.Resize,{width:e,height:t})},0)}s&&setTimeout(()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=s,this.rebuildFullSnapshot(s),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(s.data.initialOffset))},1),this.service.state.context.events.find(xn)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(r=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===r||r.classList.remove("rrweb-paused"),this.emitter.emit(ye.Start)}pause(e){var t,r;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(r=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===r||r.classList.add("rrweb-paused"),this.emitter.emit(ye.Pause)}resume(e=0){console.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(ye.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(ye.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;xn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=V()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(an(this.iframe.contentWindow,this.iframe.contentDocument),re(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const r=[],n=(e,t)=>{this.collectIframeAndAttachDocument(r,e);for(const r of this.config.plugins||[])r.onBuild&&r.onBuild(e,{id:t,replayer:this})};(function(e,t){var r=t.doc,n=t.onVisit,s=t.hackCss,o=void 0===s||s,a=t.afterAppend,c=t.cache,u=t.mirror,l=void 0===u?new d:u,p=q(e,{doc:r,mirror:l,skipChild:!1,hackCss:o,afterAppend:a,cache:c});(function(e,t){function r(e){t(e)}for(var n=0,i=e.getIds();n<i.length;n++){var s=i[n];e.has(s)&&r(e.getNode(s))}})(l,function(e){n&&n(e),function(e,t){var r=t.getMeta(e);if((null==r?void 0:r.type)===i.Element){var n=e;for(var s in r.attributes)if(Object.prototype.hasOwnProperty.call(r.attributes,s)&&s.startsWith("rr_")){var o=r.attributes[s];"rr_scrollLeft"===s&&(n.scrollLeft=o),"rr_scrollTop"===s&&(n.scrollTop=o)}}}(e,l)})})(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of r)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==e);const{documentElement:s,head:o}=this.iframe.contentDocument;this.insertStyleRules(s,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(ye.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;const n=(i=this.config.blockClass,[`.${i} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var i;if(this.config.pauseAnimation&&n.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const r=this.virtualDom.createElement("style");this.virtualDom.mirror.add(r,sn(r,this.virtualDom.unserializedId)),e.insertBefore(r,t),r.rules.push({source:me.StyleSheetRule,adds:n.map((e,t)=>({rule:e,index:t}))})}else{const i=document.createElement("style");e.insertBefore(i,t);for(let e=0;e<n.length;e++)null===(r=i.sheet)||void 0===r||r.insertRule(n[e],e)}}attachDocumentToIframe(e,t){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,n=[],s=(e,s)=>{this.collectIframeAndAttachDocument(n,e);const o=r.getMeta(e);if((null==o?void 0:o.type)===i.Element&&"HTML"===(null==o?void 0:o.tagName.toUpperCase())){const{documentElement:e,head:r}=t.contentDocument;this.insertStyleRules(e,r)}for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:s,replayer:this})};q(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:s,cache:this.cache}),s(t.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter(t=>t!==e)}collectIframeAndAttachDocument(e,t){if(se(t,this.mirror)){const r=this.newDocumentQueue.find(e=>e.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let r,n=this.service.state;const i=()=>{n=this.service.state};this.emitter.on(ye.Start,i),this.emitter.on(ye.Pause,i);const s=()=>{this.emitter.off(ye.Start,i),this.emitter.off(ye.Pause,i)};t.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{t.sheet||(e.add(t),t.addEventListener("load",()=>{e.delete(t),0===e.size&&-1!==r&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(ye.LoadStylesheetEnd),r&&clearTimeout(r),s())}))}),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(ye.LoadStylesheetStart),r=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),r=-1,s()},this.config.loadTimeout))}}preloadAllImages(){return ze(this,void 0,void 0,function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(ye.Start,e),this.emitter.on(ye.Pause,e);const t=[];for(const e of this.service.state.context.events)e.type===he.IncrementalSnapshot&&e.data.source===me.CanvasMutation&&(t.push(this.deserializeAndPreloadCanvasEvents(e.data,e)),("commands"in e.data?e.data.commands:[e.data]).forEach(t=>{this.preloadImages(t,e)}));return Promise.all(t)})}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),r=t.getContext("2d"),n=null==r?void 0:r.createImageData(t.width,t.height);null==n||n.data,JSON.parse(e.args[0]),null==r||r.putImageData(n,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return ze(this,void 0,void 0,function*(){if(!this.canvasEventMap.has(t)){const r={isUnchanged:!0};if("commands"in e){const n=yield Promise.all(e.commands.map(e=>ze(this,void 0,void 0,function*(){const t=yield Promise.all(e.args.map(Tn(this.imageMap,null,r)));return Object.assign(Object.assign({},e),{args:t})})));!1===r.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:n}))}else{const n=yield Promise.all(e.args.map(Tn(this.imageMap,null,r)));!1===r.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:n}))}}})}applyIncremental(e,t){var r,n,i;const{data:s}=e;switch(s.source){case me.Mutation:try{this.applyMutation(s,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,s)}break;case me.Drag:case me.TouchMove:case me.MouseMove:if(t){const e=s.positions[s.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:s}}else s.positions.forEach(r=>{const n={doAction:()=>{this.moveAndHover(r.x,r.y,r.id,t,s)},delay:r.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(n)}),this.timer.addAction({doAction(){},delay:e.delay-(null===(r=s.positions[0])||void 0===r?void 0:r.timeOffset)});break;case me.MouseInteraction:{if(-1===s.id||t)break;const e=new Event(fe[s.type].toLowerCase()),r=this.mirror.getNode(s.id);if(!r)return this.debugNodeNotFound(s,s.id);this.emitter.emit(ye.MouseInteraction,{type:s.type,target:r});const{triggerFocus:n}=this.config;switch(s.type){case fe.Blur:"blur"in r&&r.blur();break;case fe.Focus:n&&r.focus&&r.focus({preventScroll:!0});break;case fe.Click:case fe.TouchStart:case fe.TouchEnd:t?(s.type===fe.TouchStart?this.touchActive=!0:s.type===fe.TouchEnd&&(this.touchActive=!1),this.mousePos={x:s.x,y:s.y,id:s.id,debugData:s}):(s.type===fe.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(s.x,s.y,s.id,t,s),s.type===fe.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):s.type===fe.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):s.type===fe.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case fe.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:r.dispatchEvent(e)}break}case me.Scroll:if(-1===s.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);e.scrollData=s;break}this.applyScroll(s,t);break;case me.ViewportResize:this.emitter.emit(ye.Resize,{width:s.width,height:s.height});break;case me.Input:if(-1===s.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);e.inputData=s;break}this.applyInput(s);break;case me.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(s.id):this.mirror.getNode(s.id);if(!e)return this.debugNodeNotFound(s,s.id);const t=e;try{s.currentTime&&(t.currentTime=s.currentTime),s.volume&&(t.volume=s.volume),s.muted&&(t.muted=s.muted),1===s.type&&t.pause(),0===s.type&&t.play(),4===s.type&&(t.playbackRate=s.playbackRate)}catch(e){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case me.StyleSheetRule:case me.StyleDeclaration:this.usingVirtualDom?s.styleId?this.constructedStyleMutations.push(s):s.id&&(null===(n=this.virtualDom.mirror.getNode(s.id))||void 0===n||n.rules.push(s)):this.applyStyleSheetMutation(s);break;case me.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(s.id);if(!t)return this.debugNodeNotFound(s,s.id);t.canvasMutations.push({event:e,mutation:s})}else{const t=this.mirror.getNode(s.id);if(!t)return this.debugNodeNotFound(s,s.id);En({event:e,mutation:s,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case me.Font:try{const e=new FontFace(s.family,s.buffer?new Uint8Array(JSON.parse(s.fontSource)):s.fontSource,s.descriptors);null===(i=this.iframe.contentDocument)||void 0===i||i.fonts.add(e)}catch(e){this.config.showWarning&&console.warn(e)}break;case me.Selection:if(t){this.lastSelectionData=s;break}this.applySelection(s);break;case me.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(s):this.applyAdoptedStyleSheet(s)}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,function(e,t=function(){return new _r}(),r=new Hr){(function e(n,i){const s=rn(n,r,t,i);if(null!==s)if("IFRAME"!==(null==i?void 0:i.nodeName)&&n.nodeType!==Ur.DOCUMENT_FRAGMENT_NODE&&(null==i||i.appendChild(s),s.parentNode=i,s.parentElement=i),"IFRAME"===n.nodeName){const t=n.contentDocument;t&&e(t,s)}else n.nodeType!==Ur.DOCUMENT_NODE&&n.nodeType!==Ur.ELEMENT_NODE&&n.nodeType!==Ur.DOCUMENT_FRAGMENT_NODE||(n.nodeType===Ur.ELEMENT_NODE&&n.shadowRoot&&e(n.shadowRoot,s),n.childNodes.forEach(t=>e(t,s)))})(e,null)}(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],r=rn(t.node,this.virtualDom,this.mirror);r&&(t.node=r)}catch(e){this.config.showWarning&&console.warn(e)}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes.forEach(t=>{var n;const i=r.getNode(t.id);if(!i){if(e.removes.find(e=>e.id===t.parentId))return;return this.warnNodeNotFound(e,t.id)}let s=r.getNode(t.parentId);if(!s)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&ce(s)&&(s=s.shadowRoot),r.removeNodeFromMap(i),s)try{s.removeChild(i),this.usingVirtualDom&&"#text"===i.nodeName&&"STYLE"===s.nodeName&&(null===(n=s.rules)||void 0===n?void 0:n.length)>0&&(s.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",s,i,e)}});const n=Object.assign({},this.legacy_missingNodeRetryMap),s=[],o=e=>{var t;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let o=r.getNode(e.parentId);if(!o)return e.node.type===i.Document?this.newDocumentQueue.push(e):s.push(e);e.node.isShadow&&(ce(o)||o.attachShadow({mode:"open"}),o=o.shadowRoot);let a=null,c=null;if(e.previousId&&(a=r.getNode(e.previousId)),e.nextId&&(c=r.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=r.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return s.push(e);if(e.node.rootId&&!r.getNode(e.node.rootId))return;const u=e.node.rootId?r.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(se(o,r))return void this.attachDocumentToIframe(e,o);const l=(e,t)=>{for(const r of this.config.plugins||[])r.onBuild&&r.onBuild(e,{id:t,replayer:this})},d=q(e.node,{doc:u,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:l});if(-1===e.previousId||-1===e.nextId)return void(n[e.node.id]={node:d,mutation:e});const p=r.getMeta(o);if(p&&p.type===i.Element&&"textarea"===p.tagName&&e.node.type===i.Text){const e=Array.isArray(o.childNodes)?o.childNodes:Array.from(o.childNodes);for(const t of e)t.nodeType===o.TEXT_NODE&&o.removeChild(t)}if(a&&a.nextSibling&&a.nextSibling.parentNode)o.insertBefore(d,a.nextSibling);else if(c&&c.parentNode)o.contains(c)?o.insertBefore(d,c):o.insertBefore(d,null);else{if(o===u)for(;u.firstChild;)u.removeChild(u.firstChild);o.appendChild(d)}if(l(d,e.node.id),this.usingVirtualDom&&"#text"===d.nodeName&&"STYLE"===o.nodeName&&(null===(t=o.rules)||void 0===t?void 0:t.length)>0&&(o.rules=[]),se(d,this.mirror)){const e=this.mirror.getId(d),t=this.newDocumentQueue.find(t=>t.parentId===e);t&&(this.attachDocumentToIframe(t,d),this.newDocumentQueue=this.newDocumentQueue.filter(e=>e!==t))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(n,o,d,e)};e.adds.forEach(e=>{o(e)});const a=Date.now();for(;s.length;){const e=ne(s);if(s.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e)r.getNode(t.value.parentId)?ie(t,e=>{o(e)}):this.debug("Drop resolve tree since there is no parent for the root node.",t)}Object.keys(n).length&&Object.assign(this.legacy_missingNodeRetryMap,n),de(e.texts).forEach(t=>{var n;const i=r.getNode(t.id);if(!i){if(e.removes.find(e=>e.id===t.id))return;return this.warnNodeNotFound(e,t.id)}if(i.textContent=t.value,this.usingVirtualDom){const e=i.parentNode;(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.length)>0&&(e.rules=[])}}),e.attributes.forEach(t=>{const n=r.getNode(t.id);if(!n){if(e.removes.find(e=>e.id===t.id))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const i=t.attributes[e];if(null===i)n.removeAttribute(e);else if("string"==typeof i)try{if("_cssText"===e&&("LINK"===n.nodeName||"STYLE"===n.nodeName))try{const e=r.getMeta(n);Object.assign(e.attributes,t.attributes);const i=q(e,{doc:n.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache}),s=n.nextSibling,o=n.parentNode;if(i&&o){o.removeChild(n),o.insertBefore(i,s),r.replace(t.id,i);break}}catch(e){}n.setAttribute(e,i)}catch(e){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=i,t=n;for(const r in e)if(!1===e[r])t.style.removeProperty(r);else if(e[r]instanceof Array){const n=e[r];t.style.setProperty(r,n[0],n[1])}else{const n=e[r];t.style.setProperty(r,n)}}}})}applyScroll(e,t){var r,n;const s=this.mirror.getNode(e.id);if(!s)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(s);if(s===this.iframe.contentDocument)null===(r=this.iframe.contentWindow)||void 0===r||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if((null==o?void 0:o.type)===i.Document)null===(n=s.defaultView)||void 0===n||n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{s.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,r=e.ranges.map(({start:e,startOffset:r,end:n,endOffset:i})=>{const s=this.mirror.getNode(e),o=this.mirror.getNode(n);if(!s||!o)return;const a=new Range;a.setStart(s,r),a.setEnd(o,i);const c=s.ownerDocument,u=null==c?void 0:c.getSelection();return u&&t.add(u),{range:a,selection:u}});t.forEach(e=>e.removeAllRanges()),r.forEach(e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))})}catch(e){}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),r&&(e.source===me.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===me.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,n,i,s;if(null===(r=e.adds)||void 0===r||r.forEach(({rule:e,index:r})=>{try{if(Array.isArray(r)){const{positions:n,index:i}=le(r);ue(t.cssRules,n).insertRule(e,i)}else{const n=void 0===r?void 0:Math.min(r,t.cssRules.length);null==t||t.insertRule(e,n)}}catch(e){}}),null===(n=e.removes)||void 0===n||n.forEach(({index:e})=>{try{if(Array.isArray(e)){const{positions:r,index:n}=le(e);ue(t.cssRules,r).deleteRule(n||0)}else null==t||t.deleteRule(e)}catch(e){}}),e.replace)try{null===(i=t.replace)||void 0===i||i.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(s=t.replaceSync)||void 0===s||s.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){e.set&&ue(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&ue(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const r=this.mirror.getNode(e.id);if(!r)return;null===(t=e.styles)||void 0===t||t.forEach(e=>{var t;let n=null,i=null;if(ce(r)?i=(null===(t=r.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===r.nodeName&&(i=r.defaultView),i)try{n=new i.CSSStyleSheet,this.styleMirror.add(n,e.styleId),this.applyStyleSheetRule({source:me.StyleSheetRule,adds:e.rules},n)}catch(e){}});let n=0;const i=(e,t)=>{const r=t.map(e=>this.styleMirror.getStyle(e)).filter(e=>null!==e);ce(e)?e.shadowRoot.adoptedStyleSheets=r:"#document"===e.nodeName&&(e.adoptedStyleSheets=r),r.length!==t.length&&n<10&&(setTimeout(()=>i(e,t),0+100*n),n++)};i(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,n){const{previousId:i,nextId:s}=n,o=i&&e[i],a=s&&e[s];if(o){const{node:n,mutation:i}=o;t.insertBefore(n,r),delete e[i.node.id],delete this.legacy_missingNodeRetryMap[i.node.id],(i.previousId||i.nextId)&&this.legacy_resolveMissingNode(e,t,n,i)}if(a){const{node:n,mutation:i}=a;t.insertBefore(n,r.nextSibling),delete e[i.node.id],delete this.legacy_missingNodeRetryMap[i.node.id],(i.previousId||i.nextId)&&this.legacy_resolveMissingNode(e,t,n,i)}}moveAndHover(e,t,r,n,i){const s=this.mirror.getNode(r);if(!s)return this.debugNodeNotFound(i,r);const o=ae(s,this.iframe),a=e*o.absoluteScale+o.x,c=t*o.absoluteScale+o.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,n||this.drawMouseTail({x:a,y:c}),this.hoverElements(s)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:r,strokeStyle:n,duration:i}=!0===this.config.mouseTail?Dn:Object.assign({},Dn,this.config.mouseTail),s=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=r,e.lineCap=t,e.strokeStyle=n,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(t=>e.lineTo(t.x,t.y)),e.stroke())};this.tailPositions.push(e),s(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(t=>t!==e),s()},i/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach(e=>{e.classList.remove(":hover")});let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type===he.IncrementalSnapshot&&e.data.source>me.Mutation&&e.data.source<=me.Input}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(ye.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(Nn,`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&console.warn(Nn,...e)}debug(...e){this.config.showDebug&&console.log(Nn,...e)}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(8156);return n.default})());
|
|
3
3
|
//# sourceMappingURL=index.js.map
|