@lucida-analytics/browser 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +14 -4
  2. package/dist/autocapture.d.ts +1 -1
  3. package/dist/autocapture.js +1 -1
  4. package/dist/{client-DZX6o-eI.d.ts → client-pxkkaWtR.d.ts} +2 -2
  5. package/dist/consent.d.ts +2 -2
  6. package/dist/core.d.ts +3 -3
  7. package/dist/core.js +2 -2
  8. package/dist/correlate.d.ts +8 -2
  9. package/dist/correlate.js +1 -1
  10. package/dist/early-access.d.ts +1 -1
  11. package/dist/experiments.d.ts +1 -1
  12. package/dist/flags.d.ts +1 -1
  13. package/dist/forms.d.ts +1 -1
  14. package/dist/guides.d.ts +1 -1
  15. package/dist/heatmaps.d.ts +1 -1
  16. package/dist/host-headers.d.ts +1 -1
  17. package/dist/index.d.ts +10 -4
  18. package/dist/index.js +2 -2
  19. package/dist/inspector.d.ts +1 -1
  20. package/dist/lucida.js +3 -3
  21. package/dist/recommendations.d.ts +1 -1
  22. package/dist/replay.d.ts +2 -2
  23. package/dist/replay.js +1 -1
  24. package/dist/static/v0/autocapture.js +1 -1
  25. package/dist/static/v0/core.js +2 -2
  26. package/dist/static/v0/correlate.js +1 -1
  27. package/dist/static/v0/index.js +2 -2
  28. package/dist/static/v0/lucida.js +3 -3
  29. package/dist/static/v0/manifest.json +24 -24
  30. package/dist/static/v0/replay.js +1 -1
  31. package/dist/static/v0.1.6/autocapture.js +1 -0
  32. package/dist/static/v0.1.6/core.js +3 -0
  33. package/dist/static/v0.1.6/correlate.js +1 -0
  34. package/dist/static/v0.1.6/index.js +3 -0
  35. package/dist/static/v0.1.6/lucida.js +3 -0
  36. package/dist/static/v0.1.6/manifest.json +28 -0
  37. package/dist/static/v0.1.6/replay.js +1 -0
  38. package/dist/toolbar.d.ts +1 -1
  39. package/dist/{types-Dng5ldZO.d.ts → types-QPJGHOv0.d.ts} +17 -2
  40. package/dist/webmcp.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/storage.json +1 -1
  43. package/dist/static/v0.1.5/autocapture.js +0 -1
  44. package/dist/static/v0.1.5/core.js +0 -3
  45. package/dist/static/v0.1.5/correlate.js +0 -1
  46. package/dist/static/v0.1.5/index.js +0 -3
  47. package/dist/static/v0.1.5/lucida.js +0 -3
  48. package/dist/static/v0.1.5/manifest.json +0 -28
  49. package/dist/static/v0.1.5/replay.js +0 -1
  50. /package/dist/static/{v0.1.5 → v0.1.6}/banner-7LEREYUH.js +0 -0
  51. /package/dist/static/{v0.1.5 → v0.1.6}/chunk-536QABLP.js +0 -0
  52. /package/dist/static/{v0.1.5 → v0.1.6}/chunk-AWIQCFGN.js +0 -0
  53. /package/dist/static/{v0.1.5 → v0.1.6}/chunk-EFNCQJI3.js +0 -0
  54. /package/dist/static/{v0.1.5 → v0.1.6}/chunk-FUE3SDQU.js +0 -0
  55. /package/dist/static/{v0.1.5 → v0.1.6}/chunk-UPPUYIIH.js +0 -0
  56. /package/dist/static/{v0.1.5 → v0.1.6}/consent.js +0 -0
  57. /package/dist/static/{v0.1.5 → v0.1.6}/early-access.js +0 -0
  58. /package/dist/static/{v0.1.5 → v0.1.6}/experiments.js +0 -0
  59. /package/dist/static/{v0.1.5 → v0.1.6}/flags.js +0 -0
  60. /package/dist/static/{v0.1.5 → v0.1.6}/forms.js +0 -0
  61. /package/dist/static/{v0.1.5 → v0.1.6}/guides.js +0 -0
  62. /package/dist/static/{v0.1.5 → v0.1.6}/heatmaps.js +0 -0
  63. /package/dist/static/{v0.1.5 → v0.1.6}/host-headers.js +0 -0
  64. /package/dist/static/{v0.1.5 → v0.1.6}/inspector.js +0 -0
  65. /package/dist/static/{v0.1.5 → v0.1.6}/modules-FANMZRDJ.js +0 -0
  66. /package/dist/static/{v0.1.5 → v0.1.6}/persistent-SLVINN5A.js +0 -0
  67. /package/dist/static/{v0.1.5 → v0.1.6}/recommendations.js +0 -0
  68. /package/dist/static/{v0.1.5 → v0.1.6}/recorder-4WIMQCLR.js +0 -0
  69. /package/dist/static/{v0.1.5 → v0.1.6}/toolbar.js +0 -0
  70. /package/dist/static/{v0.1.5 → v0.1.6}/validation-HGJXZ553.js +0 -0
  71. /package/dist/static/{v0.1.5 → v0.1.6}/webmcp.js +0 -0
@@ -0,0 +1,3 @@
1
+ "use strict";(()=>{var P=(t,e)=>()=>(t&&(e=t(t=0)),e);function ct(t,e,n){return e==="opt_in"?"opt_in":n==="opt_in"||n==="opt_out"||n==="cookieless"?n:e==="opt_out"?t:void 0}var Oe,at,he,ne,lt=P(()=>{"use strict";Oe="lc_consent";at=["analytics","replay","marketing"],he=class{constructor(e){this.o=e;this.modeNow=e.mode??"opt_out",this.queueBeforeConsent=e.queueBeforeConsent??!1;let n=this.opens();this.state={analytics:n,replay:n,marketing:n},this.key=e.storageKey||Oe;let r=e.storage.get(this.key);if(r)try{let o=JSON.parse(r);for(let s of at)typeof o[s]=="boolean"&&(this.state[s]=o[s]);this.decided=at.some(s=>typeof o[s]=="boolean")}catch{}this.waiting=!!e.awaitRemote&&!this.decided,this.waiting&&(this.state={analytics:!1,replay:!1,marketing:!1})}o;modeNow;queueBeforeConsent;state;decided=!1;waiting;geoCookieless=!1;key;listeners=[];opens(){return this.modeNow==="opt_out"&&!(this.o.respectDnt&&this.o.dnt)}get mode(){return this.modeNow}get resolving(){return this.waiting}get anonymous(){return this.geoCookieless&&!this.decided}resolve(e){if(!this.waiting)return this.state.analytics;this.waiting=!1,(e==="opt_in"||e==="opt_out")&&(this.modeNow=e),this.geoCookieless=e==="cookieless";let n=!this.geoCookieless&&this.opens();return this.state={analytics:n,replay:n,marketing:n},n}get(){return{...this.state}}has(e){return this.state[e]}status(e="analytics"){return this.decided?this.state[e]?"granted":"denied":"pending"}get pending(){return this.waiting||this.modeNow==="opt_in"&&!this.state.analytics}set(e){let n=this.get();for(let r of at)e[r]!==void 0&&(this.state[r]=e[r]);this.decided=!0,this.waiting=!1,this.o.storage.set(this.key,JSON.stringify(this.state));for(let r of this.listeners)r(this.get(),n)}onChange(e){this.listeners.push(e)}},ne=class{constructor(e,n){this.inner=e;this.allowed=n}inner;allowed;mem=new Map;get(e){return this.mem.has(e)?this.mem.get(e)??null:this.inner.get(e)}set(e,n){this.allowed()?this.inner.set(e,n):this.mem.set(e,n)}remove(e){this.allowed()?this.inner.remove(e):this.mem.set(e,null)}flushBuffered(){for(let[e,n]of this.mem)n===null?this.inner.remove(e):this.inner.set(e,n);this.mem.clear()}discardBuffered(){this.mem.clear()}}});function cn(t){let e=new Uint8Array(t),n=globalThis.crypto;if(n?.getRandomValues)n.getRandomValues(e);else for(let r=0;r<t;r++)e[r]=Math.floor(Math.random()*256);return e}function z(t=Date.now()){if(t>Ae){Ae=t;let s=cn(2);ue=((s[0]??0)<<8|(s[1]??0))&1023}else ue++,ue>4095&&(Ae++,ue=0);let e=cn(8),n=new Uint8Array(16),r=Ae;n[0]=Math.floor(r/2**40)&255,n[1]=Math.floor(r/2**32)&255,n[2]=Math.floor(r/2**24)&255,n[3]=Math.floor(r/2**16)&255,n[4]=Math.floor(r/2**8)&255,n[5]=r&255,n[6]=112|ue>>8,n[7]=ue&255,n[8]=128|(e[0]??0)&63;for(let s=1;s<8;s++)n[8+s]=e[s]??0;let o=Array.from(n,s=>s.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}var Ae,ue,Ie=P(()=>{"use strict";Ae=0,ue=0});var ln,Me,un=P(()=>{"use strict";Ie();ln="lc_identity",Me=class{constructor(e,n,r=!1,o=!1){this.storage=e;this.cookieless=r;let s=e.get(ln),i;try{i=s?JSON.parse(s):void 0}catch{i=void 0}if(i?.distinct_id)this.s=i;else if(r)this.s={distinct_id:"",anon_id:"",identified:!1};else{let a=n??z();this.s={distinct_id:a,anon_id:a,identified:o&&!!n},this.save()}}storage;cookieless;s;save(){this.storage.set(ln,JSON.stringify(this.s))}get distinctId(){return this.s.distinct_id}get priorAnonId(){return this.s.identified&&this.s.anon_id&&this.s.anon_id!==this.s.distinct_id?this.s.anon_id:void 0}get isIdentified(){return this.s.identified}identify(e){if(!e||e===this.s.distinct_id)return e&&!this.s.identified&&(this.s.identified=!0,this.save()),{event:null};let n=this.s.distinct_id,r=!this.s.identified;return this.s={...this.s,distinct_id:e,identified:!0},this.save(),r&&n?{event:"$identify",anonDistinctId:n}:{event:"$identify"}}aliasProps(e,n){return{alias:e,distinct_id:n??this.s.distinct_id}}reset(e=!1){if(this.cookieless){this.s={distinct_id:"",anon_id:"",identified:!1};return}let n=e&&this.s.anon_id||z();this.s={distinct_id:n,anon_id:n,identified:!1},this.save()}}});function ae(t,e={}){let n=Math.min(e.maxMs??3e4,(e.baseMs??1e3)*2**t);return Math.round(n*(.5+.5*(e.random??Math.random)()))}function dn(t){return t===0||t===408||t===429||t>=500}var Te=P(()=>{"use strict"});var Fe,pn=P(()=>{"use strict";Te();Fe=class{constructor(e){this.o=e;this.flushAt=e.flushAt??20,this.intervalMs=e.flushIntervalMs??5e3,this.maxSize=e.maxQueueSize??1e3,this.maxRetries=e.maxRetries??5,this.batchMax=Math.max(1,Math.min(e.maxBatchSize??1e3,1e3))}o;items=[];timer;attempt=0;inflight;closed=!1;warned404=!1;flushAt;intervalMs;maxSize;maxRetries;batchMax;get size(){return this.items.length}enqueue(e){this.closed||(this.items.push(e),this.items.length>this.maxSize&&this.o.onDrop?.(this.items.splice(0,this.items.length-this.maxSize),"queue_full"),this.items.length>=this.flushAt?this.flush():this.arm(this.intervalMs))}arm(e){this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},e))}disarm(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0}flush(e={}){if(this.disarm(),this.inflight)return this.inflight.then(()=>this.items.length?this.flush(e):void 0);if(!this.items.length)return Promise.resolve();let n=this.items.splice(0,this.batchMax),r=(this.o.clock??Date).now(),o=JSON.stringify({api_key:this.o.apiKey,batch:n,sent_at:new Date(r).toISOString()});this.o.log?.("send batch",n.length);let s=this.o.transport.send(this.o.url,o,e.beacon?{beacon:!0}:{}).then(i=>i,()=>({status:0,retryAfterMs:void 0})).then(i=>this.settle(n,i.status,!!e.beacon,i.retryAfterMs)).finally(()=>{this.inflight=void 0});return this.inflight=s,s}settle(e,n,r,o){if(n>=200&&n<300){this.attempt=0,this.items.length>=this.flushAt?this.flush():this.items.length&&this.arm(this.intervalMs);return}if(!dn(n)||r||this.attempt>=this.maxRetries){n===404&&!this.warned404&&(this.warned404=!0,console.warn(`[lucida] ${this.o.url} returned 404, so events are being dropped. apiHost is probably wrong: use https://capture.lucidace.com (or your own capture host), not the app host.`)),this.o.onDrop?.(e,`status_${n}`),this.attempt=0;return}this.items.unshift(...e);let s=Math.max(ae(this.attempt++,this.o.backoff),Math.min(o??0,6e4));this.o.log?.("retry in",s,"ms"),this.arm(s)}clear(){this.items=[],this.disarm()}async shutdown(){await this.flush(),this.closed=!0,this.disarm()}}});function fn(t,e,n){return typeof t=="number"&&Number.isInteger(t)&&t>=e&&t<=n?t*6e4:void 0}function So(t,e){let n=ko.exec(t);if(!n)return!0;let r=parseInt(n[1]+n[2],16);return r-e<=6e4&&e-r<=wo}var ut,_o,xo,wo,ko,je,gn=P(()=>{"use strict";Ie();ut="lc_session";_o=6e4,xo=10*36e5,wo=24*36e5,ko=/^([0-9a-f]{8})-?([0-9a-f]{4})-7[0-9a-f]{3}-/i;je=class{constructor(e,n={}){this.storage=e;this.o=n;this.idleMs=Math.min(xo,Math.max(_o,n.idleMs??30*6e4)),this.maxMs=n.maxMs??24*36e5,this.newOn=n.newOnEvents??[],this.clock=n.clock??{now:()=>Date.now()},this.bootstrapId=n.bootstrapId}storage;o;windowId=z();idleMs;maxMs;newOn;clock;bootstrapId;configure(e){this.o.idleMs===void 0&&(this.idleMs=fn(e.session_idle_minutes,1,600)??this.idleMs),this.o.maxMs===void 0&&(this.maxMs=fn(e.session_max_minutes,5,10080)??this.maxMs),this.o.newOnEvents===void 0&&Array.isArray(e.session_new_on_events)&&(this.newOn=e.session_new_on_events.filter(n=>typeof n=="string"&&n!==""))}read(){try{let e=this.storage.get(ut);return e?JSON.parse(e):void 0}catch{return}}touch(e,n){let r=this.clock.now(),o=this.read(),s=!!(o?.campaign&&e&&o.campaign!==e),i=n!==void 0&&this.newOn.includes(n),a=!o||Math.abs(r-o.last)>this.idleMs||Math.abs(r-o.start)>this.maxMs||s||i;return(a||!o)&&(o={id:!o&&this.bootstrapId&&So(this.bootstrapId,r)?this.bootstrapId:z(r),start:r,last:r}),this.bootstrapId=void 0,o.last=r,e&&(o.campaign=e),this.storage.set(ut,JSON.stringify(o)),{sessionId:o.id,windowId:this.windowId,isNew:a}}startedAt(){return this.read()?.start}reset(){this.storage.remove(ut)}}});function mn(t,e){let n=t.get(e);if(n)try{return JSON.parse(n)}catch{return}}var Le,De,hn=P(()=>{"use strict";Le=class{constructor(e,n="lc_props",r){this.storage=e;this.key=n;this.persist=r;this.p=mn(e,n)??{}}storage;key;persist;p;save(){let e=this.persist;this.storage.set(this.key,JSON.stringify(e?Object.fromEntries(Object.entries(this.p).filter(([n])=>e(n))):this.p))}register(e){Object.assign(this.p,e),this.save()}registerOnce(e){for(let[n,r]of Object.entries(e))n in this.p||(this.p[n]=r);this.save()}unregister(e){delete this.p[e],this.save()}all(){return{...this.p}}clear(){this.p={},this.storage.remove(this.key)}},De=class{constructor(e){this.storage=e;this.g=mn(e,"lc_groups")??{}}storage;g;set(e,n){this.g[e]=n,this.storage.set("lc_groups",JSON.stringify(this.g))}all(){return Object.keys(this.g).length?{...this.g}:void 0}clear(){this.g={},this.storage.remove("lc_groups")}}});function Co(t,e){let n=new Date(t??e);return(Number.isNaN(n.getTime())?new Date(e):n).toISOString()}var ye,yn=P(()=>{"use strict";lt();un();pn();gn();hn();Ie();ye=class{constructor(e){this.c=e;this.clock=e.clock??{now:()=>Date.now()},this.consent=new he({...e.consent,storage:e.consentStorage??e.storage}),this.gated=new ne(e.storage,()=>this.consent.has("analytics")),this.storage=this.gated,this.identity=new Me(this.gated,e.bootstrapDistinctId,e.cookieless,e.bootstrapIdentified),this.session=new je(this.gated,{clock:this.clock,...e.session}),this.props=new Le(this.gated,void 0,e.persistProperty),this.groupState=new De(this.gated),this.queue=new Fe({transport:e.transport,url:`${e.apiHost.replace(/\/+$/,"")}/v1/batch`,apiKey:e.apiKey,clock:this.clock,...e.log?{log:e.log}:{},...e.onDrop?{onDrop:e.onDrop}:{},...e.queue})}c;consent;identity;session;queue;storage;gated;props;groupState;clock;device;pre=[];listeners=[];captureListeners=[];sessionListeners=[];lastSession="";filter;get anonDistinctId(){return this.identity.priorAnonId}get distinctId(){return this.identity.distinctId}get deviceId(){return this.c.cookieless?"":(this.device||(this.device=this.gated.get("lc_device_id")||z(),this.gated.set("lc_device_id",this.device)),this.device)}get groups(){return this.groupState.all()}get sessionId(){return this.touchSession().sessionId}touchSession(e){let n=this.session.touch(this.c.campaignKey?.(),e);if(n.sessionId!==this.lastSession){this.lastSession=n.sessionId;for(let r of this.sessionListeners)r(n.sessionId,n.windowId)}return n}onSessionId(e){return this.sessionListeners.push(e),()=>{this.sessionListeners.splice(this.sessionListeners.indexOf(e),1)}}get sessionStart(){return this.session.startedAt()}getProperty(e){return this.props.all()[e]}setFilter(e){this.filter=e}onChange(e){this.listeners.push(e)}onCaptured(e){this.captureListeners.push(e)}emit(e){for(let n of this.listeners)n(e)}consentStatus(){return this.consent.status()}get anonymousOnReject(){return!!this.c.consent?.cookielessOnReject&&this.consent.status()==="denied"}capture(e,n={},r={}){let o=this.consent.has("analytics"),s=!o&&(this.anonymousOnReject||this.consent.anonymous),i=this.consent.pending&&(this.consent.queueBeforeConsent||this.consent.resolving);if(!o&&!s&&!i){this.c.log?.("dropped (no consent)",e);return}if(s&&(e==="$identify"||e==="$create_alias")){this.c.log?.("withheld (declined, anonymous mode)",e);return}let a=this.touchSession(e),c=this.c.enrich?.(e,n),l=this.consent.status()!=="pending",d=s?{}:{...c?.$set,...r.$set,...e==="$consent_updated"&&l?{$consent:this.consent.get()}:{}},f=s?{}:{...c?.$set_once,...r.$set_once},y=this.groupState.all(),g=s?"":this.identity.distinctId,x={uuid:z(this.clock.now()),event:e,...g?{distinct_id:g}:{},timestamp:Co(r.timestamp,this.clock.now()),properties:{...this.props.all(),...c?.properties,...n,$session_id:a.sessionId,$window_id:a.windowId,$lib:this.c.library.name,$lib_version:this.c.library.version,...l?{$consent:this.consent.get()}:{}},...Object.keys(d).length?{$set:d}:{},...Object.keys(f).length?{$set_once:f}:{},...!s&&r.$unset?.length?{$unset:r.$unset}:{},...y?{$groups:y}:{}},v=this.filter?this.filter(x):x;if(!v){this.c.log?.("dropped (policy)",e);return}this.c.log?.("capture",e,v),this.c.onCapture?.(v);for(let w of this.captureListeners)w(v);return o||s?this.queue.enqueue(v):this.pre.length<(this.c.queue?.maxQueueSize??1e3)&&this.pre.push(v),v}identify(e,n,r){let o=this.identity.identify(e);(o.event||n||r)&&this.capture("$identify",o.anonDistinctId?{$anon_distinct_id:o.anonDistinctId}:{},{...n?{$set:n}:{},...r?{$set_once:r}:{}}),this.emit("identify")}alias(e,n){this.capture("$create_alias",this.identity.aliasProps(e,n))}reset(e={}){this.identity.reset(e.reuseAnonymousId),e.resetDeviceId&&(this.device=void 0,this.gated.remove("lc_device_id")),this.props.clear(),this.groupState.clear(),this.session.reset(),this.lastSession="",this.emit("reset")}register(e){this.props.register(e)}registerOnce(e){this.props.registerOnce(e)}unregister(e){this.props.unregister(e)}group(e,n,r){this.groupState.set(e,n),this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r??{}}),this.emit("group")}getConsent(){return this.consent.get()}getConsentStatus(e="analytics"){return this.consent.status(e)}hasConsent(e){return this.consent.has(e)}setConsent(e){let n=this.consent.has("analytics"),r=e.analytics??n;if(n&&!r&&(this.capture("$opt_out"),this.queue.flush()),!n&&r&&(this.anonymousOnReject||this.consent.anonymous)&&this.queue.flush(),this.consent.set(e),!n&&r){this.gated.flushBuffered();for(let o of this.pre.splice(0))this.queue.enqueue(o);this.capture("$opt_in")}else n&&!r&&this.queue.clear();r||(this.pre.length=0),this.emit("consent")}applyRemote(e){this.session.configure(e),this.resolveConsent(ct(this.consent.mode,e.consent_mode,e.consent_default))}resolveConsent(e){if(!this.consent.resolving)return;let n=this.consent.resolve(e),r=this.pre.splice(0);if(n){this.gated.flushBuffered();for(let o of r)this.queue.enqueue(o)}else if(this.consent.anonymous){this.gated.discardBuffered();for(let o of r){if(o.event==="$identify"||o.event==="$create_alias")continue;let s={...o};delete s.distinct_id,delete s.$set,delete s.$set_once,delete s.$unset,this.queue.enqueue(s)}}else this.consent.queueBeforeConsent&&this.pre.push(...r);this.emit("consent")}optIn(){this.setConsent({analytics:!0,replay:!0,marketing:!0})}optOut(){this.setConsent({analytics:!1,replay:!1,marketing:!1})}flush(e){return this.queue.flush(e)}shutdown(){return this.queue.shutdown()}}});function dt(t){let e="";return n=>{for(e+=n;;){let r=/\r?\n\r?\n/.exec(e);if(!r)return;let o=e.slice(0,r.index);e=e.slice(r.index+r[0].length);let s="message",i,a=[];for(let c of o.split(/\r?\n/)){if(c.startsWith(":"))continue;let l=c.indexOf(":"),[d,f]=l<0?[c,""]:[c.slice(0,l),c.slice(l+1).replace(/^ /,"")];d==="event"?s=f??"":d==="data"?a.push(f??""):d==="id"&&(i=f)}a.length&&t(i===void 0?{event:s,data:a.join(`
2
+ `)}:{event:s,data:a.join(`
3
+ `),id:i})}}}var He,pt=P(()=>{"use strict";Te();He=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;start(){this.stopped&&(this.stopped=!1,this.loop())}stop(){this.stopped=!0,this.ctl?.abort(),this.timer&&clearTimeout(this.timer),this.o.onState?.(!1)}async loop(){let e=0;for(;!this.stopped;){try{await this.connectOnce()&&(e=0)}catch(r){this.stopped||this.o.log?.("flag stream error",r)}if(this.o.onState?.(!1),this.stopped)return;let n=ae(e++,this.o.backoff);await new Promise(r=>{this.timer=setTimeout(r,n),this.timer.unref?.()})}}async connectOnce(){this.ctl=new AbortController;let e=await this.o.fetch(this.o.url,{headers:{Authorization:`Bearer ${this.o.secretKey}`,Accept:"text/event-stream"},signal:this.ctl.signal});if(!e.ok||!e.body)throw new Error(`stream status ${e.status}`);this.o.onState?.(!0);let n=dt(o=>{if(o.event==="definitions")try{this.o.onChange(JSON.parse(o.data).etag)}catch{this.o.onChange(void 0)}}),r=e.body.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:o,value:s}=await r.read();if(o)return!0;n(s)}}}});function ft(t){let e=!1,n,r=new He({url:`${t.apiHost}/v1/flags/stream`,secretKey:t.apiKey,fetch:t.fetch,...t.backoff?{backoff:t.backoff}:{},...t.log?{log:t.log}:{},onState:l=>e=l,onChange:l=>{l!==void 0&&l===n||(n=l,t.reload())}}),o=()=>t.visibility?.hidden()??!1,s=t.pollMs??6e4,i=s>0?setInterval(()=>!e&&!o()&&t.reload(),s):void 0,a=()=>{o()?r.stop():(r.start(),t.reload())};o()||r.start();let c=t.visibility?.subscribe(a);return()=>{r.stop(),c?.(),i&&clearInterval(i)}}var vn=P(()=>{"use strict";pt()});function gt(t,e){let n=new Set,{whenConsented:r,disabled:o,...s}=e,i=new Ne({...s,distinctId:()=>t.distinctId,onIntervention:c=>{for(let l of[...n])l(c)}}),a=!1;return t.onChange(c=>{a&&((c==="identify"||c==="reset")&&i.restart(),c==="consent"&&(t.hasConsent("analytics")?i.start():i.stop()))}),{on(c){return n.add(c),!a&&!o&&(a=!0,r(()=>i.start())),()=>{n.delete(c)}},stop:()=>i.stop()}}var Ne,bn=P(()=>{"use strict";pt();Te();Ne=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;cursor=0;gen=0;polling=!1;start(){this.stopped&&(this.stopped=!1,this.loop(++this.gen))}stop(){this.stopped=!0,this.gen++,this.ctl?.abort(),this.timer&&clearTimeout(this.timer)}restart(){let e=!this.stopped;this.stop(),this.cursor=0,e&&this.start()}live(e){return!this.stopped&&e===this.gen}deliver(e){if(e.seq>this.cursor){this.cursor=e.seq;try{this.o.onIntervention(e)}catch(n){this.o.log?.("onIntervention threw",n)}}}url(e){let n=`distinct_id=${encodeURIComponent(this.o.distinctId())}${this.cursor?`&cursor=${this.cursor}`:""}`;return`${this.o.apiHost}${e}?${n}`}sleep(e){return new Promise(n=>{this.timer=setTimeout(n,e),this.timer.unref?.()})}async loop(e){let n=0;for(;this.live(e);){let r;try{let o=await this.connectOnce(e);if(o==="gone")return this.stop();o==="poll"?(n=0,r=this.o.pollMs??15e3):(o==="streamed"&&(n=0),r=ae(n++,this.o.backoff))}catch(o){this.live(e)&&this.o.log?.("intervention stream error",o),r=ae(n++,this.o.backoff)}if(!this.live(e))return;await this.sleep(r)}}async connectOnce(e){if(this.polling)return this.pollOnce(e);this.ctl=new AbortController;let n={Authorization:`Bearer ${this.o.apiKey}`,Accept:"text/event-stream"},r=await this.o.fetch(this.url("/v1/interventions/stream"),{headers:n,signal:this.ctl.signal});if(r.status===404)return"gone";if(!r.ok)return"failed";let o=r.body;if(!o||typeof TextDecoderStream>"u")return this.ctl.abort(),this.polling=!0,this.pollOnce(e);let s=dt(a=>{if(!(a.event!=="intervention"||!this.live(e)))try{this.deliver(JSON.parse(a.data))}catch{this.o.log?.("bad intervention payload")}}),i=o.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:a,value:c}=await i.read();if(a)return"streamed";s(c)}}async pollOnce(e){this.ctl=new AbortController;let n=await this.o.fetch(this.url("/v1/interventions"),{headers:{Authorization:`Bearer ${this.o.apiKey}`},signal:this.ctl.signal});if(n.status===404)return"gone";if(!n.ok)return"failed";let r=await n.json();if(this.live(e))for(let o of r.data??[])this.deliver(o);return"poll"}}});function mt(t,e,n={}){let r=n.key??"lc_offline",o=n.maxBatches??50,s=n.maxBytes??1e6,i=n.isOnline??(()=>!0),a,c,l=()=>{try{let g=JSON.parse(e.get(r)??"[]");return Array.isArray(g)?g:[]}catch{return[]}},d=g=>{let x=g.reduce((v,w)=>v+w.body.length,0);for(;g.length>o||x>s&&g.length>1;)x-=g.shift().body.length;g.length?e.set(r,JSON.stringify(g)):e.remove(r)},f=g=>{d([...l(),...g]),a??=setTimeout(()=>{a=void 0,y.drain()},n.retryMs??3e4)},y={async send(g,x,v){if(!i())return f([{url:g,body:x}]),{status:200};let w=await t.send(g,x,v);return w.status!==0?w:(f([{url:g,body:x}]),{status:200})},drain(){return c??=(async()=>{let g=l();if(!g.length||!i())return;e.remove(r);let x=[];for(let[v,w]of g.entries())if((await t.send(w.url,w.body)).status===0){x.push(...g.slice(v));break}x.length&&f(x)})().finally(()=>{c=void 0}),c}};return y}var _n=P(()=>{"use strict"});function xn(t){let e=new TextEncoder().encode(t),n=e.length+9+63>>6<<6,r=new Uint8Array(n);r.set(e),r[e.length]=128;let o=new DataView(r.buffer);o.setUint32(n-8,Math.floor(e.length*8/2**32)),o.setUint32(n-4,e.length*8>>>0);let s=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],i=new Uint32Array(64);for(let a=0;a<n;a+=64){for(let l=0;l<16;l++)i[l]=o.getUint32(a+l*4);for(let l=16;l<64;l++){let d=i[l-15],f=i[l-2],y=V(d,7)^V(d,18)^d>>>3,g=V(f,17)^V(f,19)^f>>>10;i[l]=i[l-16]+y+i[l-7]+g|0}let c=s.slice();for(let l=0;l<64;l++){let[d,f,y,,g,x,v,w]=c,C=w+(V(g,6)^V(g,11)^V(g,25))+(g&x^~g&v)+Ro[l]+i[l]|0,R=(V(d,2)^V(d,13)^V(d,22))+(d&f^d&y^f&y)|0;c.pop(),c.unshift(C+R|0),c[4]=c[4]+C|0}for(let l=0;l<8;l++)s[l]=s[l]+c[l]|0}return s.map(a=>(a>>>0).toString(16).padStart(8,"0")).join("")}var Ro,V,wn=P(()=>{"use strict";Ro=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),V=(t,e)=>t>>>e|t<<32-e});function kn(t){let e=t.split(".");if(e.length!==4)return;let n=[];for(let r of e){if(!Eo.test(r)||Number(r)>255)return;n.push(Number(r))}return n}function Oo(t){if(t.includes("%"))return;let e=t,n=t.lastIndexOf(":"),r=t.slice(n+1);if(r.includes(".")){let d=kn(r);if(!d)return;e=`${t.slice(0,n+1)}${(d[0]<<8|d[1]).toString(16)}:${(d[2]<<8|d[3]).toString(16)}`}let o=e.split("::");if(o.length>2)return;let s=d=>{if(d==="")return[];let f=[];for(let y of d.split(":")){if(!Po.test(y))return;f.push(parseInt(y,16))}return f},i=s(o[0]),a=o.length===2?s(o[1]):[];if(!i||!a)return;let c=i.length+a.length;return(o.length===2?c>7:c!==8)?void 0:[...i,...Array(8-c).fill(0),...a].flatMap(d=>[d>>8,d&255])}function Sn(t){return t.includes(":")?Oo(t):kn(t)}function Cn(t){if(typeof t!="string")return;let e=Sn(t.trim());return e&&Ao(e)?e.slice(12):e}function Io(t){let e=typeof t=="string"?[t]:Array.isArray(t)?t:[],n=[];for(let r of e){if(typeof r!="string")continue;let o=r.trim(),s=o.indexOf("/");if(s<0){let c=Cn(o);c&&n.push({bytes:c,bits:c.length*8});continue}let i=Sn(o.slice(0,s)),a=o.slice(s+1);!i||!$o.test(a)||Number(a)>i.length*8||n.push({bytes:i,bits:Number(a)})}return n}function Mo(t,e){if(t.bytes.length!==e.length)return!1;for(let n=0;n<t.bits;n+=8){let o=255<<8-Math.min(8,t.bits-n)&255,s=n/8;if((t.bytes[s]&o)!==(e[s]&o))return!1}return!0}function Rn(t,e,n,r){switch(t){case"array_contains_any":case"array_contains_all":case"array_contains_none":{if(!Array.isArray(e)||!Array.isArray(n))return!1;let o=n.filter(s=>e.some(i=>r(i,s))).length;return t==="array_contains_any"?o>0:t==="array_contains_all"?o===n.length:o===0}case"ip_in_cidr":case"ip_not_in_cidr":{let o=Cn(e),s=Io(n);return!o||!s.length?!1:s.some(i=>Mo(i,o))===(t==="ip_in_cidr")}}return!1}var Eo,Po,$o,Ao,En=P(()=>{"use strict";Eo=/^(0|[1-9]\d{0,2})$/,Po=/^[0-9a-fA-F]{1,4}$/,$o=/^(0|[1-9]\d*)$/;Ao=t=>t.length===16&&t.slice(0,10).every(e=>e===0)&&t[10]===255&&t[11]===255});function Lo(t){let e=Fo.exec(t.trim());return e?Number(e[1])*jo[e[2]]:void 0}function $n(t,e,n){if(typeof t=="number")return t*1e3;if(typeof t!="string")return;let r=t.trim();if(n){let s=Lo(r);if(s!==void 0)return e-s*1e3}if(!To.test(r)&&!Pn.test(r))return;let o=Date.parse(Pn.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(o)?void 0:o}function On(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=t[n]??0,o=e[n]??0;if(r!==o)return r<o?-1:1}return 0}function Do(t,e,n){if(typeof e!="string")return;let r=e.trim().replace(/^v/,"").split(".");if(t==="semver_wildcard"){let l=r[r.length-1];if(l!=="*"&&l!=="x"&&l!=="X")return;if(r.length===1)return[[0],[2**30]];let d=n.parseVersion(r.slice(0,-1).join("."));if(!d)return;let f=[...d];return f[f.length-1]=f[f.length-1]+1,[d,f]}let o=n.parseVersion(e);if(!o)return;for(;o.length<3;)o.push(0);let[s,i,a]=o,c;return t==="semver_tilde"&&r.length===1?c=[s+1,0,0]:t==="semver_tilde"||s===0&&i>0?c=[s,i+1,0]:s>0?c=[s+1,0,0]:c=[0,0,a+1],[o,c]}function An(t,e,n,r,o){switch(t){case"icontains":case"not_icontains":case"starts_with":case"not_starts_with":case"ends_with":case"not_ends_with":return typeof e!="string"||typeof n!="string"?!1:t.endsWith("icontains")?e.toLowerCase().includes(n.toLowerCase())===(t==="icontains"):t.endsWith("starts_with")?e.startsWith(n)===(t==="starts_with"):e.endsWith(n)===(t==="ends_with");case"between":case"not_between":{let s=o.toFloat(e);if(!Array.isArray(n)||n.length!==2||s===void 0)return!1;let[i,a]=n;return typeof i!="number"||typeof a!="number"?!1:(s>=i&&s<=a)==(t==="between")}case"is_date_before":case"is_date_after":{let s=$n(e,r,!1),i=$n(n,r,!0);return s===void 0||i===void 0?!1:t==="is_date_before"?s<i:s>i}case"semver_eq":case"semver_neq":case"semver_gt":case"semver_gte":case"semver_lt":case"semver_lte":{let s=o.cmpVersion(e,n);if(s===void 0)return!1;let i=t.slice(7);return i==="eq"?s===0:i==="neq"?s!==0:i==="gt"?s>0:i==="gte"?s>=0:i==="lt"?s<0:s<=0}case"semver_tilde":case"semver_caret":case"semver_wildcard":{let s=o.parseVersion(e),i=Do(t,n,o);return!!s&&!!i&&On(s,i[0])>=0&&On(s,i[1])<0}}return!1}var To,Pn,Fo,jo,In=P(()=>{"use strict";To=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,Pn=/^\d{4}-\d{2}-\d{2}$/,Fo=/^-?(\d{1,6})([hdwmy])$/,jo={h:3600,d:86400,w:604800,m:2592e3,y:31536e3}});function ht(t){if(typeof t=="number")return t;if(typeof t=="string"&&Ho.test(t.trim()))return Number(t.trim())}function yt(t,e){let n=typeof t=="number",r=typeof e=="number";return n||r?n&&r&&t===e:t===e}function bt(t){if(typeof t!="string")return;let e=t.trim().replace(/^v/,""),n=e.search(/[-+]/);n>=0&&(e=e.slice(0,n));let r=[];for(let o of e.split(".")){if(!/^[+-]?\d+$/.test(o))return;let s=parseInt(o,10);if(s<0)return;r.push(s)}return r}function vt(t,e){let n=bt(t),r=bt(e);if(!(!n||!r)){for(let o=0;o<Math.max(n.length,r.length);o++){let s=n[o]??0,i=r[o]??0;if(s!==i)return s<i?-1:1}return 0}}function re(t,e,n,r,o,s=Date.now()){let i=n&&e!==null&&e!==void 0;if(t==="is_set")return i;if(t==="is_not_set")return!i;if(!i)return!1;switch(t){case"eq":case"neq":{let a;if(o){let c=vt(e,r);if(c===void 0)return!1;a=c===0}else a=yt(e,r);return a===(t==="eq")}case"contains":case"ncontains":case"regex":case"nregex":{if(typeof e!="string"||typeof r!="string")return!1;if(t==="contains"||t==="ncontains")return e.includes(r)===(t==="contains");let a;try{a=new RegExp(r)}catch{return!1}return a.test(e)===(t==="regex")}case"gt":case"gte":case"lt":case"lte":{let a;if(o)a=vt(e,r);else{let c=ht(e),l=ht(r);a=c===void 0||l===void 0?void 0:No(c,l)}return a===void 0?!1:t==="gt"?a>0:t==="gte"?a>=0:t==="lt"?a<0:a<=0}case"in":case"not_in":return Array.isArray(r)?r.some(a=>yt(e,a))===(t==="in"):!1}return t.startsWith("array_")||t.startsWith("ip_")?Rn(t,e,r,yt):An(t,e,r,s,{toFloat:ht,parseVersion:bt,cmpVersion:vt})}var Ho,No,_t=P(()=>{"use strict";En();In();Ho=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;No=(t,e)=>t<e?-1:t>e?1:0});function wt(t){return t.properties?.length?`${t.key}|${JSON.stringify(t.properties.map(e=>[e.key,e.op,e.value??null]))}`:t.key}function Mn(t,e,n=Date.now()){return(t.properties??[]).every(r=>re(r.op,e[r.key],Object.hasOwn(e,r.key),r.value,!1,n))}function kt(t,e){let n=e[t.scope??"session"]?.[wt(t)]??0;return t.op==="is_set"?n>0:t.op==="is_not_set"?n===0:re(t.op,n,!0,t.value,!1)}function Fn(t,e,n){for(let s of t.runtime??[])if(s.filters.every(a=>{if(a.type!=="flag")return kt(a,e);let c=n(a.key);return!!c&&re(a.op,c.value,!0,a.value,!1)}))return Fn(s.result,e,n);if(!t.runtime)return t;let{runtime:r,...o}=t;return o}function St(t,e){let n={},r=new Map,o=s=>{if(r.get(s)===2)return n[s];let i=t[s];if(!i||r.get(s)===1)return;r.set(s,1);let a=Fn(i,e,o);return n[s]=a,r.set(s,2),a};for(let s of Object.keys(t))o(s);return n}function qe(t,e){let n=[],r=s=>{s.type==="event"&&s.properties?.length&&n.push(s)};for(let s of t??[])for(let i of s.conditions)for(let a of i.filters??[])r(a);let o=s=>{for(let i of s.runtime??[])i.filters.forEach(r),o(i.result)};return Object.values(e).forEach(o),n}function Ue(t,e){if(!xt(e))return e;let n=xt(t)?{...t}:{};for(let[r,o]of Object.entries(e))o===null?delete n[r]:n[r]=Ue(n[r],o);return n}var Tn,xt,ve,Ct=P(()=>{"use strict";_t();Tn=t=>(t??[]).filter(e=>e.type==="event");xt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);ve=class{session={};page={};sid="";constructor(e){if(e&&typeof e.sid=="string"&&xt(e.session)){this.sid=e.sid;for(let[n,r]of Object.entries(e.session))typeof r=="number"&&r>0&&(this.session[n]=r)}}record(e,n,r={},o=[]){n!==this.sid&&(this.sid=n,this.session={},this.page={}),e==="$pageview"&&(this.page={});let s=new Set([e]);for(let i of o)i.type==="event"&&i.key===e&&i.properties?.length&&Mn(i,r)&&s.add(wt(i));for(let i of s)this.session[i]=(this.session[i]??0)+1,this.page[i]=(this.page[i]??0)+1}counts(e){return e===this.sid?{session:{...this.session},page:{...this.page}}:{session:{},page:{}}}saved(){return{sid:this.sid,session:{...this.session}}}}});function jn(t,e){let n=e?t.contexts?.[e]:void 0;if(n)return n;if(e==="user")return{key:t.bucketing_key||t.distinct_id,properties:t.person_properties};if(e==="device")return{key:t.device_id,properties:t.device_properties}}function be(t,e,n,r=!1){let o=r?`${t}.${e}.variant.${n}`:`${t}.${e}.${n}`;return parseInt(xn(o).slice(0,13),16)/Uo}function Bo(t,e){return typeof e=="boolean"?typeof t=="boolean"?t===e:e:t===e}function Wo(t,e,n){let r=e.now?Date.parse(e.now):NaN,o=Number.isNaN(r)?Date.now():r,s;switch(t.type){case"person":s=e.person_properties;break;case"group":s=e.group_properties?.[t.group_type??""];break;case"device":s=e.device_properties;break;case"geo":s=e.geo_properties;break;case"context":if(!qo.includes(t.context_kind??""))return!1;s=jn(e,t.context_kind)?.properties;break;case"app_version":return re(t.op,e.app_version,!!e.app_version,t.value,!0,o);case"flag":{let i=n[t.key];return!!i&&re(t.op,i.value,!0,t.value,!1,o)}default:return!1}return re(t.op,s?.[t.key],!!s&&Object.hasOwn(s,t.key),t.value,!1,o)}function Vo(t,e,n){let r=t.variants;if(e.variant_override){let i=r.find(a=>a.key===e.variant_override);if(i)return i}let o=be(t.key,t.salt,n,!0)*100,s=0;for(let i of r)if(s+=i.rollout_pct,o<s)return i;return r[r.length-1]}function Ln(t,e){return Dn(t.aggregation,e)}function Dn(t,e){return t.kind==="group"?e.groups?.[t.group_type??""]:t.kind==="device"?e.device_id:t.kind==="context"?jn(e,t.context_kind)?.key:e.bucketing_key||e.distinct_id}function Ko(t,e,n,r){let o=t.sticky?r.sticky_assignments?.[t.key]:void 0;if(o===void 0)return;let s={value:!0,reason:"sticky_bucket",condition_index:n};if(t.type==="multivariate"&&t.variants?.length){if(t.variants.some(a=>a.key===e.variant_override))return;let i=t.variants.find(a=>a.key===o);return i?(s.value=s.variant=i.key,We(s,i.payload,e)):void 0}if(o===!0)return We(s,t.type==="json"?t.payload:void 0,e)}function We(t,e,n){let r=n.payload_patch===void 0||n.payload_patch===null?e:Ue(e,n.payload_patch);return r!==void 0&&(t.payload=r),t}function Go(t,e){return!t.app_contexts?.length||!e.app_contexts?.length?!0:t.app_contexts.some(n=>e.app_contexts?.includes(n))}function Hn(t,e,n={}){if(!Go(t,e))return N("app_context_excluded");if(!t.active)return N("inactive");if(t.kill_switch)return N("kill_switch");let r=!1;for(let c of t.prerequisites??[]){let l=n[c.flag];if(!l)return N("prerequisite_missing");if(l.reason==="requires_server")r=!0;else if(l.reason==="prerequisite_cycle"||!Bo(l.value,c.value))return N("prerequisite_failed")}if(r)return N("requires_server");let o=Ln(t,e),s=t.conditions.some(c=>c.aggregation);if(!o&&(!s||t.holdout||t.namespace))return N("no_bucketing_key");if(t.holdout&&be("holdout",t.holdout.salt,o??"")*100<t.holdout.percentage)return N("holdout");if(t.namespace&&t.namespace.total>0){let c=Math.floor(be("namespace",t.namespace.salt,o??"")*t.namespace.total);if(c<t.namespace.start||c>=t.namespace.end)return N("namespace_excluded")}let i=0,a=[];for(let[c,l]of t.conditions.entries()){let d=l.aggregation?Dn(l.aggregation,e):o;if(!d){i++;continue}let f=!1,y=!0,g=!1;for(let v of l.filters??[]){if(v.type==="event"){if(e.runtime_events===void 0)g=!0;else if(!kt(v,e.runtime_events)){y=!1;break}continue}let w=v.type==="cohort"?e.cohorts?.[v.key]:void 0;if(w!==void 0){if(w===(v.op==="not_in"||v.op==="neq")){y=!1;break}}else if(v.type==="cohort"||v.type==="flag"&&n[v.key]?.reason==="requires_server")f=!0;else if(!Wo(v,e,n)){y=!1;break}}if(!y)continue;if(f)return Rt(N("requires_server",c),a);let x=zo(t,l,c,e,d);if(x)if(g)a.push({filters:Tn(l.filters),result:x});else return Rt(x,a)}return Rt(N(i>0&&i===t.conditions.length?"no_bucketing_key":"no_condition_match"),a)}function zo(t,e,n,r,o){let s=e.aggregation?void 0:Ko(t,e,n,r);if(s)return s;if(be(t.key,t.salt,o)*100>=e.rollout_pct)return t.early_exit?N("out_of_rollout",n):void 0;let i={value:!0,reason:"condition_match",condition_index:n};if(t.type==="multivariate"&&t.variants?.length){let a=Vo(t,e,o);return i.value=i.variant=a.key,We(i,a.payload,e)}return We(i,t.type==="json"?t.payload:void 0,e)}function Nn(t){return[...(t.prerequisites??[]).map(e=>e.flag),...t.conditions.flatMap(e=>(e.filters??[]).filter(n=>n.type==="flag").map(n=>n.key))]}function Et(t,e){let n=new Map(t.map(i=>[i.key,i])),r={},o=new Map,s=i=>{let a=n.get(i);if(!a||o.has(i))return;o.set(i,1);let c=!1;for(let l of Nn(a))s(l),(o.get(l)===1||r[l]?.reason==="prerequisite_cycle")&&(c=!0);r[i]=c?N("prerequisite_cycle"):Xo(a,e,r),o.set(i,2)};for(let i of t)s(i.key);return r}function Xo(t,e,n){return Be(t,e,n,[],new Set)}function Be(t,e,n,r,o){let[s,...i]=r;if(s===void 0){let x=new Set,v=new Proxy(n,{get:(R,L)=>(x.add(String(L)),R[L])}),w=Hn(t,e,v),C=[];for(let R of Nn(t))x.has(R)&&!o.has(R)&&!C.includes(R)&&n[R]?.runtime?.length&&C.push(R);return C.length?Be(t,e,n,C,new Set([...o,...C])):w}let a=Be(t,e,n,i,o),c=n[s],l=new Set([c.value]),d=[];for(let x of qn(c)){if(l.has(x.value))continue;l.add(x.value);let v=Be(t,e,{...n,[s]:x},i,o);Un(v,a)||d.push({filters:[{type:"flag",key:s,op:"eq",value:x.value}],result:v})}let f=[...d,...a.runtime??[]],{runtime:y,...g}=a;return f.length?{...g,runtime:f}:g}function qn(t){return(t.runtime??[]).flatMap(e=>{let{runtime:n,...r}=e.result;return[r,...qn(e.result)]})}function Un(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Array.isArray(t)!==Array.isArray(e))return!1;let n=t,r=e,o=new Set([...Object.keys(n),...Object.keys(r)]);for(let s of o)if(!Un(n[s],r[s]))return!1;return!0}var qo,Uo,N,Rt,Pt,$t,Bn=P(()=>{"use strict";_t();Ct();wn();qo=["user","device","org"],Uo=16**13;N=(t,e=-1)=>({value:!1,reason:t,condition_index:e});Rt=(t,e)=>e.length?{...t,runtime:e}:t;Pt=t=>t.reason==="requires_server",$t=t=>t.reason!=="app_context_excluded"});function Ot(t){let e=Object.keys(t);if(e.length===0)return{};let n={};for(let r of e)n[`$feature/${r}`]=t[r];return n.$active_feature_flags=e.filter(r=>t[r]!==!1).sort(),n}var Wn=P(()=>{"use strict"});function ce(t,e,n,r){return{key:t,value:e,enabled:e!==void 0&&e!==!1,...typeof e=="string"?{variant:e}:{},...n!==void 0?{payload:n}:{},reason:e===void 0?"not_found":r}}var _e,Vn=P(()=>{"use strict";_e=class{constructor(e,n=Date.now){this.ttlMs=e;this.now=n}ttlMs;now;stamp;mark(e){return this.stamp={at:this.now(),id:e}}restore(e){typeof e?.at=="number"&&typeof e.id=="string"&&(this.stamp={at:e.at,id:e.id})}fresh(e){return!!this.ttlMs&&this.ttlMs>0&&!!this.stamp&&this.stamp.id===e&&this.now()-this.stamp.at<this.ttlMs}clear(){this.stamp=void 0}}});function rs(t){let e=Zo;for(let n of ns.encode(t))e=(e^BigInt(n))*es&ts;return e}function Xn(t){let e=(t.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(o=>ke(o).length>=2);if(!e.length)return;let n=new Array(64).fill(0);for(let o of e){let s=rs(o);for(let i=0;i<64;i++)n[i]=(n[i]??0)+((s>>BigInt(i)&1n)===1n?1:-1)}let r=0n;for(let o=0;o<64;o++)(n[o]??0)>0&&(r|=1n<<BigInt(o));return r.toString(16).padStart(16,"0")}function Yn(t){let n=` ${t.toLowerCase().replace(/’/g,"'").replace(/[.,!?;:]/g," ").replace(/\s+/g," ").trim()} `,r=0;for(let s of Gn)n.includes(` ${s} `)&&(r++,n=n.split(` ${s} `).join(" "));let o=zn.filter(s=>n.includes(` ${s} `)).length;return r>o?-1:o>r?1:0}function os(t){let e=Jn(t);if(e.length<13||e.length>19)return!1;let n=0;return e.reverse().forEach((r,o)=>n+=o%2===1?r>4?r*2-9:r*2:r),n%10===0}function is(t){let e=Jn(t).length;return e>=10&&e<=15}function Mt(t){let e=t;for(let[n,r]of ss)e=e.replace(n,o=>r(o)?as(o):o);return e===t?void 0:e}function Qn(t){if(typeof t!="string")return;let e=t.toLowerCase();return/^[0-9a-f]{32}$/.test(e)?e:void 0}function cs(t,e,n){let r=It(e,n),o=Mt(r);return o===void 0?{[t]:r}:{[t]:o,$ai_text_redacted:!0}}function er(t,e,n,r){if(t!=="user"&&t!=="assistant")return;let o={$ai_role:t,$ai_message_index:n,$ai_text_length:ke(e).length};if(t==="user"){let s=Xn(e);s!==void 0&&(o.$ai_text_hash=s),o.$ai_sentiment=Yn(e)}return r?{...o,...cs("$ai_text",e,Jo)}:o}function tr(t,e){let n=t.value;if(t.kind==="thumbs"&&n!==1&&n!==-1||t.kind==="rating"&&!(Number.isInteger(n)&&n>=1&&n<=5)||t.kind!=="thumbs"&&t.kind!=="rating"&&t.kind!=="comment")return;let r={$ai_feedback_kind:t.kind};if(t.kind!=="comment"&&(r.$ai_feedback_value=n),t.comment&&e){let o=It(t.comment,Qo);r.$ai_feedback_comment=Mt(o)??o}return t.messageIndex!==void 0&&(r.$ai_message_index=t.messageIndex),r}function At(t,e){let n=Zn(t),r=xe(e,64);return{...n?{$ai_outcome:n}:{},...r?{$ai_resolution:r}:{}}}function ls(){let t=globalThis.crypto,e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let r=0;r<16;r++)e[r]=Math.floor(Math.random()*256);e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function nr(t={}){let e={$ai_conversation_id:t.conversationId||ls()},n=(r,o)=>{o!==void 0&&(e[r]=o)};return n("$ai_agent_name",xe(t.agentName,128)),n("$ai_agent_version",xe(t.agentVersion,64)),n("$ai_topic",xe(t.topic,128)),n("$ai_use_case",xe(t.useCase,128)),n("$ai_trace_id",Qn(t.traceId)),e}var de,Yo,Jo,Qo,Gn,zn,ke,It,Zo,es,ts,ns,Jn,Kn,ss,as,Zn,xe,we,rr=P(()=>{"use strict";de={started:"$ai_conversation_started",message:"$ai_message",feedback:"$ai_feedback",ended:"$ai_conversation_ended",outcome:"$ai_outcome"},Yo=["resolved","unresolved","escalated","abandoned","error"],Jo=4e3,Qo=2e3,Gn=["wrong","useless","not helpful","unhelpful","doesn't work","does not work","didn't help","did not help","not what i asked","that's not it","stupid","terrible","awful","frustrating","frustrated","annoying","worst","hate","incorrect","nonsense","confusing","makes no sense","real person","human agent","talk to a human","speak to a human","wtf","ugh"],zn=["thanks","thank you","great","perfect","awesome","helpful","that worked","works now","solved","exactly"],ke=t=>Array.from(t),It=(t,e)=>ke(t).slice(0,e).join(""),Zo=0xcbf29ce484222325n,es=0x100000001b3n,ts=0xffffffffffffffffn,ns=new TextEncoder;Jn=t=>ke(t).filter(e=>e>="0"&&e<="9").map(Number);Kn=String.raw`[\p{Alphabetic}\p{M}\p{Nd}\p{Pc}\p{Join_Control}]`,ss=[[new RegExp(String.raw`(?<!${Kn})\p{Nd}(?:[ -]?\p{Nd}){12,18}(?!${Kn})`,"gu"),os],[/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g,()=>!0],[/\+?\p{Nd}[\p{Nd}\s().-]{7,}\p{Nd}/gu,is]];as=t=>ke(t).map(e=>/\s/u.test(e)?e:"*").join("");Zn=t=>typeof t=="string"&&Yo.includes(t)?t:void 0,xe=(t,e)=>typeof t=="string"&&t?It(t,e):void 0;we=class{next=0;common;emit;captureText;constructor(e,n={},r=!1){this.emit=e,this.captureText=r,this.common=nr(n)}get id(){return this.common.$ai_conversation_id}send(e,n){this.emit(e,{...this.common,...n})}start(){return this.send(de.started,{}),this}message(e,n,r={}){let o=r.index??this.next,s=er(e,n,o,this.captureText);return s?(this.next=o+1,this.send(de.message,s),!0):!1}feedback(e){let n=tr(e,this.captureText);return n?(this.send(de.feedback,n),!0):!1}end(e,n){this.send(de.ended,At(e,n))}outcome(e,n){let r=At(e,n);return r.$ai_outcome?(this.send(de.outcome,r),!0):!1}}});var Se=P(()=>{"use strict";yn();lt();vn();bn();_n();Bn();Ct();Wn();Vn();rr()});function ir(t,e=90,n=Date.now){let r,o=()=>{try{return JSON.parse(t.get(sr)??"{}")}catch{return{}}};return()=>{let s=o();if(location.search!==r){r=location.search;let a=new URLSearchParams(r),c=!1;for(let l of K){let d=a.get(l);d&&(s[l]={v:d.slice(0,512),t:n()},c=!0)}c&&t.set(sr,JSON.stringify(s))}let i={};for(let a of K){let c=s[a];c&&n()-c.t<e*864e5&&(i[a]=c.v)}return i}}var K,sr,Ce=P(()=>{"use strict";K=["gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","igshid","msclkid","ttclid","li_fat_id","twclid","mc_cid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],sr="lc_click_ids"});function xs(t){let e={},n=new URLSearchParams(location.search);for(let r of[...oe,...K,...t]){let o=n.get(r);o&&(e[`$${r}`]=o)}return e}function gr(){let t=new URLSearchParams(location.search),e=oe.map(n=>t.get(n)??"");return e.some(Boolean)?e.join("|"):void 0}function ws(t){try{return t?new URL(t).hostname:""}catch{return""}}function Ss(){let t=location.hash;return t.length>1?location.pathname+t.split("?")[0]:location.pathname}function mr(t,e,n=[],r=!1){let o={$current_url:ks(),$host:location.host,$pathname:r?Ss():location.pathname,$referrer:document.referrer,$title:document.title,$screen_width:screen.width,$screen_height:screen.height,$viewport_width:window.innerWidth,$viewport_height:window.innerHeight,$browser_language:navigator.language,$timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};if(navigator.maxTouchPoints>1&&(o.$touch_points=navigator.maxTouchPoints),t!=="$pageview")return{properties:o};let s=xs(n);Object.assign(o,s);let i=e.$current_url??location.href,a=e.$referrer??document.referrer,c={$initial_referrer:a||"$direct",$initial_referring_domain:ws(a)||"$direct",$initial_current_url:i};for(let[l,d]of Object.entries(s))c[`$initial_${l.slice(1)}`]=d;return{properties:o,$set_once:c}}var oe,ks,Ke=P(()=>{"use strict";Ce();oe=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];ks=()=>location.href.replace(/([?&])__lc_toolbar=[^&#]*&?/,"$1").replace(/[?&]$/,"")});function wr(t,e=Date.now){let n=t.eventsPerSecond??10,r=t.burst??100,o=r,s=e();return()=>{let i=e();return o=Math.min(r,o+(i-s)/1e3*n),s=i,o<1?!1:(o-=1,!0)}}var kr=P(()=>{"use strict"});function $s(t,e){let n=t,r=[...Es,...e.maskParams??[],...e.maskCampaignParams?[...oe,...K]:[]];if(r.length){let o=n.indexOf("#"),s=o<0?n:n.slice(0,o),i=o<0?"":n.slice(o);n=s.replace(new RegExp(`([?&])(${r.map(Sr).join("|")})=[^&]*`,"gi"),`$1$2=${jt}`)+i}return e.stripHash&&(n=n.replace(/#.*$/,"")),n}function Cr(t){let e=new RegExp(`^\\$(initial_|last_)?(${[...oe,...K].map(Sr).join("|")})$`),n=r=>{let o;if(t.maskCampaignParams)for(let[s,i]of Object.entries(r))typeof i=="string"&&e.test(s)?(o??={...r})[s]=jt:s==="$click_ids"&&i&&typeof i=="object"&&((o??={...r})[s]=Object.fromEntries(Object.keys(i).map(a=>[a,jt])));for(let s of Ps){let i=(o??r)[s];if(typeof i!="string")continue;let a=$s(i,t);a!==i&&((o??={...r})[s]=a)}return o??r};return r=>({...r,properties:n(r.properties),...r.$set?{$set:n(r.$set)}:{},...r.$set_once?{$set_once:n(r.$set_once)}:{}})}var jt,Es,Ps,Sr,Rr=P(()=>{"use strict";Ce();Ke();jt="<masked>",Es=["password","passwd","pwd","pass","token","access_token","refresh_token","id_token","secret","client_secret","api_key","apikey","key","auth","authorization","code","otp","email","ssn"],Ps=["$current_url","$referrer","$initial_referrer","$initial_current_url","$last_current_url"],Sr=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});function xi(t){return t.startsWith("re:")?t.slice(3):t.split("*").map(e=>e.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function Yt(t,e){return!!t?.some(n=>{try{return new RegExp(xi(n),"i").test(e)}catch{return!1}})}var zr=P(()=>{"use strict"});Se();var us=["bot","crawl","spider","slurp","headlesschrome","phantomjs","puppeteer","playwright","lighthouse","pingdom","uptimerobot","facebookexternalhit","preview","scrapy","python-requests","go-http-client","cypress","lightpanda","hubspot","nessus","prerender","deepscan","screaming frog","sitebulb","turnitin","ia_archiver","chatgpt-user","app.hypefactors.com","google favicon","google web preview","-google","googleother","googleweblight","google-read-aloud","google-inspectiontool","google-hoteladsverifier","google-cloudvertexbot"];function or(t,e=[]){let n=t.toLowerCase();return e.some(r=>r&&n.includes(r.toLowerCase()))?!0:us.some(r=>n.includes(r))&&!/\bcubot\b/.test(n)}Ce();function ds(){return Array.from(document.querySelectorAll("meta[http-equiv]")).filter(t=>t.getAttribute("http-equiv")?.toLowerCase()==="content-security-policy").map(t=>t.getAttribute("content")??"")}function ps(t){let e=new Map;for(let r of t.split(";")){let[o,...s]=r.trim().toLowerCase().split(/\s+/);o&&!e.has(o)&&e.set(o,s)}let n=e.get("style-src-elem")??e.get("style-src")??e.get("default-src");return!!n&&!(n.includes("'unsafe-inline'")&&!n.some(r=>r.startsWith("'nonce-")||r.startsWith("'sha")))}function cr(t,e){if(typeof document>"u")return()=>{};!e&&ds().some(ps)&&t("CSP hint: this page's Content-Security-Policy blocks inline <style>; set the `nonce` option so guides and the experiment veil render (docs/guides/csp.md)");let n=r=>{let o=r;/^style-src/.test(o.effectiveDirective??"")&&o.blockedURI==="inline"&&t(`CSP hint: an inline style was blocked by ${o.effectiveDirective}${e?" (check that `nonce` matches the page's nonce)":"; set the `nonce` option"}`)};return document.addEventListener("securitypolicyviolation",n),()=>document.removeEventListener("securitypolicyviolation",n)}var fs=(t,e)=>t.slice(0,e);function ar(t){try{let e=new URL(t);return e.protocol==="data:"||e.protocol==="blob:"?e.protocol:e.origin+e.pathname}catch{return fs(t,64)}}function lr(t,e={}){if(typeof document>"u")return()=>{};let n=e.maxPerPage??20,r=new Set,o=s=>{let i=s,a={$csp_directive:i.effectiveDirective??i.violatedDirective,$csp_blocked_uri:ar(i.blockedURI??""),$csp_source_file:i.sourceFile?ar(i.sourceFile):void 0,$csp_line:i.lineNumber||void 0,$csp_column:i.columnNumber||void 0,$csp_disposition:i.disposition},c=[a.$csp_directive,a.$csp_blocked_uri,a.$csp_source_file,a.$csp_line].join("|");r.has(c)||r.size>=n||(r.add(c),t("$csp_violation",Object.fromEntries(Object.entries(a).filter(([,l])=>l!==void 0))))};return document.addEventListener("securitypolicyviolation",o),()=>document.removeEventListener("securitypolicyviolation",o)}var gs=["chrome-extension:","moz-extension:","safari-web-extension:","ms-browser-extension:"],Ve=()=>typeof location<"u"&&gs.includes(location.protocol),ur=(t,e,n)=>`${t.replace(/\/+$/,"")}/static/v${e}/${n}`,ms={replay:"replay",heatmaps:"heatmaps",forms:"forms",toolbar:"toolbar",guides:"guides",inspector:"inspector",experiments:"visualChanges","early-access":"earlyAccess",consent:"consentModule"},hs=t=>import(t);async function ys(t,e,n=globalThis.fetch){try{let r=await n(ur(t,e,"manifest.json"),{credentials:"omit"});if(!r.ok)return;let o=await r.json();return o&&typeof o.files=="object"&&o.files?o:void 0}catch{return}}async function vs(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-384",t));return`sha384-${btoa(String.fromCharCode(...e))}`}async function dr(t,e,n,r=hs,o=globalThis.fetch){let s=t.length?await ys(e.assetHost,e.version,o):void 0;return(await Promise.all(t.map(async a=>{let c=ms[a];if(!c)return n("unknown module",a);let l=ur(e.assetHost,e.version,`${a}.js`);try{if(s){let f=s.files[`${a}.js`],y=f?await o(l,{credentials:"omit",cache:"force-cache"}):void 0;if(!y?.ok||await vs(await y.arrayBuffer())!==f)return n("module refused, it does not match the manifest",a)}let d=(await r(l))[c];return typeof d=="function"?d:n("module has no export",a,c)}catch(d){return n("module failed to load",a,d)}}))).filter(a=>!!a)}function bs(t,e,n){let r=e.find(i=>t.startsWith(`${i}/`));if(!r)return t;let o=t.slice(r.length),s=o.search(/[?#]/);return r+n(s<0?o:o.slice(0,s))+(s<0?"":o.slice(s))}function pr(t,e,n,r){if(!r)return{transport:t,fetch:e};let o=s=>bs(s,n,r);return{transport:{send:(s,i,a)=>t.send(o(s),i,a)},fetch:((s,i)=>e(typeof s=="string"?o(s):s instanceof URL?o(s.href):s,i))}}var _s="__LUCIDA_DEVTOOLS_HOOK__";function fr(t,e,n){let r=globalThis[_s];if(!(!r||typeof r.emit!="function"||typeof r.attach!="function")){t.onCapture(o=>{try{r.emit(o)}catch{}});try{r.attach({projectKeyPrefix:t.apiKey.slice(0,8),apiHost:n,distinctId:()=>e.distinctId,loadToolbar:o=>e.loadToolbar(o),startReplay:async()=>t.replay?(await t.replay.start(!0),t.replay.isRecording()):!1,replayUrl:()=>e.getReplayUrl()})}catch{}}}Ke();function Ge(t,e,n=globalThis){e&&(n[typeof e=="string"?e:"lucida"]=t,typeof CustomEvent=="function"&&n.dispatchEvent?.(new CustomEvent("lucida:ready",{detail:t})))}Se();var pe=()=>{},Tt=()=>Promise.resolve(),hr={isInternal:!1,hasOptedOut:()=>!1,hasOptedIn:()=>!1,consentStatus:()=>"pending",getConsentStatus:()=>"pending",getConsent:()=>({analytics:!1,replay:!1,marketing:!1}),getAllFlags:()=>({}),isFeatureEnabled:()=>!1,getFlagResult:t=>ce(t,void 0,void 0,"not_found"),getReplayUrl:()=>"",onSessionId:()=>pe,onFlags:()=>pe,onIntervention:()=>pe,onConsent:()=>pe,flush:Tt,shutdown:Tt,reloadFlags:Tt,loadToolbar:()=>Promise.resolve(!1),recommendations:t=>Promise.resolve({placement:t,strategy:"",items:[],shown:pe,clicked:pe})};function yr(t){return new Proxy(()=>{},{get:(e,n)=>{if(!(typeof n!="string"||n==="then"))return t&&Object.hasOwn(hr,n)?hr[n]:yr(!1)}})}var vr=()=>yr(!0);var Ft="_lcid";var br=(t,e)=>e.some(n=>{let r=n.replace(/^\./,"").toLowerCase();return t.toLowerCase()===r||t.toLowerCase().endsWith(`.${r}`)}),Cs=(t,e=Date.now(),n)=>`${t}.${e.toString(36)}${n?`_${n}`:""}`;function Rs(t,e=Date.now()){let n=t.lastIndexOf("."),[r="",o]=t.slice(n+1).split("_",2),s=/^[0-9a-z]+$/.test(r)?parseInt(r,36):NaN,i=t.slice(0,n);if(n>0&&i.length<=200&&s<=e+5e3&&e-s<=12e4)return o&&/^[\w-]{1,64}$/.test(o)?{distinctId:i,sessionId:o}:{distinctId:i}}function _r(t){if(!t?.length)return;let e=new URL(location.href),n=e.searchParams.get(Ft);if(n!==null){e.searchParams.delete(Ft),history.replaceState(history.state,"",e.toString());try{if(document.referrer&&!br(new URL(document.referrer).hostname,t))return}catch{return}return Rs(n)}}var xr=t=>{let e=t.config.crossDomains;if(!e?.length)return;let n=r=>{let o=r.target instanceof Element?r.target.closest("a[href]"):null;if(!o||!t.core.hasConsent("analytics"))return;let s=o;if(!/^https?:$/.test(s.protocol)||s.host===location.host||!br(s.hostname,e))return;let i=new URL(s.href);i.searchParams.set(Ft,Cs(t.client.distinctId,Date.now(),t.core.sessionId)),s.href=i.toString()};return document.addEventListener("click",n,!0),document.addEventListener("auxclick",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("auxclick",n,!0)}};kr();Rr();function Os(t,e,n){let r=e;for(let o of t)try{let s=o(r);if(s==null)return null;if(typeof s!="object"||typeof s.event!="string")return n("beforeSend hook returned a non-event, dropping:",typeof s),null;r=s}catch(s){return n("beforeSend hook threw, dropping event:",s),null}return r}function As(t,e=Math.random){return n=>t>=1?n:t<=0||e()>=t?null:{...n,properties:{...n.properties,$sample_rate:t}}}function Is(t){let e=new Set(t),n=r=>Object.fromEntries(Object.entries(r).filter(([o])=>!e.has(o)));return r=>({...r,properties:n(r.properties),...r.$set?{$set:n(r.$set)}:{},...r.$set_once?{$set_once:n(r.$set_once)}:{}})}var Lt="lc_person_identified",ze="lc_pending_set_once",Er=new Set(["$identify","$create_alias","$groupidentify"]),Pr="$$client_ingestion_warning",Ms=6e4,Dt=class{constructor(e,n){this.mode=e;this.storage=n;this.identified=n.get(Lt)==="1";try{this.pending=JSON.parse(n.get(ze)??"{}")}catch{this.pending={}}}mode;storage;identified;pending;get blocksPersonWrites(){return this.mode==="never"}get isProfile(){return this.mode==="always"||this.mode==="identified_only"&&this.identified}markIdentified(){this.mode!=="identified_only"||this.identified||(this.identified=!0,this.storage.set(Lt,"1"))}personless(e){return this.mode==="always"?!1:(this.mode==="never"||!this.identified)&&!Er.has(e)}stash(e){if(this.mode!=="identified_only"||!e)return;let n=Object.entries(e).filter(([r])=>!(r in this.pending));n.length&&(this.pending={...this.pending,...Object.fromEntries(n)},this.storage.set(ze,JSON.stringify(this.pending)))}take(){if(!Object.keys(this.pending).length)return;let e=this.pending;return this.pending={},this.storage.remove(ze),e}reset(){this.identified=!1,this.pending={},this.storage.remove(Lt),this.storage.remove(ze)}};function Ts(t,e){let n=e,r;if(t.person.personless(e.event)){t.person.stash(e.$set_once);let{$set:s,$set_once:i,$unset:a,...c}=e;n={...c,properties:{...e.properties,$process_person_profile:!1}}}else(r=t.person.take())&&(n={...e,$set_once:{...e.$set_once,...r}});let o=t.hooks.length?Os(t.hooks,n,t.log):n;return o&&t.limit&&!t.limit()&&(t.log("rate limited, dropped",o.event),t.onLimited?.(),o=null),!o&&r&&t.person.stash(r),o}function Fs(t){let e=t.beforeSend?Array.isArray(t.beforeSend)?t.beforeSend:[t.beforeSend]:[];return[Cr(t.urlPrivacy??{}),...t.propertyDenylist?.length?[Is(t.propertyDenylist)]:[],...t.sampleRate!==void 0?[As(t.sampleRate)]:[],...e]}function $r(t,e,n,r=Date.now){let o=new Dt(e.personProfiles??"always",t.storage),s,i,a=0,c=-1/0,l=()=>{a+=1,!(r()-c<Ms)&&(c=r(),queueMicrotask(()=>{let d=a;a=0,t.capture(Pr,{$$client_ingestion_warning_message:`client rate limit dropped ${d} event(s)`,$dropped_count:d})}))};return t.setFilter(d=>(e.rateLimit!==s&&(s=e.rateLimit,i=s?wr(s):void 0),Ts({hooks:Fs(e),person:o,limit:d.event===Pr?void 0:i,log:n,onLimited:l},d))),o}var Ht=class{m=new Map;get(e){return this.m.get(e)??null}set(e,n){this.m.set(e,n)}remove(e){this.m.delete(e)}},js=365,Ls=new Set("co.uk org.uk ac.uk gov.uk me.uk ltd.uk plc.uk net.uk com.au net.au org.au edu.au gov.au co.nz org.nz net.nz co.jp ne.jp or.jp ac.jp go.jp co.kr or.kr com.cn net.cn org.cn com.hk com.tw com.sg com.my co.in net.in org.in co.id co.th com.ph com.vn com.br net.br org.br com.ar com.mx com.co com.pe com.tr com.ua com.pl co.za co.il com.eg com.sa com.ng co.ke github.io gitlab.io vercel.app netlify.app herokuapp.com pages.dev workers.dev web.app firebaseapp.com azurewebsites.net cloudfront.net appspot.com onrender.com fly.dev glitch.me repl.co blogspot.com wordpress.com myshopify.com vercel.dev netlify.com surge.sh render.com railway.app koyeb.app deno.dev ngrok.io ngrok-free.app trycloudflare.com cloudfunctions.net run.app s3.amazonaws.com elasticbeanstalk.com azurestaticapps.net wixsite.com webflow.io framer.app bubbleapps.io".split(" ")),Ds=new Set("co com net org edu gov gob go ac or ne ltd plc sch mil nom".split(" "));function Hs(t){let e=t.toLowerCase().split(".");for(let n=1;n<e.length-1;n++)if(Ls.has(e.slice(n).join("."))||n===e.length-2&&e[n+1].length===2&&Ds.has(e[n]))return e.slice(n-1).join(".")}function Ns(t=location.hostname){if(/^[\d.]+$/.test(t)||t.includes(":"))return;let e=t.split(".");for(let n=e.length-2;n>=0;n--){let r=e.slice(n).join(".");if(document.cookie=`__lc_probe=1; Domain=${r}; Path=/; Max-Age=10; SameSite=Lax`,document.cookie.includes("__lc_probe=1"))return document.cookie=`__lc_probe=; Domain=${r}; Path=/; Max-Age=0`,r}return Hs(t)}var Xe=class{constructor(e={}){this.o=e}o;domain=null;attr(){if(this.domain===null)try{this.domain=this.o.domain??(this.o.crossSubdomain?Ns():void 0)}catch{this.domain=void 0}return this.domain?`; Domain=${this.domain}`:""}held=new Map;read(e){try{for(let n of document.cookie.split("; ")){let r=n.indexOf("=");if(n.slice(0,r)===e)return decodeURIComponent(n.slice(r+1))}}catch{}return null}get(e){return this.read(e)??this.held.get(e)??null}set(e,n){let r=this.o.secure??location.protocol==="https:"?"; Secure":"",o=Math.round((this.o.expiryDays??js)*86400);try{document.cookie=`${e}=${encodeURIComponent(n)}; Max-Age=${o}; Path=/${this.attr()}; SameSite=Lax${r}`}catch{}this.read(e)===n?this.held.delete(e):this.held.set(e,n)}remove(e){this.held.delete(e);try{document.cookie=`${e}=; Max-Age=0; Path=/${this.attr()}; SameSite=Lax`}catch{}}},fe=class{constructor(e="localStorage"){this.kind=e}kind;store(){try{return globalThis[this.kind]}catch{return}}get(e){try{return this.store()?.getItem(e)??null}catch{return null}}set(e,n){try{this.store()?.setItem(e,n)}catch{}}remove(e){try{this.store()?.removeItem(e)}catch{}}},Nt=class extends fe{constructor(){super("localStorage")}},qs=["lc_identity","lc_session","lc_device_id","lc_consent","lc_person_identified"],qt=class{constructor(e,n,r){this.cookie=e;this.local=n;this.cookieKeys=r}cookie;local;cookieKeys;get(e){let[n,r]=this.cookieKeys(e)?[this.cookie,this.local]:[this.local,this.cookie];return n.get(e)??r.get(e)}set(e,n){this.local.set(e,n),this.cookieKeys(e)?this.cookie.set(e,n):this.cookie.remove(e)}remove(e){this.local.remove(e),this.cookie.remove(e)}},Ye=class{constructor(e,n){this.inner=e;this.delayMs=n}inner;delayMs;pending=new Map;timer;get(e){return this.pending.has(e)?this.pending.get(e)??null:this.inner.get(e)}set(e,n){this.queue(e,n)}remove(e){this.queue(e,null)}queue(e,n){this.pending.set(e,n),this.timer??=setTimeout(()=>this.flush(),this.delayMs)}flush(){clearTimeout(this.timer),this.timer=void 0;for(let[e,n]of this.pending)n===null?this.inner.remove(e):this.inner.set(e,n);this.pending.clear()}},Ut=class{constructor(e,n){this.inner=e;this.suffix=n}inner;suffix;get(e){return this.inner.get(e+this.suffix)}set(e,n){this.inner.set(e+this.suffix,n)}remove(e){this.inner.remove(e+this.suffix)}},Je=t=>`_${t.replace(/\W/g,"").slice(-8)}`;function Qe(t,e,n){if(t==="memory"||t==="none")return new Ht;let r=Je(e),o=t==="cookie"?new Xe(n):t==="localStorage+cookie"?new qt(new Xe(n),new Nt,s=>qs.some(i=>s===i+r)):new fe(t);return new Ut(o,r)}function Or(t,e,n){let r=Je(e),o=new Set;try{for(let s of document.cookie.split("; "))o.add(s.split("=")[0]);for(let s of[globalThis.localStorage,globalThis.sessionStorage])for(let i=0;i<s.length;i++)o.add(s.key(i))}catch{}for(let s of o)if(!(!s.startsWith("lc_")||!s.endsWith(r)||s===n+r)){t.remove(s.slice(0,-r.length));try{localStorage.removeItem(s),sessionStorage.removeItem(s)}catch{}}}async function Us(t){if(!(typeof CompressionStream>"u"||typeof Response>"u"))try{let e=new Response(t).body?.pipeThrough(new CompressionStream("gzip"));return e?new Uint8Array(await new Response(e).arrayBuffer()):void 0}catch{return}}function Ar(t,e={}){let n=e.compress??!0,r=(o,s)=>(e.onError?.({url:o,status:s}),{status:s});return{async send(o,s,i){if(i?.beacon&&!e.disableBeacon&&typeof navigator<"u"&&navigator.sendBeacon)return navigator.sendBeacon(o,new Blob([s],{type:"text/plain"}))?{status:200}:r(o,0);try{let a=n&&s.length>=1024?await Us(s):void 0,c=await t(a?`${o}${o.includes("?")?"&":"?"}compression=gzip`:o,{method:"POST",body:a??s,headers:{...e.headers,"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:(a?.length??s.length)<6e4});return c.status>=400?r(o,c.status):{status:c.status}}catch{return r(o,0)}}}}var Bt={send:async()=>({status:200})};var Bs="lucida-browser",Kt="0.1.6",Wt="lc_internal",Ws=3e3,Ze="https://capture.lucidace.com",Vt=t=>!!t&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype;function Ir(t,e={},n=[]){if(typeof window>"u"||typeof navigator>"u")return vr();let r=!!e.debug||typeof location<"u"&&/[?&]__(lc|lucida)_debug=(1|true)/.test(location.search),o=(...u)=>{r&&console.debug("[lucida]",...u)},s=(e.apiHost??Ze).replace(/\/+$/,""),i=Object.fromEntries(Object.entries(e).map(([u,m])=>[u,Vt(m)?{...m}:m]));i.apiHost=s;let a=e.extension??Ve(),c=u=>a&&(u==="cookie"||u==="localStorage+cookie")?e.extensionPersistence??"localStorage":u,l=c(e.cookieless==="always"?"none":e.persistence??"cookie"),d=[s,...e.flagsApiHost?[e.flagsApiHost.replace(/\/+$/,"")]:[]],f=e.fetch??((...u)=>fetch(...u)),y=u=>pr(u,f,d,e.rewritePath),g=y(Bt).fetch,x=e.consent?.respectDnt,v=navigator.globalPrivacyControl===!0,w=(e.respectDnt??x)===!0&&navigator.doNotTrack==="1"||(e.respectGpc??x)===!0&&v,C=e.blockBots!==!1&&typeof navigator<"u"&&or(navigator.userAgent??"",e.blockedUserAgents),R=!!e.disabled||C;C&&o("bot user agent: capture disabled");let L,Y=y(e.transport??Ar(f,{headers:i.requestHeaders,onError:e.onRequestError,disableBeacon:e.disableBeacon})).transport;if(!e.transport&&e.offlineQueue!==!1&&l!=="memory"&&l!=="none"){let u=new ne(new fe(l==="sessionStorage"?"sessionStorage":"localStorage"),()=>h.hasConsent("analytics"));Y=L=mt(Y,u,{key:`lc_offline${Je(t)}`,isOnline:()=>navigator.onLine!==!1})}let T=R?void 0:_r(e.crossDomains),$=Qe(R?"memory":l,t,e.cookie),F=(e.storageWriteDelayMs??0)>0?new Ye($,e.storageWriteDelayMs):void 0,O=T?.sessionId??e.bootstrap?.sessionId,q,A=!1,H,M=[],h=new ye({apiKey:t,apiHost:s,transport:R?Bt:Y,storage:F??$,...e.consentPersistence&&!R?{consentStorage:Qe(c(e.consentPersistence),t,e.cookie)}:{},persistProperty:u=>!i.persistedProperties||i.persistedProperties.includes(u),...l==="none"?{cookieless:!0}:{},library:{name:Bs,version:Kt},consent:{...e.cookieless==="on_reject"?{cookielessOnReject:!0}:{},...e.consent,...!R&&(e.consent?.geo||e.consent?.mode!=="opt_in")?{awaitRemote:!0}:{},respectDnt:!0,dnt:w},queue:{...e.flushAt?{flushAt:e.flushAt}:{},...e.flushIntervalMs?{flushIntervalMs:e.flushIntervalMs}:{}},...T||e.bootstrap?.distinctId?{bootstrapDistinctId:T?.distinctId??e.bootstrap?.distinctId}:{},...e.bootstrap?.isIdentified&&!T?{bootstrapIdentified:!0}:{},session:{...e.session,...O?{bootstrapId:O}:{}},enrich:(u,m)=>{let _=mr(u,m,i.customCampaignParams,e.capturePageview==="hash");if(s!==Ze&&(_.properties={..._.properties,$lib_custom_api_host:s}),M.length){let S=h.sessionId;for(let E of M)_.properties={..._.properties,...E(S)}}let p=H?.()??{},b=Object.keys(p);return b.length&&(_.properties={..._.properties,$click_ids:p},u==="$pageview"&&(_.$set_once={...Object.fromEntries(b.map(S=>[`$initial_${S}`,p[S]])),..._.$set_once},_.$set=Object.fromEntries(b.map(S=>[`$last_${S}`,p[S]])))),i.sendFeatureFlags!==!1&&u!=="$snapshot"&&q&&(_.properties={...Ot(q.all()),..._.properties}),A?{..._,properties:{..._.properties,$internal:!0}}:_},campaignKey:gr,log:o});A=h.storage.get(Wt)==="1",e.clickIds!==!1&&(H=ir(h.storage,e.clickIds?.expiryDays));let j=$r(h,i,o);e.bootstrap?.isIdentified&&j.markIdentified();let J=u=>j.blocksPersonWrites?(o(`personProfiles=never: ${u} ignored`),!0):!1;R||h.onChange(u=>{u!=="consent"||h.hasConsent("analytics")||h.consentStatus()!=="denied"||(F?.flush(),Or($,t,e.consent?.storageKey||Oe))});let le=new Set;h.onChange(u=>{u==="consent"&&[...le].forEach(m=>m())});let Q=[],G=[cr(o,e.nonce)],ge=h.storage;if(e.flagPersistence&&!R){let u=new ne(Qe(c(e.flagPersistence),t,e.cookie),()=>h.hasConsent("analytics"));h.onChange(m=>{m==="consent"&&(h.hasConsent("analytics")?u.flushBuffered():u.discardBuffered())}),ge=u}let se=u=>{if(R)return;if(h.hasConsent("analytics"))return u();let m=!1;h.onChange(_=>{!m&&_==="consent"&&h.hasConsent("analytics")&&(m=!0,u())})},ie,k={core:h,client:void 0,config:i,flagStorage:ge,apiKey:t,log:o,fetch:g,onUnload:u=>{Q.push(u)},whenConsented:se,onCapture:u=>h.onCaptured(u),eventExtras:M,clickExtras:[],flagPersonProps:[],loadConfig:()=>ie??=new Promise(u=>se(()=>{g(`${s}/v1/config?api_key=${encodeURIComponent(t)}`).then(m=>m.ok?m.json():null).then(m=>(m&&h.applyRemote(m),m)).then(u,()=>u(null))}))},me=Promise.resolve();if(h.consent.resolving){let u=!1,m=g(`${s}/v1/config?api_key=${encodeURIComponent(t)}`,{credentials:"omit"}).then(_=>(u=_.status>=500,_.ok?_.json():null)).catch(()=>(u=!0,null));ie=m,me=new Promise(_=>{let p=setTimeout(()=>(h.resolveConsent("opt_in"),_()),Ws);m.then(b=>{clearTimeout(p),b?h.applyRemote(b):u?h.resolveConsent("opt_in"):h.applyRemote({}),_()})})}let Z=gt(h,{apiHost:s,apiKey:t,fetch:g,whenConsented:se,log:o,disabled:R});G.push(()=>Z.stop());let ee={get distinctId(){return h.distinctId},capture:(u,m,_)=>{h.capture(u,m,_?.timestamp!==void 0?{timestamp:_.timestamp}:{})&&(_?.sendInstantly||_?.transport)&&h.flush(_.transport==="beacon"?{beacon:!0}:{})},identify:(u,m,_)=>{J("identify")||(j.markIdentified(),h.identify(u,m,_))},alias:(u,m)=>{J("alias")||(j.markIdentified(),h.alias(u,m))},reset:u=>{h.reset({resetDeviceId:!!u,reuseAnonymousId:!!e.reuseAnonymousId}),j.reset()},createPersonProfile:()=>{J("createPersonProfile")||j.isProfile||(j.markIdentified(),h.capture("$set",{}))},setConfig:u=>{let m=i;for(let[_,p]of Object.entries(u)){let b=m[_];Vt(b)&&Vt(p)?Object.assign(b,p):m[_]=p}"debug"in u&&(r=!!u.debug)},setPersonProperties:(u,m)=>{!u&&!m||J("setPersonProperties")||(j.markIdentified(),h.capture("$set",{},{...u?{$set:u}:{},...m?{$set_once:m}:{}}))},unsetPersonProperties:u=>{!u.length||J("unsetPersonProperties")||(j.markIdentified(),h.capture("$set",{},{$unset:u}))},getDistinctId:()=>h.distinctId,getSessionId:()=>h.sessionId,onSessionId:u=>h.onSessionId(m=>u(m)),getProperty:u=>h.getProperty(u),hasOptedOut:()=>h.consentStatus()==="denied",hasOptedIn:()=>h.consentStatus()==="granted",onConsent:u=>(le.add(u),()=>{le.delete(u)}),getReplayUrl:u=>{let _=`${(e.uiHost??s).replace(/\/+$/,"")}/replays/${encodeURIComponent(h.sessionId)}`,p=h.sessionStart;return!u?.withTimestamp||p===void 0?_:`${_}?t=${Math.max(0,Math.round((Date.now()-p)/1e3-(u.timestampLookBackSeconds??10)))}`},debug:(u=!0)=>{r=u},featureView:(u,m)=>{h.capture("$feature_view",{...m,$feature_flag:u},{$set:{[`$feature_view/${u}`]:!0}})},featureInteraction:(u,m)=>{h.capture("$feature_interaction",{...m,$feature_flag:u},{$set:{[`$feature_interaction/${u}`]:!0}})},updateFlags:(u,m,_)=>k.flags?.update(u,m,_?.merge??!0),register:u=>h.register(u),registerOnce:u=>h.registerOnce(u),unregister:u=>h.unregister(u),group:(u,m,_)=>{j.markIdentified(),h.group(u,m,_)},optIn:(u=["analytics","replay"])=>h.setConsent({analytics:u.includes("analytics"),replay:u.includes("replay"),marketing:u.includes("marketing")}),optOut:()=>h.optOut(),optOutInternal:(u=!0)=>{A=u,u?h.storage.set(Wt,"1"):h.storage.remove(Wt)},get isInternal(){return A},setConsent:u=>h.setConsent(u),getConsent:()=>h.getConsent(),getConsentStatus:u=>h.getConsentStatus(u),consentStatus:()=>h.consentStatus(),getFlag:u=>k.flags?.get(u),getFlagPayload:u=>k.flags?.payload(u),getFlagResult:(u,m)=>k.flags?.result(u,m)??ce(u,void 0,void 0,"not_found"),getLayerParam:(u,m,_)=>k.flags?.layerParam(u,m)??_,isFeatureEnabled:u=>{let m=k.flags?.get(u);return m!==void 0&&m!==!1},onFlags:u=>k.flags?.onChange(u)??(()=>{}),onIntervention:u=>Z.on(u),reloadFlags:()=>k.flags?.reload()??Promise.resolve(),getAllFlags:()=>k.flags?.all()??{},overrideFlags:(u,m)=>k.flags?.override(u,m),setPersonPropertiesForFlags:(u,m)=>k.flags?.setPersonProperties(u,m),resetPersonPropertiesForFlags:()=>k.flags?.resetPersonProperties(),setGroupPropertiesForFlags:(u,m)=>k.flags?.setGroupProperties(u,m),resetGroupPropertiesForFlags:()=>k.flags?.resetGroupProperties(),setContext:(u,m,_)=>k.flags?.setContext(u,m,_),clearContext:u=>k.flags?.clearContext(u),guides:{showChangelog:()=>k.guides?.showChangelog()??0,show:u=>k.guides?.show(u)??!1,reset:u=>k.guides?.reset(u)},ai:{startConversation:u=>new we((m,_)=>ee.capture(m,_),u,i.ai?.captureText===!0).start()},earlyAccess:{list:()=>k.earlyAccess?.list()??Promise.resolve([]),optIn:u=>k.earlyAccess?.optIn(u),optOut:u=>k.earlyAccess?.optOut(u)},replay:{start:u=>k.replay?.start(u)??Promise.resolve(),stop:()=>k.replay?.stop(),pause:()=>k.replay?.pause(),resume:()=>k.replay?.resume(),tag:u=>k.replay?.tag(u),isRecording:()=>k.replay?.isRecording()??!1},consent:{showBanner:u=>k.consentUi?.showBanner(u)??Promise.resolve(null),hideBanner:()=>k.consentUi?.hideBanner()},loadToolbar:u=>k.toolbar?.load(typeof u=="string"?u:u.token)??Promise.resolve(!1),activateExperiment:u=>k.experiments?.activate(u),recommendations:(u,m)=>k.recs?.get(u,m)??Promise.resolve({placement:u,strategy:"",items:[],shown(){},clicked(){}}),flush:()=>me.then(()=>h.flush()),shutdown:async()=>{for(let u of G)u();F?.flush(),await h.shutdown()}};if(k.client=ee,!R){let u=()=>{for(let _ of Q)_();F?.flush(),h.flush({beacon:!0})};window.addEventListener("pagehide",u);let m=()=>{document.visibilityState==="hidden"&&h.flush({beacon:!0})};if(document.addEventListener("visibilitychange",m),G.push(()=>{window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",m)}),L){let _=()=>{L.drain()};window.addEventListener("online",_),G.push(()=>window.removeEventListener("online",_)),se(_)}if(e.captureCspViolations){let _=typeof e.captureCspViolations=="object"?e.captureCspViolations:{};G.push(lr((p,b)=>{h.capture(p,b)},_))}for(let _ of n){let p=_(k);p&&G.push(p)}q=k.flags,n.length||k.loadConfig(),fr(k,ee,s)}return Ge(ee,e.exposeGlobal),o("initialised",{apiHost:s,consent:h.getConsent()}),ee}var Vs='[data-lc-region="article"]';function Mr(t,e,n){if(e.articles===!1)return()=>{};let r;t.loadConfig().then(v=>{typeof v?.article_selector=="string"&&(r=v.article_selector)});let o=()=>{for(let v of[e.articleSelector,r,Vs])if(v)try{let w=document.querySelector(v);if(w)return w}catch{}return null},s=location.href,i=location.pathname,a=null,c=0,l=!1,d=()=>{if(a??=o(),!a)return;let v=a.getBoundingClientRect();if(v.height<=0)return;let w=Math.round(Math.min(100,Math.max(0,(window.innerHeight-v.top)/v.height*100)));c=Math.max(c,w);let C=a.querySelector("h1,h2");C&&C.getBoundingClientRect().bottom<0&&(l=!0)},f=()=>{!a||!n()||(d(),t.client.capture("$article_read",{$article_id:(a.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||i,$article_depth:c,$article_finished:c>=90,$article_headline_exit:!l&&c<25}),a=null)},y=()=>{f(),a=null,c=0,l=!1,s=location.href,i=location.pathname},g=()=>location.href!==s?y():d(),x=new MutationObserver(g);return x.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",g,{passive:!0}),t.onUnload(f),d(),()=>{x.disconnect(),window.removeEventListener("scroll",g)}}var et="data-lc-content",Ks="data-lc-content-piece",Gs="data-lc-content-target";var Gt=(t,e)=>(t.getAttribute(e)??"").trim().slice(0,200);function Tr(t,e,n){if(e.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let r=new WeakSet,o=d=>{let f={$content_name:Gt(d,et)},y=Gt(d,Ks),g=Gt(d,Gs);return y&&(f.$content_piece=y),g&&(f.$content_target=g),f},s=location.href,i=new IntersectionObserver(d=>{for(let f of d)!f.isIntersecting||r.has(f.target)||!n()||(r.add(f.target),t.client.capture("$content_impression",o(f.target)))},{threshold:.5}),a=d=>d.querySelectorAll(`[${et}]`).forEach(f=>i.observe(f));a(document);let c=new MutationObserver(()=>{location.href!==s&&(s=location.href,i.disconnect(),document.querySelectorAll(`[${et}]`).forEach(d=>r.delete(d))),a(document)});c.observe(document.documentElement,{childList:!0,subtree:!0});let l=d=>{let f=d.target?.closest?.(`[${et}]`);f&&n()&&t.client.capture("$content_interaction",{...o(f),$content_interaction_type:"click"})};return document.addEventListener("click",l,!0),()=>{i.disconnect(),c.disconnect(),document.removeEventListener("click",l,!0)}}var zs=new Set(["input","textarea","select","option"]),Xs=["name","type","role","aria-label","title","alt","placeholder"],Ys=/(?:\d[ -]?){9,}/;function Js(t){if(zs.has(t.tagName.toLowerCase())||t.isContentEditable)return;let e="";for(let n of Array.from(t.childNodes))n.nodeType===3&&(e+=n.textContent??"");if(e=e.replace(/\s+/g," ").trim(),!(!e||Ys.test(e)))return e.slice(0,255)}function Fr(t){if(!t?.length)return()=>!1;let e=t.map(n=>n.toLowerCase());return n=>e.some(r=>r.endsWith("*")?n.startsWith(r.slice(0,-1)):n===r)}var Qs="***";function nt(t){let e={};for(let n=t,r=0;n&&r<10;n=n.parentElement,r++)for(let o of Array.from(n.attributes)){let s=o.name.startsWith("data-lc-attr-")?o.name.slice(13):"";s&&!(s in e)&&!s.startsWith("$")&&(e[s]=o.value.slice(0,255))}return e}function Zs(t,e,n,r){let o=t.parentElement,s=o?Array.from(o.children):[t],i={tag_name:t.tagName.toLowerCase(),nth_child:s.indexOf(t)+1,nth_of_type:s.filter(d=>d.tagName===t.tagName).indexOf(t)+1},a=(t.getAttribute("class")??"").split(/\s+/).filter(Boolean);a.length&&!n("class")&&(i.classes=a),t.id&&!n("id")&&(i.attr__id=r("id",t.id));let c=t.getAttribute("href");c&&!n("href")&&(i.href=r("href",c.slice(0,1024)));let l={};for(let d of Array.from(t.attributes))(d.name.startsWith("data-lc-")||Xs.includes(d.name))&&!n(d.name)&&(l[d.name]=r(d.name,d.value.slice(0,255)));if(Object.keys(l).length&&(i.attrs=l),e){let d=Js(t);d&&(i.text=d)}return i}function rt(t,e,n,r,o={}){let s=[],i=Fr(r),a=Fr(o.allow),c=o.maskAll?(d,f)=>a(d)?f:Qs:(d,f)=>f,l=e;for(let d=t;d&&s.length<10;d=d.parentElement)s.push(Zs(d,l,i,c)),(d===n||!n)&&(l=!1);return s}var tt=t=>t.replace(/(["\\])/g,"\\$1");function ot(t){return t.map(e=>{let n=e.tag_name+(e.classes?"."+e.classes.join("."):"")+":";e.attr__id&&(n+=`attr__id="${tt(e.attr__id)}"`),e.href&&(n+=`href="${tt(e.href)}"`),e.text&&(n+=`text="${tt(e.text)}"`);for(let[r,o]of Object.entries(e.attrs??{}))n+=`attr__${r}="${tt(o)}"`;return n+`nth-child="${e.nth_child}"nth-of-type="${e.nth_of_type}"`}).join(";")}var X=[],ei=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,ti=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,ni=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,ri="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function oi(t,e=[]){if(e.length&&t.closest(e.join(","))||t.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=t.closest(ri)??t,r=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(ei.test((n.textContent??"").trim())||ti.test(r))return!0;for(let o=n,s=0;o&&s<3;o=o.parentElement,s++)if(ni.test(o.getAttribute("class")??""))return!0;return!1}var si=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function jr(t,e=Date.now(),n={},r){if(r&&n.ignoreSelectors?.length&&r.closest(n.ignoreSelectors.join(",")))return{};if(r&&n.suppressSteppers!==!1&&oi(r,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&si())return{};let o=n.windowMs??1e3,s=n.radiusPx??30;for(X.length&&e<X[X.length-1].t&&(X.length=0),X.push({t:e,x:t.clientX,y:t.clientY});X.length&&e-X[0].t>o;)X.shift();let i=X.filter(a=>Math.hypot(a.x-t.clientX,a.y-t.clientY)<=s).length;return i>=(n.count??3)?{$rageclick:!0,$rageclick_count:i}:{}}function Lr(t,e,n=700){if(typeof MutationObserver>"u")return;let r=!1,o=new MutationObserver(()=>r=!0);o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let s=()=>{r=!0};window.addEventListener("scroll",s,{capture:!0,passive:!0}),document.addEventListener("selectionchange",s);let i=()=>{o.disconnect(),window.removeEventListener("scroll",s,{capture:!0}),document.removeEventListener("selectionchange",s)},a=setTimeout(()=>{i(),!r&&document.visibilityState!=="hidden"&&t.client.capture("$deadclick_hint",{$selector:e,$no_mutation_ms:n})},n);t.onUnload(()=>{clearTimeout(a),i()})}var Dr=/^[A-Za-z_][\w-]*$/,ii=5;function ai(t){let e=[];for(let n=t;n&&e.length<ii;n=n.parentElement){let r=n.tagName.toLowerCase();if(n.id&&Dr.test(n.id)){e.unshift(`${r}#${n.id}`);break}let o=(n.getAttribute("class")??"").split(/\s+/).filter(s=>Dr.test(s)).slice(0,2);e.unshift(r+o.map(s=>`.${s}`).join(""))}return e.join(" ")}function Hr(t,e,n,r,o={}){let s={$selector:ai(n),$el_interactive:r};(e.clientX||e.clientY||e.detail)&&(s.$click_x=Math.round(e.clientX+(window.scrollX||0)),s.$click_y=Math.round(e.clientY+(window.scrollY||0))),o.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(s,jr(e,Date.now(),o.rageClicks||{},n));let i=o.deadClicks;!r&&e.isTrusted&&i!==!1&&!(i?.ignoreSelectors?.length&&n.closest(i.ignoreSelectors.join(",")))&&Lr(t,s.$selector,i?.waitMs);for(let a of t.clickExtras)Object.assign(s,a(e,n));return s}var ci="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",li="[data-lc-ignore]",zt=t=>t.some(e=>typeof e=="string"?location.href.includes(e):e.test(location.href)),ui=t=>!t?.length||zt(t),Xt=t=>({maskAll:t.maskAllAttributes,allow:t.attributeAllowlist}),Re=(t,e)=>!!t.closest(li)||!!(e.denySelectors?.length&&t.closest(e.denySelectors.join(",")));function Nr(t,e,n,r=()=>!0){let o=e.events??["click","change","submit"],s=0,i=l=>{let d=l.target;!n()||!r()||l.isComposing||!(d instanceof Element)||Re(d,e)||d instanceof HTMLInputElement&&d.type==="password"||(s+=1)},a=l=>d=>{if(!n()||l!=="click"&&!r())return;let f=d.target;if(!(f instanceof Element)||Re(f,e)||e.allowSelectors?.length&&!f.closest(e.allowSelectors.join(","))||e.elementAllowlist?.length&&!f.closest(e.elementAllowlist.join(","))||!ui(e.urlAllowlist)||l==="change"&&!/^(input|select|textarea)$/i.test(f.tagName)||f instanceof HTMLInputElement&&f.type==="password")return;let y=f.closest(ci);if(l==="click"&&!y&&!e.allowSelectors?.length)return;let g=rt(f,e.captureText??!0,y??void 0,e.attributeIgnore,Xt(e)),x=g.find(w=>w.text)?.text,v=s;s=0,t.client.capture("$autocapture",{...nt(f),$event_type:l,...v>0?{$keystroke_count:v}:{},$elements:g,$elements_chain:ot(g),...x?{$el_text:x}:{},...l==="click"?Hr(t,d,f,!!y,e):{}})};t.autocaptureClicks=o.includes("click");let c=o.map(l=>[l,a(l)]);for(let[l,d]of c)document.addEventListener(l,d,!0);return document.addEventListener("keydown",i,!0),()=>{for(let[l,d]of c)document.removeEventListener(l,d,!0);document.removeEventListener("keydown",i,!0)}}var di='[contenteditable]:not([contenteditable="false"])',qr="input,textarea,select",pi=255;function fi(t){return t.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,pi)}var gi=t=>t?t instanceof Element?t:t.parentElement:null;function Ur(t,e,n,r=()=>!0){let o=e.events??["click","change","submit"],s=e.contentEditable!==!1&&o.includes("change"),i=new WeakSet,a=y=>{let g=rt(y,!1,y,e.attributeIgnore,Xt(e));return{...nt(y),$elements:g,$elements_chain:ot(g)}},c=y=>{let g=y instanceof Element?y.closest(di):null;return g&&!Re(g,e)?g:null},l=y=>{let g=n()&&r()?c(y.target):null;g&&i.add(g)},d=y=>{let g=c(y.target);!g||!i.has(g)||y.relatedTarget instanceof Node&&g.contains(y.relatedTarget)||(i.delete(g),n()&&r()&&t.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...a(g)}))},f=y=>{if(!n()||!e.copyCut)return;let g=typeof getSelection=="function"?getSelection():null,x=y.target instanceof Element?y.target:null,v=gi(g?.anchorNode)??x;if(!v||Re(v,e)||v.closest(qr)||x?.closest(qr))return;let w=e.captureCopiedText?fi(g?.toString()??""):"";t.client.capture("$copy_autocapture",{$copy_type:y.type,...a(v),...w?{$selected_content:w}:{}})};return s&&(document.addEventListener("input",l,!0),document.addEventListener("focusout",d,!0)),document.addEventListener("copy",f,!0),document.addEventListener("cut",f,!0),()=>{document.removeEventListener("input",l,!0),document.removeEventListener("focusout",d,!0),document.removeEventListener("copy",f,!0),document.removeEventListener("cut",f,!0)}}var mi="[data-lc-ignore]",hi=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],yi=["q","s","search","query"],Br=t=>t.origin+t.pathname;function Wr(t,e,n){let r=Array.isArray(e.fileDownloads)?e.fileDownloads.map(s=>s.toLowerCase()):hi,o=[];if(e.outboundLinks!==!1||e.fileDownloads!==!1){let s=i=>{let a=i.target instanceof Element?i.target.closest("a[href]"):null;if(!a||!n()||a.closest(mi))return;let c;try{c=new URL(a.href,location.href)}catch{return}if(c.protocol!=="http:"&&c.protocol!=="https:")return;let l=decodeURIComponent(c.pathname.split("/").pop()??""),d=l.includes(".")?l.split(".").pop().toLowerCase():"";e.fileDownloads!==!1&&(a.hasAttribute("download")||r.includes(d))?t.client.capture("$file_download",{$url:Br(c),$file_name:l,$file_extension:d}):e.outboundLinks!==!1&&c.host!==location.host&&t.client.capture("$outbound_click",{$url:Br(c),$outbound_host:c.host})};document.addEventListener("click",s,!0),o.push(()=>document.removeEventListener("click",s,!0))}if(e.siteSearch!==!1){let s=typeof e.siteSearch=="object"&&e.siteSearch.params?e.siteSearch.params:yi,i=!0;o.push(()=>{i=!1}),t.onCapture(a=>{if(!i||a.event!=="$pageview"||!n())return;let c=new URLSearchParams(location.search);for(let l of s){let d=c.get(l)?.trim();if(d)return void t.client.capture("$site_search",{$search_term:d.slice(0,200),$search_param:l})}})}return()=>o.forEach(s=>s())}var vi=[25,50,75],bi="data-lc-media-title";function Vr(t){let e=t.currentSrc||t.src;if(!e||e.startsWith("blob:")||e.startsWith("data:"))return"";try{let n=new URL(e,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var _i=t=>(t.getAttribute(bi)??t.getAttribute("title")??t.getAttribute("aria-label")??"").trim().slice(0,200);function Kr(t,e,n){if(e.media===!1)return()=>{};let r=new WeakMap,o=c=>{let l={$media_type:c instanceof HTMLVideoElement?"video":"audio",$media_src:Vr(c)},d=_i(c);return d&&(l.$media_title=d),Number.isFinite(c.duration)&&(l.$media_duration=Math.round(c.duration)),l},s=c=>{let l=Vr(c);if(!l)return null;let d=r.get(c);return(!d||d.src!==l)&&r.set(c,d={src:l,played:!1,reached:new Set,done:!1}),d},i=c=>{let l=c.target;if(!(l instanceof HTMLMediaElement)||!n())return;let d=s(l);if(d)if(c.type==="play"){if(d.done&&Object.assign(d,{played:!1,reached:new Set,done:!1}),d.played)return;d.played=!0,t.client.capture("$media_play",o(l))}else if(c.type==="timeupdate"){if(!d.played||d.done||!Number.isFinite(l.duration)||l.duration<=0)return;let f=l.currentTime/l.duration*100;for(let y of vi)f>=y&&!d.reached.has(y)&&(d.reached.add(y),t.client.capture("$media_progress",{...o(l),$media_progress:y}))}else c.type==="ended"&&d.played&&!d.done&&(d.done=!0,t.client.capture("$media_complete",o(l)))},a=["play","timeupdate","ended"];return a.forEach(c=>document.addEventListener(c,i,!0)),()=>a.forEach(c=>document.removeEventListener(c,i,!0))}function Gr(t=()=>performance.now()){let e=()=>document.visibilityState!=="hidden",n=0,r=e()?t():null,o=()=>{e()?r===null&&(r=t()):(r!==null&&(n+=t()-r),r=null)};return document.addEventListener("visibilitychange",o),{read:()=>Math.round(n+(r===null?0:t()-r)),reset:()=>{n=0,r=e()?t():null},stop:()=>document.removeEventListener("visibilitychange",o)}}zr();var Xr=255,wi=new Set(["input","textarea","select","option"]),ki="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Si=new Set(["value","password","autocomplete"]),Ci=/(?:\d[ -]?){9,}/,Ee=new WeakMap,Jt=new WeakMap;function Yr(t,e){let n=Jt.get(t);if(n)return new Promise(r=>{let o=setTimeout(r,e);n.then(()=>(clearTimeout(o),r()))})}function Ri(t){return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!="object")return!1;let n=e;return typeof n.name=="string"&&n.name!==""&&!n.name.startsWith("$")&&typeof n.selector=="string"&&(n.source==="text"||n.source==="attribute"&&typeof n.attribute=="string")&&Array.isArray(n.events)}):[]}function Ei(t){if(!t||wi.has(t.tagName.toLowerCase())||t.isContentEditable)return!1;try{return!t.closest(ki)}catch{return!1}}function Pi(t,e){if(t.source==="attribute"){let r=(t.attribute??"").toLowerCase();if(!r||Si.has(r)||r.startsWith("on"))return;let o=e.getAttribute(r);return o===null?void 0:o.slice(0,Xr)}let n=(e.textContent??"").replace(/\s+/g," ").trim();if(!(!n||Ci.test(n)))return n.slice(0,Xr)}function Jr(t,e,n,r=location.href){let o={};for(let s of t){if(!s.events.includes(e)||s.url&&!Yt([s.url],r))continue;let i=null;try{i=s.scope==="target"?e==="click"&&n?n.closest(s.selector):null:document.querySelector(s.selector)}catch{continue}if(!Ei(i))continue;let a=Pi(s,i);a!==void 0&&(o[s.name]=a)}return o}function Qr(t){let e=!0,n=t.loadConfig().then(r=>{e&&Ee.set(t,Ri(r?.snapshot_properties)),Jt.delete(t)});return Jt.set(t,n),t.clickExtras.push((r,o)=>e?Jr(Ee.get(t)??[],"click",o):{}),()=>{e=!1,Ee.delete(t)}}function Zr(t){let e=Ee.get(t);return e?.length?Jr(e,"pageview"):{}}function eo(t){return!!Ee.get(t)?.some(e=>e.events.includes("pageview"))}var $i=t=>{try{return new URL(t).pathname}catch{return t}};function Oi(t){for(let e of t===void 0?[]:Array.isArray(t)?t:[t])try{let n=document.querySelector(e);if(n)return n}catch{}}function to(t){let e=0,n=0,r=()=>{let o=Oi(t),s=document.documentElement,i=o?o.scrollHeight:Math.max(s.scrollHeight,document.body?.scrollHeight??0),a=o?o.scrollTop:window.scrollY||window.pageYOffset||0,c=Math.min(i,a+(o?o.clientHeight:window.innerHeight));c>e&&(e=c,n=i>0?Math.min(100,Math.round(c/i*100)):0)};return r(),window.addEventListener("scroll",r,{passive:!0,capture:!0}),window.addEventListener("resize",r,{passive:!0}),{read:()=>({pct:n,px:e}),stop:()=>{window.removeEventListener("scroll",r,{capture:!0}),window.removeEventListener("resize",r)}}}var Ai=800,Ii=t=>t.core.hasConsent("analytics")||t.core.consent.resolving;function Mi(t){return t==="history"?{path:!0,search:!0}:t==="hash"?{path:!0,search:!0,hash:!0}:typeof t=="object"?t:void 0}function Ti(t,e,n){try{let r=new URL(t),o=new URL(e);return!!(n.path&&r.pathname!==o.pathname||n.search&&r.search!==o.search||n.hash&&r.hash!==o.hash)}catch{return t!==e}}function st(t,e,n={}){let r=n.views??!0,o=n.leave??!0,s=Mi(e),i=t.config.scrollRoot,a=location.href,c=a,l=Date.now(),d=to(i),f=Gr(),y,g=()=>{if(!o||y===a)return;y=a;let{pct:O,px:q}=d.read();t.client.capture("$pageleave",{$current_url:a,$scroll_depth:O,$scroll_depth_px:q,$engagement_time_ms:f.read()})},x=!1,v=(O,q={})=>{if(!r)return;let{core:A}=t;if(!A.hasConsent("analytics")&&!A.anonymousOnReject&&!(A.consent.pending&&A.consent.queueBeforeConsent)){if(!x){x=!0;let H=()=>{x&&(x=!1,v())};t.whenConsented(H),A.onChange(M=>{M==="consent"&&A.anonymousOnReject&&H()})}return}t.client.capture("$pageview",{...Zr(t),...O===void 0?{}:{$referrer:O},...q})},w,C=()=>{let O=w;w=void 0,O?.()},R=O=>{if(location.href===c)return;let q=c;if(c=location.href,!s||!Ti(q,c,s))return;let A=a;g(),d.stop();let H=new Date(l);a=location.href,l=Date.now(),d=to(i),f.reset();let M={$navigation_type:O,$prev_pageview_pathname:$i(A),$prev_pageview_duration:Math.round((l-H.getTime())/100)/10};eo(t)?setTimeout(()=>v(A,M),0):(C(),w=()=>v(A,M),queueMicrotask(C))};t.onUnload(g);let L=Ii(t)?Yr(t,Ai):void 0;if(L?(w=()=>v(),t.onUnload(C),L.then(C)):v(),!s)return()=>(d.stop(),f.stop());let{pushState:Y,replaceState:T}=history;history.pushState=function(...O){C(),Y.apply(this,O),R("pushState")},history.replaceState=function(...O){C(),T.apply(this,O),R("replaceState")};let $=()=>R("popstate"),F=()=>R("hashchange");return window.addEventListener("popstate",$),s.hash&&window.addEventListener("hashchange",F),()=>{window.removeEventListener("hashchange",F),history.pushState=Y,history.replaceState=T,window.removeEventListener("popstate",$),d.stop(),f.stop()}}var no=t=>{let e=[],n=t.config.autocapture,r=!1,o=!1;if(n!==!1){let a=typeof n=="object"?n:{},c=()=>!r&&!(a.urlIgnorelist?.length&&zt(a.urlIgnorelist)),l=()=>!o;e.push(Nr(t,a,c,l),Ur(t,a,c,l),Wr(t,a,c),Tr(t,a,c),Mr(t,a,c),Kr(t,a,c),Qr(t)),n===void 0&&t.loadConfig().then(d=>r=d?.autocapture===!1),t.loadConfig().then(d=>o=d?.autocapture_inputs===!1)}let s=t.config.capturePageview??"history",i=t.config.capturePageleave??"if_capture_pageview";return s!==!1&&i!==!1?e.push(st(t,s)):s!==!1?e.push(st(t,s,{leave:!1})):i===!0&&e.push(st(t,"history",{views:!1})),()=>e.forEach(a=>a())};Se();var Fi="lc_preview",Qt="lc_preview";function ji(t){let e={};for(let n of(t??"").split(",")){let r=n.indexOf(":");r>0&&r<n.length-1&&(e[n.slice(0,r)]=n.slice(r+1))}return e}function ro(t){let e=new URL(t).searchParams.get(Fi),n=null;try{n=sessionStorage.getItem(Qt)}catch{}return{forced:ji(e==="off"?null:e??n),persist(){try{e==="off"?sessionStorage.removeItem(Qt):e&&sessionStorage.setItem(Qt,e)}catch{}}}}Ce();Ke();var Zt="lc_flag_initial";function Li(t){try{return t?new URL(t).hostname:""}catch{return""}}function Di(){let t=new URLSearchParams(location.search),e={$initial_referrer:document.referrer||"$direct",$initial_referring_domain:Li(document.referrer)||"$direct",$initial_current_url:location.href.split("#")[0]};for(let n of[...oe,...K]){let r=t.get(n);r&&(e[`$initial_${n}`]=r)}return e}function io(t,e){if(typeof location>"u")return{};let n=t.get(Zt);if(n)try{return JSON.parse(n)}catch{}let r=Di();return e(()=>{t.get(Zt)||t.set(Zt,JSON.stringify(r))}),r}function Hi(){let t=navigator.userAgent,e=/Edg\//.test(t)?"Edge":/OPR\/|Opera/.test(t)?"Opera":/Firefox\//.test(t)?"Firefox":/Chrome\/|CriOS/.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"Other",n=/Windows/.test(t)?"Windows":/Android/.test(t)?"Android":/iPhone|iPad|iPod/.test(t)?"iOS":/Mac OS X/.test(t)?"Mac OS X":/CrOS/.test(t)?"Chrome OS":/Linux/.test(t)?"Linux":"Other";return{browser:e,os:n}}function ao(){if(typeof location>"u"||typeof navigator>"u")return{};let t={},e=new URLSearchParams(location.search);for(let o of[...oe,...K]){let s=e.get(o);s&&(t[`$${o}`]=s)}let{browser:n,os:r}=Hi();return t.$browser=n,t.$os=r,t.$device_type=String(en().$device_type??"Desktop"),t}function en(){if(typeof window>"u")return{};let t=window.innerWidth;return{$viewport_width:t,$viewport_height:window.innerHeight,$screen_width:screen.width,$screen_height:screen.height,$browser_language:navigator.language,$device_type:Ni(t)}}function Ni(t,e=navigator){let n=e.userAgent??"";return/iPad|Tablet|PlayBook|Silk|Kindle/i.test(n)||/Macintosh/.test(n)&&(e.maxTouchPoints??0)>1?"Tablet":/Android/i.test(n)?/Mobile/i.test(n)?"Mobile":"Tablet":/iPhone|iPod|Mobile|Windows Phone|BlackBerry|Opera Mini/i.test(n)||e.userAgentData?.mobile?"Mobile":/Windows|Macintosh|X11|CrOS|Linux/i.test(n)?"Desktop":t<768?"Mobile":t<1024?"Tablet":"Desktop"}var qi=/^[A-Za-z0-9_.-]{1,100}$/,Ui=/^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*){0,5}$/,Bi=new Set(["__proto__","prototype","constructor"]),Wi=50,co=200;function oo(t,e){if(!Ui.test(e))return;let n=t;for(let r of e.split(".")){if(Bi.has(r)||n===null||typeof n!="object"||typeof Node<"u"&&n instanceof Node)return;n=n[r]}if(typeof n=="string")return n.slice(0,co);if(typeof n=="number"&&Number.isFinite(n)||typeof n=="boolean")return n}function Vi(){let t=new Map;for(let e of(typeof document>"u"?"":document.cookie).split(";")){let n=e.indexOf("=");if(n<1)continue;let r=e.slice(0,n).trim(),o=e.slice(n+1).trim();try{o=decodeURIComponent(o)}catch{}t.has(r)||t.set(r,o.slice(0,co))}return t}function so(t){let e={};if(!t||typeof window>"u")return e;let n=s=>Array.isArray(s)?s.filter(i=>typeof i=="string").slice(0,Wi):[],r=n(t.cookies).filter(s=>qi.test(s));if(r.length){let s=Vi();for(let i of r){let a=s.get(i);a!==void 0&&(e[`$cookie/${i}`]=a)}}for(let s of n(t.globals)){let i=oo(window,s);i!==void 0&&(e[`$global/${s}`]=i)}let o=window.dataLayer;if(Array.isArray(o))for(let s of n(t.data_layer))for(let i=o.length-1;i>=0;i--){let a=oo(o[i],s);if(a!==void 0){e[`$datalayer/${s}`]=a;break}}return e}var lo=t=>{if(t.config.flagOptions?.disableRemote&&!t.config.localFlags?.length)return;let e;t.flagPersonProps.push(()=>e&&t.core.hasConsent("analytics")?so(e):{}),t.loadConfig().then(n=>{let r=n?.flag_targeting_sources;!r||typeof r!="object"||(e=r,Object.keys(so(r)).length&&t.flags?.reload())})};Se();function tn(t){return typeof t=="object"?t.value??t.variant??!!t.enabled:t}function nn(t){let e={value:tn(t),reason:t.reason??"remote",condition_index:t.condition_index??-1};return t.variant&&(e.variant=t.variant),t.payload!==void 0&&(e.payload=t.payload),t.runtime?.length&&(e.runtime=t.runtime.map(n=>({filters:n.filters,result:nn(n.result)}))),e}var uo="lc_rt_events",po=t=>!!t?.some(e=>e.conditions.some(n=>n.filters?.some(r=>r.type==="event")));function fo(t,e){let n;try{let i=t.flagStorage.get(uo);i&&(n=JSON.parse(i))}catch{}let r=new ve(n),o={},s=qe(e,o);return{counts:()=>r.counts(t.core.sessionId),setServer(i){o=i,s=qe(e,o)},server:()=>o,drop(i){for(let a of i)delete o[a]},resolved(){return St(o,r.counts(t.core.sessionId))},record(i,a,c){r.record(i,t.core.sessionId,a,s),c&&t.whenConsented(()=>t.flagStorage.set(uo,JSON.stringify(r.saved())))}}}var rn="lc_flags",on="lc_flag_overrides_api";function go(t){try{let e=localStorage.getItem("lc_flag_overrides");return e?JSON.parse(e)[t]:void 0}catch{return}}var mo=t=>{let{core:e,config:n}=t,r={},o={},s={},i,a,c=!1,l=0,d=new Set,f=new Set,y="",g={},x=()=>Object.keys(g).length>0,v={},w={},C={},R=new Set,L=typeof location>"u"?{forced:{},persist(){}}:ro(location.href),Y=Object.keys(L.forced).length>0,T=()=>({...r,...C}),$=t.config.flagOptions??{},F=new _e($.cacheTtlMs),O=(t.config.flagsApiHost??t.config.apiHost).replace(/\/+$/,""),q=$.keys?.length?new Set($.keys):void 0,A=p=>q?Object.fromEntries(Object.entries(p).filter(([b])=>q.has(b))):p,H=(p,b,S=!0)=>{if(r=A(p),o=A(b),c=!0,S)for(let E of R)E(T())},M=fo(t,n.localFlags),h=!1,j=()=>{h||(h=!0,queueMicrotask(()=>{h=!1,Z()}))},J=t.flagStorage.get(rn);if(J)try{let p=JSON.parse(J);r=p.values,o=p.payloads,s=Object.fromEntries(Object.keys(r).map(b=>[b,"cached"])),p.rt&&M.setServer(p.rt),F.restore(p),c=Object.keys(r).length>0}catch{}let le=t.flagStorage.get(on);if(le)try{C=JSON.parse(le)}catch{}let Q=n.bootstrap;if(Q?.flags||Q?.payloads){let p={...Q.flags};for(let b of Object.keys(Q.payloads??{}))p[b]??=!0;H({...r,...p},{...o,...Q.payloads});for(let b of Object.keys(p))s[b]="bootstrap"}let G={},ge=()=>({...$.autoProperties===!1?{}:ao(),...io(e.storage,t.whenConsented),...Object.assign({},...t.flagPersonProps.map(p=>p())),...v}),se=$.evaluationContexts?.length?{app_contexts:$.evaluationContexts}:{},ie=(p=!0)=>{let b=n.localFlags;if(!b?.length)return!0;let S=n.localFlagsContext,E=Et(b,{runtime_events:M.counts(),distinct_id:e.distinctId,...e.groups?{groups:e.groups}:{},...e.deviceId?{device_id:e.deviceId}:{},...x()?{contexts:g}:{},...se,...S,person_properties:{...ge(),...S?.person_properties},group_properties:{...S?.group_properties,...w}}),D={},I={},U=!1;for(let[te,B]of Object.entries(E))Pt(B)?U=!0:$t(B)&&(D[te]=B.value,s[te]=B.reason,B.payload!==void 0&&(I[te]=B.payload));return G=D,H({...r,...D},{...o,...I},p),U},k=p=>{let b={...r},S={...o};for(let[E,D]of Object.entries(M.resolved()))b[E]=D.value,s[E]=D.reason,D.payload!==void 0?S[E]=D.payload:delete S[E];H(b,S,p)},me=po(n.localFlags);t.onCapture(p=>{let b=me||Object.keys(M.server()).length>0;if(M.record(p.event,p.properties,b),!b)return;let S=JSON.stringify([T(),o]);if(me&&ie(!1),k(!1),JSON.stringify([T(),o])!==S)for(let E of R)E(T())});let Z=(p=!0)=>{let b=++l;return!ie()||$.disableRemote||!p&&F.fresh(e.distinctId)?Promise.resolve():new Promise(S=>{t.whenConsented(()=>{if(b!==l)return S();L.persist();let E=new AbortController,D=setTimeout(()=>E.abort(),$.timeoutMs??1e4);t.fetch(`${O}/v1/flags`,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",signal:E.signal,body:JSON.stringify({api_key:t.apiKey,...e.distinctId?{distinct_id:e.distinctId}:{},...e.anonDistinctId?{anon_distinct_id:e.anonDistinctId}:{},groups:e.groups??{},person_properties:ge(),...Object.keys(w).length?{group_properties:w}:{},device_properties:en(),...e.deviceId?{device_id:e.deviceId}:{},...x()?{contexts:g}:{},...se,...Y?{preview:L.forced}:{},...$.keys?.length?{flag_keys:$.keys}:{}})}).then(I=>I.ok?I.json():Promise.reject(new Error(`status ${I.status}`))).then(I=>{if(b!==l)return;if(I.quota_limited)return a="quota_limited",t.log("flags quota limited; keeping cached values");a=I.errors_while_computing_flags?"errors_while_computing_flags":void 0;let U={},te={},B={};for(let[$e,W]of Object.entries(I.flags??{}))U[$e]=tn(W),typeof W=="object"&&W.payload!==void 0&&(te[$e]=W.payload),s[$e]=typeof W=="object"&&typeof W.reason=="string"?W.reason:"remote",typeof W=="object"&&W.runtime?.length&&(B[$e]=nn(W));i=I.request_id,M.setServer(B);let Pe=I.errors_while_computing_flags;H({...G,...Pe?r:{},...U},Pe?{...o,...te}:te,!1),k(!0),t.flagStorage.set(rn,JSON.stringify({values:{...Pe?r:{},...U},payloads:{...Pe?o:{},...te},rt:B,...F.mark(e.distinctId)})),t.log("flags loaded",U)}).catch(I=>{let U=/^status (\d+)/.exec(String(I?.message))?.[1];b===l&&(a=E.signal.aborted?"timeout":U?`api_error_${U}`:"connection_error"),t.log("flags fetch failed",I)}).finally(()=>{clearTimeout(D),S()})})})},ee=p=>C[p]??go(p)??r[p];t.flags={get(p){let b=ee(p);if(b===void 0)return;if(p in L.forced||p in C)return b;let S=e.sessionId;S!==y&&(d.clear(),f.clear(),y=S),f.has(p)||(f.add(p),e.capture("$exposure",{$feature_flag:p,$feature_flag_response:b,...typeof b=="string"?{$feature_flag_variant:b}:{},...i?{$feature_flag_request_id:i}:{}}));let E=`${p}:${String(b)}`;return d.has(E)||(d.add(E),e.capture("$feature_flag_called",{$feature_flag:p,$feature_flag_response:b,...i?{$feature_flag_request_id:i}:{},...s[p]?{$feature_flag_reason:s[p]}:{},...s[p]==="bootstrap"?{$used_bootstrap_value:!0}:{},...a?{$feature_flag_error:a}:{}})),b},all:()=>c||Object.keys(r).length||Object.keys(C).length?T():{},payload:p=>o[p],result(p,b){let S=b?.sendExposure===!1?ee(p):this.get(p),E=p in C||go(p)!==void 0?"override":p in L.forced?"preview":s[p]??"remote";return ce(p,S,o[p],E)},layerParam(p,b){for(let[S,E]of Object.entries(o)){let D=E;if(D?.lc_layer!==p||!D.lc_params||!(b in D.lc_params))continue;let I=this.get(S);if(I!==void 0&&I!==!1)return D.lc_params[b]}},onChange(p){return R.add(p),c&&p(T()),()=>{R.delete(p)}},reload:Z,update(p,b,S=!0){for(let E of Object.keys(p))s[E]="pushed";M.drop(Object.keys(p)),H(S?{...r,...p}:{...p},S?{...o,...b}:{...b})},override(p,b){C=p?{...p}:{},p?b?.persist&&t.whenConsented(()=>t.flagStorage.set(on,JSON.stringify(C))):t.flagStorage.remove(on);for(let S of R)S(T())},setPersonProperties(p,b=!0){F.clear(),v={...v,...p},b&&j()},resetPersonProperties(){v={}},setGroupProperties(p,b=!0){F.clear();for(let[S,E]of Object.entries(p))w[S]={...w[S],...E};b&&j()},resetGroupProperties(){w={}},setContext(p,b,S){F.clear(),g={...g,[p]:{key:b,properties:S??{}}},j()},clearContext(p){F.clear();let{[p]:b,...S}=g;g=S,j()}},e.onChange(p=>{if(p==="reset"){g={},v={},w={},d.clear(),f.clear(),r={},o={},s={},i=void 0,a=void 0,M.setServer({}),F.clear(),t.flagStorage.remove(rn),ie(!1);for(let b of R)b(T())}(p==="identify"||p==="reset"||p==="group")&&j()}),n.disableFlagsOnFirstLoad?ie():Z(!1);let u=n.flagStream,m;u&&!$.disableRemote&&t.whenConsented(()=>{m=ft({apiHost:O,apiKey:t.apiKey,fetch:t.fetch,reload:()=>{Z()},visibility:{hidden:()=>document.visibilityState==="hidden",subscribe:p=>(document.addEventListener("visibilitychange",p),()=>document.removeEventListener("visibilitychange",p))},...typeof u=="object"&&u.pollMs!==void 0?{pollMs:u.pollMs}:{},log:t.log})});let _=$.refreshMs&&$.refreshMs>0&&!$.disableRemote?setInterval(()=>document.visibilityState!=="hidden"&&void Z(!1),$.refreshMs):void 0;return()=>{m?.(),_&&clearInterval(_)}};function it(t){let e=window.fetch;window.fetch=function(i,a){let c=i instanceof Request?i.url:String(i),l=new Headers(a?.headers??(i instanceof Request?i.headers:void 0)),d=[...l.entries()].join("|");return t(c,l),[...l.entries()].join("|")===d?e.call(this,i,a):e.call(this,i,{...a,headers:l})};let n=XMLHttpRequest.prototype,{open:r,send:o}=n,s=new WeakMap;return n.open=function(i,a,...c){return s.set(this,String(a)),r.call(this,i,a,...c)},n.send=function(i){let a=s.get(this);if(a){let c=new Headers;t(a,c),c.forEach((l,d)=>this.setRequestHeader(d,l))}return o.call(this,i)},()=>{window.fetch=e,n.open=r,n.send=o}}var sn="lucida.session_id";function Ki(t,e){return[...(t??"").split(",").map(r=>r.trim()).filter(r=>r&&!r.startsWith(`${sn}=`)),`${sn}=${encodeURIComponent(e)}`].join(",")}function Gi(t,e=[]){let n;try{n=new URL(t,location.href)}catch{return!1}return n.origin===location.origin||e.some(r=>typeof r=="string"?n.origin===r:r.test(n.href))}var ho=t=>{let e=t.config.watchtower,{core:n}=t,r=zi(t);if(!e?.correlate)return r;let o=n.sessionId;t.onCapture(a=>o=String(a.properties.$session_id??o));let s=a=>n.hasConsent("analytics")&&!a.startsWith(t.config.apiHost)&&Gi(a,e.origins),i=it((a,c)=>{s(a)&&c.set("baggage",Ki(c.get("baggage"),o))});return()=>(i(),r?.())};function zi(t){let e=t.config.watchtower?.client??globalThis.watchtower;if(typeof e?.setAttribute!="function")return;let{core:n}=t,r=o=>{n.hasConsent("analytics")&&e.setAttribute(sn,o)};return t.whenConsented(()=>r(n.sessionId)),n.onSessionId(r)}var Xi="X-Lucida-Distinct-Id",Yi="X-Lucida-Session-Id";function Ji(t,e){let n;try{n=new URL(t,location.href).hostname.toLowerCase()}catch{return!1}return e.some(r=>{let o=r.toLowerCase();return o.startsWith(".")?n===o.slice(1)||n.endsWith(o):n===o})}var yo=t=>/^[\x20-\x7e]*$/.test(t)?t:encodeURIComponent(t),vo=t=>{let e=t.config.tracingHeaders;if(!e?.length)return;let{core:n}=t;return it((r,o)=>{!n.hasConsent("analytics")||r.startsWith(t.config.apiHost)||!Ji(r,e)||(n.distinctId&&o.set(Xi,yo(n.distinctId)),o.set(Yi,yo(n.sessionId)))})};function bo(t,e={},n=[]){return Ir(t,e,[no,mo,lo,ho,vo,xr,...n])}var an=(()=>{try{let t=typeof document>"u"?void 0:document.currentScript?.src;return t?new URL(t).origin:void 0}catch{return}})();function Qi(t,e,n){if(!t.modules?.length)return Promise.resolve([]);if(t.extension??Ve())return console.warn("[lucida] extension mode: `modules` are not loaded remotely; bundle them with createClient"),Promise.resolve([]);let r=t.assetHost??an??t.apiHost??Ze;return dr(t.modules,{assetHost:r,version:Kt},(...o)=>console.warn("[lucida]",...o),e,n)}function Zi(t,e,n){let r=t.lucidaQueue??[],o=[],s=Promise.resolve(),i=!1,a=l=>{let[d,...f]=l;if(d==="init"){if(t.lucida||i)return;i=!0;let g=f[1]??{},x=v=>{let w=!g.uiHost&&!g.assetHost&&an?{uiHost:an}:{};t.lucida=bo(String(f[0]),{...w,...g},v),Ge(t.lucida,!0,t);let C=o;o=[],C.forEach(a)};g.modules?.length?s=Qi(g,e,n).then(x):x([]);return}if(!t.lucida){o.push(l);return}let y=t.lucida[d];typeof y=="function"&&y.apply(t.lucida,f)},c=r.splice(0);return r.push=(...l)=>(l.forEach(a),r.length),t.lucidaQueue=r,c.forEach(a),s}typeof window<"u"&&Zi(window);})();
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": "0.1.6",
3
+ "files": {
4
+ "autocapture.js": "sha384-DDAGXR+vbOxKtn81H2qUkWbf/AKTUT4EK46i8sdH7jhe5cdqGiQQli0zjBQfOHEG",
5
+ "banner-7LEREYUH.js": "sha384-Qp/NqT/ErMxTXljd3BTWMnbB8lmjwU6tHN92KxosOvQ+jODaakgrhiMPGp2HUssl",
6
+ "consent.js": "sha384-gfpx8znG/5LuNJA6KpFlTtTeo7O4W/4Pt7jageTPD4l8mq3MMjDMeZM+BwCj0Gzs",
7
+ "core.js": "sha384-pGqIvhY6/6kZVhlqY9984JqEHxcMXOjKLTgvUND2UBLDeArnu3x0gkshTPQhmOnz",
8
+ "correlate.js": "sha384-v9vUN2naMNMTe8neR1TILpaXrVpdAYeyiZs9YL8UmzS/QDDvlHUpO8RtL5oPiXop",
9
+ "early-access.js": "sha384-5JZ6DWRYgfoeu7QgSPi8kvVlys4CZ6H2wWuvEEggc83iau5z0sJ8RQD1AXtLCjGQ",
10
+ "experiments.js": "sha384-5smoFlAcR2T1XmBgazy5HGun22PvX5Pa7IKIKtONtN/CpNy6U9SDWb7W7Di9d5fR",
11
+ "flags.js": "sha384-leEfAfEPD56SEaTBA0frnZvRvDk8p/tOilnGeNDqoRLUuR4e0uoVSY2z96lInBHN",
12
+ "forms.js": "sha384-G61YPp3pr3ZeyhVNhHSjYIexf3/bmgQjZEUJrPrY5qP0ykMnXfk5PAgDK2ErLqF+",
13
+ "guides.js": "sha384-ojyyhBUHcWeLxnIuFqEe/K8+CgHJCFT0Q85LsBpZtG+p+8k7jsGzDjPJon2SZQg1",
14
+ "heatmaps.js": "sha384-drg7hBMqgcVNdV3zVr2Df+LJ+CMsf9lbeWugFixjEpyMBvEgEci5A1hWEjLZX5Vn",
15
+ "host-headers.js": "sha384-8OsSDIVDEo3Lsk3G+L5xNJ4pkAYXDEAz+ggBK7sG1cj7tOITAXDKaM2EFtQCHGiF",
16
+ "index.js": "sha384-1CYQ8dFo94HLDb4YnLPKo9h08i2Px03KsRKFNgEMiiq4x5+I0CAoUVb4QoGkTgV3",
17
+ "inspector.js": "sha384-wCjcdzjbZ1mAYS3w19Io8NOJQfrnlmfDkinoan/0LUTqCw6M7OSR9QDwxDp6M5+T",
18
+ "lucida.js": "sha384-toDyt2ORHqXnDcQ8IzvDZA7ggrWxrFULySEgott3RgOZoH9686tKsCcvVLij5WHt",
19
+ "modules-FANMZRDJ.js": "sha384-UjLSth+cPZTIxwMGFgoUEocqFSHXnM7IgYpICNSRRU7NTlFkfCg3WUNUbu8u04EP",
20
+ "persistent-SLVINN5A.js": "sha384-DUvReNmdZNyY7aEE/oFQW7ZOS4J1CyyqE6eheXPBOv/zXqCViscg3GE74E9OSdRQ",
21
+ "recommendations.js": "sha384-6XyPo/sQd1LNvQ87+vlgOLYe/ecapP9mmDeKlkTRx15d9gTAmDRwCPrX+n6zy2lx",
22
+ "recorder-4WIMQCLR.js": "sha384-7OIwHRXGKBAgkMw+adAxAXZ51mTlhVaig1Srek5OkdY2F9nqfRWLvpAg+WJ+4lOf",
23
+ "replay.js": "sha384-mv7Sg2RyfNP/UTCuS6Vg6QxjvcJIv031WMOz0wKgXjaYTPFzx/8VUTv7MLs/PLDl",
24
+ "toolbar.js": "sha384-5RaMXlQzkpgbv3L9JX67X8YdRd9s5/Kt5usUm4uqC0afaZkXTYbBkdInD2b0ORP3",
25
+ "validation-HGJXZ553.js": "sha384-NmKcVVwg5IWD+ctqpalFATPXleIm4PFPkcQgQ3d/iUILxmjIC8tENjXFPibdEVTX",
26
+ "webmcp.js": "sha384-Vs+fImvLlnbEZtId9H/pA4VXB1bVaxEjOYY+DcAUTN5pXXuNNFOYQfltuj2giALZ"
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ import{a as g,c as v,d as O,e as b,f as P,g as R,i as W,j as D}from"./chunk-UPPUYIIH.js";import"./chunk-EFNCQJI3.js";var x="lc_replay_ack",U=()=>{try{let e=sessionStorage.getItem(x);return e?[e]:[]}catch{return[]}};function $(){let e={status:"awaiting_config",disabledReason:void 0,startReason:void 0,sampleRate:void 0,minDurationMs:void 0,triggers:void 0,matchedGroups:void 0,bufferLength:void 0,flushedBytes:0,confirmed:new Set(U()),rrwebError:void 0,rrwebErrors:0,bufferBytes:void 0,throttled:void 0};return Object.assign(e,{ack(t){if(!e.confirmed.has(t)){e.confirmed.add(t);try{sessionStorage.setItem(x,t)}catch{}}},props(t){let i=e.triggers?.(),r={$recording_status:e.status,$has_recording:e.confirmed.has(t)};e.disabledReason&&(r.$replay_disabled_reason=e.disabledReason),e.startReason&&(r.$session_recording_start_reason=e.startReason),e.sampleRate!==void 0&&(r.$replay_sample_rate=e.sampleRate),e.minDurationMs!==void 0&&(r.$replay_minimum_duration=e.minDurationMs),i&&(r.$replay_url_trigger_status=i.url,r.$replay_event_trigger_status=i.event,r.$replay_linked_flag_trigger_status=i.flag);let d=e.matchedGroups?.();d?.length&&(r.$replay_trigger_groups_matched=d),e.bufferLength&&(r.$replay_buffer_length=e.bufferLength()),e.flushedBytes&&(r.$replay_flushed_size=e.flushedBytes),e.rrwebError&&(r.$replay_rrweb_error=e.rrwebError),e.rrwebErrors&&(r.$replay_rrweb_error_count=e.rrwebErrors);let p=e.bufferBytes?.();p&&(r.$replay_buffer_size=p);let a=e.throttled?.();return a&&(r.$replay_throttled_mutations=a),r}})}var k="lucida_replay_url";function j(e,t,i,r=2e3){let d={},p=()=>{if(!i())return;let o=globalThis,s=t();try{e.intercom&&typeof o.Intercom=="function"&&d.intercom!==s&&(o.Intercom("update",{[k]:s}),d.intercom=s),e.crisp&&typeof o.$crisp?.push=="function"&&d.crisp!==s&&(o.$crisp.push(["set","session:data",[[[k,s]]]]),d.crisp=s)}catch{}};p();let a=setInterval(p,r);return()=>clearInterval(a)}var N=e=>{let t=$();e.eventExtras.push(n=>t.props(n));let i=e.config.replay??{},r=n=>{t.status="disabled",t.disabledReason=n};if(i.enabled===!1)return r("disabled_locally");let d=e.config.replayOwner??i.owner;if(!b(d))return d||console.warn("[lucida] replay is off: Watchtower is already recording this page. Set replayOwner: 'lucida' (or 'both') to record with Lucida too."),e.loadConfig(),r("owner_watchtower");if(navigator.connection?.saveData)return r("data_saver");let a="idle",o,s=0,m=!1,C=location.href,h=()=>e.core.hasConsent("analytics")&&e.core.hasConsent("replay"),y=async n=>{if(a!=="idle")return;if(!h())return r("no_consent");a="starting",t.status="awaiting_config";let u=++s,l=await e.loadConfig(),f=g(l?.replay_never_record,C)||!!n&&g(l?.replay_never_record,location.href),c=f?null:v(i,l);if(u!==s)return void(a="idle");if(!c)return r(f?"never_record_page":"remote_disabled"),void(a="idle");let M=e.core.sessionId,S=c.trigger_groups.length>0,T=!!n?.sampling||S||R(M,"",c.sample_rate);if(t.sampleRate=S?void 0:c.sample_rate,t.minDurationMs=c.min_duration_ms,!T)return t.status="sampled",void(a="idle");t.status="lazy_loading",t.disabledReason=void 0;let{startRecorder:I}=await import("./recorder-4WIMQCLR.js");if(u!==s)return void(a="idle");o=I(e,c,t,n),a="on"},w=()=>{s++,o?.stop(),o=void 0,a="idle"};e.replay={start:async n=>{m=!1;let u=n===!0,l=f=>u||typeof n=="object"&&!!n[f];await y({sampling:n===void 0||l("sampling"),url_trigger:l("url_trigger"),event_trigger:l("event_trigger"),linked_flag:l("linked_flag")})},stop:()=>{m=!0,w(),r("stopped_manually")},pause:()=>o?.pause(),resume:()=>o?.resume(),tag:n=>e.client.capture("$replay_tag",{name:n,session_id:e.core.sessionId}),isRecording:()=>a==="on"&&!o?.paused()},e.core.onChange(n=>{n==="consent"&&(h()?m||y():(w(),r("no_consent")))}),y();let _=i.supportWidgets,E=_?.intercom||_?.crisp?j(_,()=>e.client.getReplayUrl(),()=>a==="on"&&!o?.paused()):void 0;return()=>{s++,o?.stop(),E?.()}};export{P as fnv1a32,b as lucidaRecords,D as pagePrivacy,g as policyMatches,N as replay,v as resolveReplay,R as sampled,O as urlAllowed,W as urlRules};
package/dist/toolbar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as Guide, G as GuideStep, H as Host, M as Module } from './types-Dng5ldZO.js';
1
+ import { g as Guide, G as GuideStep, H as Host, M as Module } from './types-QPJGHOv0.js';
2
2
  import '@lucida-analytics/sdk-core';
3
3
 
4
4
  /** Session derived from the POST /v1/toolbar/exchange response (contract: sdks/browser/README.md). */
@@ -509,6 +509,10 @@ declare function placementFlag(placement: string, payload: (k: string) => unknow
509
509
  */
510
510
  declare const recommendations: Module;
511
511
 
512
+ /** The part of a Watchtower browser client the seam uses (`@watchtower/browser` `setAttribute`). */
513
+ interface WatchtowerLike {
514
+ setAttribute(key: string, value: string | number | boolean): void;
515
+ }
512
516
  interface BootstrapConfig {
513
517
  distinctId?: string;
514
518
  /** distinctId belongs to a signed-in user (identified), not an anonymous visitor. */
@@ -694,7 +698,10 @@ interface BrowserConfig extends StorageConfig, DeliveryConfig {
694
698
  watchtower?: {
695
699
  correlate?: boolean;
696
700
  origins?: Array<string | RegExp>;
701
+ client?: WatchtowerLike;
697
702
  };
703
+ /** Publish the client as `globalThis.lucida` (or the given name), the same object the classic script exposes, and fire `lucida:ready` on window. Default off (on in the Next integration). */
704
+ exposeGlobal?: boolean | string;
698
705
  /** Heatmap capture options (the `heatmaps` module). `attention` batches visible time per scroll band and element. */
699
706
  heatmaps?: {
700
707
  moves?: boolean;
@@ -724,6 +731,8 @@ interface AgentAnalytics {
724
731
  }
725
732
  interface RemoteConfig {
726
733
  autocapture?: boolean;
734
+ /** `false`: autocapture drops input, change and submit events (clicks stay). Absent = true. */
735
+ autocapture_inputs?: boolean;
727
736
  /** Mirrors go/gateway ProjectConfig. */
728
737
  session_recording?: boolean;
729
738
  replay_sample_rate?: number;
@@ -1067,6 +1076,8 @@ interface Host {
1067
1076
  type Module = (host: Host) => void | (() => void);
1068
1077
  interface Client {
1069
1078
  readonly distinctId: string;
1079
+ /** Same value as `distinctId`, as a method (for code that passes the client around as a callback source). */
1080
+ getDistinctId(): string;
1070
1081
  capture(event: string, props?: Props, options?: CaptureOptions): void;
1071
1082
  identify(id: string, set?: Props, setOnce?: Props): void;
1072
1083
  alias(alias: string, original?: string): void;
@@ -1092,8 +1103,12 @@ interface Client {
1092
1103
  onSessionId(cb: (sessionId: string) => void): () => void;
1093
1104
  /** A registered super property (`register`). */
1094
1105
  getProperty(key: string): unknown;
1095
- /** True while analytics capture is not allowed (opted out, or an opt_in project not yet opted in). */
1106
+ /** True only after an explicit decline (optOut, a denied category, DNT/GPC). False while the choice is still pending. */
1096
1107
  hasOptedOut(): boolean;
1108
+ /** True only after an explicit grant (optIn / setConsent). False while pending. */
1109
+ hasOptedIn(): boolean;
1110
+ /** Called after every consent change (grant, decline, revoke); returns the unsubscribe. */
1111
+ onConsent(cb: () => void): () => void;
1097
1112
  /** Link to this session's replay in the Lucida app (uiHost, else apiHost). */
1098
1113
  getReplayUrl(o?: {
1099
1114
  withTimestamp?: boolean;
@@ -1192,4 +1207,4 @@ interface Client {
1192
1207
  shutdown(): Promise<void>;
1193
1208
  }
1194
1209
 
1195
- export { type MutationThrottle as $, type AgentAnalytics as A, type BannerOptions as B, type ConsentSource as C, type DeliveryConfig as D, type ReplayControl as E, type FlagValue as F, type GuideStep as G, type Host as H, denylistHook as I, placementFlag as J, privatizeUrl as K, type LazyModuleName as L, type Module as M, recommendations as N, sampleHook as O, type Persistence as P, urlPrivacyHook as Q, RECS_PAYLOAD_KEY as R, type StorageConfig as S, type TargetConditions as T, type UrlPrivacy as U, type AssetCapture as V, type CanvasCapture as W, type CanvasMaskRule as X, type CanvasRegion as Y, type CrossOriginIframes as Z, type MaskableInput as _, type BannerPosition as a, type NetworkEntry as a0, type NetworkOptions as a1, type PagePrivacy as a2, type ReplayConfig as a3, type ReplayOwner as a4, type ReplayTrigger as a5, type ResolvedReplay as a6, type SupportWidgets as a7, type TriggerGroup as a8, type TriggerState as a9, type UrlPrivacyRule as aa, fnv1a32 as ab, lucidaRecords as ac, pagePrivacy as ad, policyMatches as ae, resolveReplay as af, sampled as ag, urlAllowed as ah, urlRules as ai, type BannerTexts as b, type ConsentUi as c, type BrowserConfig as d, type Client as e, type GuideAutomation as f, type Guide as g, type GuideTokens as h, type AutocaptureConfig as i, type BeforeSend as j, type BootstrapConfig as k, type CaptureOptions as l, type FlagOptions as m, type FlagsService as n, type FrustrationConfig as o, type GuideButton as p, type GuideKind as q, type GuideRule as r, type GuidesService as s, type PersonProfiles as t, type PropFilter as u, type RecommendationItem as v, type RecommendationOptions as w, type Recommendations as x, type RecsService as y, type RemoteConfig as z };
1210
+ export { type MaskableInput as $, type AgentAnalytics as A, type BannerOptions as B, type ConsentSource as C, type DeliveryConfig as D, type ReplayControl as E, type FlagValue as F, type GuideStep as G, type Host as H, denylistHook as I, placementFlag as J, privatizeUrl as K, type LazyModuleName as L, type Module as M, recommendations as N, sampleHook as O, type Persistence as P, urlPrivacyHook as Q, RECS_PAYLOAD_KEY as R, type StorageConfig as S, type TargetConditions as T, type UrlPrivacy as U, type AssetCapture as V, type WatchtowerLike as W, type CanvasCapture as X, type CanvasMaskRule as Y, type CanvasRegion as Z, type CrossOriginIframes as _, type BannerPosition as a, type MutationThrottle as a0, type NetworkEntry as a1, type NetworkOptions as a2, type PagePrivacy as a3, type ReplayConfig as a4, type ReplayOwner as a5, type ReplayTrigger as a6, type ResolvedReplay as a7, type SupportWidgets as a8, type TriggerGroup as a9, type TriggerState as aa, type UrlPrivacyRule as ab, fnv1a32 as ac, lucidaRecords as ad, pagePrivacy as ae, policyMatches as af, resolveReplay as ag, sampled as ah, urlAllowed as ai, urlRules as aj, type BannerTexts as b, type ConsentUi as c, type BrowserConfig as d, type Client as e, type GuideAutomation as f, type Guide as g, type GuideTokens as h, type AutocaptureConfig as i, type BeforeSend as j, type BootstrapConfig as k, type CaptureOptions as l, type FlagOptions as m, type FlagsService as n, type FrustrationConfig as o, type GuideButton as p, type GuideKind as q, type GuideRule as r, type GuidesService as s, type PersonProfiles as t, type PropFilter as u, type RecommendationItem as v, type RecommendationOptions as w, type Recommendations as x, type RecsService as y, type RemoteConfig as z };
package/dist/webmcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { M as Module } from './types-Dng5ldZO.js';
1
+ import { M as Module } from './types-QPJGHOv0.js';
2
2
  import '@lucida-analytics/sdk-core';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucida-analytics/browser",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/storage.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Every cookie and storage key the Lucida browser SDK writes. Published for consent managers (Cookie Munch preset, docs/integrations/cookiemunch-preset.md). sdks/browser/test/storage-manifest.test.ts fails when the SDK source names an lc_* key that is not listed here.",
3
3
  "sdk": "@lucida-analytics/browser",
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "suffix_rule": {
6
6
  "applies_to": "every key with suffixed: true",
7
7
  "rule": "name + '_' + the last 8 word characters of the project's public key (key.replace(/\\W/g, '').slice(-8))",
@@ -1 +0,0 @@
1
- var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);function Ke(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function j(e,t){return!!e?.some(n=>{try{return new RegExp(Ke(n),"i").test(t)}catch{return!1}})}var pe=ve(()=>{"use strict"});var be='[data-lc-region="article"]';function K(e,t,n){if(t.articles===!1)return()=>{};let o;e.loadConfig().then(f=>{typeof f?.article_selector=="string"&&(o=f.article_selector)});let s=()=>{for(let f of[t.articleSelector,o,be])if(f)try{let _=document.querySelector(f);if(_)return _}catch{}return null},i=location.href,l=location.pathname,c=null,a=0,u=!1,r=()=>{if(c??=s(),!c)return;let f=c.getBoundingClientRect();if(f.height<=0)return;let _=Math.round(Math.min(100,Math.max(0,(window.innerHeight-f.top)/f.height*100)));a=Math.max(a,_);let v=c.querySelector("h1,h2");v&&v.getBoundingClientRect().bottom<0&&(u=!0)},p=()=>{!c||!n()||(r(),e.client.capture("$article_read",{$article_id:(c.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||l,$article_depth:a,$article_finished:a>=90,$article_headline_exit:!u&&a<25}),c=null)},d=()=>{p(),c=null,a=0,u=!1,i=location.href,l=location.pathname},m=()=>location.href!==i?d():r(),g=new MutationObserver(m);return g.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),e.onUnload(p),r(),()=>{g.disconnect(),window.removeEventListener("scroll",m)}}var T="data-lc-content",Ee="data-lc-content-piece",we="data-lc-content-target";var O=(e,t)=>(e.getAttribute(t)??"").trim().slice(0,200);function G(e,t,n){if(t.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let o=new WeakSet,s=r=>{let p={$content_name:O(r,T)},d=O(r,Ee),m=O(r,we);return d&&(p.$content_piece=d),m&&(p.$content_target=m),p},i=location.href,l=new IntersectionObserver(r=>{for(let p of r)!p.isIntersecting||o.has(p.target)||!n()||(o.add(p.target),e.client.capture("$content_impression",s(p.target)))},{threshold:.5}),c=r=>r.querySelectorAll(`[${T}]`).forEach(p=>l.observe(p));c(document);let a=new MutationObserver(()=>{location.href!==i&&(i=location.href,l.disconnect(),document.querySelectorAll(`[${T}]`).forEach(r=>o.delete(r))),c(document)});a.observe(document.documentElement,{childList:!0,subtree:!0});let u=r=>{let p=r.target?.closest?.(`[${T}]`);p&&n()&&e.client.capture("$content_interaction",{...s(p),$content_interaction_type:"click"})};return document.addEventListener("click",u,!0),()=>{l.disconnect(),a.disconnect(),document.removeEventListener("click",u,!0)}}var ke=new Set(["input","textarea","select","option"]),xe=["name","type","role","aria-label","title","alt","placeholder"],Re=/(?:\d[ -]?){9,}/;function Ce(e){if(ke.has(e.tagName.toLowerCase())||e.isContentEditable)return;let t="";for(let n of Array.from(e.childNodes))n.nodeType===3&&(t+=n.textContent??"");if(t=t.replace(/\s+/g," ").trim(),!(!t||Re.test(t)))return t.slice(0,255)}function Y(e){if(!e?.length)return()=>!1;let t=e.map(n=>n.toLowerCase());return n=>t.some(o=>o.endsWith("*")?n.startsWith(o.slice(0,-1)):n===o)}var B="***";function w(e){let t={};for(let n=e,o=0;n&&o<10;n=n.parentElement,o++)for(let s of Array.from(n.attributes)){let i=s.name.startsWith("data-lc-attr-")?s.name.slice(13):"";i&&!(i in t)&&!i.startsWith("$")&&(t[i]=s.value.slice(0,255))}return t}function Se(e,t,n,o){let s=e.parentElement,i=s?Array.from(s.children):[e],l={tag_name:e.tagName.toLowerCase(),nth_child:i.indexOf(e)+1,nth_of_type:i.filter(r=>r.tagName===e.tagName).indexOf(e)+1},c=(e.getAttribute("class")??"").split(/\s+/).filter(Boolean);c.length&&!n("class")&&(l.classes=c),e.id&&!n("id")&&(l.attr__id=o("id",e.id));let a=e.getAttribute("href");a&&!n("href")&&(l.href=o("href",a.slice(0,1024)));let u={};for(let r of Array.from(e.attributes))(r.name.startsWith("data-lc-")||xe.includes(r.name))&&!n(r.name)&&(u[r.name]=o(r.name,r.value.slice(0,255)));if(Object.keys(u).length&&(l.attrs=u),t){let r=Ce(e);r&&(l.text=r)}return l}function k(e,t,n,o,s={}){let i=[],l=Y(o),c=Y(s.allow),a=s.maskAll?(r,p)=>c(r)?p:B:(r,p)=>p,u=t;for(let r=e;r&&i.length<10;r=r.parentElement)i.push(Se(r,u,l,a)),(r===n||!n)&&(u=!1);return i}var $=e=>e.replace(/(["\\])/g,"\\$1");function x(e){return e.map(t=>{let n=t.tag_name+(t.classes?"."+t.classes.join("."):"")+":";t.attr__id&&(n+=`attr__id="${$(t.attr__id)}"`),t.href&&(n+=`href="${$(t.href)}"`),t.text&&(n+=`text="${$(t.text)}"`);for(let[o,s]of Object.entries(t.attrs??{}))n+=`attr__${o}="${$(s)}"`;return n+`nth-child="${t.nth_child}"nth-of-type="${t.nth_of_type}"`}).join(";")}var b=[],Ae=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,Me=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,Te=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,$e="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function z(e,t=[]){if(t.length&&e.closest(t.join(","))||e.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=e.closest($e)??e,o=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(Ae.test((n.textContent??"").trim())||Me.test(o))return!0;for(let s=n,i=0;s&&i<3;s=s.parentElement,i++)if(Te.test(s.getAttribute("class")??""))return!0;return!1}var Le=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function V(e,t=Date.now(),n={},o){if(o&&n.ignoreSelectors?.length&&o.closest(n.ignoreSelectors.join(",")))return{};if(o&&n.suppressSteppers!==!1&&z(o,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&Le())return{};let s=n.windowMs??1e3,i=n.radiusPx??30;for(b.length&&t<b[b.length-1].t&&(b.length=0),b.push({t,x:e.clientX,y:e.clientY});b.length&&t-b[0].t>s;)b.shift();let l=b.filter(c=>Math.hypot(c.x-e.clientX,c.y-e.clientY)<=i).length;return l>=(n.count??3)?{$rageclick:!0,$rageclick_count:l}:{}}function Q(e,t,n=700){if(typeof MutationObserver>"u")return;let o=!1,s=new MutationObserver(()=>o=!0);s.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let i=()=>{o=!0};window.addEventListener("scroll",i,{capture:!0,passive:!0}),document.addEventListener("selectionchange",i);let l=()=>{s.disconnect(),window.removeEventListener("scroll",i,{capture:!0}),document.removeEventListener("selectionchange",i)},c=setTimeout(()=>{l(),!o&&document.visibilityState!=="hidden"&&e.client.capture("$deadclick_hint",{$selector:t,$no_mutation_ms:n})},n);e.onUnload(()=>{clearTimeout(c),l()})}var Z=/^[A-Za-z_][\w-]*$/,Oe=5;function J(e){let t=[];for(let n=e;n&&t.length<Oe;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Z.test(n.id)){t.unshift(`${o}#${n.id}`);break}let s=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Z.test(i)).slice(0,2);t.unshift(o+s.map(i=>`.${i}`).join(""))}return t.join(" ")}function ee(e,t,n,o,s={}){let i={$selector:J(n),$el_interactive:o};(t.clientX||t.clientY||t.detail)&&(i.$click_x=Math.round(t.clientX+(window.scrollX||0)),i.$click_y=Math.round(t.clientY+(window.scrollY||0))),s.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(i,V(t,Date.now(),s.rageClicks||{},n));let l=s.deadClicks;!o&&t.isTrusted&&l!==!1&&!(l?.ignoreSelectors?.length&&n.closest(l.ignoreSelectors.join(",")))&&Q(e,i.$selector,l?.waitMs);for(let c of e.clickExtras)Object.assign(i,c(t,n));return i}var He="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",Ie="[data-lc-ignore]",H=e=>e.some(t=>typeof t=="string"?location.href.includes(t):t.test(location.href)),Pe=e=>!e?.length||H(e),I=e=>({maskAll:e.maskAllAttributes,allow:e.attributeAllowlist}),R=(e,t)=>!!e.closest(Ie)||!!(t.denySelectors?.length&&e.closest(t.denySelectors.join(",")));function te(e,t,n){let o=t.events??["click","change","submit"],s=0,i=a=>{let u=a.target;!n()||a.isComposing||!(u instanceof Element)||R(u,t)||u instanceof HTMLInputElement&&u.type==="password"||(s+=1)},l=a=>u=>{if(!n())return;let r=u.target;if(!(r instanceof Element)||R(r,t)||t.allowSelectors?.length&&!r.closest(t.allowSelectors.join(","))||t.elementAllowlist?.length&&!r.closest(t.elementAllowlist.join(","))||!Pe(t.urlAllowlist)||a==="change"&&!/^(input|select|textarea)$/i.test(r.tagName)||r instanceof HTMLInputElement&&r.type==="password")return;let p=r.closest(He);if(a==="click"&&!p&&!t.allowSelectors?.length)return;let d=k(r,t.captureText??!0,p??void 0,t.attributeIgnore,I(t)),m=d.find(f=>f.text)?.text,g=s;s=0,e.client.capture("$autocapture",{...w(r),$event_type:a,...g>0?{$keystroke_count:g}:{},$elements:d,$elements_chain:x(d),...m?{$el_text:m}:{},...a==="click"?ee(e,u,r,!!p,t):{}})};e.autocaptureClicks=o.includes("click");let c=o.map(a=>[a,l(a)]);for(let[a,u]of c)document.addEventListener(a,u,!0);return document.addEventListener("keydown",i,!0),()=>{for(let[a,u]of c)document.removeEventListener(a,u,!0);document.removeEventListener("keydown",i,!0)}}var je='[contenteditable]:not([contenteditable="false"])',ne="input,textarea,select",Ne=255;function re(e){return e.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Ne)}var We=e=>e?e instanceof Element?e:e.parentElement:null;function oe(e,t,n){let o=t.events??["click","change","submit"],s=t.contentEditable!==!1&&o.includes("change"),i=new WeakSet,l=p=>{let d=k(p,!1,p,t.attributeIgnore,I(t));return{...w(p),$elements:d,$elements_chain:x(d)}},c=p=>{let d=p instanceof Element?p.closest(je):null;return d&&!R(d,t)?d:null},a=p=>{let d=n()?c(p.target):null;d&&i.add(d)},u=p=>{let d=c(p.target);!d||!i.has(d)||p.relatedTarget instanceof Node&&d.contains(p.relatedTarget)||(i.delete(d),n()&&e.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...l(d)}))},r=p=>{if(!n()||!t.copyCut)return;let d=typeof getSelection=="function"?getSelection():null,m=p.target instanceof Element?p.target:null,g=We(d?.anchorNode)??m;if(!g||R(g,t)||g.closest(ne)||m?.closest(ne))return;let f=t.captureCopiedText?re(d?.toString()??""):"";e.client.capture("$copy_autocapture",{$copy_type:p.type,...l(g),...f?{$selected_content:f}:{}})};return s&&(document.addEventListener("input",a,!0),document.addEventListener("focusout",u,!0)),document.addEventListener("copy",r,!0),document.addEventListener("cut",r,!0),()=>{document.removeEventListener("input",a,!0),document.removeEventListener("focusout",u,!0),document.removeEventListener("copy",r,!0),document.removeEventListener("cut",r,!0)}}var De="[data-lc-ignore]",ie=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],ae=["q","s","search","query"],se=e=>e.origin+e.pathname;function le(e,t,n){let o=Array.isArray(t.fileDownloads)?t.fileDownloads.map(i=>i.toLowerCase()):ie,s=[];if(t.outboundLinks!==!1||t.fileDownloads!==!1){let i=l=>{let c=l.target instanceof Element?l.target.closest("a[href]"):null;if(!c||!n()||c.closest(De))return;let a;try{a=new URL(c.href,location.href)}catch{return}if(a.protocol!=="http:"&&a.protocol!=="https:")return;let u=decodeURIComponent(a.pathname.split("/").pop()??""),r=u.includes(".")?u.split(".").pop().toLowerCase():"";t.fileDownloads!==!1&&(c.hasAttribute("download")||o.includes(r))?e.client.capture("$file_download",{$url:se(a),$file_name:u,$file_extension:r}):t.outboundLinks!==!1&&a.host!==location.host&&e.client.capture("$outbound_click",{$url:se(a),$outbound_host:a.host})};document.addEventListener("click",i,!0),s.push(()=>document.removeEventListener("click",i,!0))}if(t.siteSearch!==!1){let i=typeof t.siteSearch=="object"&&t.siteSearch.params?t.siteSearch.params:ae,l=!0;s.push(()=>{l=!1}),e.onCapture(c=>{if(!l||c.event!=="$pageview"||!n())return;let a=new URLSearchParams(location.search);for(let u of i){let r=a.get(u)?.trim();if(r)return void e.client.capture("$site_search",{$search_term:r.slice(0,200),$search_param:u})}})}return()=>s.forEach(i=>i())}function Ue(e,t={}){e.capture("$page_not_found",{$status:404,...t})}var Xe=[25,50,75],Fe="data-lc-media-title";function P(e){let t=e.currentSrc||e.src;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return"";try{let n=new URL(t,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var qe=e=>(e.getAttribute(Fe)??e.getAttribute("title")??e.getAttribute("aria-label")??"").trim().slice(0,200);function ce(e,t,n){if(t.media===!1)return()=>{};let o=new WeakMap,s=a=>{let u={$media_type:a instanceof HTMLVideoElement?"video":"audio",$media_src:P(a)},r=qe(a);return r&&(u.$media_title=r),Number.isFinite(a.duration)&&(u.$media_duration=Math.round(a.duration)),u},i=a=>{let u=P(a);if(!u)return null;let r=o.get(a);return(!r||r.src!==u)&&o.set(a,r={src:u,played:!1,reached:new Set,done:!1}),r},l=a=>{let u=a.target;if(!(u instanceof HTMLMediaElement)||!n())return;let r=i(u);if(r)if(a.type==="play"){if(r.done&&Object.assign(r,{played:!1,reached:new Set,done:!1}),r.played)return;r.played=!0,e.client.capture("$media_play",s(u))}else if(a.type==="timeupdate"){if(!r.played||r.done||!Number.isFinite(u.duration)||u.duration<=0)return;let p=u.currentTime/u.duration*100;for(let d of Xe)p>=d&&!r.reached.has(d)&&(r.reached.add(d),e.client.capture("$media_progress",{...s(u),$media_progress:d}))}else a.type==="ended"&&r.played&&!r.done&&(r.done=!0,e.client.capture("$media_complete",s(u)))},c=["play","timeupdate","ended"];return c.forEach(a=>document.addEventListener(a,l,!0)),()=>c.forEach(a=>document.removeEventListener(a,l,!0))}function ue(e=()=>performance.now()){let t=()=>document.visibilityState!=="hidden",n=0,o=t()?e():null,s=()=>{t()?o===null&&(o=e()):(o!==null&&(n+=e()-o),o=null)};return document.addEventListener("visibilitychange",s),{read:()=>Math.round(n+(o===null?0:e()-o)),reset:()=>{n=0,o=t()?e():null},stop:()=>document.removeEventListener("visibilitychange",s)}}pe();var de=255,Ge=new Set(["input","textarea","select","option"]),Ye="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Be=new Set(["value","password","autocomplete"]),ze=/(?:\d[ -]?){9,}/,C=new WeakMap,N=new WeakMap;function fe(e,t){let n=N.get(e);if(n)return new Promise(o=>{let s=setTimeout(o,t);n.then(()=>(clearTimeout(s),o()))})}function me(e){return Array.isArray(e)?e.filter(t=>{if(!t||typeof t!="object")return!1;let n=t;return typeof n.name=="string"&&n.name!==""&&!n.name.startsWith("$")&&typeof n.selector=="string"&&(n.source==="text"||n.source==="attribute"&&typeof n.attribute=="string")&&Array.isArray(n.events)}):[]}function Ve(e){if(!e||Ge.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(Ye)}catch{return!1}}function Qe(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||Be.has(o)||o.startsWith("on"))return;let s=t.getAttribute(o);return s===null?void 0:s.slice(0,de)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||ze.test(n)))return n.slice(0,de)}function W(e,t,n,o=location.href){let s={};for(let i of e){if(!i.events.includes(t)||i.url&&!j([i.url],o))continue;let l=null;try{l=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!Ve(l))continue;let c=Qe(i,l);c!==void 0&&(s[i.name]=c)}return s}function ge(e){let t=!0,n=e.loadConfig().then(o=>{t&&C.set(e,me(o?.snapshot_properties)),N.delete(e)});return N.set(e,n),e.clickExtras.push((o,s)=>t?W(C.get(e)??[],"click",s):{}),()=>{t=!1,C.delete(e)}}function he(e){let t=C.get(e);return t?.length?W(t,"pageview"):{}}function ye(e){return!!C.get(e)?.some(t=>t.events.includes("pageview"))}var Ze=e=>{try{return new URL(e).pathname}catch{return e}};function Je(e){for(let t of e===void 0?[]:Array.isArray(e)?e:[e])try{let n=document.querySelector(t);if(n)return n}catch{}}function _e(e){let t=0,n=0,o=()=>{let s=Je(e),i=document.documentElement,l=s?s.scrollHeight:Math.max(i.scrollHeight,document.body?.scrollHeight??0),c=s?s.scrollTop:window.scrollY||window.pageYOffset||0,a=Math.min(l,c+(s?s.clientHeight:window.innerHeight));a>t&&(t=a,n=l>0?Math.min(100,Math.round(a/l*100)):0)};return o(),window.addEventListener("scroll",o,{passive:!0,capture:!0}),window.addEventListener("resize",o,{passive:!0}),{read:()=>({pct:n,px:t}),stop:()=>{window.removeEventListener("scroll",o,{capture:!0}),window.removeEventListener("resize",o)}}}var et=800,tt=e=>e.core.hasConsent("analytics")||e.core.consent.resolving;function nt(e){return e==="history"?{path:!0,search:!0}:e==="hash"?{path:!0,search:!0,hash:!0}:typeof e=="object"?e:void 0}function rt(e,t,n){try{let o=new URL(e),s=new URL(t);return!!(n.path&&o.pathname!==s.pathname||n.search&&o.search!==s.search||n.hash&&o.hash!==s.hash)}catch{return e!==t}}function L(e,t,n={}){let o=n.views??!0,s=n.leave??!0,i=nt(t),l=e.config.scrollRoot,c=location.href,a=c,u=Date.now(),r=_e(l),p=ue(),d,m=()=>{if(!s||d===c)return;d=c;let{pct:h,px:E}=r.read();e.client.capture("$pageleave",{$current_url:c,$scroll_depth:h,$scroll_depth_px:E,$engagement_time_ms:p.read()})},g=!1,f=(h,E={})=>{if(!o)return;let{core:y}=e;if(!y.hasConsent("analytics")&&!y.anonymousOnReject&&!(y.consent.pending&&y.consent.queueBeforeConsent)){if(!g){g=!0;let A=()=>{g&&(g=!1,f())};e.whenConsented(A),y.onChange(M=>{M==="consent"&&y.anonymousOnReject&&A()})}return}e.client.capture("$pageview",{...he(e),...h===void 0?{}:{$referrer:h},...E})},_,v=()=>{let h=_;_=void 0,h?.()},S=h=>{if(location.href===a)return;let E=a;if(a=location.href,!i||!rt(E,a,i))return;let y=c;m(),r.stop();let A=new Date(u);c=location.href,u=Date.now(),r=_e(l),p.reset();let M={$navigation_type:h,$prev_pageview_pathname:Ze(y),$prev_pageview_duration:Math.round((u-A.getTime())/100)/10};ye(e)?setTimeout(()=>f(y,M),0):(v(),_=()=>f(y,M),queueMicrotask(v))};e.onUnload(m);let D=tt(e)?fe(e,et):void 0;if(D?(_=()=>f(),e.onUnload(v),D.then(v)):f(),!i)return()=>(r.stop(),p.stop());let{pushState:U,replaceState:X}=history;history.pushState=function(...h){v(),U.apply(this,h),S("pushState")},history.replaceState=function(...h){v(),X.apply(this,h),S("replaceState")};let F=()=>S("popstate"),q=()=>S("hashchange");return window.addEventListener("popstate",F),i.hash&&window.addEventListener("hashchange",q),()=>{window.removeEventListener("hashchange",q),history.pushState=U,history.replaceState=X,window.removeEventListener("popstate",F),r.stop(),p.stop()}}var Wt=e=>{let t=[],n=e.config.autocapture,o=!1;if(n!==!1){let l=typeof n=="object"?n:{},c=()=>!o&&!(l.urlIgnorelist?.length&&H(l.urlIgnorelist));t.push(te(e,l,c),oe(e,l,c),le(e,l,c),G(e,l,c),K(e,l,c),ce(e,l,c),ge(e)),n===void 0&&e.loadConfig().then(a=>o=a?.autocapture===!1)}let s=e.config.capturePageview??"history",i=e.config.capturePageleave??"if_capture_pageview";return s!==!1&&i!==!1?t.push(L(e,s)):s!==!1?t.push(L(e,s,{leave:!1})):i===!0&&t.push(L(e,"history",{views:!1})),()=>t.forEach(l=>l())};export{ie as DOWNLOAD_EXTENSIONS,B as MASKED,ae as SEARCH_PARAMS,w as attrProps,Wt as autocapture,k as buildChain,x as chainToString,J as cssSelector,z as isStepper,re as maskCopied,P as mediaSrc,W as readSnapshot,me as snapshotRules,Ue as tag404};