@heycatch/sdk 0.7.0-dev.59 → 0.7.0-dev.974

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var Mi=Object.defineProperty;var dl=Object.getOwnPropertyDescriptor;var pl=Object.getOwnPropertyNames;var fl=Object.prototype.hasOwnProperty;var _l=(t,e)=>{for(var r in e)Mi(t,r,{get:e[r],enumerable:!0})},vl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pl(e))!fl.call(t,n)&&n!==r&&Mi(t,n,{get:()=>e[n],enumerable:!(i=dl(e,n))||i.enumerable});return t};var gl=t=>vl(Mi({},"__esModule",{value:!0}),t);var jh={};_l(jh,{KNOWN_FRAMEWORKS:()=>Eo,KNOWN_INSTALL_AGENTS:()=>ko,SDK_VERSION:()=>Et,STAGE:()=>$t,UNKNOWN_INSTALL_VALUE:()=>Je,analytics:()=>Dh});module.exports=gl(jh);var Xs="project",Oi="[a-z0-9]",Hh=new RegExp(`^${Oi}$`),Qs="heycatch";var eo;function ae(t,e,r){function i(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,u);let l=o.prototype,c=Object.keys(l);for(let h=0;h<c.length;h++){let d=c[h];d in a||(a[d]=l[d].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function o(a){var u;let l=r?.Parent?new s:this;i(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var Ze=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(eo=globalThis).__zod_globalConfig??(eo.__zod_globalConfig={});var Fi=globalThis.__zod_globalConfig;function vt(t){return t&&Object.assign(Fi,t),Fi}function ro(t,e){return typeof e=="bigint"?e.toString():e}function io(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var to=Symbol("evaluating");function gt(t,e,r){let i;Object.defineProperty(t,e,{get(){if(i!==to)return i===void 0&&(i=to,i=r()),i},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}var Li="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function zr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function no(t){if(zr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(zr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ni(t){return no(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Di(t,e,r){let i=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(i._zod.parent=t),i}function mt(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function so(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Gh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Bt(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function oo(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function ji(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Tr(t){return typeof t=="string"?t:t?.message}function yt(t,e,r){let i=t.message?t.message:Tr(t.inst?._zod.def?.error?.(t))??Tr(e?.error?.(t))??Tr(r.customError?.(t))??Tr(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:o,...a}=t;return a.path??(a.path=[]),a.message=i,e?.reportInput&&(a.input=o),a}var ao=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,ro,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},uo=ae("$ZodError",ao),Vt=ae("$ZodError",ao,{Parent:Error});var yl=t=>(e,r,i,n)=>{let s=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Ze;if(o.issues.length){let a=new(n?.Err??t)(o.issues.map(u=>yt(u,s,vt())));throw Li(a,n?.callee),a}return o.value},Ir=yl(Vt),bl=t=>async(e,r,i,n)=>{let s=i?{...i,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let a=new(n?.Err??t)(o.issues.map(u=>yt(u,s,vt())));throw Li(a,n?.callee),a}return o.value},Cr=bl(Vt),xl=t=>(e,r,i)=>{let n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Ze;return s.issues.length?{success:!1,error:new(t??uo)(s.issues.map(o=>yt(o,n,vt())))}:{success:!0,data:s.value}},qt=xl(Vt),wl=t=>async(e,r,i)=>{let n=i?{...i,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>yt(o,n,vt())))}:{success:!0,data:s.value}},Wt=wl(Vt);var $l="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",El=new RegExp(`^${$l}$`);var lo=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Ui=ae("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])});var kl=ae("$ZodCheckStringFormat",(t,e)=>{var r,i;Ui.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),ho=ae("$ZodCheckRegex",(t,e)=>{kl.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var po={major:4,minor:4,patch:3};var bt=ae("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=po;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let n of i)for(let s of n._zod.onattach)s(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(o,a,u)=>{let l=Bt(o),c;for(let h of a){if(h._zod.def.when){if(oo(o)||!h._zod.def.when(o))continue}else if(l)continue;let d=o.issues.length,f=h._zod.check(o);if(f instanceof Promise&&u?.async===!1)throw new Ze;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await f,o.issues.length!==d&&(l||(l=Bt(o,d)))});else{if(o.issues.length===d)continue;l||(l=Bt(o,d))}}return c?c.then(()=>o):o},s=(o,a,u)=>{if(Bt(o))return o.aborted=!0,o;let l=n(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new Ze;return l.then(c=>t._zod.parse(c,u))}return t._zod.parse(l,u)};t._zod.run=(o,a)=>{if(a.skipChecks)return t._zod.parse(o,a);if(a.direction==="backward"){let l=t._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(c=>s(c,o,a)):s(l,o,a)}let u=t._zod.parse(o,a);if(u instanceof Promise){if(a.async===!1)throw new Ze;return u.then(l=>n(l,i,a))}return n(u,i,a)}}gt(t,"~standard",()=>({validate:n=>{try{let s=qt(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Wt(t,n).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),vo=ae("$ZodString",(t,e)=>{bt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??lo(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}});function fo(t,e,r){t.issues.length&&e.issues.push(...ji(r,t.issues)),e.value[r]=t.value}var go=ae("$ZodArray",(t,e)=>{bt.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let o=0;o<n.length;o++){let a=n[o],u=e.element._zod.run({value:a,issues:[]},i);u instanceof Promise?s.push(u.then(l=>fo(l,r,o))):fo(u,r,o)}return s.length?Promise.all(s).then(()=>r):r}});function Ar(t,e,r,i,n,s){let o=r in i;if(t.issues.length){if(n&&s&&!o)return;e.issues.push(...ji(r,t.issues))}if(!o&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?o&&(e.value[r]=void 0):e.value[r]=t.value}function Tl(t){let e=Object.keys(t.shape);for(let i of e)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=so(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function zl(t,e,r,i,n,s){let o=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,c=u.optin==="optional",h=u.optout==="optional";for(let d in e){if(d==="__proto__"||a.has(d))continue;if(l==="never"){o.push(d);continue}let f=u.run({value:e[d],issues:[]},i);f instanceof Promise?t.push(f.then(p=>Ar(p,r,d,e,c,h))):Ar(f,r,d,e,c,h)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var mo=ae("$ZodObject",(t,e)=>{if(bt.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let u={...a};return Object.defineProperty(e,"shape",{value:u}),u}})}let i=io(()=>Tl(e));gt(t._zod,"propValues",()=>{let a=e.shape,u={};for(let l in a){let c=a[l]._zod;if(c.values){u[l]??(u[l]=new Set);for(let h of c.values)u[l].add(h)}}return u});let n=zr,s=e.catchall,o;t._zod.parse=(a,u)=>{o??(o=i.value);let l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let c=[],h=o.shape;for(let d of o.keys){let f=h[d],p=f._zod.optin==="optional",_=f._zod.optout==="optional",m=f._zod.run({value:l[d],issues:[]},u);m instanceof Promise?c.push(m.then(g=>Ar(g,a,d,l,p,_))):Ar(m,a,d,l,p,_)}return s?zl(c,l,a,u,i.value,t):c.length?Promise.all(c).then(()=>a):a}});var yo=ae("$ZodDefault",(t,e)=>{bt.init(t,e),t._zod.optin="optional",gt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>_o(s,e)):_o(n,e)}});function _o(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function bo(t,e){return new t({type:"string",...mt(e)})}function Hi(t,e){return new ho({check:"string_format",format:"regex",...mt(e),pattern:t})}var Rr=ae("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");bt.init(t,e),t.def=e,t.type=e.type,t.parse=(r,i)=>Ir(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>qt(t,r,i),t.parseAsync=async(r,i)=>Cr(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>Wt(t,r,i),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),t.with=t.check,t.clone=(r,i)=>Di(t,r,i),t.brand=()=>t,t.register=((r,i)=>(r.add(t,i),t)),t.apply=r=>r(t)}),Cl=ae("ZodMiniString",(t,e)=>{vo.init(t,e),Rr.init(t,e)});function xt(t){return bo(Cl,t)}var Al=ae("ZodMiniArray",(t,e)=>{go.init(t,e),Rr.init(t,e)});function xo(t,e){return new Al({type:"array",element:t,...mt(e)})}var Rl=ae("ZodMiniObject",(t,e)=>{mo.init(t,e),Rr.init(t,e),gt(t,"shape",()=>e.shape)});function Bi(t,e){let r={type:"object",shape:t??{},...mt(e)};return new Rl(r)}var Ml=ae("ZodMiniDefault",(t,e)=>{yo.init(t,e),Rr.init(t,e)});function wt(t,e){return new Ml({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Ni(e)}})}var Mr="https://in.dev.heycatch.ai",$t="dev",Et="0.7.0-dev.59",wo="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Re(){return typeof globalThis.window<"u"}var Je="unknown",$o=Bi({projectKey:xt({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Hi(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:wt(xo(xt()),[]),install:wt(Bi({framework:wt(xt(),Je),frameworkVersion:wt(xt(),Je),agent:wt(xt(),Je)}),{framework:Je,frameworkVersion:Je,agent:Je})}),Eo=["nextjs","vite-react","react","vue","svelte","astro","angular","react-native","web"],ko=["lovable","bolt","v0","replit","cursor","claude-code","codex","windsurf","other"];var Zl=new RegExp(String.raw`^\/(${Oi})\/?$`),Ll=1e3;function Nl(t){return new URLSearchParams({utm_source:Qs,utm_campaign:t}).toString()}var Dl=["utm_source","utm_medium","utm_campaign"];function Or(){if(!Re())return!1;let t=Zl.exec(globalThis.location.pathname);if(!t)return!1;let e=t[1];return e===void 0?!1:(globalThis.location.replace(`/?${Nl(e)}`),!0)}function Po(){new URLSearchParams(globalThis.location.search).get("utm_campaign")!==null&&setTimeout(()=>{let e=new URLSearchParams(globalThis.location.search);if(e.get("utm_campaign")===null)return;for(let i of Dl)e.delete(i);let r=e.toString();globalThis.history.replaceState(globalThis.history.state,"",globalThis.location.pathname+(r===""?"":`?${r}`)+globalThis.location.hash)},Ll)}var v=typeof window<"u"?window:void 0,he=typeof globalThis<"u"?globalThis:v,fe=he?.navigator,P=he?.document,ie=he?.location,Cs=he?.fetch,yn=he!=null&&he.XMLHttpRequest&&"withCredentials"in new he.XMLHttpRequest?he.XMLHttpRequest:void 0,So=he?.AbortController,jl=he?.CompressionStream,ye=fe?.userAgent;function Ea(){return!(!v||v.navigator.onLine===!1)}var Kt=typeof globalThis<"u"?globalThis:v;Kt&&typeof self>"u"&&(Kt.self=Kt),Kt&&typeof File>"u"&&(Kt.File=function(){});var z=v??{},D={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function To(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(l){return void r(l)}a.done?e(u):Promise.resolve(u).then(i,n)}function re(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(u){To(s,i,n,o,a,"next",u)}function a(u){To(s,i,n,o,a,"throw",u)}o(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},y.apply(null,arguments)}function ka(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var zo=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Io(t){return typeof t=="string"||t}function Co(t){return typeof t=="string"?t:void 0}var Yt,Ul=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],He=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),Ao=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),Hl=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Bl=["token"],Pa="NativeGzipValidationError",bn=t=>t.length>=2&&t[0]===31&&t[1]===139,Ro=(t,e)=>t===Ao.GZipJS||e===Ao.GZipJS||e==="gzip",Mo=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Fr=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Pa,e},Gl=(function(){var t=re((function*(e,r){18>e.size&&Fr("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());bn(i)&&i[2]===8||Fr("invalid-header");var n=new DataView(yield e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(Yt)return Yt;Yt=[];for(var c=0;256>c;c++){for(var h=c,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;Yt[c]=h>>>0}return Yt})(),u=4294967295,l=0;o.length>l;l++)u=a[255&(u^o[l])]^u>>>8;return(4294967295^u)>>>0})(r)&&Fr("invalid-crc");var s=r.length>>>0;n.getUint32(4,!0)!==s&&Fr("invalid-size")}));return function(e,r){return t.apply(this,arguments)}})();function xn(){return xn=re((function*(t,e,r){e===void 0&&(e=!0);try{var i=new TextEncoder().encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),o=s.write(i).then((()=>s.close())).catch((function(){var l=re((function*(c){try{yield s.abort(c)}catch{}throw c}));return function(c){return l.apply(this,arguments)}})()),a=new Response(n.readable).blob(),u=(yield Promise.all([a,o]))[0];return yield Gl(u,i),u}catch(l){if(r!=null&&r.rethrow)throw l;return e&&console.error("Failed to gzip compress data",l),null}})),xn.apply(this,arguments)}var Vl=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Oo=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return Vl.concat(e).some((i=>{var n=i.toLowerCase();return r.indexOf(n)!==-1}))};function A(t,e){return t.indexOf(e)!==-1}var zi=function(t){return t.trim()},wn=function(t){return t.replace(/^\$/,"")};function Sa(t){var e,r=[];return(e=JSON.stringify(t,(function(i,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(n))return"[Circular]";r.push(n)}return n}})))!==null&&e!==void 0?e:"null"}var Ta=Object.prototype,za=Ta.hasOwnProperty,Ii=Ta.toString,R=Array.isArray||function(t){return Ii.call(t)==="[object Array]"},Ce=t=>typeof t=="function",Y=t=>t===Object(t)&&!R(t),Xe=t=>{if(Y(t)){for(var e in t)if(za.call(t,e))return!1;return!0}return!1},x=t=>t===void 0,U=t=>Ii.call(t)=="[object String]",$n=t=>U(t)&&t.trim().length===0,ve=t=>t===null,M=t=>x(t)||ve(t),ce=t=>Ii.call(t)=="[object Number]"&&t==t,je=t=>ce(t)&&t>0,Ae=t=>Ii.call(t)==="[object Boolean]",ql=t=>t instanceof FormData,Wl=t=>A(Hl,t),Kl=t=>A(Bl,t);function Ia(t){return t===null||typeof t!="object"}function Qr(t,e){return{}.toString.call(t)==="[object "+e+"]"}function As(t){return typeof Event<"u"&&(function(e,r){try{return e instanceof r}catch{return!1}})(t,Event)}var Yl=[!0,"true",1,"1","yes"],Gi=t=>A(Yl,t),Jl=[!1,"false",0,"0","no"];function Oe(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),ce(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),Oe(n||r,e,r,i))}var En=class{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Oe(e.bucketSize,0,100,e.Ge),this.Qe=Oe(e.refillRate,0,this.Ze,e.Ge),this.Je=Oe(e.refillInterval,0,864e5,e.Ge)}Ke(e,r){var i=Math.floor((r-e.lastAccess)/this.Je);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qe,this.Ze),e.lastAccess=e.lastAccess+i*this.Je)}consumeRateLimit(e){var r,i=Date.now(),n=String(e),s=this.$e[n];return s?this.Ke(s,i):this.$e[n]=s={tokens:this.Ze,lastAccess:i},s.tokens===0||(s.tokens--,s.tokens===0&&((r=this.ze)==null||r.call(this,e)),s.tokens===0)}stop(){this.$e={}}},$e="Mobile",ei="iOS",We="Android",Ft="Tablet",Ca=We+" "+Ft,Aa="iPad",Ra="Apple",Ma=Ra+" Watch",hr="Safari",Zt="BlackBerry",Oa="Samsung",Fa=Oa+"Browser",Za=Oa+" Internet",dt="Chrome",Xl=dt+" OS",La=dt+" "+ei,Rs="Internet Explorer",Na=Rs+" "+$e,Ms="Opera",Ql=Ms+" Mini",Os="Edge",Da="Microsoft "+Os,Mt="Firefox",ja=Mt+" "+ei,mr="Nintendo",yr="PlayStation",Ot="Xbox",Ua=We+" "+$e,Ha=$e+" "+hr,or="Windows",kn=or+" Phone",Fo="Nokia",Pn="Ouya",Ba="Generic",ec=Ba+" "+$e.toLowerCase(),Ga=Ba+" "+Ft.toLowerCase(),Sn="Konqueror",Va="Oculus Browser",ti="Vivaldi",qa="Yandex",ri="Whale",Tn="DuckDuckGo",Wa="Pale Moon",ii="Waterfox",dr="Brave",Ka="Google Search App",ee="(\\d+(\\.\\d+)?)",Vi=new RegExp("Version/"+ee),tc=new RegExp(Ot,"i"),rc=new RegExp(yr+" \\w+","i"),ic=new RegExp(mr+" \\w+","i"),Fs=new RegExp(Zt+"|PlayBook|BB10","i"),nc={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Ya=function(t,e,r,i){e=e||"";var n=(function(s){return s!=null&&s.brave?dr:null})(r);return n||(i!=null&&i.detectGoogleSearchApp&&A(t,"GSA/")?Ka:A(t," OPR/")&&A(t,"Mini")?Ql:A(t," OPR/")?Ms:Fs.test(t)?Zt:A(t,"IE"+$e)||A(t,"WPDesktop")?Na:A(t,"OculusBrowser")?Va:A(t,Fa)?Za:A(t,Os)||A(t,"Edg/")?Da:A(t,ti+"/")?ti:A(t,"YaBrowser/")?qa:A(t,ri+"/")?ri:A(t,Tn+"/")||A(t,"Ddg/")?Tn:A(t,"FBIOS")?"Facebook "+$e:A(t,"UCWEB")||A(t,"UCBrowser")?"UC Browser":A(t,"CriOS")?La:A(t,"CrMo")||A(t,dt)?dt:A(t,We)&&A(t,hr)?Ua:A(t,"FxiOS")?ja:A(t.toLowerCase(),Sn.toLowerCase())?Sn:A(t,dr+"/")?dr:((s,o)=>o&&A(o,Ra)||(function(a){return A(a,hr)&&!A(a,dt)&&!A(a,We)})(s))(t,e)?A(t,$e)?Ha:hr:A(t,"PaleMoon/")?Wa:A(t,ii+"/")?ii:A(t,Mt)?Mt:A(t,"MSIE")||A(t,"Trident/")?Rs:A(t,"Gecko")?Mt:"")},sc={[Na]:[new RegExp("rv:"+ee)],[Da]:[new RegExp(Os+"?\\/"+ee)],[dt]:[new RegExp("("+dt+"|CrMo)\\/"+ee)],[La]:[new RegExp("CriOS\\/"+ee)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ee)],[hr]:[Vi],[Ha]:[Vi],[Ms]:[new RegExp("(Opera|OPR)\\/"+ee)],[Mt]:[new RegExp(Mt+"\\/"+ee)],[ja]:[new RegExp("FxiOS\\/"+ee)],[Sn]:[new RegExp("Konqueror[:/]?"+ee,"i")],[Zt]:[new RegExp(Zt+" "+ee),Vi],[Ua]:[new RegExp("android\\s"+ee,"i")],[Za]:[new RegExp(Fa+"\\/"+ee)],[Va]:[new RegExp("OculusBrowser\\/"+ee)],[ti]:[new RegExp(ti+"\\/"+ee)],[qa]:[new RegExp("YaBrowser\\/"+ee)],[ri]:[new RegExp(ri+"\\/"+ee)],[dr]:[new RegExp(dr+"\\/"+ee)],[Tn]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ee)],[Wa]:[new RegExp("PaleMoon\\/"+ee)],[ii]:[new RegExp(ii+"\\/"+ee)],[Ka]:[new RegExp("GSA\\/"+ee)],[Rs]:[new RegExp("(rv:|MSIE )"+ee)],Mozilla:[new RegExp("rv:"+ee)]},oc=function(t,e,r,i){var n=Ya(t,e,r,i),s=sc[n];if(x(s))return null;for(var o=0;s.length>o;o++){var a=t.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},Zo=[[new RegExp(Ot+"; "+Ot+" (.*?)[);]","i"),t=>[Ot,t&&t[1]||""]],[new RegExp(mr,"i"),[mr,""]],[new RegExp(yr,"i"),[yr,""]],[Fs,[Zt,""]],[new RegExp(or,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[kn,""];if(new RegExp($e).test(e)&&!/IEMobile\b/.test(e))return[or+" "+$e,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var i=nc[r[1]]||"";return/arm/i.test(e)&&(i="RT"),[or,i]}return[or,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ei,[t[3],t[4],t[5]||"0"].join(".")]:[ei,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=x(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+We+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+We+")","i"),t=>t&&t[2]?[We,[t[2],t[3],t[4]||"0"].join(".")]:[We,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Xl,""]],[/Linux|debian/i,["Linux",""]]],Lo=function(t){return ic.test(t)?mr:rc.test(t)?yr:tc.test(t)?Ot:new RegExp(Pn,"i").test(t)?Pn:new RegExp("("+kn+"|WPDesktop)","i").test(t)?kn:/iPad/.test(t)?Aa:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ma:Fs.test(t)?Zt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Fo,"i").test(t)?Fo:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp($e).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?We:Ca:new RegExp("(pda|"+$e+")","i").test(t)?ec:new RegExp(Ft,"i").test(t)&&!new RegExp(Ft+" pc","i").test(t)?Ga:""},ac=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function No(t,e){return typeof(r=t)=="string"&&ac.test(r)?t:e();var r}function Qe(t){return t&&t.split("#")[0]}function Vr(t,e){var r=setTimeout(t,e);return r?.unref&&r?.unref(),r}var uc=t=>t instanceof Error,Ja={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},lc=Ja.info;function Xa(t){if(Ae(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(R(t))return{arrayValue:{values:t.map((e=>Xa(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function ni(t){var e=[];for(var r in t){var i=t[r];ve(i)||x(i)||e.push({key:r,value:Xa(i)})}return e}function cc(t,e){var r=Ja[t.level||"info"]||lc,i=r.text,n=r.number,s=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),M(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),M(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=y({},o,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:n,severityText:i,body:{stringValue:t.body},attributes:ni(a)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),x(t.trace_flags)||(u.flags=t.trace_flags),u}function Qa(t,e,r){return y({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function eu(t,e,r,i){return{resourceLogs:[{resource:{attributes:ni(e)},scopeLogs:[{scope:{name:r,version:i},logRecords:t}]}]}}var hc=class{constructor(t,e,r,i,n,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=r,this.Ye=i,this.Xe=n,this.et=s,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.wt(t);if(e!==null)if(e.body){if(this.xt()){var r={record:cc(e,this.Ye())};this.Xe((()=>this.kt(r)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=R(e)?e:[e],i=t;for(var n of r)try{var s=n(i);if(!s)return this.Ge.info("Log was rejected in beforeSend function"),null;i=s}catch(o){return this.Ge.error("Error in beforeSend function for log:",o),null}return i}xt(){if(this.yt===void 0)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return re((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return re((function*(){var e;t.bt();var r=(e=t._instance.getPersistedProperty(He.LogsQueue))!==null&&e!==void 0?e:[];if(r.length!==0)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o;t.it=0;var a=Math.min(r.length,t.vt),u=r.slice(0,a),l=eu(u.map((h=>h.record)),t.Ct(),(s=t.tt)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),c=yield t._instance.Tt(l);if(c.kind==="too-large"&&u.length>1)t.vt=Math.max(1,Math.floor(u.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.vt);else if(c.kind==="retry-later"||(c.kind==="too-large"?t.Ge.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&t.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(u.length),r=(o=t._instance.getPersistedProperty(He.LogsQueue))!==null&&o!==void 0?o:[],n+=u.length,c.kind==="fatal"))throw c.error}}))()}It(t){var e=this;return re((function*(){var r,i=Math.max(0,t-e.it),n=(r=e._instance.getPersistedProperty(He.LogsQueue))!==null&&r!==void 0?r:[];e._instance.setPersistedProperty(He.LogsQueue,n.slice(i)),yield e.et()}))()}Ct(){return Qa(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var r=(e=this._instance.getPersistedProperty(He.LogsQueue))!==null&&e!==void 0?e:[];this.dt>r.length||(r.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(He.LogsQueue,r),this.ht>r.length?this.Mt():this._t()}}Mt(t){t===void 0&&(t=this.ct),this.Et||(this.Et=Vr((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(He.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re((function*(){e.bt();var r=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([r,new Promise((i=>Vr(i,t)))]):yield r}))()}flushWithTimeout(t){var e=this;return re((function*(){var r=!1,i=e.flush(),n=new Promise((s=>Vr((()=>{r=!0,s()}),t)));try{yield Promise.race([i,n])}finally{r&&i.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}},qi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Do(t){return String(t)+"000000"}function jo(t,e,r,i){var n="";return i&&(n=Object.keys(i).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(i[s]))).join(",")),t+"\0"+e+"\0"+(r??"")+"\0"+n}var dc=class{constructor(t,e,r){this._instance=t,this.Te=e,this.Ge=r,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,r){e===void 0&&(e=1),this.Nt({name:t,type:"count",value:e,unit:r?.unit,attributes:r?.attributes})}gauge(t,e,r){this.Nt({name:t,type:"gauge",value:e,unit:r?.unit,attributes:r?.attributes})}histogram(t,e,r){this.Nt({name:t,type:"histogram",value:e,unit:r?.unit,attributes:r?.attributes})}flush(){var t=this,e=this.rt,r=(function(){var n=re((function*(){e&&(yield e.catch((()=>{}))),yield t.Dt()}));return function(){return n.apply(this,arguments)}})(),i=r().finally((()=>{this.rt===i&&(this.rt=null)}));return this.rt=i,i}drainWindow(){if(this.Ot.size===0)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=e.attributes?y({},e.attributes):void 0,i=jo(e.type,e.name,e.unit,r)}catch(o){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var n=this.Ot.get(i);if(!n){if(!this.jt())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(i,n)}var s=this.Lt.get(e.name);s===void 0?this.Lt.set(e.name,e.type):s===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+s+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(n,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var r;switch(t.type){case"count":t.total=((r=t.total)!==null&&r!==void 0?r:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(qi.length+1).fill(0)});var i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[(function(n,s){for(var o=0;s.length>o;o++)if(s[o]>=n)return o;return s.length})(e,qi)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=R(e)?e:[e],i=t;for(var n of r)try{var s=n(i);if(!s)return this.Ge.info("Metric was rejected in beforeSend function"),null;i=s}catch(o){return this.Ge.error("Error in beforeSend function for metric:",o),null}return i}Mt(){this.Et||(this.Et=Vr((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return re((function*(){if(t.Ot.size!==0){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var r=t.At,i=yield t._instance.Bt(t.qt(e));if(r===t.At)switch(i.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",i.error)}}}))()}qt(t){return e=this.zt(t),r=(function(s,o,a){return y({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ni(r)},scopeMetrics:[{scope:{name:i,version:n},metrics:e}]}]};var e,r,i,n}zt(t){var e=Do(Date.now()),r=new Map;for(var i of t.values()){var n,s=jo(i.type,i.name,i.unit,void 0),o=r.get(s);o||(o=y({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=ni((n=i.attributes)!==null&&n!==void 0?n:{}),u=Do(i.windowStartMs);if(i.type==="count"){var l,c={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:(l=i.total)!==null&&l!==void 0?l:0};o.sum.dataPoints.push(c)}else if(i.type==="gauge"){var h,d={attributes:a,timeUnixNano:e,asDouble:(h=i.last)!==null&&h!==void 0?h:0};o.gauge.dataPoints.push(d)}else i.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:qi})}return Array.from(r.values())}Ut(t){var e,r;for(var i of t){var n=i[0],s=i[1],o=this.Ot.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((r=s.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.jt()&&this.Ot.set(n,s)}}},Zr,Uo,Wi;function pc(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return Wi&&r.length===Uo||(Uo=r.length,Wi=r.reduce(((i,n)=>{Zr||(Zr={});var s=Zr[n];if(s)i[s[0]]=s[1];else for(var o=t(n),a=o.length-1;a>=0;a--){var u=o[a],l=u?.filename,c=e[n];if(l&&c){i[l]=c,Zr[n]=[l,c];break}}return i}),{})),Wi}}var zn=class{constructor(e,r,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=r,this.modifiers=i}buildFromUnknown(e,r){r===void 0&&(r={});var i=r&&r.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,r,0).apply(e),s=this.buildParsingContext(r),o=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var r=this;return re((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&R(i.stacktrace.frames)&&(i.stacktrace.frames=yield r.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var i,n;return e.cause!=null&&(i=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),y({},e,{cause:i,stack:n})}applyChunkIds(e,r){return e.map((i=>(i.filename&&r&&(i.chunk_id=r[i.filename]),i)))}applyCoercers(e,r){for(var i of this.coercers)if(i.match(e))return i.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return re((function*(){var i=e;for(var n of r.modifiers)i=yield n(i);return i}))()}convertToExceptionList(e,r){var i,n,s,o={type:e.type,value:e.value,mechanism:{type:(i=r.type)!==null&&i!==void 0?i:"generic",handled:(n=r.handled)===null||n===void 0||n,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,y({},r,{handled:!0}))),a}buildParsingContext(e){var r;return{chunkIdMap:pc(this.stackParser),skipFirstLines:(r=e.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(e,r,i){i===void 0&&(i=0);var n=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,r,o);return this.applyCoercers(s,a)}};return y({},r,{syntheticException:i==0?r.syntheticException:void 0,mechanism:e,apply:s=>n(s,i),next:s=>n(s,i+1)})}},Lt="?";function In(t,e,r,i,n){var s={platform:t,filename:e,function:r==="<anonymous>"?Lt:r,in_app:!0};return x(i)||(s.lineno=i),x(n)||(s.colno=n),s}var tu=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,i=t.indexOf("safari-web-extension")!==-1;return r||i?[t.indexOf("@")!==-1?t.split("@")[0]:Lt,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},fc=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_c=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vc=/\((\S*)(?::(\d+))(?::(\d+))\)/,gc=(t,e)=>{var r=fc.exec(t);if(r)return In(e,r[1],Lt,+r[2],+r[3]);var i=_c.exec(t);if(i){if(i[2]&&i[2].indexOf("eval")===0){var n=vc.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=tu(i[1]||Lt,i[2]);return In(e,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},mc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,yc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,bc=(t,e)=>{var r=mc.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=yc.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||Lt,o=tu(s,n);return In(e,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},Ho=/\(error: (.*)\)/,Cn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var i=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return Qr(e,"DOMException")}isDOMError(e){return Qr(e,"DOMError")}},An=class{match(e){return(r=>r instanceof Error)(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Rn=class{constructor(){}match(e){return Qr(e,"ErrorEvent")&&e.error!=null}coerce(e,r){var i;return r.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},xc=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Mn=class{match(e){return typeof e=="string"}coerce(e,r){var i,n=this.getInfos(e),s=n[0],o=n[1];return{type:s??"Error",value:o??e,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var r="Error",i=e,n=e.match(xc);return n&&(r=n[1],i=n[2]),[r,i]}},wc=["fatal","error","warning","log","info","debug"];function ru(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(e>=n.length)return i===r.length?n:n.length>e?n.slice(0,e)+"...":n}return""}var On=class{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var i,n=this.getErrorPropertyFromObject(e);return n?r.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=r.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return As(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+ru(e)}isSeverityLevel(e){return U(e)&&!$n(e)&&wc.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var i=e[r];if(uc(i))return i}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}},Fn=class{match(e){return As(e)}coerce(e,r){var i,n=e.constructor.name;return{type:n,value:n+" captured as exception with keys: "+ru(e),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Zn=class{match(e){return Ia(e)}coerce(e,r){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Ln=class{match(e){return Qr(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!As(e))return!1;try{var r=e.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(e,r){var i,n=this.getUnhandledRejectionReason(e);return Ia(n)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(n),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},si="$message",oi="$timestamp",$c=new Set([si,oi]),Ki={enabled:!0,max_bytes:32768};function ai(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Ki.enabled,max_bytes:Ec(t.max_bytes,Ki.max_bytes)}:y({},Ki)}var Nn=class{constructor(e){this.Vt=[],this.Wt=0,this.Te=ai(e)}setConfig(e){this.Te=ai(e),this.Zt()}add(e){var r=(function(n){var s;try{s=Sa(n)}catch{return}try{var o=JSON.parse(s);if(!Y(o))return;var a=o,u=a[si],l=a[oi];return!U(u)||u.trim().length===0||!U(l)&&!ce(l)?void 0:{step:a,json:s}}catch{return}})(e);if(r){var i=(function(n){if(typeof TextEncoder<"u")return new TextEncoder().encode(n).length;for(var s=encodeURIComponent(n),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o})(r.json);i>this.Te.max_bytes||(this.Vt.push({step:r.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((e=>e.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var e=this.Vt.shift();e&&(this.Wt-=e.bytes)}}};function Ec(t,e){if(!ce(t)||t===1/0||t===-1/0)return e;var r=Math.floor(t);return 0>r?e:r}var iu=function(t,e){var r=(e===void 0?{}:e).debugEnabled,i={k(n){if(v&&(D.DEBUG||v.POSTHOG_DEBUG||r)&&!x(v.console)&&v.console){for(var s=("__rrweb_original__"in v.console[n])?v.console[n].__rrweb_original__:v.console[n],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},debug(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("debug",...s)},info(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("log",...s)},warn(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("warn",...s)},error(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("error",...s)},critical(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(n){i.error("You must initialize PostHog before calling "+n)},createLogger:(n,s)=>iu(t+" "+n,s)};return i},w=iu("[PostHog.js]"),J=w.createLogger,kc=J("[ExternalScriptsLoader]"),Yi=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return kc.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var i=P?.querySelectorAll("script");if(i){for(var n,s=function(){if(i[o].src===e){var u=i[o];return u.__posthog_loading_callback_fired?{v:r()}:(u.addEventListener("load",(l=>{u.__posthog_loading_callback_fired=!0,r(void 0,l)})),u.onerror=l=>r(l),{v:void 0})}},o=0;i.length>o;o++)if(n=s())return n.v}var a=()=>{if(!P)return r("document not found");var u=P.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=h=>{u.__posthog_loading_callback_fired=!0,r(void 0,h)},u.onerror=h=>r(h),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")P.head.appendChild(u);else{var l,c=P.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(u,c[0]):P.body.appendChild(u)}};P!=null&&P.body?a():P?.addEventListener("DOMContentLoaded",a)};z.__PosthogExtensions__=z.__PosthogExtensions__||{},z.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e!=="remote-config"){var i;if(t.config.strict_script_versioning)i=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var n="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;n=n+"&t="+Math.floor(Date.now()/s)*s}i=t.requestRouter.endpointFor("assets",n)}Yi(t,i,r)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Yi(t,o,r)}},z.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var i=t.requestRouter.endpointFor("api",e);Yi(t,i,r)};D.DEBUG=!1,D.LIB_VERSION="1.407.6",D.LIB_NAME="web";var nu="$people_distinct_id",ui="$device_id",Ji="$device_model",ar="__alias",ur="__timers",Dn="$autocapture_disabled_server_side",jn="$heatmaps_enabled_server_side",Un="$exception_capture_enabled_server_side",Hn="$error_tracking_suppression_rules",Bn="$error_tracking_capture_extension_exceptions",Gn="$web_vitals_enabled_server_side",Zs="$dead_clicks_enabled_server_side",Ls="$product_tours_enabled_server_side",Vn="$web_vitals_allowed_metrics",ht="$session_recording_remote_config",su="$replay_sample_rate",ou="$replay_override_sampling",au="$replay_override_linked_flag",uu="$replay_override_url_trigger",lu="$replay_override_event_trigger",At="$sesid",Ns="$session_is_sampled",ct="$enabled_feature_flags",qr="$active_feature_flags",lr="$early_access_features",qn="$feature_flag_details",Wr="$feature_flag_payloads",Wn="$feature_flag_request_id",li="$minimal_flag_called_events",Ue="$override_feature_flags",zt="$override_feature_flag_payloads",at="$stored_person_properties",ut="$stored_group_properties",Kn="$surveys",ci="$surveys_loaded_at",Yn="$surveys_activated",Kr="$surveys_activated_session",cr="ph_product_tours",pr="$flag_call_reported",Jn="$flag_call_reported_session_id",Xn="$feature_flag_errors",br="$feature_flag_evaluated_at",Ie="$user_state",Qn="$client_session_props",es="$capture_rate_limit",ts="$initial_campaign_params",rs="$initial_referrer_info",hi="$initial_person_info",di="$epp",Lr="$posthog_cookieless",cu="$cookieless_mode",hu="$sdk_debug_extensions_init_method",du="$sdk_debug_extensions_init_time_ms",pu="$sdk_debug_recording_script_not_loaded",Ds="PostHog loadExternalDependency extension not found.",lt="on_reject",Ge="always",kt="anonymous",Pt="identified",is="identified_only",pi="visibilitychange",fi="beforeunload",It="$pageview",Xi="$pageleave",Qi="$identify",Bo="$groupidentify";function Nr(t,e){R(t)&&t.forEach(e)}function H(t,e){if(!M(t))if(R(t))t.forEach(e);else if(ql(t))t.forEach(((i,n)=>e(i,n)));else for(var r in t)za.call(t,r)&&e(t[r],r)}var q=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;e>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)n[s]!==void 0&&(t[s]=n[s]);return t};function Yr(t){for(var e=Object.keys(t),r=e.length,i=new Array(r);r--;)i[r]=[e[r],t[e[r]]];return i}var Go=function(t){try{return t()}catch{return}},Pc=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];return t.apply(this,r)}catch(n){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(n)}}},js=function(t){var e={};return H(t,(function(r,i){(U(r)&&r.length>0||ce(r))&&(e[i]=r)})),e},Sc=["herokuapp.com","vercel.app","netlify.app"];function Tc(t){var e=t?.hostname;if(!U(e))return!1;var r=e.split(".").slice(-2).join(".");for(var i of Sc)if(r===i)return!1;return!0}function te(t,e,r,i){var n=i??{},s=n.capture,o=n.passive;t?.addEventListener(e,r,{capture:s!==void 0&&s,passive:o===void 0||o})}function fu(t){return t.name==="ph_toolbar_internal"}var _u=t=>{if(P){try{for(var e=t+"=",r=P.cookie.split(";").filter((s=>s.length)),i=0;r.length>i;i++){for(var n=r[i];n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ce(t)&&isFinite(t)&&Math.floor(t)===t});var ns=class t{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,i,n){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||0>e||0>r||0>i||0>n||e>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/256,s[5]=e,s[6]=112|r>>>8,s[7]=r,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=n>>>24,s[13]=n>>>16,s[14]=n>>>8,s[15]=n,new t(s)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;16>r;r++){var i=this.bytes[r]-e.bytes[r];if(i!==0)return Math.sign(i)}return 0}},ss=class{generate(){var e=this.generateOrAbort();if(!x(e))return e;this.S=0;var r=this.generateOrAbort();if(x(r))throw new Error("Could not generate UUID after timestamp reset");return r}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return ns.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new os}},Vo,vu=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};v&&!x(v.crypto)&&crypto.getRandomValues&&(vu=t=>crypto.getRandomValues(t));var os=class{nextUint32(){return this.R.length>this.O||(vu(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}},Be=()=>zc().toString(),zc=()=>(Vo||(Vo=new ss)).generate(),Jt="",Ic=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ve={N:()=>!!P,D(t){w.error("cookieStore error: "+t)},A:_u,F(t){var e;try{e=JSON.parse(Ve.A(t))||{}}catch{}return e},q(t,e,r,i,n){if(!P)return!1;try{var s="",o="",a=(function(c,h){if(h){var d=(function(p,_){if(_===void 0&&(_=P),Jt)return Jt;if(!_||["localhost","127.0.0.1"].includes(p))return"";for(var m=p.split("."),g=Math.min(m.length,8),E="dmn_chk_"+Be();!Jt&&g--;){var $=m.slice(g).join("."),k=E+"=1;domain=."+$+";path=/";_.cookie=k+";max-age=3",_.cookie.includes(E)&&(_.cookie=k+";max-age=0",Jt=$)}return Jt})(c);if(!d){var f=(p=>{var _=p.match(Ic);return _?_[0]:""})(c);f!==d&&w.info("Warning: cookie subdomain discovery mismatch",f,d),d=f}return d?"; domain=."+d:""}return""})(P.location.hostname,i);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}n&&(o="; secure");var l=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+l.length),P.cookie=l,!0}catch{return!1}},P(t,e){if(P!=null&&P.cookie)try{Ve.q(t,"",-1,e)}catch{return}}},en=null,G={N(){if(!ve(en))return en;var t=!0;if(x(v))t=!1;else try{var e="__mplssupport__";G.q(e,"xyz"),G.A(e)!=='"xyz"'&&(t=!1),G.P(e)}catch{t=!1}return t||w.error("localStorage unsupported; falling back to cookie store"),en=t,t},D(t){w.error("localStorage error: "+t)},A(t){try{return v?.localStorage.getItem(t)}catch(e){G.D(e)}return null},F(t){try{return JSON.parse(G.A(t))||{}}catch{}return null},q(t,e){try{return v?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){G.D(r)}return!1},P(t){try{v?.localStorage.removeItem(t)}catch(e){G.D(e)}}},Cc=[ui,"distinct_id",At,Ns,di,hi,Ie],Dr={},Ac={N:()=>!0,D(t){w.error("memoryStorage error: "+t)},A:t=>Dr[t]||null,F:t=>Dr[t]||null,q:(t,e)=>(Dr[t]=e,!0),P(t){delete Dr[t]}},tt=null,le={N(){if(!ve(tt))return tt;if(tt=!0,x(v))tt=!1;else try{var t="__support__";le.q(t,"xyz"),le.A(t)!=='"xyz"'&&(tt=!1),le.P(t)}catch{tt=!1}return tt},D(t){w.error("sessionStorage error: ",t)},A(t){try{return v?.sessionStorage.getItem(t)}catch(e){le.D(e)}return null},F(t){try{return JSON.parse(le.A(t))||null}catch{}return null},q(t,e){try{return v?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){le.D(r)}return!1},P(t){try{v?.sessionStorage.removeItem(t)}catch(e){le.D(e)}}},as=class{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===Ge||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===lt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Jt.q(this.Kt,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var e=this._instance.config,r=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+r:"__ph_opt_in_out_"+r)}get Qt(){var e=this.Jt.A(this.Kt);return Gi(e)?1:A(Jl,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,r=e==="localStorage"?G:Ve;if(!this.Yt||this.Yt!==r){this.Yt=r;var i=e==="localStorage"?Ve:G;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Gi(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[fe?.doNotTrack,fe?.msDoNotTrack,z.doNotTrack].some((e=>Gi(e)))}};function gu(t,e){var r,i=t==null||(r=t.config)==null?void 0:r.get_current_url;if(!Ce(i))return e;try{var n=i(e);return U(n)&&n?n:e}catch(s){return w.error("Error in get_current_url, falling back to window.location.href",s),e}}var mu="__POSTHOG_TOOLBAR__",Rc=1,Mc=3,Oc=11;function qo(t){return t instanceof Element&&(t.id===mu||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function et(t){return!!t&&t.nodeType===Rc}function we(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function yu(t){return!!t&&t.nodeType===Mc}function bu(t){return!!t&&t.nodeType===Oc&&et(t.host)}var xu=1e3;function Us(t){return t?zi(t).split(/\s+/):[]}function Wo(t,e){var r=(function(i){var n,s=v==null||(n=v.location)==null?void 0:n.href;return x(s)?void 0:gu(i,s)})(e);return!!(r&&t&&t.some((i=>r.match(i))))}function _i(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Us(e)}function wu(t){return M(t)?null:zi(t).split(/(\s+)/).filter((e=>fr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xr(t){var e="";return ls(t)&&!Pu(t)&&t.childNodes&&t.childNodes.length&&H(t.childNodes,(function(r){var i;yu(r)&&r.textContent&&(e+=(i=wu(r.textContent))!==null&&i!==void 0?i:"")})),zi(e)}function tn(t){var e;return x(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Hs=["a","button","form","input","select","textarea","label"];function us(t,e){if(x(e))return!0;var r,i=function(s){if(e.some((o=>(function(a,u){var l=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!l&&l.call(a,u)}catch{return!1}})(s,o))))return{v:!0}};for(var n of t)if(r=i(n))return r.v;return!1}function $u(t){var e=t.parentNode;return!(!e||!et(e))&&e}var Fc=[".ph-no-autocapture","[data-ph-no-autocapture]"],Eu=["next","previous","prev",">","<"],Zc=[...Eu,"+","-","\u2212","\u2013"],Ko=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Yo=[".ph-no-rageclick",".ph-no-capture"],Lc=["","text","search","email","password","url","tel","number"];function Jo(t,e){if(!v||Bs(t))return!1;var r,i,n,s,o;if(Ae(e)?(r=!!e&&Yo,i=void 0,n=!1):(r=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Yo,i=e?.content_ignorelist,n=(o=e?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||n&&(function(u){return!(!u||!et(u))&&(!!we(u,"textarea")||(we(u,"input")?A(Lc,(u.getAttribute("type")||"").toLowerCase()):(function(l){if(l.isContentEditable)return!0;var c=l.getAttribute==null?void 0:l.getAttribute("contenteditable");return c==="true"||c===""})(u)))})(t))return!1;var a=ku(t,!1).targetElementList;return!(function(u,l){if(u===!1||x(u))return!1;var c;if(u===!0)c=Eu;else{if(!R(u))return!1;if(u.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=u.map((h=>h.toLowerCase()))}return l.some((h=>{var d=h.safeText,f=h.ariaLabel;return c.some((p=>Ko(d,p)||Ko(f,p)))}))})(i,a.map((u=>{var l;return{safeText:xr(u).toLowerCase(),ariaLabel:((l=u.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}})))&&!us(a,r)}var Bs=t=>!t||we(t,"html")||!et(t),ku=(t,e)=>{if(!v||Bs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[t],n=t;n.parentNode&&!we(n,"body");)if(bu(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=$u(n);if(!s)break;if(e||Hs.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=v.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function ls(t){for(var e=new Set,r=0,i=t;i.parentNode&&!we(i,"body");i=i.parentNode){if(r++>=xu||e.has(i))return!1;e.add(i);var n=_i(i);if(A(n,"ph-sensitive")||A(n,"ph-no-capture"))return!1}if(A(_i(t),"ph-include"))return!0;var s=t.type||"";if(U(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!U(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Pu(t){return!!(we(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||we(t,"select")||we(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Su="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Nc=new RegExp("^(?:"+Su+")$"),Dc=new RegExp(Su),Tu="\\d{3}-?\\d{2}-?\\d{4}",jc=new RegExp("^("+Tu+")$"),Uc=new RegExp("("+Tu+")");function fr(t,e){return e===void 0&&(e=!0),!(M(t)||U(t)&&(t=zi(t),(e?Nc:Dc).test((t||"").replace(/[- ]/g,""))||(e?jc:Uc).test(t)))}function Xo(t){var e=xr(t);return fr(e=(e+" "+zu(t)).trim())?e:""}function zu(t){var e="";return t&&t.childNodes&&t.childNodes.length&&H(t.childNodes,(function(r){var i;if(r&&((i=r.tagName)==null?void 0:i.toLowerCase())==="span")try{var n=xr(r);e=(e+" "+n).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+zu(r)).trim())}catch(s){w.error("[AutoCapture]",s)}})),e}function Qo(t){return t.replace(/"|\\"/g,'\\"')}function Hc(t){var e=t.attr__class;if(e)return R(e)?e:Us(e)}var jr=J("[Dead Clicks]"),Bc=()=>!0,Gc=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(Zs)),i=t.instance.config.capture_dead_clicks;return Ae(i)?i:!!Y(i)||r},vi=class{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,r,i){this.instance=e,this.isEnabled=r,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var r=e.config;"captureDeadClicks"in r&&(this.instance.persistence&&this.instance.persistence.register({[Zs]:r.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var r,i;(r=z.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture?e():(i=z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(n=>{n?jr.error("failed to load script",n):e()}))}tr(){var e;if(P){if(!this.Xt&&(e=z.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=Y(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};r.__onCapture=this.onCapture,this.onCapture&&(r.capture_dead_swipes=!1),this.Xt=z.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.Xt.start(P),jr.info("starting...")}}else jr.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,jr.info("stopping..."))}},rn=J("[SegmentIntegration]"),Iu="posthog-js";function Cu(t,e){var r=e===void 0?{}:e,i=r.organization,n=r.projectId,s=r.prefix,o=r.severityAllowList,a=o===void 0?["error"]:o,u=r.sendExceptionsToPostHog,l=u===void 0||u;return c=>{var h,d,f,p,_;if(a!=="*"&&!a.includes(c.level)||!t.__loaded)return c;c.tags||(c.tags={});var m=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());c.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var g,E=((h=c.exception)==null?void 0:h.values)||[],$=E.map((T=>y({},T,{stacktrace:T.stacktrace?y({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((L=>y({},L,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((d=E[0])==null?void 0:d.value)||c.message,$exception_type:(f=E[0])==null?void 0:f.type,$exception_level:c.level,$exception_list:$,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((p=E[0])==null?void 0:p.value)||c.message,$sentry_exception_type:(_=E[0])==null?void 0:_.type,$sentry_tags:c.tags};return i&&n&&(k.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+c.event_id),l&&((g=t.exceptions)==null||g.sendExceptionEvent(k)),c}}var cs=class{constructor(e,r,i,n,s,o){this.name=Iu,this.setupOnce=function(a){a(Cu(e,{organization:r,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},gi=class{constructor(e){this.rr=(r,i,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:n}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,r){var i,n=this.ar(e,r);return this.ir={pathname:(i=v?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var r;return this.ar(e,(r=this.ir)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,r){var i=this.ir;if(!i)return{$pageview_id:r};var n={$pageview_id:r,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,u=s.maxScrollY,l=s.maxContentHeight,c=s.lastContentY,h=s.maxContentY;if(!(x(o)||x(a)||x(u)||x(l)||x(c)||x(h))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c),h=Math.ceil(h);var d=o>1?Oe(a/o,0,1,w):1,f=o>1?Oe(u/o,0,1,w):1,p=l>1?Oe(c/l,0,1,w):1,_=l>1?Oe(h/l,0,1,w):1;n=q(n,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),n}},nn=["flags","surveys"],Vc={[nu]:{exposure:"hidden"},[ar]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ur]:{exposure:"hidden"},[Dn]:{exposure:"event"},[jn]:{exposure:"hidden"},[Un]:{exposure:"event"},[Hn]:{exposure:"hidden"},[Bn]:{exposure:"event"},[Gn]:{exposure:"event"},[Zs]:{exposure:"event"},[Ls]:{exposure:"hidden"},[Vn]:{exposure:"event"},[ht]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[At]:{exposure:"hidden"},[Ns]:{exposure:"event"},[su]:{exposure:"event",shouldSkipFromEventProperties:t=>ve(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[ct]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Y(t))return{};for(var e={},r=Object.keys(t),i=0;r.length>i;i++)e["$feature/"+r[i]]=t[r[i]];return e}},[qr]:{exposure:"event",storageGroup:"flags"},[lr]:{exposure:"hidden"},[qn]:{exposure:"hidden",storageGroup:"flags"},[Wr]:{exposure:"event",storageGroup:"flags"},[Wn]:{exposure:"event",storageGroup:"flags",volatile:!0},[li]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"event"},[zt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[Kn]:{exposure:"hidden",storageGroup:"surveys"},[ci]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Yn]:{exposure:"event"},[Kr]:{exposure:"hidden"},[cr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[pr]:{exposure:"hidden"},[Jn]:{exposure:"hidden"},[Xn]:{exposure:"hidden"},[br]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[es]:{exposure:"hidden"},[ts]:{exposure:"hidden"},[rs]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[di]:{exposure:"hidden"},[ou]:{exposure:"event"},[au]:{exposure:"event"},[uu]:{exposure:"event"},[lu]:{exposure:"event"},[hu]:{exposure:"event"},[du]:{exposure:"event"},[pu]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},qc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],rt=t=>{var e=Vc[t];if(e)return e;for(var r of qc){var i=r[1];if(t.indexOf(r[0])===0)return i}},Rt=(t,e)=>{try{return JSON.stringify(t,((r,i)=>typeof i=="bigint"?i.toString():i),e)}catch{return Sa(t)}},mi=t=>{var e=P?.createElement("a");return x(e)?null:(e.href=t,e)},Nt=function(t,e){for(var r,i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===e){r=s;break}}if(!R(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{w.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},wr=function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var h=u[c].split("=");R(h)&&(e.includes(h[0])?l.push(h[0]+"="+r):l.push(u[c]))}var d=a;return o!=null&&(d+="?"+l.join("&")),n!=null&&(d+="#"+n),d},yi=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},Au=(t,e)=>t>=e&&Ea(),Ru=(t,e,r,i)=>{if(t===0){if(Ea()){var n=e+1;return n===r&&i(),n}return e}return 0},Ur="https?://(.*)",Dt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Wc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Dt],$r="<masked>",Kc=["li_fat_id"];function Mu(t,e,r){if(!P)return{};var i,n=e?[...Dt,...r||[]]:[],s=Ou(wr(P.URL,n,$r),t),o=(i={},H(Kc,(function(a){var u=_u(a);i[a]=u||null})),i);return q(o,s)}function Ou(t,e){var r=Wc.concat(e||[]),i={};return H(r,(function(n){var s=Nt(t,n);i[n]=s||null})),i}function Fu(t){var e=(function(s){return s?s.search(Ur+"google.([^/?]*)")===0?"google":s.search(Ur+"bing.com")===0?"bing":s.search(Ur+"yahoo.com")===0?"yahoo":s.search(Ur+"duckduckgo.com")===0?"duckduckgo":null:null})(t),r=e!="yahoo"?"q":"p",i={};if(!ve(e)){i.$search_engine=e;var n=P?Nt(P.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function ea(){return navigator.language||navigator.userLanguage}var bi="$direct";function Zu(){return P?.referrer||bi}function Lu(t,e,r){r===void 0&&(r=!1);var i=t?[...Dt,...e||[]]:[],n=r?Qe(ie?.href):ie?.href,s=n?.substring(0,1e3);return{r:Zu().substring(0,1e3),u:s?wr(s,i,$r):void 0}}function Nu(t,e){var r;e===void 0&&(e=!1);var i=t.r,n=t.u,s=e?Qe(n):n,o={$referrer:i,$referring_domain:i==null?void 0:i==bi?bi:(r=mi(i))==null?void 0:r.host};if(s){o.$current_url=s;var a=mi(s);o.$host=a?.host,o.$pathname=a?.pathname;var u=Ou(s);q(o,u)}if(i){var l=Fu(i);q(o,l)}return o}function Du(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Yc(){try{return new Date().getTimezoneOffset()}catch{return}}var Jc={flags:br,surveys:ci},Xc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],St="main",_r=class{constructor(e,r,i){if(i===void 0&&(i=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=i,this.props={},this.cr=!1,this.vr=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,r),this.save(),v){var n=()=>this.flush();te(v,"beforeunload",n,{capture:!1}),te(v,"pagehide",n,{capture:!1})}}mr(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return ce(r)&&r>0?r:0}isDisabled(){return!!this.yr}pr(e){Xc.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r,i=(function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var u=[...Cc,...o];return y({},G,{F(l){try{var c={};try{c=Ve.F(l)||{}}catch{}var h,d=JSON.parse(G.A(l)||"{}");if(a){var f={};for(var p in c){var _=c[p];ve(_)||_===""||(f[p]=_)}h=q(d,f)}else h=q(c,d);return G.q(l,h),h}catch{}return null},q(l,c,h,d,f,p){var _=G.q(l,c,void 0,void 0,p);try{var m={};u.forEach((g=>{c[g]&&(m[g]=c[g])})),Object.keys(m).length&&Ve.q(l,m,h,d,f,p)}catch(g){G.D(g)}return _},P(l,c){try{v?.localStorage.removeItem(l),Ve.P(l,c)}catch(h){G.D(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&G.N()?(r=G,n=!0):s==="localstorage+cookie"&&i.N()?(r=i,n=!0):s==="sessionstorage"&&le.N()?r=le:s==="memory"?r=Ac:s==="cookie"?r=Ve:i.N()?(r=i,n=!0):r=Ve,this.ur=n,r}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var r=e??this.Te.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var i=this.props[br];return!i||typeof i!="number"||Date.now()-i>r}properties(){var e={};return H(this.props,((r,i)=>{var n=rt(i);if(n?.exposure==="derived"){if(n.shouldSkipFromEventProperties!=null&&n.shouldSkipFromEventProperties(r,i===ct?()=>this._r():()=>!1))return;n.transformToEventProperties&&q(e,n.transformToEventProperties(r))}else if(!n||n.exposure==="event"){if(n!=null&&n.shouldSkipFromEventProperties!=null&&n.shouldSkipFromEventProperties(r,(()=>!1)))return;e[i]=r}})),e}load(){if(!this.yr){var e=this.Jt.F(this.vr);e&&(this.props=q({},e)),this.hr&&this.wr()}}wr(){for(var e of nn){var r=G.F(this.br(e));if(r&&!Xe(r)){var i=this.kr(e);i.persisted=!0,this.Sr(e)||(i.fingerprint=this.Cr(r,e)),this.Tr(e,r)||q(this.props,r)}}}Sr(e){return Object.keys(this.props).some((r=>{var i;return((i=rt(r))==null?void 0:i.storageGroup)===e}))}Tr(e,r){var i=Jc[e];if(!i)return!1;var n=r[i],s=this.props[i];return ce(n)&&ce(s)&&s>n}refreshKey(e){var r;if(!this.yr){var i=this.hr?(r=rt(e))==null?void 0:r.storageGroup:void 0,n=i?G.F(this.br(i)):this.Jt.F(this.vr);if(n&&e in n)this.Ir(e,n[e]);else{if(i){var s=this.Jt.F(this.vr);if(s&&e in s)return void this.Ir(e,s[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?x(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){x(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,St))}Pr(){var e=this.Fr(),r=e.main,i=e.groups;for(var n of(this.Or(this.Jt,this.vr,r,St),nn)){var s,o=i[n];(!Xe(o)||(s=this.lr[n])!=null&&s.persisted)&&this.Or(G,this.br(n),o,n)}}Fr(){var e={},r={flags:{},surveys:{}};return H(this.props,((i,n)=>{var s,o=(s=rt(n))==null?void 0:s.storageGroup;o?r[o][n]=i:e[n]=i})),{main:e,groups:r}}Cr(e,r){if(r===St)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return H(e,((n,s)=>{var o;i[s]=(o=rt(s))!=null&&o.volatile?"__volatile__":n})),JSON.stringify(i)}Or(e,r,i,n){var s=this.kr(n);if(n===St||s.dirty||x(s.fingerprint)){var o;try{if((o=this.Cr(i,n))===s.fingerprint)return void(s.dirty=!1)}catch{o=void 0}e.q(r,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,n!==St&&(s.persisted=!0),x(o)||(s.fingerprint=o)):this.Te.debug&&w.warn('failed to persist storage entry "'+r+'"; will retry on next save')}}remove(e){var r=(e===void 0?{}:e).keepGroupEntries,i=r!==void 0&&r;if(x(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var n of nn)G.P(this.br(n));i?delete this.lr[St]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,r,i){if(Y(e)){x(r)&&(r="None"),this.Lr=x(i)?this.Nr:i;var n=!1;if(H(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==r||(this.Ir(o,s),n=!0)})),n)return this.save(),!0}return!1}register(e,r){if(Y(e)){this.Lr=x(r)?this.Nr:r;var i=!1;if(H(e,((n,s)=>{e.hasOwnProperty(s)&&this.props[s]!==n&&(this.Ir(s,n),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=Mu(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Xe(js(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=P?.referrer)?Fu(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Zu(),$referring_domain:P!=null&&P.referrer&&((e=mi(P.referrer))==null?void 0:e.host)||bi},void 0)}set_initial_person_info(){this.props[ts]||this.props[rs]||this.register_once({[hi]:Lu(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};H([rs,ts],(n=>{var s=this.props[n];s&&H(s,(function(o,a){e["$initial_"+wn(a)]=o}))}));var r=this.props[hi];if(r){var i=(function(n,s){s===void 0&&(s=!1);var o=Nu(n,s),a={};return H(o,(function(u,l){a["$initial_"+wn(l)]=u})),a})(r,this.Te.disable_capture_url_hashes);q(e,i)}return e}safe_merge(e){return H(this.props,(function(r,i){i in e||(e[i]=r)})),e}update_config(e,r,i){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var n=e.persistence!==r.persistence||!((u,l)=>{if(u.length!==l.length)return!1;var c=[...u].sort(),h=[...l].sort();return c.every(((d,f)=>d===h[f]))})(e.cookie_persisted_properties||[],r.cookie_persisted_properties||[]),s=n?this.pr(e):this.Jt,o=this.gr(e);if(n||o!==this.hr){var a=this.props;this.clear(),this.Jt=s,this.hr=o,this.props=a,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,r){var i=this.props[ur]||{};i[e]=r,this.Ir(ur,i),this.save()}remove_event_timer(e){var r=this.props[ur]||{},i=r[e];return x(i)||(delete r[e],this.Ir(ur,r),this.save()),i}get_property(e){return this.props[e]}set_property(e,r){this.Ir(e,r),this.save()}Ir(e,r){var i;this.props[e]=r,(i=rt(e))!=null&&i.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var r,i=(r=rt(e))==null?void 0:r.storageGroup;i&&(this.kr(i).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}},pe={GZipJS:"gzip-js",Base64:"base64"},Xt={Activation:"events",Cancellation:"cancelEvents"};var sn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var qe={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},on={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},hs={Popover:"popover",Inline:"inline"};var Qc={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ta={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ra=J("[RateLimiter]"),ds=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((n=>{ra.info((n||"events")+" is quota limited."),this.serverLimits[n]=new Date().getTime()+6e4}))}catch(n){return void ra.warn('could not rate limit - continuing. Error: "'+n?.message+'"',{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var r,i,n;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),u=(r=(i=this.instance.persistence)==null?void 0:i.get_property(es))!==null&&r!==void 0?r:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var l=1>u.tokens;return l||e||(u.tokens=Math.max(0,u.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(n=this.instance.persistence)==null||n.set_property(es,u),{isRateLimited:l,remainingTokens:u.tokens}}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}},Qt=J("[RemoteConfig]"),xi=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var r,i;(r=z.__PosthogExtensions__)!=null&&r.loadExternalDependency?(i=z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(r){e(r.json)}})}load(){try{if(this.remoteConfig)return Qt.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void Qt.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return Qt.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((r=>{this.Hr(r),this.Br()}));this.Hr(e),this.Br()}))}catch(e){Qt.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&P&&P.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var r=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;r!==0&&(this.zr=setInterval((()=>{this.refresh()}),r))}}Hr(e){var r;e||Qt.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded())}};var Se=Uint8Array,_e=Uint16Array,jt=Uint32Array,Gs=new Se([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vs=new Se([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ia=new Se([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ju=function(t,e){for(var r=new _e(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new jt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Uu=ju(Gs,2),ps=Uu[1];Uu[0][28]=258,ps[258]=28;for(fs=ju(Vs,0)[1],wi=new _e(32768),W=0;32768>W;++W)it=(43690&W)>>>1|(21845&W)<<1,wi[W]=((65280&(it=(61680&(it=(52428&it)>>>2|(13107&it)<<2))>>>4|(3855&it)<<4))>>>8|(255&it)<<8)>>>1;var it,fs,wi,W,vr=function(t,e,r){for(var i=t.length,n=0,s=new _e(e);i>n;++n)++s[t[n]-1];var o,a=new _e(e);for(n=0;e>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new _e(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],c=e-t[n],h=a[t[n]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[wi[h]>>>u]=l}else for(o=new _e(i),n=0;i>n;++n)o[n]=wi[a[t[n]-1]++]>>>15-t[n];return o},ft=new Se(288);for(W=0;144>W;++W)ft[W]=8;for(W=144;256>W;++W)ft[W]=9;for(W=256;280>W;++W)ft[W]=7;for(W=280;288>W;++W)ft[W]=8;var $i=new Se(32);for(W=0;32>W;++W)$i[W]=5;var eh=vr(ft,9,0),th=vr($i,5,0),Hu=function(t){return(t/8>>0)+(7&t&&1)},Bu=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var i=new(t instanceof _e?_e:t instanceof jt?jt:Se)(r-e);return i.set(t.subarray(e,r)),i},Le=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},er=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},an=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Se(0),0];if(n==1){var o=new Se(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(T,L){return T.f-L.f})),r.push({s:-1,f:25001});var a=r[0],u=r[1],l=0,c=1,h=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=n-1;)a=r[r[h].f>r[l].f?l++:h++],u=r[l!=c&&r[h].f>r[l].f?l++:h++],r[c++]={s:-1,f:a.f+u.f,l:a,r:u};var d=s[0].s;for(i=1;n>i;++i)s[i].s>d&&(d=s[i].s);var f=new _e(d+1),p=_s(r[c-1],f,0);if(p>e){i=0;var _=0,m=p-e,g=1<<m;for(s.sort((function(T,L){return f[L.s]-f[T.s]||T.f-L.f}));n>i;++i){var E=s[i].s;if(e>=f[E])break;_+=g-(1<<p-f[E]),f[E]=e}for(_>>>=m;_>0;){var $=s[i].s;e>f[$]?_-=1<<e-f[$]++-1:++i}for(;i>=0&&_;--i){var k=s[i].s;f[k]==e&&(--f[k],++_)}p=e}return[new Se(f),p]},_s=function(t,e,r){return t.s==-1?Math.max(_s(t.l,e,r+1),_s(t.r,e,r+1)):e[t.s]=r},na=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new _e(++e),i=0,n=t[0],s=1,o=function(u){r[i++]=u},a=1;e>=a;++a)if(t[a]==n&&a!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return[r.subarray(0,i),e]},tr=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},vs=function(t,e,r){var i=r.length,n=Hu(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},sa=function(t,e,r,i,n,s,o,a,u,l,c){Le(e,c++,r),++n[256];for(var h=an(n,15),d=h[0],f=h[1],p=an(s,15),_=p[0],m=p[1],g=na(d),E=g[0],$=g[1],k=na(_),T=k[0],L=k[1],F=new _e(19),b=0;E.length>b;++b)F[31&E[b]]++;for(b=0;T.length>b;++b)F[31&T[b]]++;for(var S=an(F,7),I=S[0],O=S[1],C=19;C>4&&!I[ia[C-1]];--C);var Z,X,B,N,V=l+5<<3,K=tr(n,ft)+tr(s,$i)+o,be=tr(n,d)+tr(s,_)+o+14+3*C+tr(F,I)+(2*F[16]+3*F[17]+7*F[18]);if(K>=V&&be>=V)return vs(e,c,t.subarray(u,u+l));if(Le(e,c,1+(K>be)),c+=2,K>be){Z=vr(d,f,0),X=d,B=vr(_,m,0),N=_;var Ee=vr(I,O,0);for(Le(e,c,$-257),Le(e,c+5,L-1),Le(e,c+10,C-4),c+=14,b=0;C>b;++b)Le(e,c+3*b,I[ia[b]]);c+=3*C;for(var ge=[E,T],xe=0;2>xe;++xe){var Q=ge[xe];for(b=0;Q.length>b;++b)Le(e,c,Ee[se=31&Q[b]]),c+=I[se],se>15&&(Le(e,c,Q[b]>>>5&127),c+=Q[b]>>>12)}}else Z=eh,X=ft,B=th,N=$i;for(b=0;a>b;++b)if(i[b]>255){var se;er(e,c,Z[257+(se=i[b]>>>18&31)]),c+=X[se+257],se>7&&(Le(e,c,i[b]>>>23&31),c+=Gs[se]);var oe=31&i[b];er(e,c,B[oe]),c+=N[oe],oe>3&&(er(e,c,i[b]>>>5&8191),c+=Vs[oe])}else er(e,c,Z[i[b]]),c+=X[i[b]];return er(e,c,Z[256]),c+X[256]},rh=new jt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ih=(function(){for(var t=new jt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t})(),un=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function nh(t,e){e===void 0&&(e={});var r=(function(){var h=4294967295;return{p(d){for(var f=h,p=0;d.length>p;++p)f=ih[255&f^d[p]]^f>>>8;h=f},d(){return 4294967295^h}}})(),i=t.length;r.p(t);var n,s,o,a,u,l=(a=10+((n=e).filename&&n.filename.length+1||0),u=8,(function(h,d,f,p,_,m){var g=h.length,E=new Se(p+g+5*(1+Math.floor(g/7e3))+_),$=E.subarray(p,E.length-_),k=0;if(!d||8>g)for(var T=0;g>=T;T+=65535){var L=T+65535;g>L?k=vs($,k,h.subarray(T,L)):($[T]=!0,k=vs($,k,h.subarray(T,g)))}else{for(var F=rh[d-1],b=F>>>13,S=8191&F,I=(1<<f)-1,O=new _e(32768),C=new _e(I+1),Z=Math.ceil(f/3),X=2*Z,B=function(Ri){return(h[Ri]^h[Ri+1]<<Z^h[Ri+2]<<X)&I},N=new jt(25e3),V=new _e(288),K=new _e(32),be=0,Ee=0,ge=(T=0,0),xe=0,Q=0;g>T;++T){var se=B(T),oe=32767&T,ue=C[se];if(O[oe]=ue,C[se]=oe,T>=xe){var Ke=g-T;if((be>7e3||ge>24576)&&Ke>423){k=sa(h,$,0,N,V,K,Ee,ge,Q,T-Q,k),ge=be=Ee=0,Q=T;for(var de=0;286>de;++de)V[de]=0;for(de=0;30>de;++de)K[de]=0}var Te=2,Ye=0,me=S,ze=oe-ue&32767;if(Ke>2&&se==B(T-ze))for(var kr=Math.min(b,Ke)-1,Ut=Math.min(32767,T),Pr=Math.min(258,Ke);Ut>=ze&&--me&&oe!=ue;){if(h[T+Te]==h[T+Te-ze]){for(var ke=0;Pr>ke&&h[T+ke]==h[T+ke-ze];++ke);if(ke>Te){if(Te=ke,Ye=ze,ke>kr)break;var Sr=Math.min(ze,ke-2),Ht=0;for(de=0;Sr>de;++de){var Ai=T-ze+de+32768&32767,Ks=Ai-O[Ai]+32768&32767;Ks>Ht&&(Ht=Ks,ue=Ai)}}}ze+=(oe=ue)-(ue=O[oe])+32768&32767}if(Ye){N[ge++]=268435456|ps[Te]<<18|fs[Ye];var Ys=31&ps[Te],Js=31&fs[Ye];Ee+=Gs[Ys]+Vs[Js],++V[257+Ys],++K[Js],xe=T+Te,++be}else N[ge++]=h[T],++V[h[T]]}}k=sa(h,$,!0,N,V,K,Ee,ge,Q,T-Q,k)}return Bu(E,0,p+Hu(k)+_)})(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),c=l.length;return(function(h,d){var f=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&un(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),f){h[3]=8;for(var p=0;f.length>=p;++p)h[p+10]=f.charCodeAt(p)}})(l,e),un(l,c-8,r.d()),un(l,c-4,i),l}var sh=!!yn||!!Cs,Gu="text/plain",Jr=!1,Vu=(t,e)=>{var r=t.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return t;var a=o.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},qs=function(t,e,r){var i;r===void 0&&(r=!0);var n=t.split("?"),s=n[0],o=n[1],a=y({},e),u=(i=o?.split("&").map((c=>{var h,d=c.split("="),f=d[0],p=r&&(h=a[f])!==null&&h!==void 0?h:d[1];return delete a[f],f+"="+p})))!==null&&i!==void 0?i:[],l=(function(c,h){var d,f;h===void 0&&(h="&");var p=[];return H(c,(function(_,m){x(_)||x(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(_)?_.name:_.toString()),f=encodeURIComponent(m),p[p.length]=f+"="+d)})),p.join(h)})(a);return l&&u.push(l),u.length>0?s+"?"+u.join("&"):s},ln=t=>{if(t.Vr)return t.Vr;var e=t.data,r=t.compression;if(e){if(r===pe.GZipJS){var i=nh((function(a,u){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new Se(a.length+(a.length>>>1)),h=0,d=function(m){c[h++]=m},f=0;l>f;++f){if(h+5>c.length){var p=new Se(h+8+(l-f<<1));p.set(c),c=p}var _=a.charCodeAt(f);128>_?d(_):2048>_?(d(192|_>>>6),d(128|63&_)):_>55295&&57344>_?(d(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++f))>>>18),d(128|_>>>12&63),d(128|_>>>6&63),d(128|63&_)):(d(224|_>>>12),d(128|_>>>6&63),d(128|63&_))}return Bu(c,0,h)})(Rt(e)),{mtime:0});return{contentType:Gu,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===pe.Base64){var n=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((u,l)=>String.fromCharCode(parseInt(l,16)))))})(Rt(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Rt(a)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Rt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},qu=t=>{var e,r,i=()=>t.transport==="sendBeacon"?{url:qs(t.url,{compression:pe.Base64}),encodedBody:ln(y({},t,{compression:pe.Base64,Vr:void 0}))}:{url:Vu(t.url,"compression"),encodedBody:ln(y({},t,{compression:void 0,Vr:void 0}))};try{e=ln(t)}catch(n){if(Ro(t.compression,Nt(t.url,"compression")))return w.error("Failed to gzip request body, sending uncompressed payload",n),i();throw n}return e&&Ro(t.compression,Nt(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?bn(new Uint8Array(r)):ArrayBuffer.isView(r)&&bn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Jr=!0,i()):{url:t.url,encodedBody:e}},Wu=t=>{try{return qu(t)}catch(e){return w.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},oh=(function(){var t=re((function*(e){var r=Rt(e.data),i=yield(function(s,o,a){return xn.apply(this,arguments)})(r,D.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return y({},e,{Vr:{contentType:Gu,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),ah=/Failed to fetch|NetworkError|Load failed/i,Ku=t=>{var e=Wu(t);if(e){var r=e.url,i=e.encodedBody,n=i??{},s=n.contentType,o=n.body,a=n.estimatedSize,u=new Headers;H(t.headers,(function(p,_){u.append(_,p)})),s&&u.append("Content-Type",s);var l=null,c=!1;if(So){var h=new So;l={signal:h.signal,timeout:setTimeout((()=>{var p,_;c=!0,h.abort((p=t.timeout,(_=new Error("PostHog request timed out"+(p?" after "+p+"ms":""))).name="AbortError",_))}),t.timeout)}}var d=p=>{c&&p?.name==="AbortError"||(_=>_?.name==="TypeError"&&ah.test(_?.message||""))(p)?w.warn(p):w.error(p),t.callback==null||t.callback({statusCode:0,error:p})};try{var f;Cs(r,y({method:t?.method||"GET",headers:u,keepalive:t.method==="POST"&&!t.Wr&&52428.8>(a||0),body:o,signal:(f=l)==null?void 0:f.signal},t.fetchOptions)).then((p=>p.text().then((_=>{var m={statusCode:p.status,text:_};if(p.status===200)try{m.json=JSON.parse(_)}catch(g){w.error(g)}t.callback==null||t.callback(m)})))).catch(d).finally((()=>l?clearTimeout(l.timeout):null))}catch(p){l&&clearTimeout(l.timeout),d(p)}}},gs=t=>{try{var e,r=qu(t),i=r.url,n=r.encodedBody,s=n??{},o=s.body,a=s.estimatedSize;if(!o)return;var u=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(fe.sendBeacon(i,u))return;var l=R(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(R(l)&&l.length>1&&(a??0)>16384){var c=Math.ceil(l.length/2),h=d=>R(t.data)?d:y({},t.data,{batch:d});return gs(y({},t,{data:h(l.slice(0,c))})),void gs(y({},t,{data:h(l.slice(c))}))}w.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),Ku(y({},t,{Wr:!0}))}catch(d){w.warn("Beacon send failed",d)}},oa=(t,e,r,i)=>{var n=i==="query"?e==="POST"?"sent_at":"_":void 0;return qs(r===pe.GZipJS?Vu(t,"compression"):t,y({},n?{[n]:Date.now().toString()}:{},r===pe.GZipJS?{}:{compression:r}))},Xr=[];Cs&&Xr.push({transport:"fetch",method:Ku}),yn&&Xr.push({transport:"XHR",method(t){var e=Wu(t);if(e){var r=new yn,i=e.encodedBody;r.open(t.method||"GET",e.url,!0);var n=i??{},s=n.contentType,o=n.body;H(t.headers,(function(a,u){r.setRequestHeader(u,a)})),s&&r.setRequestHeader("Content-Type",s),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(a)}},r.send(o)}}}),fe!=null&&fe.sendBeacon&&Xr.push({transport:"sendBeacon",method:gs});var ms=3e3,ys=class{constructor(e,r){this.Zr=!0,this.Gr=[],this.Qr=Oe(r?.flush_interval_ms||ms,250,5e3,w.createLogger("flush interval"),ms),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},r=Object.values(e);[...r.filter((i=>i.url.indexOf("/e")===0)),...r.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ti(y({},i,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var r=this.ei(),i=function(){var s=r[n],o=new Date().getTime();s.data&&R(s.data)&&H(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.ti(s)};for(var n in r)i()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(r){w.error(r)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return H(this.Gr,(r=>{var i,n=r,s=(n?n.batchKey:null)||n.url;x(e[s])&&(e[s]=y({},n,{data:[]})),(i=e[s].data)==null||i.push(n.data)})),this.Gr=[],e}},uh=["retriesPerformedSoFar"],bs=class{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!x(v)&&"onLine"in v.navigator&&(this.ni=v.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},te(v,"online",this.si),te(v,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var r=e.retriesPerformedSoFar,i=ka(e,uh);je(r)&&(i.url=qs(i.url,{retry_count:r})),this._instance._send_request(y({},i,{callback:n=>{if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(r??0))return void this.kt(y({retriesPerformedSoFar:r},i));n.statusCode===0&&w.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(r??0)+" retries.")}i.callback==null||i.callback(n)}}))}kt(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var i=(function(o){var a=3e3*Math.pow(2,o),u=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-u))})(r),n=Date.now()+i;this.Gr.push({retryAt:n,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),w.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),r=[],i=this.Gr.filter((s=>e>s.retryAt||(r.push(s),!1)));if(this.Gr=r,i.length>0)for(var n of i)this.retriableRequest(n.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,x(v)||(this.si&&(v.removeEventListener("online",this.si),this.si=void 0),this.ai&&(v.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var r=e.requestOptions;try{this._instance._send_request(y({},r,{transport:"sendBeacon"}))}catch(i){w.error(i)}}this.Gr=[]}},xs=class{constructor(e){this.hi=()=>{var r,i,n,s;this.di||(this.di={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.di.lastScrollY=Math.ceil(a),this.di.maxScrollY=Math.max(a,(r=this.di.maxScrollY)!==null&&r!==void 0?r:0),this.di.maxScrollHeight=Math.max(u,(i=this.di.maxScrollHeight)!==null&&i!==void 0?i:0),this.di.lastContentY=l,this.di.maxContentY=Math.max(l,(n=this.di.maxContentY)!==null&&n!==void 0?n:0),this.di.maxContentHeight=Math.max(c,(s=this.di.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){te(v,"scroll",this.hi,{capture:!0}),te(v,"scrollend",this.hi,{capture:!0}),te(v,"resize",this.hi)}scrollElement(){if(!this.ci)return v?.document.documentElement;var e=R(this.ci)?this.ci:[this.ci];for(var r of e){var i=v?.document.querySelector(r);if(i)return i}}vi(e){var r=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[r]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}},lh=t=>Lu(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes),Ei=class{constructor(e,r,i,n){this.fi=s=>{var o=this.pi();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.gi(this._instance)};this.mi.register({[Qn]:a})}},this._instance=e,this.yi=r,this.mi=i,this.gi=n||lh,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Qn]}getSetOnceProps(){var e,r=(e=this.pi())==null?void 0:e.props;return r?"r"in r?Nu(r,this._instance.config.disable_capture_url_hashes):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return H(js(this.getSetOnceProps()),((r,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+wn(i)]=r})),e}},Er=class{on(e,r){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(r),()=>{this.bi[e]=this.bi[e].filter((i=>i!==r))}}emit(e,r){for(var i of this.bi[e]||[])i(r);for(var n of this.bi["*"]||[])n(e,r)}constructor(){this.bi={}}},rr=J("[SessionId]"),ki=class{on(e,r){return this.wi.on(e,r)}constructor(e,r,i){var n;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Er,this.Ti=(l,c)=>!(!je(l)||!je(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ge)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=r||Be,this.Ri=i||Be;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Oe(this.Te.session_idle_timeout_seconds||1800,60,36e3,rr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var o=le.F(this.Oi),a=le.F(this.Fi);o&&!a?this.Ii=o:le.P(this.Oi),le.q(this.Fi,!0)}if((n=this.Te.bootstrap)!=null&&n.sessionID)try{var u=(l=>{var c=this.Te.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(l){rr.error("Invalid sessionID in bootstrap",l)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((r=>r!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&le.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&le.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?le.F(this.Oi):null}qi(e){var r=this.xi;return!ve(r)&&!ve(e)&&5e3>Math.abs(e-r)}$i(e,r,i){var n=r!==this._sessionActivityTimestamp,s=!(e!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=r,this.Mi=e,s&&!n||s&&this.qi(r)||(this.xi=r,this.mi.register({[At]:[r,e,i]}))}ji(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return je(r)&&r>0}Hi(){this.ji()?this.mi.refreshKey(At):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!ve(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var r=this.Ui();r[1]===this.Mi&&r[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[At]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],r=je(e)?e:0,i=je(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(r,i)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[At];return R(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&v&&(v.removeEventListener(fi,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&le.P(this.Fi)},te(v,fi,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.Te.cookieless_mode===Ge)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=r||new Date().getTime(),n=this.Ui(),s=n[1],o=n[2],a=this.zi(),u=this.Di(),l=je(o)&&Math.abs(i-o)>864e5,c=!1,h=!1,d=!s,f=s,p=!d&&!e&&this.Ti(i,a);if(p){(p=this.Vi(i))||rr.info("cross-tab refresh kept the session alive",{sessionId:s});var _=this.Ui();s=_[1],o=_[2]}d||p||l?(s=this.Ei(),u=this.Ri(),rr.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),o=i,c=!0):(u||(u=this.Ri(),c=!0),(h=s!==f)&&(rr.info("adopted cross-tab session id",{sessionId:s,windowId:u}),c=!0));var m=je(a)&&e&&!l?a:i,g=je(o)?o:new Date().getTime();this.Ni(u),this.$i(s,m,g),e||this.Pi();var E={noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:h};return c&&this.ki.forEach(($=>$(s,u,E))),{sessionId:s,windowId:u,sessionStartTimestamp:g,changeReason:c?E:void 0,lastActivityTimestamp:a}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}},Yu=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&Oo(r,e))return!0;try{var i=t?.userAgentData;if(i!=null&&i.brands&&i.brands.some((n=>Oo(n?.brand,e))))return!0}catch{}return!!t.webdriver};function Ju(){return(Ju=re((function*(){var t=fe?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=e?.model;return U(r)&&r.length>0?r:void 0}catch(i){return void w.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var Pi=function(t,e){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function aa(t,e,r){return Rt({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var Xu={exact:(t,e)=>e.some((r=>t.some((i=>r===i)))),is_not:(t,e)=>e.every((r=>t.every((i=>r!==i)))),regex:(t,e)=>e.some((r=>t.some((i=>Pi(r,i))))),not_regex:(t,e)=>e.every((r=>t.every((i=>!Pi(r,i))))),icontains:(t,e)=>e.map(Hr).some((r=>t.map(Hr).some((i=>r.includes(i))))),not_icontains:(t,e)=>e.map(Hr).every((r=>t.map(Hr).every((i=>!r.includes(i))))),gt:(t,e)=>e.some((r=>{var i=parseFloat(r);return!isNaN(i)&&t.some((n=>i>parseFloat(n)))})),lt:(t,e)=>e.some((r=>{var i=parseFloat(r);return!isNaN(i)&&t.some((n=>i<parseFloat(n)))}))},Hr=t=>t.toLowerCase();function Qu(t,e){return!t||Object.entries(t).every((r=>{var i=r[1],n=e?.[r[0]];if(x(n)||ve(n))return!1;var s=[String(n)],o=Xu[i.operator];return!!o&&o(i.values,s)}))}var ws="custom",ua="i.posthog.com",ch=/^\/static\//,$s=class{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+ua,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ws),this.Zi[this.apiHost]}Gi(e){if(ch.test(e)){var r=this.instance.config.asset_host;if(typeof r=="string")return r.trim().replace(/\/$/,"")||void 0}}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(e==="assets"){var i=this.Gi(r);if(i)return""+i+r}if(this.region===ws)return this.apiHost+r;var n=ua+r;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}};function el(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var j=J("[Surveys]"),tl="seenSurvey_",rl=t=>{try{var e=(r=>((i,n)=>""+tl+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(n))(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(r){j.error("Failed to persist survey seen state",r)}},hh=[sn.Popover,sn.Widget,sn.API],dh={ignoreConditions:!1,ignoreDelay:!1,displayType:hs.Popover},ph=J("[PostHog ExternalIntegrations]"),fh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Es=class{constructor(e){this._instance=e}er(e,r){var i;(i=z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(n=>{if(n)return ph.error("failed to load script",n);r()}))}startIfEnabledOrStop(){var e=this,r=function(){var s,o,a,u=i[0],l=i[1];!l||(s=z.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.er(fh[u],(()=>{var c;(c=z.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[u])==null||c.start(e._instance)})),!l&&(o=z.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[u]&&((a=z.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[u])==null||a.stop())};for(var i of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;r()}}},gr={},cn=0,Si=()=>{},la='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ir="Surveys module not available",ca="sanitize_properties is deprecated. Use before_send instead",il="Invalid value for property_denylist config: ",_h=["token","distinct_id",cu],Ct="posthog",nl=!sh&&ye?.indexOf("MSIE")===-1&&ye?.indexOf("Mozilla")===-1,hn=t=>{var e;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Tc(P?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Si,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&U(ie?.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){w.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:is,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ms},error_tracking:{},_onCapture:Si},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:Zc,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:r&&r>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r)}))(t))},vh=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],ha=t=>{var e={};for(var r of vh){var i=r[0],n=r[1];x(t[i])||(e[n]=t[i])}var s=q({},e,t),o=t.__preview_external_dependency_versioned_paths;return x(o)||(x(t.strict_script_versioning)&&(s.strict_script_versioning=!!o),U(o)&&x(t.asset_host)&&(s.asset_host=o)),R(t.property_blacklist)&&(x(t.property_denylist)?s.property_denylist=t.property_blacklist:R(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:w.error(il+t.property_denylist)),s},ks=class{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},pt=class t{Ji(e,r){if(e){var i=this.Ki.indexOf(e);i!==-1&&this.Ki.splice(i,1)}return this.Ki.push(r),r.initialize==null||r.initialize(),r}Yi(){return this.config.cookieless_mode===Ge||this.config.cookieless_mode===lt&&this.consent.isRejected()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new ks,this.Xi=!1,this.version=D.LIB_VERSION,this.en=new Er,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=hn(),this.SentryIntegration=cs,this.sentryIntegration=i=>(function(n,s){var o=Cu(n,s);return{name:Iu,processEvent:a=>o(a)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new xs(this),this.pageViewManager=new gi(this),this.rateLimiter=new ds(this),this.requestRouter=new $s(this),this.consent=new as(this),this.externalIntegrations=new Es(this);var r=(e=t.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(i,n,s)=>{var o=U(i)?{[i]:n}:i;this.setPersonProperties(o),s?.({})},set_once:(i,n,s)=>{var o=U(i)?{[i]:n}:i;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",(i=>w.info('send "'+i?.event+'"',i)))}init(e,r,i){if(i&&i!==Ct){var n,s=(n=gr[i])!==null&&n!==void 0?n:new t;return s._init(e,r,i),gr[i]=s,gr[Ct][i]=s,s}return this._init(e,r,i)}_init(e,r,i){var n,s;r===void 0&&(r={});var o=U(e)?e.trim():"";if(!o)return w.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=hn(r.defaults),r.debug=this.an(r.debug),this.ln=r,this.un=[],r.person_profiles?this.nn=r.person_profiles:r.process_person&&(this.nn=r.process_person);var a=hn(r.defaults),u=ha(r),l=q({},a,u,{name:i,token:o});Y(a.rageclick)&&Y(u.rageclick)&&(l.rageclick=q({},a.rageclick,u.rageclick)),Y(a.session_recording)&&Y(u.session_recording)&&(l.session_recording=q({},a.session_recording,u.session_recording)),this.set_config(l),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:pe.GZipJS;var c=this.hn();this.persistence=new _r(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _r(y({},this.config,{persistence:"sessionStorage"}),c,!1);var h=y({},this.persistence.props),d=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new ys((k=>this.cn(k)),this.config.request_queue_config),this.vn=new bs(this),this.__request_queue=[];var f=this.Yi();if(f||(this.sessionManager=new ki(this),this.sessionPropsManager=new Ei(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(f)}),0)):(w.info("Initializing extensions synchronously"),this.fn(f)),D.DEBUG=D.DEBUG||this.config.debug,D.DEBUG&&w.info("Starting in debug mode",{this:this,config:r,thisC:y({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(n=r.bootstrap)!=null&&n.distinctID||(r.bootstrap=y({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var p=r.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(Ie);if(r.bootstrap.isIdentifiedID&&_!=null&&_!==p&&m===kt)this.identify(p);else if(r.bootstrap.isIdentifiedID&&_!=null&&_!==p&&m===Pt)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var g=this.config.get_device_id(Be()),E=r.bootstrap.isIdentifiedID?g:p;this.persistence.set_property(Ie,r.bootstrap.isIdentifiedID?Pt:kt),this.register({distinct_id:p,$device_id:E})}}if(f)this.register_once({distinct_id:Lr,$device_id:null},"");else if(!this.get_distinct_id()){var $=this.config.get_device_id(Be());this.register_once({distinct_id:$,$device_id:$},""),this.persistence.set_property(Ie,kt)}return te(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(k,T){var L=k.config.segment;if(!L)return T();(function(F,b){var S=F.config.segment;if(!S)return b();var I=C=>{var Z=()=>C.anonymousId()||Be();F.config.get_device_id=Z,C.id()&&(F.register({distinct_id:C.id(),$device_id:Z()}),F.persistence.set_property(Ie,Pt)),b()},O=S.user();"then"in O&&Ce(O.then)?O.then(I):I(O)})(k,(()=>{L.register((F=>{typeof Promise<"u"&&Promise.resolve||rn.warn("This browser does not have Promise support, and can not use the segment integration");var b=(S,I)=>{if(!I)return S;S.event.userId||S.event.anonymousId===F.get_distinct_id()||(rn.info("No userId set, resetting PostHog"),F.reset()),S.event.userId&&S.event.userId!==F.get_distinct_id()&&(rn.info("UserId set, identifying with PostHog"),F.identify(S.event.userId));var O=F.calculateEventProperties(I,S.event.properties);return S.event.properties=Object.assign({},O,S.event.properties),S};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:S=>b(S,S.event.event),page:S=>b(S,It),identify:S=>b(S,Qi),screen:S=>b(S,"$screen")}})(k)).then((()=>{T()}))}))})(this,(()=>this.pn())):this.pn(),Ce(this.config._onCapture)&&this.config._onCapture!==Si&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&w.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Ju.apply(this,arguments)})().then((k=>{k&&this.register({[Ji]:k})})).catch(Si),this}fn(e){var r,i,n,s,o,a,u,l,c=performance.now(),h=y({},t.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ki.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new h.featureFlags(this)),h.exceptions&&this.Ki.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new h.exceptions(this)),h.historyAutocapture&&this.Ki.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ki.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ki.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ki.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ki.push(this.surveys=(n=this.surveys)!==null&&n!==void 0?n:new h.surveys(this)),h.logs&&this.Ki.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new h.logs(this)),h.metrics&&this.Ki.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new h.metrics(this)),h.conversations&&this.Ki.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new h.conversations(this)),h.productTours&&this.Ki.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ki.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ki.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Gc)),h.toolbar&&this.Ki.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new h.toolbar(this)),h.experiments&&this.Ki.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new h.experiments(this)),this.Ki.forEach((f=>{f.initialize&&d.push((()=>{f.initialize==null||f.initialize()}))})),d.push((()=>{if(this.gn){var f=this.gn;this.gn=void 0,this.Hr(f)}})),this.mn(d,c)}mn(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout((()=>{this.mn(e,r)}),0);var i=e.shift();if(i)try{i()}catch(s){w.error("Error initializing extension:",s)}}var n=Math.round(performance.now()-r);this.register_for_session({[hu]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[du]:n}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+n+"ms)")}Hr(e){if(!P||!P.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=A(i.supportedCompression,pe.GZipJS)?pe.GZipJS:A(i.supportedCompression,pe.Base64)?pe.Base64:void 0),(r=i.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:is}),this.Ki.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}pn(){try{this.config.loaded(this)}catch(i){w.critical("`loaded` function failed",i)}if(this.bn(),this.config.internal_or_test_user_hostname&&ie!=null&&ie.hostname){var e=ie.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new xi(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.dn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Nr(this.__request_queue,(e=>this.cn(e))),this.__request_queue=[],this.bn()}_handle_unload(){var e,r,i,n,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(r=this.metrics)==null||r.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(Xi),(i=this.logs)==null||i.flushLogs("sendBeacon"),(n=this.dn)==null||n.unload(),(s=this.vn)==null||s.unload()):this.xn()&&this.capture(Xi,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?nl?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=y({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(x(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(r=>{var i,n,s,o=y({},r);o.timeout=o.timeout||6e4;var a,u,l,c,h,d=(i=o.transport)!==null&&i!==void 0?i:"fetch";d==="sendBeacon"&&x(o.compression)&&o.data&&(o.compression=pe.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(u=(h=(c=R(a=o.data)?a:[a])[0])==null||(l=h.properties)==null?void 0:l.token)!==null&&u!==void 0?u:h?.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(_,m){return m===void 0&&(m=new Date().toISOString()),R(_)?_.map((g=>y({},g,{sent_at:m}))):y({},_,{sent_at:m})})(o.data))),o.url=oa(o.url,o.method,o.compression,o.timestampMode);var f=Xr.filter((_=>!o.disableTransport||!_.transport||!o.disableTransport.includes(_.transport))),p=(n=(s=(function(_,m){for(var g=0;_.length>g;g++)if(_[g].transport===d)return _[g]})(f))==null?void 0:s.method)!==null&&n!==void 0?n:f[0].method;if(!p)throw new Error("No available transport method");d!=="sendBeacon"&&o.data&&o.compression===pe.GZipJS&&jl&&typeof Promise<"u"&&!Jr?oh(o).then((_=>{p(_)})).catch((_=>{if(Mo(_))return Jr=!0,void p(y({},o,{compression:void 0,url:oa(r.url,r.method,void 0,r.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var g="name"in m?String(m.name):"";return Mo(m)||g===Pa})(_)&&(Jr=!0),p(o)})):p(o)})(y({},e,{callback:r=>{var i,n;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(i=(n=this.config).on_request_error)==null||i.call(n,r),e.callback==null||e.callback(r)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){cn++;try{var r,i=[],n=[],s=[];Nr(e,(a=>{if(a)if(R(r=a[0]))s.push(a);else if(Ce(a))try{a.call(this)}catch(u){w.error("Error executing queued PostHog call",a,u)}else R(a)&&r==="alias"?i.push(a):R(a)&&r.indexOf("capture")!==-1&&Ce(this[r])?s.push(a):n.push(a)}));var o=function(a,u){Nr(a,(function(l){try{if(R(l[0])){var c=u;H(l,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else u[l[0]].apply(u,l.slice(1))}catch(h){w.error("Error executing queued PostHog call",l,h)}}))};o(i,this),o(n,this),o(s,this)}finally{cn--}}push(e){if(cn>0&&R(e)&&U(e[0])){var r=t.prototype[e[0]];Ce(r)&&r.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,r,i){var n,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!x(e)&&U(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){r!=null&&r.$current_url&&!U(r?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),e!=="$exception"||i!=null&&i.kn||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=i?.timestamp||h,f=No(i?.uuid,Be),p={uuid:f,event:e,properties:this.calculateEventProperties(e,r||{},d,f)};e===It&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var _=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(li)===!0;i?.$set&&!_&&(p.$set=i?.$set);var m=i?.$unset;m&&(p.$unset=m);var g,E,$,k=_?void 0:this.Sn(i?.$set_once,e!==Bo,e===Qi);if(k&&(p.$set_once=k),i!=null&&i._noTruncate||(s=this.config.properties_string_max_length,o=p,a=C=>U(C)?C.slice(0,s):C,u=new Set,p=(function C(Z,X){if(Z!==Object(Z))return a?a(Z):Z;if(!u.has(Z)){var B;if(u.add(Z),R(Z))B=[],Nr(Z,(V=>{B.push(C(V))}));else{var N={};H(Z,((V,K)=>{u.has(V)||(N[K]=C(V,K))})),B=N}return B}})(o)),p.timestamp=d,x(i?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),_&&(p.properties=(function(C,Z){Z===void 0&&(Z=[]);var X={},B=N=>{C[N]!==void 0&&(X[N]=C[N])};return Ul.forEach(B),Z.forEach(B),X})(p.properties,_h)),e===qe.DISMISSED||e===qe.SENT){var T=r?.[on.SURVEY_ID],L=r?.[on.SURVEY_ITERATION];rl({id:T,current_iteration:L}),p.$set=y({},p.$set,{[(g={id:T,current_iteration:L},E=e===qe.SENT?"responded":"dismissed",$="$survey_"+E+"/"+g.id,g.current_iteration&&g.current_iteration>0&&($="$survey_"+E+"/"+g.id+"/"+g.current_iteration),$)]:!0})}else e===qe.SHOWN&&(p.$set=y({},p.$set,{[on.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Qc.SHOWN){var F=r?.[ta.TOUR_TYPE];F&&(p.$set=y({},p.$set,{[ta.TOUR_LAST_SEEN_DATE+"/"+F]:new Date().toISOString()}))}var b=y({},p.properties.$set,p.$set);if(Xe(b)||this.setPersonPropertiesForFlags(b),!M(this.config.before_send)){var S=this.wt(p);if(!S)return;(p=S).uuid=No(p.uuid,Be)}this.en.emit("eventCaptured",p);var I=(n=i?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:I,data:p,compression:"best-available",timestampMode:i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(I)?"body":"capture-body",batchKey:i?._batchKey,transport:i?.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.cn(O):this.dn.enqueue(O),p}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(r=>e(r.event,r)))}calculateEventProperties(e,r,i,n,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return r;var o=s?void 0:this.persistence.remove_event_timer(e),a=y({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Yi()&&(a[cu]=!0),e==="$snapshot"){var u=y({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!U(a.distinct_id)&&!ce(a.distinct_id)||$n(a.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=(function($,k,T,L){var F,b,S,I;if(L===void 0&&(L=!1),!ye)return{};var O,C=$?[...Dt,...k||[]]:[],Z=(function(kr){for(var Ut=0;Zo.length>Ut;Ut++){var Pr=Zo[Ut],ke=Pr[1],Sr=Pr[0].exec(kr),Ht=Sr&&(Ce(ke)?ke(Sr,kr):ke);if(Ht)return Ht}return["",""]})(ye),X=Z[0],B=Z[1],N=(O=typeof navigator<"u"?navigator:void 0)!=null&&O.brave?{brave:!0}:{},V={};x(T)||(V.detectGoogleSearchApp=T);var K={},be=(F=navigator)==null||(F=F.userAgentData)==null?void 0:F.platform,Ee=(b=navigator)==null?void 0:b.maxTouchPoints,ge=v==null||(S=v.screen)==null?void 0:S.width,xe=v==null||(I=v.screen)==null?void 0:I.height,Q=v?.devicePixelRatio;x(be)||(K.userAgentDataPlatform=be),x(Ee)||(K.maxTouchPoints=Ee),x(ge)||(K.screenWidth=ge),x(xe)||(K.screenHeight=xe),x(Q)||(K.devicePixelRatio=Q);var se,oe,ue,Ke,de,Te,Ye,me,ze=q(js({$os:X,$os_version:B,$browser:Ya(ye,navigator.vendor,N,V),$device:Lo(ye),$device_type:(oe=ye,ue=K,me=Lo(oe),me===Aa||me===Ca||me==="Kobo"||me==="Kindle Fire"||me===Ga?Ft:me===mr||me===Ot||me===yr||me===Pn?"Console":me===Ma?"Wearable":me?$e:ue?.userAgentDataPlatform==="Android"&&((Ke=ue?.maxTouchPoints)!==null&&Ke!==void 0?Ke:0)>0?600>Math.min((de=ue?.screenWidth)!==null&&de!==void 0?de:0,(Te=ue?.screenHeight)!==null&&Te!==void 0?Te:0)/((Ye=ue?.devicePixelRatio)!==null&&Ye!==void 0?Ye:1)?$e:Ft:"Desktop"),$timezone:Du(),$timezone_offset:Yc()}),{$current_url:wr(L?Qe(ie?.href):ie?.href,C,$r),$host:ie?.host,$pathname:ie?.pathname,$raw_user_agent:ye.length>1e3?ye.substring(0,997)+"...":ye,$browser_version:oc(ye,navigator.vendor,N,V),$browser_language:ea(),$browser_language_prefix:(se=ea(),typeof se=="string"?se.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return D.SDK_DIST_CHANNEL&&(ze.$sdk_dist_channel=D.SDK_DIST_CHANNEL),ze})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime()),d=h.windowId;a.$session_id=h.sessionId,a.$window_id=d}this.sessionPropsManager&&q(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&q(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.vn)==null?void 0:f.length}catch($){a.$sdk_debug_error_capturing_properties=String($)}if(this.requestRouter.region===ws&&(a.$lib_custom_api_host=this.config.api_host),l=e!==It||s?e!==Xi||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=q(a,l),e===It&&P&&(a.title=P.title),!x(o)){var p=i.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}ye&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),m=this.sessionPersistence.properties();H(["$referrer","$referring_domain"],($=>{$ in _&&delete m[$]})),(a=q({},c,_,m,a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?H(this.config.property_denylist,(function($){delete a[$]})):w.error(il+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(w.error(ca),a=g(a,e));var E=this.Cn();return a.$process_person_profile=E,E&&!s&&this.Tn("_calculate_event_properties"),a}Sn(e,r,i){var n;if(r===void 0&&(r=!0),i===void 0&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return e;var s=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),a=q({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&(w.error(ca),a=u(a,"$set_once")),r&&(this.Xi=!0),Xe(a)?void 0:a}register(e,r){var i;(i=this.persistence)==null||i.register(e,r)}register_once(e,r,i){var n;(n=this.persistence)==null||n.register_once(e,r,i)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e)}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e)}In(e,r){this.register({[e]:r})}getFeatureFlag(e,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var i,n;return(i=(n=this.featureFlags)==null?void 0:n.isFeatureEnabled(e,r))!==null&&i!==void 0?i:r?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,r,i){var n;(n=this.featureFlags)==null||n.updateFlags(e,r,i)}updateEarlyAccessFeatureEnrollment(e,r,i){var n;(n=this.featureFlags)==null||n.updateEarlyAccessFeatureEnrollment(e,r,i)}getEarlyAccessFeatures(e,r,i){var n;return r===void 0&&(r=!1),(n=this.featureFlags)==null?void 0:n.getEarlyAccessFeatures(e,r,i)}on(e,r){return this.en.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ir}),()=>{})}onSessionId(e){var r,i;return(r=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:ir})}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:ir})}renderSurvey(e,r){var i;(i=this.surveys)==null||i.renderSurvey(e,r)}displaySurvey(e,r){var i;r===void 0&&(r=dh),(i=this.surveys)==null||i.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)==null||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,i;return(r=(i=this.surveys)==null?void 0:i.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:ir}}canRenderSurveyAsync(e,r){var i,n;return r===void 0&&(r=!1),(i=(n=this.surveys)==null?void 0:n.canRenderSurveyAsync(e,r))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:ir})}Mn(e){return!e||$n(e)?(w.critical("Unique user id has not been set in posthog.identify"),!1):e===Lr?(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,r,i){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(ce(e)&&(e=e.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.Tn("posthog.identify")){var n=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ui)||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),e!==n&&e!==this.get_property(ar)&&(this.unregister(ar),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Ie)||kt)===kt;e!==n&&o?(this.persistence.set_property(Ie,Pt),this.setPersonPropertiesForFlags({$set:r||{},$set_once:i||{}},!1),this.capture(Qi,{distinct_id:e,$anon_distinct_id:n},{$set:r||{},$set_once:i||{}}),this.sn=aa(e,r,i),(s=this.featureFlags)==null||s.setAnonymousDistinctId(n)):(r||i)&&this.setPersonProperties(r,i),e!==n&&(this.reloadFeatureFlags(),this.unregister(pr))}}setPersonProperties(e,r){if((e||r)&&this.Tn("posthog.setPersonProperties")){var i=aa(this.get_distinct_id(),e,r);this.sn!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.sn=i):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var r,i=(R(e)?e:[e]).filter((n=>U(n)&&n.length>0));i.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((r=this.featureFlags)==null||r.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(e,r,i){if(e&&r){var n=this.getGroups(),s=n[e]!==r;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},n,{[e]:r})}),s||i){var o={$group_type:e,$group_key:r};i&&(o.$group_set=i),this.capture(Bo,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){var i;r===void 0&&(r=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e){var r;e===void 0&&(e=!0),(r=this.featureFlags)==null||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r){var i;r===void 0&&(r=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(e)}reset(e){var r,i,n,s,o,a,u,l,c,h;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var d,f=this.get_property(ui),p=this.get_property(Ji),_=this.get_property(ht);if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(i=this.sessionPersistence)==null||i.clear(),x(_)||(d=this.persistence)==null||d.register({[ht]:_}),(n=this.surveys)==null||n.reset(),(s=this.wn)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.logs)==null||u.reset(),(l=this.metrics)==null||l.reset(),(c=this.persistence)==null||c.set_property(Ie,kt),(h=this.sessionManager)==null||h.resetSessionId(),this.sn=null,this.config.cookieless_mode===Ge)this.register_once({distinct_id:Lr,$device_id:null},"");else{var m=this.config.get_device_id(Be());this.register_once({distinct_id:m,$device_id:e?m:f},""),e||x(p)||this.register({[Ji]:p})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return re((function*(){var i,n,s,o,a;r.__loaded?((i=r.logs)==null||i.flushLogs("sendBeacon"),(n=r.metrics)==null||n.flush("sendBeacon"),(s=r.dn)==null||s.unload(),(o=r.vn)==null||o.unload(),(a=r.featureFlags)==null||a.destroy()):w.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,r){var i;this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(i=this.conversations)==null||i.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var r=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.sessionStartTimestamp,n=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r.sessionId);if(e!=null&&e.withTimestamp&&i){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!i)return n;n+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}return n}alias(e,r){return e===this.get_property(nu)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(x(r)&&(r=this.get_distinct_id()),e!==r?(this.In(ar,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=y({},this.config);if(Y(e)){var i,n,s,o,a,u,l,c,h,d,f;q(this.config,ha(e));var p=this.hn();(i=this.persistence)==null||i.update_config(this.config,r,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _r(y({},this.config,{persistence:"sessionStorage"}),p,!1);var _=this.an(this.config.debug);Ae(_)&&(this.config.debug=_),Ae(this.config.debug)&&(this.config.debug?(D.DEBUG=!0,G.N()&&G.q("ph_debug",!0),w.info("set_config",{config:e,oldConfig:r,newConfig:y({},this.config)})):(D.DEBUG=!1,G.N()&&G.P("ph_debug"))),(n=this.exceptionObserver)==null||n.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.tracingHeaders)==null||a.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Pn(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(e,r){D.LIB_NAME=e,D.LIB_VERSION=r}startSessionRecording(e){var r,i,n,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),u.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),u.linked_flag&&((n=this.sessionRecording)==null||n.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,r){if(this.exceptions){var i=new Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},n,r))}}addExceptionStep(e,r){var i;(i=this.exceptions)==null||i.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)==null||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)==null?void 0:r.logger)!==null&&e!==void 0?e:t.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,i;return(r=(i=this.toolbar)==null?void 0:i.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Ct;return r!==Ct&&(r=Ct+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(Ie))===Pt||((r=this.sessionPersistence)==null?void 0:r.get_property(Ie))===Pt}Cn(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===is&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ar])&&((r=this.persistence)==null||(r=r.props)==null||!r[di]))}xn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(e){return this.config.person_profiles==="never"?(w.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(di,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==lt)}Pn(){var e,r,i,n,s=this.hn();return((e=this.persistence)==null?void 0:e.yr)!==s&&((i=this.persistence)==null||i.set_disabled(s)),((r=this.sessionPersistence)==null?void 0:r.yr)!==s&&((n=this.sessionPersistence)==null||n.set_disabled(s)),s}opt_in_capturing(e){var r;if(this.config.cookieless_mode!==Ge){if(this.Yi()){var i,n,s,o,a;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=new ki(this),this.pageViewManager=new gi(this),this.persistence&&(this.sessionPropsManager=new Ei(this,this.sessionManager,this.persistence));var u,l=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=t.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ji(this.sessionRecording,new l(this)),this.yn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.yn)))}var c,h;this.consent.optInOut(!0),this.Pn(),this.bn(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==lt&&((c=this.surveys)==null||c.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else w.warn(la)}opt_out_capturing(){var e,r,i;this.config.cookieless_mode!==Ge?(this.config.cookieless_mode===lt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===lt&&(this.register({distinct_id:Lr,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):w.warn(la)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ge||(this.config.cookieless_mode===lt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return fe?Yu(fe,this.config.custom_blocked_useragents):void 0}_n(){P&&(P.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(It,{title:P.title},{send_instantly:!0}),this.rn&&(P.removeEventListener(pi,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),te(P,pi,this.rn)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ur(){var e=this.ln||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,i,n,s,o){var a=i in r&&!M(r[i]),u=n in r&&!M(r[n]);return a?r[i]:!!u&&(o&&o.warn("Config field '"+n+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),r[n])})(e,"advanced_disable_flags","advanced_disable_decide",0,w)}wt(e){var r;if(M(this.config.before_send))return e;var i=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(Kl),n=R(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var o of n){if(s=o(s),M(s)){var a="Event '"+e.event+"' was rejected in beforeSend function";return Wl(e.event)?w.warn(a+". This can cause unexpected behavior."):w.info(a),null}s.properties&&!Xe(s.properties)||w.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of i)if(s.properties&&M(s.properties[u]))return w.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(i)})}an(e){var r=Ae(e)&&!e,i=G.N()&&G.A("ph_debug")==="true";return!r&&(!!i||e)}};pt.__defaultExtensionClasses={},pt.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var r=0;e.length>r;r++)t.prototype[e[r]]=Pc(t.prototype[e[r]])})(pt,["identify"]);var Ti=class{constructor(e){this.disabled=e===!1;var r=Y(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,i){if(this.disabled)return!1;var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(r-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:e,y:r,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:i}];return!1}},dn="$copy_autocapture",pn=J("[AutoCapture]");function fn(t,e){return e.length>t?e.slice(0,t)+"...":e}function gh(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!et(e));return e}function mh(t,e){var r,i,n=e.e,s=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,u=e.elementsChainAsString,l=e.disableCaptureUrlHashes;if(!et(t))return{props:{}};for(var c=[t],h=new Set([t]),d=t;d.parentNode&&!we(d,"body")&&xu>c.length;)if(bu(d.parentNode)){var f=d.parentNode.host;if(h.has(f))break;h.add(f),c.push(f),d=f}else{if(!et(d.parentNode)||h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}var p,_,m=[],g={},E=!1,$=!1;if(H(c,(b=>{var S=ls(b);if(we(b,"a")){var I=b.getAttribute("href");E=!!(S&&I&&fr(I))&&(l?Qe(I):I)}A(_i(b),"ph-no-capture")&&($=!0),m.push((function(C,Z,X,B,N){N===void 0&&(N=!1);var V=C.tagName.toLowerCase(),K={tag_name:V};Hs.indexOf(V)>-1&&!X&&(K.$el_text=V.toLowerCase()==="a"||V.toLowerCase()==="button"?fn(1024,Xo(C)):fn(1024,xr(C)));var be=_i(C);be.length>0&&(K.classes=be.filter((function(Q){return Q!==""}))),H(C.attributes,(function(Q){var se;if((!Pu(C)||["name","id","class","aria-label"].indexOf(Q.name)!==-1)&&(B==null||!B.includes(Q.name))&&!Z&&fr(Q.value)&&(!U(se=Q.name)||se.substring(0,10)!=="_ngcontent"&&se.substring(0,7)!=="_nghost")){var oe=Q.value;Q.name==="class"&&(oe=Us(oe).join(" ")),K["attr__"+Q.name]=fn(1024,Q.name==="href"&&N?Qe(oe):oe)}}));for(var Ee=1,ge=1,xe=C;xe=gh(xe);)Ee++,xe.tagName===C.tagName&&ge++;return K.nth_child=Ee,K.nth_of_type=ge,K})(b,s,o,a,l));var O=(function(C){if(!ls(C))return{};var Z={};return H(C.attributes,(function(X){if(X.name&&X.name.indexOf("data-ph-capture-attribute")===0){var B=X.name.replace("data-ph-capture-attribute-",""),N=X.value;B&&N&&fr(N)&&(Z[B]=N)}})),Z})(b);q(g,O)})),$)return{props:{},explicitNoCapture:$};if(o||(m[0].$el_text=we(t,"a")||we(t,"button")?Xo(t):xr(t)),E){var k,T;m[0].attr__href=E;var L=(k=mi(E))==null?void 0:k.host,F=v==null||(T=v.location)==null?void 0:T.host;L&&F&&L!==F&&(p=E)}return{props:q({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(_=m,(function(b){return b.map((S=>{var I,O,C="";if(S.tag_name&&(C+=S.tag_name),S.attr_class)for(var Z of(S.attr_class.sort(),S.attr_class))C+="."+Z.replace(/"/g,"");var X=y({},S.text?{text:S.text}:{},{"nth-child":(I=S.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(O=S.nth_of_type)!==null&&O!==void 0?O:0},S.href?{href:S.href}:{},S.attr_id?{attr_id:S.attr_id}:{},S.attributes),B={};return Yr(X).sort(((N,V)=>N[0].localeCompare(V[0]))).forEach((N=>{var V=N[1];return B[Qo(N[0].toString())]=Qo(V.toString())})),(C+=":")+Yr(B).map((N=>N[0]+'="'+N[1]+'"')).join("")})).join(";")})((function(b){return b.map((S=>{var I,O,C={text:(I=S.$el_text)==null?void 0:I.slice(0,400),tag_name:S.tag_name,href:(O=S.attr__href)==null?void 0:O.slice(0,2048),attr_class:Hc(S),attr_id:S.attr__id,nth_child:S.nth_child,nth_of_type:S.nth_of_type,attributes:{}};return Yr(S).filter((Z=>Z[0].indexOf("attr__")===0)).forEach((Z=>C.attributes[Z[0]]=Z[1])),C}))})(_)))},(r=m[0])!=null&&r.$el_text?{$el_text:(i=m[0])==null?void 0:i.$el_text}:{},p&&n.type==="click"?{$external_click_url:p}:{},g)}}var nr=J("[ExceptionAutocapture]"),da=()=>{},yh=J("[TracingHeaders]"),nt=J("[Web Vitals]"),pa=9e5,fa="disabled",_a="lazy_loading",sr="awaiting_config",Br="missing_config";J("[SessionRecording]"),J("[SessionRecording]");var Ps="[SessionRecording]",Ne=J(Ps),bh=J("[Heatmaps]");function _n(t){return Y(t)&&"clientX"in t&&"clientY"in t&&ce(t.clientX)&&ce(t.clientY)}var vn=J("[Product Tours]"),gn=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Ls))},xh=["$set_once","$set"],Me=J("[SiteApps]"),va="Error while initializing PostHog app with config id ";function Tt(t,e,r){if(M(t))return!1;switch(r){case"exact":return t===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var Ss=class{constructor(e){this.Fn=new Er,this.Ln=(r,i)=>this.$n(r,i)&&this.An(r,i)&&this.Nn(r,i)&&this.Dn(r,i),this.$n=(r,i)=>i==null||!i.event||r?.event===i?.event,this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,r;x((e=this._instance)==null?void 0:e._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((i,n)=>{this.on(i,n)}))}register(e){var r,i;if(!x((r=this._instance)==null?void 0:r._addCaptureHook)&&(e.forEach((o=>{var a,u;(a=this.jn)==null||a.add(o),(u=o.steps)==null||u.forEach((l=>{var c;(c=this.qn)==null||c.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var n,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(s)}}on(e,r){var i;r!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(r.event))&&this.jn&&((i=this.jn)==null?void 0:i.size)>0&&this.jn.forEach((n=>{this.Hn(r,n)&&this.Fn.emit("actionCaptured",n.name)}))}Bn(e){this.onAction("actionCaptured",(r=>e(r)))}Hn(e,r){if(r?.steps==null)return!1;for(var i of r.steps)if(this.Ln(e,i))return!0;return!1}onAction(e,r){return this.Fn.on(e,r)}An(e,r){if(r!=null&&r.url){var i,n=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!n||typeof n!="string"||!Tt(n,r.url,r.url_matching||"contains"))return!1}return!0}Nn(e,r){return!!this.Un(e,r)&&!!this.zn(e,r)&&!!this.Vn(e,r)}Un(e,r){var i;if(r==null||!r.href)return!0;var n=this.Wn(e);if(n.length>0)return n.some((a=>Tt(a.href,r.href,r.href_matching||"exact")));var s,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&Tt((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",r.href,r.href_matching||"exact")}zn(e,r){var i;if(r==null||!r.text)return!0;var n=this.Wn(e);if(n.length>0)return n.some((l=>Tt(l.text,r.text,r.text_matching||"exact")||Tt(l.$el_text,r.text,r.text_matching||"exact")));var s,o,a,u=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!u&&(s=(function(l){for(var c,h=[],d=/(?::|")text="(.*?)"/g;!M(c=d.exec(l));)h.includes(c[1])||h.push(c[1]);return h})(u),o=r.text,a=r.text_matching||"exact",s.some((l=>Tt(l,o,a))))}Vn(e,r){var i,n;if(r==null||!r.selector)return!0;var s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(s!=null&&s.includes(r.selector))return!0;var o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";if(r.selector_regex&&o)try{return new RegExp(r.selector_regex).test(o)}catch{return!1}return!1}Wn(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e?.properties.$elements}Dn(e,r){return r==null||!r.properties||r.properties.length===0||Qu(r.properties.reduce(((i,n)=>{var s=R(n.value)?n.value.map(String):n.value!=null?[String(n.value)]:[];return i[n.key]={values:s,operator:n.operator||"exact"},i}),{}),e?.properties)}},Ts=class{constructor(e){var r;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(r=this._instance)==null||r.onSessionId==null||r.onSessionId((i=>this.Kn(i)))}Yn(e,r){return!!e&&Qu(e.propertyFilters,r?.properties)}Xn(e,r){var i=new Map;return e.forEach((n=>{var s;(s=n.conditions)==null||(s=s[r])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=i.get(o.name)||[];a.push(n.id),i.set(o.name,a)}}))})),i}es(e,r,i){var n=(i===Xt.Activation?this.Gn:this.Qn).get(e),s=[];return this.ts((o=>{s=o.filter((a=>n?.includes(a.id)))})),s.filter((o=>{var a,u=(a=o.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((l=>l.name===e));return this.Yn(u,r)}))}register(e){var r;x((r=this._instance)==null?void 0:r._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var r=e.filter((i=>{var n,s;return((n=i.conditions)==null?void 0:n.actions)&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));r.length!==0&&(this.ss==null&&(this.ss=new Ss(this._instance),this.ss.init(),this.ss.Bn((i=>{this.onAction(i)}))),r.forEach((i=>{var n,s,o,a,u;i.conditions&&(n=i.conditions)!=null&&n.actions&&(s=i.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ss)==null||a.register(i.conditions.actions.values),(u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((l=>{if(l&&l.name){var c=this.Jn.get(l.name);c&&c.push(i.id),this.Jn.set(l.name,c||[i.id])}})))})))}rs(e){var r,i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));i.length===0&&n.length===0||((r=this._instance)==null||r._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Gn=this.Xn(e,Xt.Activation),this.Qn=this.Xn(e,Xt.Cancellation))}onEvent(e,r){var i,n,s=this.os(),o=(r==null||(i=r.properties)==null?void 0:i.$survey_id)||(r==null||(n=r.properties)==null?void 0:n.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.ls(e,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.us([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),void this.hs(o)}if(this.Qn.has(e)){var u=this.es(e,r,Xt.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((c=>c.id))}),this.us(u.map((c=>c.id))),u.forEach((c=>this.ds(c.id))))}if(this.Gn.has(e)){s.info("event name matched",{event:e,eventPayload:r,items:this.Gn.get(e)});var l=this.es(e,r,Xt.Activation);this.cs(l.map((c=>c.id)))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){e.length!==0&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter((i=>i!==e));var r=this.vs();r.includes(e)||(this.fs([...r,e]),this.ps())}us(e){var r=new Set(e);this.Zn=this.Zn.filter((s=>!r.has(s)));var i=this.gs(),n=i.filter((s=>!r.has(s)));n.length!==i.length&&(this.fs(n),n.length===0&&this.ys())}gs(){var e,r=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r])||[]}vs(){var e,r,i=this.gs();if(i.length===0)return[];var n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],s=(r=this._instance)==null||r.get_session_id==null?void 0:r.get_session_id();return s&&n===s?i:[]}ps(){var e,r=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();r&&this.ws(r)}ys(){this.xs()}Kn(e){var r,i=(r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[this._s()];i&&i!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((e=>!this.ks(e)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}},zs=class extends Ts{constructor(e){super(e)}bs(){return Yn}_s(){return Kr}Cs(){return qe.SHOWN}ts(e){var r;(r=this._instance)==null||r.getSurveys(e)}ds(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}os(){return j}fs(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[Yn]:e})}ws(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[Kr]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Kr)}ks(){return!1}ls(e,r){var i;this.ts((s=>{i=s.find((o=>o.id===r))}));var n=!i||(function(s){var o;return el(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"})(i);return n?e===qe.SHOWN?"consume":"ignore":e===qe.SHOWN?"persist":e===qe.DISMISSED||e===qe.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Gr="SDK is not enabled or survey functionality is not yet loaded",ga="Disabled. Not loading surveys.",wh=v!=null&&v.location?yi(v.location.hash,"__posthog")||yi(location.hash,"state"):null,ma="_postHogToolbarParams",ya=J("[Toolbar]"),ne=J("[FeatureFlags]"),st=J("[FeatureFlags]",{debugEnabled:!0}),mn=`" failed. Feature flags didn't load in time.`,ba=t=>{for(var e={},r=0;t.length>r;r++)e[t[r]]=!0;return e},xa=t=>{var e={};for(var r of Yr(t||{})){var i=r[1];i&&(e[r[0]]=i)}return e},De=J("[Error tracking]"),wa="Refusing to render web experiment since the viewer is a likely bot",$h={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Pi(e,t),not_regex:(t,e)=>!Pi(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},Is=class t{get Te(){return this._instance.config}constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),r.getWebExperiments((n=>{t.Ts("retrieved web experiments from the server"),r.Is=new Map,n.forEach((s=>{if(s.feature_flag_key){var o;r.Is&&(t.Ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=r.Is)==null||o.set(s.feature_flag_key,s));var a=r._instance.getFeatureFlag(s.feature_flag_key);U(a)&&s.variants[a]&&r.Ms(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var l=s.variants[u];t.Es(l,r._instance)&&r.Ms(s.name,u,l.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())t.Ts(wa);else if(!this.Te.disable_web_experiments){if(M(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ts("applying feature flags",e),e.forEach((r=>{var i;if(this.Is&&(i=this.Is)!=null&&i.has(r)){var n,s=this._instance.getFeatureFlag(r),o=(n=this.Is)==null?void 0:n.get(r);s&&o!=null&&o.variants[s]&&this.Ms(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var r=Nt(e?.search,"__experiment_id"),i=Nt(e?.search,"__experiment_variant");r&&i&&(t.Ts("previewing web experiments "+r+" && "+i),this.getWebExperiments((n=>{this.Rs(parseInt(r),i,n)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,i){if(this.Te.disable_web_experiments&&!i)return e([]);var n=this._instance.get_property("$web_experiments");if(n&&!r)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Rs(e,r,i){var n=i.filter((s=>s.id===e));n&&n.length>0&&(t.Ts("Previewing web experiment ["+n[0].name+"] with variant ["+r+"]"),this.Ms(n[0].name,r,n[0].variants[r].transforms))}static Es(e,r){return!M(e.conditions)&&t.Ps(e,r)&&t.Os(e)}static Ps(e,r){var i;if(M(e.conditions)||M((i=e.conditions)==null?void 0:i.url))return!0;var n=t.getWindowLocation();if(n){var s,o,a,u=gu(r,n.href);return(s=e.conditions)==null||!s.url||$h[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return v?.location}static Os(e){var r;if(M(e.conditions)||M((r=e.conditions)==null?void 0:r.utm))return!0;var i=Mu();if(i.utm_source){var n,s,o,a,u,l,c,h,d=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==i.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==i.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return d&&p&&_&&f}return!1}static Ts(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;r>n;n++)i[n-1]=arguments[n];w.info("[WebExperiments] "+e,i)}Ms(e,r,i){this._is_bot()?t.Ts(wa):r!=="control"?i.forEach((n=>{if(n.selector){var s;t.Ts("applying transform of variant "+r+" for experiment "+e+" ",n);var o=(s=document)==null?void 0:s.querySelectorAll(n.selector);o?.forEach((a=>{var u=a;n.html&&(u.innerHTML=n.html),n.css&&u.setAttribute("style",n.css)}))}})):t.Ts("Control variants leave the page unmodified.")}_is_bot(){return fe&&this._instance?Yu(fe,this.Te.custom_blocked_useragents):void 0}},Pe=J("[Conversations]"),ot="Conversations not available yet.",$a="console",Ci={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],v&&te(v,"online",this.Bs)}destroy(){v?.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return(t=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,ne.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=(t=this.Te.evaluation_contexts)!==null&&t!==void 0?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(ne.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),e!=null&&e.length?e.filter((r=>{var i=r&&typeof r=="string"&&r.trim().length>0;return i||ne.error("Invalid evaluation context found:",r,"Expected non-empty string"),i})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!x(t)){if(R(t))return t.filter((e=>{var r=e&&typeof e=="string"&&e.trim().length>0;return r||ne.error("Invalid flag key found:",e,"Expected non-empty string"),r}));ne.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,r=this._instance.config,i=(t=(e=r.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(i).length){var n,s,o=(n=(s=r.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(i).filter((l=>!!i[l])).reduce(((l,c)=>(l[c]=i[c]||!1,l)),{}),u=Object.keys(o).filter((l=>a[l])).reduce(((l,c)=>(o[c]&&(l[c]=o[c]),l)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,r){var i,n,s=r!=null&&r.merge&&(i=this.zs(ct))!==null&&i!==void 0?i:{},o=r!=null&&r.merge&&(n=this.zs(Wr))!==null&&n!==void 0?n:{},a=y({},s,t),u=y({},o,e),l={};for(var c of Object.entries(a)){var h=c[0],d=c[1];l[h]={key:h,enabled:Io(d),variant:Co(d),reason:void 0,metadata:x(u?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(qn),e=this.zs(Ue),r=this.zs(zt);if(!r&&!e)return t||{};var i=q({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var s of n){var o,a,u=i[s],l=e?.[s],c=x(l)?(o=u?.enabled)!==null&&o!==void 0&&o:!!l,h=x(l)?u.variant:typeof l=="string"?l:void 0,d=r?.[s],f=y({},u,{enabled:c,variant:c?h??u?.variant:void 0});c!==u?.enabled&&(f.original_enabled=u?.enabled),h!==u?.variant&&(f.original_variant=u?.variant),d&&(f.metadata=y({},u?.metadata,{payload:d,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),i[s]=f}return this.Fs||(ne.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this.Fs=!0),i}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((r=>{var i=t[r];return{key:r,enabled:Io(i),variant:Co(i),payload:zo(e[r])}}))}getFlagVariants(){var t=this.zs(ct),e=this.zs(Ue);if(!e)return t||{};for(var r=q({},t),i=Object.keys(e),n=0;i.length>n;n++)r[i[n]]=e[i[n]];return this.Fs||(ne.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.Fs=!0),r}getFlagPayloads(){var t=this.zs(Wr),e=this.zs(zt);if(!e)return t||{};for(var r=q({},t||{}),i=Object.keys(e),n=0;i.length>n;n++)r[i[n]]=e[i[n]];return this.Fs||(ne.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.Fs=!0),r}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,i=this.zs(ui),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.zs(at)||{},{$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION}),group_properties:this.zs(ut),timezone:Du()};ve(i)||x(i)||(n.$device_id=i),(t!=null&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.Gs()&&(n.evaluation_contexts=this.Zs());var s=this.Qs();x(s)||(n.flag_keys=s);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var l,c,h,d=!0;if(this.Xs(u.statusCode),u.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),d=!1),this.$s=!1,!n.disable_flags||this.Ns){this.Ds=!d;var f=[];u.error?u.error instanceof Error?f.push(u.error.name==="AbortError"?"timeout":"connection_error"):f.push("unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),(l=u.json)!=null&&l.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var p,_=!((c=u.json)==null||(c=c.quotaLimited)==null||!c.includes("feature_flags"));_&&f.push("quota_limited"),(h=this.mi)==null||h.register({[Xn]:f}),_?ne.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(n.disable_flags||this.receivedFeatureFlags((p=u.json)!==null&&p!==void 0?p:{},d,{partialResponse:o}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return Au(this.Hs,3)}Xs(t){this.Hs=Ru(t,this.Hs,3,(()=>ne.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var r;if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFeatureFlagResult(t,e);return(r=i?.variant)!==null&&r!==void 0?r:i?.enabled}}else ne.warn('getFeatureFlag for key "'+t+mn)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var r=this.getFlagVariants(),i=t in r,n=r[t],s=this.getFlagPayloads()[t],o=String(n),a=this.zs(Wn)||void 0,u=this.zs(br)||void 0,l=this.zs(pr)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.zs(Jn);h&&h!==d&&(l={},(c=this.mi)==null||c.register({[pr]:l,[Jn]:h}))}if((e.send_event||!("send_event"in e))&&(!(t in l)||!l[t].includes(o))){var f,p,_,m,g,E,$,k,T,L,F;R(l[t])?l[t].push(o):l[t]=[o],(f=this.mi)==null||f.register({[pr]:l});var b=this.getFeatureFlagDetails(t),S=[...(p=this.zs(Xn))!==null&&p!==void 0?p:[]];x(n)&&S.push("flag_missing");var I={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((_=this.Te.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[t])||null,$used_bootstrap_value:!this.Ds};x(b==null||(g=b.metadata)==null?void 0:g.has_experiment)||(I.$feature_flag_has_experiment=b.metadata.has_experiment),x(b==null||(E=b.metadata)==null?void 0:E.version)||(I.$feature_flag_version=b.metadata.version);var O,C=($=b==null||(k=b.reason)==null?void 0:k.description)!==null&&$!==void 0?$:b==null||(T=b.reason)==null?void 0:T.code;C&&(I.$feature_flag_reason=C),b!=null&&(L=b.metadata)!=null&&L.id&&(I.$feature_flag_id=b.metadata.id),x(b?.original_variant)&&x(b?.original_enabled)||(I.$feature_flag_original_response=x(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(F=b.metadata)!=null&&F.original_payload&&(I.$feature_flag_original_payload=b==null||(O=b.metadata)==null?void 0:O.original_payload),S.length&&(I.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",I)}if(i)return{key:t,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:zo(s)}}}else ne.warn('getFeatureFlagResult for key "'+t+mn)}getRemoteConfigPayload(t,e){var r=this.Te.token,i={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION}};this.Gs()&&(i.evaluation_contexts=this.Zs());var n=this.Qs();x(n)||(i.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(s){var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;e(a?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return ne.warn('isFeatureEnabled for key "'+t+mn),e.defaultValue;var r=this.getFeatureFlag(t,e);return x(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var i=this.getFlagVariants(),n=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,l,c,h){u===void 0&&(u={}),l===void 0&&(l={}),c===void 0&&(c={});var d=(b=>{var S=b.flags;return S?(b.featureFlags=Object.fromEntries(Object.keys(S).map((I=>{var O;return[I,(O=S[I].variant)!==null&&O!==void 0?O:S[I].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter((I=>S[I].enabled)).filter((I=>{var O;return(O=S[I].metadata)==null?void 0:O.payload})).map((I=>{var O;return[I,(O=S[I].metadata)==null?void 0:O.payload]})))):b.featureFlags&&ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(o),f=d.flags,p=d.featureFlags,_=d.featureFlagPayloads;if(p){var m=o.requestId,g=o.evaluatedAt;if(R(p)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(p)for(var $=0;p.length>$;$++)E[p[$]]=!0;a&&a.register({[qr]:p,[ct]:E,[li]:!1})}else{var k=p,T=_,L=f;if(h!=null&&h.partialResponse)k=y({},u,k),T=y({},l,T),L=y({},c,L);else if(o.errorsWhileComputingFlags)if(f){var F=new Set(Object.keys(f).filter((b=>{var S;return!((S=f[b])!=null&&S.failed)})));k=y({},u,Object.fromEntries(Object.entries(k).filter((b=>F.has(b[0]))))),T=y({},l,Object.fromEntries(Object.entries(T||{}).filter((b=>F.has(b[0]))))),L=y({},c,Object.fromEntries(Object.entries(L||{}).filter((b=>F.has(b[0])))))}else k=y({},u,k),T=y({},l,T),L=y({},c,L);a&&a.register(y({[qr]:Object.keys(xa(k)),[ct]:k||{},[Wr]:T||{},[qn]:L||{},[li]:o.minimalFlagCalledEvents===!0},m?{[Wn]:m}:{},g?{[br]:g}:{}))}}})(t,this.mi,i,n,s,r),e||(this.js=!1),this.eo(e)}}override(t,e){e===void 0&&(e=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.mi.unregister(Ue),this.mi.unregister(zt),this.eo(),st.info("All overrides cleared");if(R(t)){var e=ba(t);return this.mi.register({[Ue]:e}),this.eo(),st.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,i=t;if(this.Fs=!!((r=i.suppressWarning)!==null&&r!==void 0&&r),"flags"in i){if(i.flags===!1)this.mi.unregister(Ue),st.info("Flag overrides cleared");else if(i.flags){if(R(i.flags)){var n=ba(i.flags);this.mi.register({[Ue]:n})}else this.mi.register({[Ue]:i.flags});st.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.mi.unregister(zt),st.info("Payload overrides cleared")):i.payloads&&(this.mi.register({[zt]:i.payloads}),st.info("Payload overrides set",{payloads:i.payloads}))),void this.eo()}if(t&&typeof t=="object")return this.mi.register({[Ue]:t}),this.eo(),st.info("Flag overrides set",{flags:t});ne.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),r=e.flags,i=e.flagVariants;try{t(r,i)}catch(n){ne.error("Error while running feature flags callback",n)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var i,n=(this.zs(lr)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=y({},this.getFlagVariants(),{[t]:e});(i=this.mi)==null||i.register({[qr]:Object.keys(xa(a)),[ct]:a}),this.eo()}getEarlyAccessFeatures(t,e,r){e===void 0&&(e=!1);var i=this.zs(lr),n=r?"&"+r.map((s=>"stage="+s)).join("&"):"";if(i&&!e)return t(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+n),method:"GET",timestampMode:"query",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.mi)==null||o.unregister(lr),(a=this.mi)==null||a.register({[lr]:u}),t(u)}}})}ro(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((r=>e[r])),flagVariants:Object.keys(e).filter((r=>e[r])).reduce(((r,i)=>(r[i]=e[i],r)),{})}}eo(t){var e=this.ro(),r=e.flags,i=e.flagVariants;this.featureFlagEventHandlers.forEach((n=>{try{n(r,i,{errorsLoading:t})}catch(s){ne.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(at)||{},i=t?.$set||(t!=null&&t.$set_once?{}:t),n=t?.$set_once,s={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(s[o]=n[o]));this._instance.register({[at]:y({},r,s,i)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=y({},this.zs(at)||{});t.forEach((i=>{delete r[i]})),this._instance.register({[at]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(at),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(ut)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=y({},r[i],t[i]),delete t[i]})),this._instance.register({[ut]:y({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(ut)||{};this._instance.register({[ut]:y({},e,{[t]:{}})})}else this._instance.unregister(ut)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},Eh={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!((t=this.io)==null||!t.isStarted)}get status(){var t,e;return this.no===sr||this.no===Br?this.no:(t=(e=this.io)==null?void 0:e.status)!==null&&t!==void 0?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=fa,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Ne.error("started without valid sessionManager"),new Error(Ps+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===Ge)throw new Error(Ps+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!((t=this._instance.get_property(ht))==null||!t.enabled),r=!this.Te.disable_session_recording,i=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&r&&!i}startIfEnabledOrStop(t){var e;if(!this.oo||(e=this.io)==null||!e.isStarted){var r=!x(Object.assign)&&!x(Array.from);this.oo&&r?(this.ao(t),Ne.info("starting")):(this.no=fa,this.stopRecording())}}ao(t){var e,r,i;this.oo&&(this.no!==sr&&this.no!==Br&&(this.no=_a),z!=null&&(e=z.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(r=z.__PosthogExtensions__)!=null&&r.initSessionRecording?this.lo(t):(i=z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.uo,(n=>{if(n)return Ne.error("could not load recorder",n);this.lo(t)})))}stopRecording(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.stop()}ho(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.discard()}do(){var t,e;(t=this.mi)==null||t.unregister(Ns),(e=this.mi)==null||e.unregister(su)}co(t,e){if(M(t))return null;var r,i=ce(t)?t:parseFloat(t);return typeof(r=i)!="number"||!Number.isFinite(r)||0>r||r>1?(Ne.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):i}vo(t){if(this.mi){var e,r,i=this.mi,n=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.co((s=this.Te.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.co(o?.sampleRate,"remote config sampleRate"),l=a??u;M(l)&&this.do();var c=o?.minimumDurationMilliseconds;i.register({[ht]:y({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:y({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:x(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};n(),(e=this.so)==null||e.call(this),this.so=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===sr&&(this.no=Br,Ne.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var r;e===void 0&&(e="log"),(r=this.io)!=null&&r.log?this.io.log(t,e):Ne.warn("log called before recorder was ready")}get uo(){var t,e,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(ht);return(r==null||(e=r.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}fo(){var t,e,r=this._instance.get_property(ht);if(!r)return!1;try{e=typeof r=="object"?r:JSON.parse(r)}catch(n){return Ne.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}var i=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-i}lo(t){var e,r;if((e=z.__PosthogExtensions__)==null||!e.initSessionRecording)return Ne.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[pu]:!0});if(this.io||(this.io=(r=z.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===Br||this.no===sr?void 0:(this.no=sr,Ne.info("persisted remote config is stale, requesting fresh config before starting"),void new xi(this._instance).load());this.no=_a,this.io.start(t)}onRRwebEmit(t){var e;(e=this.io)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||(e=this.mi)==null||e.register({[au]:!0}),(t=this.io)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||(e=this.mi)==null||e.register({[ou]:!0}),(t=this.io)==null||t.overrideSampling()}overrideTrigger(t){var e,r;this.io||(r=this.mi)==null||r.register({[t==="url"?uu:lu]:!0}),(e=this.io)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.io)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!((r=this.io)==null||!r.tryAddCustomEvent(t,e))}}},kh={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Ti(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,r=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((i=>new RegExp(i))),r.url_ignorelist=(e=r.url_ignorelist)==null?void 0:e.map((i=>new RegExp(i))),r}wo(){if(this.isBrowserSupported()){if(v&&P){var t=r=>{r=r||v?.event;try{this.xo(r)}catch(i){pn.error("Failed to capture event",i)}};if(te(P,"submit",t,{capture:!0}),te(P,"change",t,{capture:!0}),te(P,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=r=>{r=r||v?.event;try{this.xo(r,dn)}catch(i){pn.error("Failed to capture copy/cut event",i)}};te(P,"copy",e,{capture:!0}),te(P,"cut",e,{capture:!0})}}}else pn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var r=e.autocapture_opt_out;Ae(r)&&(this.instance.persistence&&this.instance.persistence.register({[Dn]:r}),this.mo=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,r=[];return(e=this._o)==null||e.forEach((i=>{var n=P?.querySelectorAll(i);n?.forEach((s=>{t===s&&r.push(i)}))})),r}get isEnabled(){var t,e,r=(t=this.instance.persistence)==null?void 0:t.props[Dn],i=this.mo,n=this.instance.Ur()&&!this.yo;if(ve(i)&&!Ae(r)&&!n)return!1;var s=(e=this.mo)!==null&&e!==void 0?e:!!r;return!!this.instance.config.autocapture&&!s}xo(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var r,i=tn(t);yu(i)&&(i=i.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&Jo(i,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var n=e===dn;if(i&&(function(h,d,f,p,_,m){var g;if(!v||Bs(h)||f!=null&&f.url_allowlist&&!Wo(f.url_allowlist,m)||f!=null&&f.url_ignorelist&&Wo(f.url_ignorelist,m))return!1;if(f!=null&&f.dom_event_allowlist){var E=f.dom_event_allowlist;if(E&&!E.some((b=>d.type===b)))return!1}var $=ku(h,p),k=$.parentIsUsefulElement,T=$.targetElementList;if(!(function(b,S){var I=S?.element_allowlist;if(x(I))return!0;var O,C=function(X){if(I.some((B=>X.tagName.toLowerCase()===B)))return{v:!0}};for(var Z of b)if(O=C(Z))return O.v;return!1})(T,f)||!us(T,f?.css_selector_allowlist)||us(T,(g=f?.css_selector_ignorelist)!==null&&g!==void 0?g:Fc))return!1;try{var L=v.getComputedStyle(h);if(L&&L.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var F=h.tagName.toLowerCase();switch(F){case"html":return!1;case"form":return(_||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(d.type)>=0;default:return k?(_||["click"]).indexOf(d.type)>=0:(_||["click"]).indexOf(d.type)>=0&&(Hs.indexOf(F)>-1||h.getAttribute("contenteditable")==="true")}})(i,t,this.Te,n,n?["copy","cut"]:void 0,this.instance)){var s=mh(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),e===dn){var u,l=wu(v==null||(u=v.getSelection())==null?void 0:u.toString()),c=t.type||"clipboard";if(!l)return!1;o.$selected_content=l,o.$copy_type=c}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return Ce(P?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(v&&((e=v.history[t])==null||!e.__posthog_wrapped__)){var r=this;(function(i,n,s){try{if(!(n in i))return da;var o={next:i[n]},a=s((function(){for(var u=arguments.length,l=new Array(u),c=0;u>c;c++)l[c]=arguments[c];return o.next.apply(this,l)}));return Ce(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),i[n]=a,()=>{if(i[n]!==a)for(var u=i[n];Ce(u)&&u.__posthog_layer__;){var l=u.__posthog_layer__;if(l.next===a)return void(l.next=o.next);u=l.next}else i[n]=o.next}}catch{return da}})(v.history,t,(i=>function(n,s,o){i.call(this,n,s,o),r.Io(t)}))}}Io(t){try{var e,r=v==null||(e=v.location)==null?void 0:e.pathname;if(!r)return;r!==this.ko&&this.isEnabled&&this._instance.capture(It,{navigation_type:t}),this.ko=r}catch(i){w.error("Error capturing "+t+" pageview",i)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};te(v,"popstate",t),this.So=()=>{v&&v.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!((e=this.instance.persistence)==null||!e.props[jn]),this.rageclicks=new Ti(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Y(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return M(this.Te.capture_heatmaps)?M(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;bh.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval((t=this.Eo)!==null&&t!==void 0?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[jn]:r}),this.Mo=r,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){_n(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=P?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){v&&P&&(this.Fo=this.oi.bind(this),te(v,fi,this.Fo),this.Lo=t=>this.pe(t||v?.event),te(P,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||v?.event),te(P,"mousemove",this.$o,{capture:!0}),this.No=new vi(this.instance,Bc,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),te(P,pi,this.Do),this.po=!0)}Po(){var t;v&&P&&(this.Fo&&v.removeEventListener(fi,this.Fo),this.Lo&&P.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&P.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&P.removeEventListener(pi,this.Do),clearTimeout(this.qo),(t=this.No)==null||t.stop(),this.po=!1)}jo(t,e){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),s=(function(o,a,u){for(var l=o;l&&et(l)&&!we(l,"body");){if(l===u)return!1;var c=void 0;try{var h,d,f;c=(h=(d=(f=l.ownerDocument)==null?void 0:f.defaultView)!==null&&d!==void 0?d:v)==null?void 0:h.getComputedStyle(l).position}catch{return!1}if(A(a,c))return!0;l=$u(l)}return!1})(tn(t),["fixed","sticky"],n);return{x:t.clientX+(s?0:i),y:t.clientY+(s?0:r),target_fixed:s,type:e}}pe(t,e){var r;if(e===void 0&&(e="click"),!qo(t.target)&&_n(t)){var i=this.jo(t,e);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Jo(tn(t),this.instance.config.rageclick)&&this.Nt(y({},i,{type:"rageclick"})),this.Nt(i)}}Ao(t){!qo(t.target)&&_n(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(v){var e=this.Te.disable_capture_url_hashes?Qe(v.location.href):v.location.href,r=this.Te.custom_personal_data_properties,i=this.Te.mask_personal_data_properties?[...Dt,...r||[]]:[],n=wr(e,i,$r);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(t)}}oi(){this.R&&!Xe(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:vi,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((r,i)=>y({},r,{["$web_vitals_"+i.name+"_event"]:y({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=r=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.zo();if(!x(n))if(M(r?.name)||M(r?.value))nt.error("Invalid metric received",r);else if(!this.Vo||this.Vo>r.value){this.R.url!==n&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),x(this.R.url)&&(this.R.url=n),this.R.firstMetricTimestamp=x(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0);var s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),o=y({},r,{$current_url:n,timestamp:Date.now()});x(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this.R.metrics.push(o),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else nt.error("Ignoring metric with value >= "+this.Vo,r)},this.Wo=()=>{if(!this.po){var r,i,n,s,o=z.__PosthogExtensions__;if(!x(o)&&!x(o.postHogWebVitalsCallbacks)){var a=o.postHogWebVitalsCallbacks;r=a.onLCP,i=a.onCLS,n=a.onFCP,s=a.onINP}r&&i&&n&&s?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uo.bind(this)),this.po=!0):nt.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[Gn]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,r=Y(this.Zo)?(t=this.Zo)==null?void 0:t.web_vitals_allowed_metrics:void 0;return M(r)?((e=this._instance.persistence)==null?void 0:e.props[Vn])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Y(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Y(this.Zo)?this.Zo.web_vitals_attribution:void 0;return t!=null&&t}get Vo(){var t=Y(this.Zo)&&ce(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:pa;return t>0&&6e4>=t?pa:t}get isEnabled(){var t=ie?.protocol;if(t!=="http:"&&t!=="https:")return nt.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Y(this.Zo)?this.Zo.web_vitals:Ae(this.Zo)?this.Zo:void 0;return Ae(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(nt.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var r=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Gn]:r}),this._instance.persistence.register({[Vn]:i})),this.Mo=r,this.startIfEnabled()}}}er(t){var e,r;(e=z.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(r=z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?nt.error("failed to load script",i):t()}))}zo(){var t=v?this._instance.config.disable_capture_url_hashes?Qe(v.location.href):v.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Dt,...e||[]]:[];return wr(t,r,$r)}nt.error("Could not determine current URL")}}},Ph={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var r;if(v&&this.isEnabled&&(r=z.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var i=z.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=z.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=z.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=n(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=s(this.captureException.bind(this)))}catch(o){nr.error("failed to start",o),this.Ko()}}},this._instance=t,this.Yo=!((e=this._instance.persistence)==null||!e.props[Un]),this.Xo=new En(y({},(function(r){var i,n,s,o;return r===void 0&&(r={}),{refillRate:(i=(n=r.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:r.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:nr})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(t)?e=y({},e,t):(x(t)?this.Yo:t)&&(e=y({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(nr.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,r;(e=z.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(r=z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return nr.error("failed to load script",i);t()}))}Ko(){var t,e,r;(t=this.Go)==null||t.call(this),this.Go=void 0,(e=this.Qo)==null||e.call(this),this.Qo=void 0,(r=this.Jo)==null||r.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Un]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(t){var e,r,i,n=(e=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&e!==void 0?e:"Exception";this.Xo.consumeRateLimit(n)?nr.info("Skipping exception capture because of client rate limiting.",{exception:n}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.ta=[],this.ra=new zn([new Cn,new Ln,new Rn,new An,new Fn,new On,new Mn,new Zn],(function(i){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;n>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var l=[],c=a.split(`
2
- `),h=u;c.length>h;h++){var d=c[h];if(1024>=d.length){var f=Ho.test(d)?d.replace(Ho,"$1"):d;if(!f.match(/\S*Error: /)){for(var p of s){var _=p(f,i);if(_){l.push(_);break}}if(l.length>=50)break}}}return(function(m){if(!m.length)return[];var g=Array.from(m);return g.reverse(),g.slice(0,50).map((E=>{return y({},E,{filename:E.filename||($=g,$[$.length-1]||{}).filename,function:E.function||Lt});var $}))})(l)}})("web:javascript",gc,bc)),this._instance=t,this.ta=(e=(r=this._instance.persistence)==null?void 0:r.get_property(Hn))!==null&&e!==void 0?e:[],this.ia=ai(this.na()),this.sa=new Nn(this.ia)}onConfigChange(){this.ia=ai(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,r,i;if(t.ok){var n=t.config;if("errorTracking"in n){var s=(e=(r=n.errorTracking)==null?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],o=(i=n.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ta=s,this._instance.persistence&&this._instance.persistence.register({[Hn]:this.ta,[Bn]:o})}}}get oa(){var t,e=!!this._instance.get_property(Bn),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.ra.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!U(t)||t.trim().length===0)return void De.warn("Ignoring exception step because message must be a non-empty string");var r=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce(((a,u)=>$c.has(u)?(o.push(u),a):(a[u]=s[u],a)),{}),droppedKeys:o}})(this.aa(e)),i=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&De.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.sa.add(y({[si]:t,[oi]:new Date().toISOString()},i))}catch(s){De.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void De.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void De.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void De.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.ia.enabled&&M(t.$exception_steps)?this.va(t):t;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return i&&this.sa.clear(),i}catch(n){return De.error("Failed to capture exception event. Dropping this exception.",n),void this.sa.clear()}}catch(n){return void De.error("Failed to process exception event. Ignoring this exception.",n)}}va(t){try{var e=this.sa.getAttachable();return e.length===0?t:y({},t,{$exception_steps:e})}catch(r){return De.error("Failed to read buffered exception steps. Capturing exception without steps.",r),t}}ha(t){this.ia.enabled&&this.sa.add({[si]:t,[oi]:new Date().toISOString()})}aa(t){return Y(t)?y({},t):{}}na(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}ua(t){if(t.length===0)return!1;var e=t.reduce(((r,i)=>{var n=i.type,s=i.value;return U(n)&&n.length>0&&r.$exception_types.push(n),U(s)&&s.length>0&&r.$exception_values.push(s),r}),{$exception_types:[],$exception_values:[]});return this.ta.some((r=>{var i=r.values.map((n=>{var s,o=Xu[n.operator],a=R(n.value)?n.value:[n.value],u=(s=e[n.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)}));return r.type==="OR"?i.some(Boolean):i.every(Boolean)}))}da(t){return t.flatMap((e=>{var r,i;return(r=(i=e.stacktrace)==null?void 0:i.frames)!==null&&r!==void 0?r:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ca(t){if(t.length>0){var e,r,i,n,s=(e=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(i=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}la(t){return!M(t)&&R(t)}}},Sh=y({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var r,i;if(this.mi&&this.mi.register({[Ls]:!!e.productTours}),!gn(this._instance))return!this.fa&&M((r=this.mi)==null?void 0:r.props[cr])||vn.info("product tours disabled; stopping and clearing cached tours"),(i=this.fa)==null||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&gn(this._instance)&&this.er((()=>this.ga()))}er(t){var e,r;(e=z.__PosthogExtensions__)!=null&&e.generateProductTours?t():(r=z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(i=>{i?vn.error("Could not load product tours script",i):t()}))}ga(){var t;!this.fa&&(t=z.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.fa=z.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!R(this.pa)||e){var r=this.mi;if(r){var i=r.props[cr];if(R(i)&&!e)return this.pa=i,void t(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:n=>{if(gn(this._instance)){var s=n.statusCode;if(s!==200||!n.json){var o="Product Tours API could not be loaded, status: "+s;return vn.error(o),void t([],{isLoaded:!1,error:o})}var a=R(n.json.product_tours)?n.json.product_tours:[];this.pa=a,r&&r.register({[cr]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){M(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;(e=this.fa)==null||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),(e=this.fa)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.fa)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.fa)==null||t.nextStep()}previousStep(){var t;(t=this.fa)==null||t.previousStep()}clearCache(){var t;this.pa=null,(t=this.mi)==null||t.unregister(cr)}resetTour(t){var e;(e=this.fa)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.fa)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.fa)==null||e.cancelPendingTour(t)}}},Ci),Th={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var r=this.globalsForEvent(e);this.ya.push(r),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return(t=z._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,r,i,n,s,o,a;if(!t)throw new Error("Event payload is required");var u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(c)){var d=h[0];u[d]={id:l[d],type:d,properties:h[1]}}var f=t.$set_once,p=t.$set;return{event:y({},ka(t,xh),{properties:y({},t.properties,p?{$set:y({},(e=(r=t.properties)==null?void 0:r.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:y({},(i=(n=t.properties)==null?void 0:n.$set_once)!==null&&i!==void 0?i:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}wa(t){var e,r=(e=t.tagName)==null?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Me.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Me.error("prepare_external_dependency_script returned null"),null):t}xa(){var t,e,r,i,n,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=P?.defaultView,l=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!l)return()=>{};if(this.ma++,this.ka)return this.Sa();var c=[],h=this,d=new WeakSet,f=(m,g,E)=>{if(m!=null&&m[g]){var $=m[g];m[g]=E($),c.push((()=>{m[g]=$}))}},p=m=>{if(d.has(m))return m;var g=h.wa(m);return g&&d.add(g),g},_=m=>m.map((g=>typeof g=="string"?g:p(g))).filter((g=>!ve(g)));return f(l,"appendChild",(m=>function(g){var E=p(g);return E?m.call(this,E):g})),f(l,"insertBefore",(m=>function(g,E){var $=p(g);return $?m.call(this,$,E):g})),f(l,"replaceChild",(m=>function(g,E){var $=p(g);return $?m.call(this,$,E):E})),[(e=u.Element)==null?void 0:e.prototype,(r=u.Document)==null?void 0:r.prototype,(i=u.DocumentFragment)==null?void 0:i.prototype].forEach((m=>{f(m,"append",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"prepend",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))}))})),[(n=u.Element)==null?void 0:n.prototype,(s=u.CharacterData)==null?void 0:s.prototype,(o=u.DocumentType)==null?void 0:o.prototype].forEach((m=>{f(m,"before",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"after",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"replaceWith",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];var T=_($);return $.length&&!T.length?void 0:g.apply(this,T)}))})),f((a=u.Element)==null?void 0:a.prototype,"insertAdjacentElement",(m=>function(g,E){var $=p(E);return $?m.call(this,g,$):null})),this.ka=()=>{c.forEach((m=>m())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,this.ma===0&&((e=this.ka)==null||e.call(this)))}}Ca(t,e){e===void 0&&(e=!0);var r=this.xa();try{var i=t(r);return e&&r(),i}catch(n){throw r(),n}}setupSiteApp(t){var e=this.apps[t.id],r=()=>{var o;!e.errored&&this.ya.length&&(Me.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((a=>this.Ca((()=>e.processEvent==null?void 0:e.processEvent(a))))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this._a)==null||o.call(this))},i=!1,n=o=>{e.errored=!o,e.loaded=!0,Me.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),i&&r()};try{var s=this.Ca((o=>t.init({posthog:this._instance,callback(a){o(),n(a)}})),!1).processEvent;s&&(e.processEvent=s),i=!0}catch(o){Me.error(va+t.id,o),n(!1)}if(i&&e.loaded)try{r()}catch(o){Me.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}Ia(t){var e=this;if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t),i=function(s){try{e.Ca((()=>s.processEvent==null?void 0:s.processEvent(r)))}catch(o){Me.error("Error while processing event "+t.event+" for site app "+s.id,o)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(t){var e,r,i,n=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(u=>this.Ia(u)))):void Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this._a)==null||r.call(this),t.ok){var s=t.config;if((i=s.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(){var u,l=a.id,c=a.url;z["__$$ph_site_app_"+l]=n._instance,(u=z.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(n._instance,c,(h=>{if(h)return Me.error(va+l,h)}))};for(var a of s.siteApps)o()}else Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},zh={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,r,i=this.Pa();i?(x(this.Ma)&&(this.Ma=(e=z.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),x(this.Ea)&&(this.Ea=(r=z.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null?void 0:r._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,r;(e=z.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(r=z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return yh.error("failed to load script",i);t()}))}Oa(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Pa(){var t=this.Oa();return R(t)?(R(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(R(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;(t=this.Ma)==null||t.call(this),(e=this.Ea)==null||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Ih=y({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return j.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(M(e))return j.warn("Flags not loaded yet. Not loading surveys.");var r=R(e);this.Fa=r?e.length>0:e,j.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(i!=null&&i.startsWith(tl)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((n=>localStorage.removeItem(n)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)j.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)j.info(ga);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())j.info("Not loading surveys in cookieless mode without consent.");else{var t=z?.__PosthogExtensions__;if(t){if(!x(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var r=t.generateSurveys;if(r)return void this.Da(r,e);var i=t.loadExternalDependency;if(!i)return void this.qa(Ds);i(this._instance,"surveys",(n=>{n||!t.generateSurveys?this.qa("Could not load surveys script",n):this.Da(t.generateSurveys,e)}))}catch(n){throw this.qa("Error initializing surveys",n),n}finally{this.La=!1}}}else j.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new zs(this._instance),j.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){j.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return j.info(ga),t([]);var r,i=this._instance.get_property(Kn);if(i&&!e)return t(i,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((n=>t(n.surveys,n.context))):(typeof Promise<"u"&&(this.Aa=new Promise((n=>{r=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:n=>{var s;this.Aa=null;var o=n.statusCode;if(o!==200||!n.json){var a="Surveys API could not be loaded, status: "+o;j.error(a),this.Na=Date.now();var u={isLoaded:!1,error:a};return t([],u),void(r==null||r({surveys:[],context:u}))}this.Na=null;var l,c=n.json.surveys||[],h=c.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(el(f)||(function(p){var _;return!((_=p.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(f))));h.length>0&&((l=this._surveyEventReceiver)==null||l.register(h)),(s=this._instance.persistence)==null||s.register({[Kn]:c,[ci]:Date.now()});var d={isLoaded:!0};t(c,d),r?.({surveys:c,context:d})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(ci);return ce(t)&&Date.now()-t>3e5}Ua(){return ce(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var r,i={id:t,current_iteration:(r=e?.iteration)!==null&&r!==void 0?r:null};rl(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){j.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!M(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);j.warn("init was not called")}za(t){var e=null;return this.getSurveys((r=>{var i;e=(i=r.find((n=>n.id===t)))!==null&&i!==void 0?i:null})),e}Va(t){if(M(this._surveyManager))return{eligible:!1,reason:Gr};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(M(this._surveyManager))return{eligible:!1,reason:Gr};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(M(this._surveyManager))return j.warn("init was not called"),{visible:!1,disabledReason:Gr};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return M(this._surveyManager)?(j.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Gr})):new Promise((r=>{this.getSurveys((i=>{var n,s=(n=i.find((a=>a.id===t)))!==null&&n!==void 0?n:null;if(s){var o=this.Wa(s);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,r){var i;if(M(this._surveyManager))j.warn("init was not called");else{var n=typeof t=="string"?this.za(t):t;if(n!=null&&n.id)if(hh.includes(n.type)){var s=P?.querySelector(e);if(s)return(i=n.appearance)!=null&&i.surveyPopupDelaySeconds?(j.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;j.info("Rendering survey "+n.id+" with delay of "+((o=n.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(n,s,r),j.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);j.warn("Survey element not found")}else j.warn("Surveys of type "+n.type+" cannot be rendered in the app");else j.warn("Survey not found")}}displaySurvey(t,e){var r;if(M(this._surveyManager))j.warn("init was not called");else{var i=this.za(t);if(i){var n=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=y({},i,{appearance:y({},i.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==hs.Popover&&e.initialResponses&&j.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.Va(i);if(!s.eligible)return void j.warn("Survey is not eligible to be displayed: ",s.reason)}e.displayType!==hs.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else j.warn("Survey not found")}}cancelPendingSurvey(t){M(this._surveyManager)?j.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Ci),Ch={toolbar:class{constructor(t){this.instance=t}Za(t){z.ph_toolbar_state=t}Ga(){var t;return(t=z.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,r){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),fu(this.instance.config)||!v||!P)return!1;t=t??v.location,r=r??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var i,n=wh||yi(t.hash,"__posthog")||yi(t.hash,"state"),s=n?Go((()=>JSON.parse(atob(decodeURIComponent(n)))))||Go((()=>JSON.parse(decodeURIComponent(n)))):null;return s&&s.action==="ph_authorize"?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((i=JSON.parse(e.getItem(ma)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Qa(t){var e=z.ph_load_toolbar||z.ph_load_editor;!M(e)&&Ce(e)?e(t,this.instance):ya.warn("No toolbar load function found")}loadToolbar(t){var e=!(P==null||!P.getElementById(mu));if(!v||e)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=y({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(v.localStorage.setItem(ma,JSON.stringify(y({},i,{source:void 0}))),this.Ga()===2)this.Qa(i);else if(this.Ga()===0){var n;this.Za(1),(n=z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return ya.error("[Toolbar] Failed to load",s),void this.Za(0);this.Za(2),this.Qa(i)})),te(v,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(i)}))}return!0}Ja(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,r){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,e,r)}}},Ah=y({experiments:Is},Ci),Rh={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;M(e)||(Ae(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||fu(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=z?.__PosthogExtensions__;if(t&&!x(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var r=t.loadExternalDependency;if(!r)return void this.tl(Ds);r(this._instance,"conversations",(i=>{i||!t.initConversations?this.tl("Could not load conversations script",i):this.el(t.initConversations),this.Ya=!1}))}catch(i){this.tl("Error initializing conversations",i),this.Ya=!1}}else Pe.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),Pe.info("Conversations loaded successfully")}catch(e){this.tl("Error completing conversations initialization",e)}else Pe.error("Cannot complete initialization: remote config is null")}tl(t,e){Pe.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Pe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!ve(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var i=this;return re((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(t,e,r):(Pe.warn(ot),null)}))()}getMessages(t,e){var r=this;return re((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Pe.warn(ot),null)}))()}markAsRead(t){var e=this;return re((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Pe.warn(ot),null)}))()}getTickets(t){var e=this;return re((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Pe.warn(ot),null)}))()}requestRestoreLink(t){var e=this;return re((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Pe.warn(ot),null)}))()}restoreFromToken(t){var e=this;return re((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Pe.warn(ot),null)}))()}restoreFromUrlToken(){var t=this;return re((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Pe.warn(ot),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}En(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Rn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},Mh={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=J("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var r,i;this.Hs=0,(r=this.ol)==null||r.onReconnect(),(i=this.al)==null||i.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.rl=!0),v&&te(v,"online",this.sl)}ll(t,e,r,i){var n,s=(function(o,a){var u,l,c,h,d,f,p,_=(u=o?.flushIntervalMs)!==null&&u!==void 0?u:3e3,m=(l=o?.maxBufferSize)!==null&&l!==void 0?l:100,g=a!=null&&a.consoleCapture?void 0:(c=o?.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,E=x(g)?Math.max(m,2048):Math.max(m,g),$=o?.resourceAttributes;return{serviceName:(h=(d=$?.["service.name"])!==null&&d!==void 0?d:o?.serviceName)!==null&&h!==void 0?h:a?.serviceNameDefault,serviceVersion:(f=$?.["service.version"])!==null&&f!==void 0?f:o?.serviceVersion,environment:(p=$?.["deployment.environment"])!==null&&p!==void 0?p:o?.environment,resourceAttributes:$,beforeSend:o?.beforeSend,flushIntervalMs:_,maxBufferSize:m,maxQueueSize:E,maxBatchRecordsPerPost:100,rateCapWindowMs:_,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((n=this._instance)==null||(n=n.config)==null?void 0:n.logs,r);return[new hc(this.ul(t,e),s,this.Ge,(()=>this.hl()),(o=>o()),void 0,i),s]}dl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.ol||this.cl!==e){var r;(r=this.ol)==null||r.reset(),this.cl=e;var i=this.ll((()=>this.Gr),(n=>{this.Gr=n}));this.ol=i[0],this.vl=i[1]}return this.ol}fl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.al||this.pl!==e){var r;(r=this.al)==null||r.reset(),this.pl=e;var i=this.ll((()=>this.nl),(n=>{this.nl=n}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$a);this.al=i[0],this.gl=i[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var r=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!M(r)&&r&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],(t=this.ol)==null||t.reset(),this.nl=[],(e=this.al)==null||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))),this.al&&this.al.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.rl&&!this.il){var t=z?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(r=>{var i;r||(i=t.logs)==null||!i.initializeLogs?this.Ge.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Ds)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:i=>i===He.LogsQueue?t():void 0,setPersistedProperty(i,n){var s;i===He.LogsQueue&&e((s=n)!==null&&s!==void 0?s:[])},Tt:i=>this.Tt(i),getLibraryId:()=>D.LIB_NAME,getLibraryVersion:()=>D.LIB_VERSION}}Tt(t){return new Promise((e=>{if(Au(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,i=s=>{r||(r=!0,clearTimeout(n),e(s))},n=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this._l(o),o>=200&&300>o)i({kind:"ok"});else if(o===413)i({kind:"too-large"});else if(o!==0&&o!==429&&500>o)i({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;i({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}}))}_l(t){(t!==0||this._instance.__loaded)&&(this.Hs=Ru(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,D.LIB_NAME,(e=>{this.Gr=e})),this.nl.length>0&&this.wl(t,this.nl,this.gl,$a,(e=>{this.nl=e}))}wl(t,e,r,i,n){if(e.length!==0){var s=e.map((a=>a.record));n([]);var o=eu(s,Qa(r,D.LIB_NAME,D.LIB_VERSION),i,D.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=i,M(n)||(e.sessionStartTimestamp=n),M(s)||(e.lastActivityTimestamp=s)}if(z!=null&&(t=z.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Qe(z.location.href):z.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Oh={metrics:class{constructor(t){this.Ge=J("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,r=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.ol&&this.cl===r||((e=this.ol)==null||e.reset(),this.cl=r,this.ol=new dc(this.ul(),(function(i){var n,s,o,a,u,l=i?.resourceAttributes;return{serviceName:(n=l?.["service.name"])!==null&&n!==void 0?n:i?.serviceName,serviceVersion:(s=l?.["service.version"])!==null&&s!==void 0?s:i?.serviceVersion,environment:(o=l?.["deployment.environment"])!==null&&o!==void 0?o:i?.environment,resourceAttributes:l,beforeSend:i?.beforeSend,flushIntervalMs:(a=i?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(u=i?.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(r),this.Ge)),this.ol}count(t,e,r){e===void 0&&(e=1),this.dl().count(t,e,r)}gauge(t,e,r){this.dl().gauge(t,e,r)}histogram(t,e,r){this.dl().histogram(t,e,r)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((r=>this.Ge.error("PostHog metrics flush failed:",r)))}reset(){var t;(t=this.ol)==null||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:r=>e.Bt(r),getLibraryId:()=>D.LIB_NAME,getLibraryVersion:()=>D.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var i=!1,n=o=>{i||(i=!0,clearTimeout(s),r(o))},s=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(y({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==429&&500>a)n({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var u;n({kind:"retry-later",error:(u=o.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+a)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Fh=y({},Ci,Eh,kh,Ph,Sh,Th,Ih,zh,Ch,Ah,Rh,Mh,Oh);pt.__defaultExtensionClasses=y({},Fh);var Fe=(function(){D.SDK_DIST_CHANNEL="npm";var t=gr[Ct]=new pt;return(function(){function e(){e.done||(e.done=!0,nl=!1,H(gr,(function(r){r._dom_loaded()})))}P!=null&&P.addEventListener?P.readyState==="complete"?e():te(P,"DOMContentLoaded",e,{capture:!1}):v&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();var sl=!1;function _t(){return sl}function Zh(){sl=!0}function Lh(t){try{return new URL(t.includes("://")?t:`https://${t}`).host}catch{return t}}var Ws=null;function ol(){Ws?.()}function al(t){if(_t()||!Re()||Or())return;let e=$o.safeParse(t);if(!e.success){let s=e.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${s}`);return}console.info(`[HeyCatch] SDK v${Et} (${$t}) initialized \u2192 ${Mr}`);let r={api_host:Mr,defaults:"2026-01-30",disable_compression:!0,disable_session_recording:!0,disable_surveys:!0,advanced_disable_flags:!0,mask_personal_data_properties:!0,rageclick:!0,...(()=>{let s=[...globalThis.location.host?[globalThis.location.host]:[],...e.data.tracingHosts.map(o=>Lh(o))];return s.length>0?{tracing_headers:[...new Set(s)]}:{}})()};Fe.init(wo,r);let{install:i}=e.data,n={heycatch_framework:i.framework,heycatch_framework_version:i.frameworkVersion,heycatch_agent:i.agent};Ws=()=>{Fe.register({heycatch_sdk_version:Et,heycatch_sdk_stage:$t,heycatch_project_key:e.data.projectKey,...n}),Fe.group(Xs,e.data.projectKey,{key:e.data.projectKey,sdk_version:Et,sdk_stage:$t,framework:i.framework,framework_version:i.frameworkVersion,agent:i.agent,origin:globalThis.location.origin,api_host:Mr})},Ws(),Po(),Zh()}function ul(t,e,r){if(!(!_t()||!Re())){if(typeof t!="string"||t.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}Fe.identify(t,e,r)}}function ll(){!_t()||!Re()||(Fe.reset(),ol())}function cl(t,e,r){if(!(!_t()||!Re())){if(typeof t!="string"||t.length===0){console.error('[HeyCatch] trackEvent() requires a non-empty event name, e.g. track("signup_completed").');return}if(t.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${t}") - that prefix is reserved for built-in events.`);return}Fe.capture(t,{...e,...Nh(r),heycatch_custom_user_event:!0})}}function hl(t,e){!_t()||!Re()||!t&&!e||Fe.setPersonProperties(t,e)}function Nh(t){let e={};return t?.set&&(e.$set=t.set),t?.setOnce&&(e.$set_once=t.setOnce),e}var Dh={init:al,resetIdentity:ll,setIdentity:ul,setPersonProperties:hl,trackEvent:cl};Or();0&&(module.exports={KNOWN_FRAMEWORKS,KNOWN_INSTALL_AGENTS,SDK_VERSION,STAGE,UNKNOWN_INSTALL_VALUE,analytics});
1
+ "use strict";var Zi=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Ul=Object.getOwnPropertyNames;var Hl=Object.prototype.hasOwnProperty;var Bl=(t,e)=>{for(var r in e)Zi(t,r,{get:e[r],enumerable:!0})},Gl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ul(e))!Hl.call(t,n)&&n!==r&&Zi(t,n,{get:()=>e[n],enumerable:!(i=jl(e,n))||i.enumerable});return t};var Vl=t=>Gl(Zi({},"__esModule",{value:!0}),t);var kd={};Bl(kd,{KNOWN_FRAMEWORKS:()=>Ko,KNOWN_INSTALL_AGENTS:()=>Yo,SDK_VERSION:()=>st,STAGE:()=>nt,UNKNOWN_INSTALL_VALUE:()=>it,analytics:()=>Ed});module.exports=Vl(kd);var io="project",Li="[a-z0-9]",Pd=new RegExp(`^${Li}$`),no="heycatch";var so;function j(t,e,r){function i(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,u);let l=o.prototype,c=Object.keys(l);for(let h=0;h<c.length;h++){let d=c[h];d in a||(a[d]=l[d].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function o(a){var u;let l=r?.Parent?new s:this;i(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}var je=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(so=globalThis).__zod_globalConfig??(so.__zod_globalConfig={});var Ni=globalThis.__zod_globalConfig;function kt(t){return t&&Object.assign(Ni,t),Ni}function ao(t){let e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function uo(t,e){return typeof e=="bigint"?e.toString():e}function lo(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function co(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}var oo=Symbol("evaluating");function rt(t,e,r){let i;Object.defineProperty(t,e,{get(){if(i!==oo)return i===void 0&&(i=oo,i=r()),i},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}var ji="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Rr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ho(t){if(Rr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Rr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ui(t){return ho(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}var po=new Set(["string","number","symbol"]);function fo(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hi(t,e,r){let i=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(i._zod.parent=t),i}function Fe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function _o(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Td={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qt(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function vo(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Bi(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Ar(t){return typeof t=="string"?t:t?.message}function St(t,e,r){let i=t.message?t.message:Ar(t.inst?._zod.def?.error?.(t))??Ar(e?.error?.(t))??Ar(r.customError?.(t))??Ar(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:o,...a}=t;return a.path??(a.path=[]),a.message=i,e?.reportInput&&(a.input=o),a}function Gi(...t){let[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}var go=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,uo,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},mo=j("$ZodError",go),Kt=j("$ZodError",go,{Parent:Error});var Wl=t=>(e,r,i,n)=>{let s=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new je;if(o.issues.length){let a=new(n?.Err??t)(o.issues.map(u=>St(u,s,kt())));throw ji(a,n?.callee),a}return o.value},Or=Wl(Kt),Kl=t=>async(e,r,i,n)=>{let s=i?{...i,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let a=new(n?.Err??t)(o.issues.map(u=>St(u,s,kt())));throw ji(a,n?.callee),a}return o.value},Mr=Kl(Kt),Yl=t=>(e,r,i)=>{let n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new je;return s.issues.length?{success:!1,error:new(t??mo)(s.issues.map(o=>St(o,n,kt())))}:{success:!0,data:s.value}},Yt=Yl(Kt),Jl=t=>async(e,r,i)=>{let n=i?{...i,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>St(o,n,kt())))}:{success:!0,data:s.value}},Jt=Jl(Kt);var Xl="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ql=new RegExp(`^${Xl}$`);var yo=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var bo=/^-?\d+(?:\.\d+)?$/,xo=/^(?:true|false)$/i;var Xt=j("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])});var $o=j("$ZodCheckStringFormat",(t,e)=>{var r,i;Xt.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),Eo=j("$ZodCheckRegex",(t,e)=>{$o.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var So={major:4,minor:4,patch:3};var Ae=j("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=So;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let n of i)for(let s of n._zod.onattach)s(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(o,a,u)=>{let l=qt(o),c;for(let h of a){if(h._zod.def.when){if(vo(o)||!h._zod.def.when(o))continue}else if(l)continue;let d=o.issues.length,f=h._zod.check(o);if(f instanceof Promise&&u?.async===!1)throw new je;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await f,o.issues.length!==d&&(l||(l=qt(o,d)))});else{if(o.issues.length===d)continue;l||(l=qt(o,d))}}return c?c.then(()=>o):o},s=(o,a,u)=>{if(qt(o))return o.aborted=!0,o;let l=n(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new je;return l.then(c=>t._zod.parse(c,u))}return t._zod.parse(l,u)};t._zod.run=(o,a)=>{if(a.skipChecks)return t._zod.parse(o,a);if(a.direction==="backward"){let l=t._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(c=>s(c,o,a)):s(l,o,a)}let u=t._zod.parse(o,a);if(u instanceof Promise){if(a.async===!1)throw new je;return u.then(l=>n(l,i,a))}return n(u,i,a)}}rt(t,"~standard",()=>({validate:n=>{try{let s=Yt(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Jt(t,n).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),Io=j("$ZodString",(t,e)=>{Ae.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??yo(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}});var Ao=j("$ZodNumber",(t,e)=>{Ae.init(t,e),t._zod.pattern=t._zod.bag.pattern??bo,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}});var Ro=j("$ZodBoolean",(t,e)=>{Ae.init(t,e),t._zod.pattern=xo,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});function Po(t,e,r){t.issues.length&&e.issues.push(...Bi(r,t.issues)),e.value[r]=t.value}var Oo=j("$ZodArray",(t,e)=>{Ae.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let o=0;o<n.length;o++){let a=n[o],u=e.element._zod.run({value:a,issues:[]},i);u instanceof Promise?s.push(u.then(l=>Po(l,r,o))):Po(u,r,o)}return s.length?Promise.all(s).then(()=>r):r}});function Fr(t,e,r,i,n,s){let o=r in i;if(t.issues.length){if(n&&s&&!o)return;e.issues.push(...Bi(r,t.issues))}if(!o&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?o&&(e.value[r]=void 0):e.value[r]=t.value}function ec(t){let e=Object.keys(t.shape);for(let i of e)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=_o(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function tc(t,e,r,i,n,s){let o=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,c=u.optin==="optional",h=u.optout==="optional";for(let d in e){if(d==="__proto__"||a.has(d))continue;if(l==="never"){o.push(d);continue}let f=u.run({value:e[d],issues:[]},i);f instanceof Promise?t.push(f.then(p=>Fr(p,r,d,e,c,h))):Fr(f,r,d,e,c,h)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var Mo=j("$ZodObject",(t,e)=>{if(Ae.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let u={...a};return Object.defineProperty(e,"shape",{value:u}),u}})}let i=lo(()=>ec(e));rt(t._zod,"propValues",()=>{let a=e.shape,u={};for(let l in a){let c=a[l]._zod;if(c.values){u[l]??(u[l]=new Set);for(let h of c.values)u[l].add(h)}}return u});let n=Rr,s=e.catchall,o;t._zod.parse=(a,u)=>{o??(o=i.value);let l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let c=[],h=o.shape;for(let d of o.keys){let f=h[d],p=f._zod.optin==="optional",_=f._zod.optout==="optional",m=f._zod.run({value:l[d],issues:[]},u);m instanceof Promise?c.push(m.then(g=>Fr(g,a,d,l,p,_))):Fr(m,a,d,l,p,_)}return s?tc(c,l,a,u,i.value,t):c.length?Promise.all(c).then(()=>a):a}});var Fo=j("$ZodEnum",(t,e)=>{Ae.init(t,e);let r=ao(e.entries),i=new Set(r);t._zod.values=i,t._zod.pattern=new RegExp(`^(${r.filter(n=>po.has(typeof n)).map(n=>typeof n=="string"?fo(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let o=n.value;return i.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:t}),n}});function zo(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var Zo=j("$ZodOptional",(t,e)=>{Ae.init(t,e),t._zod.optin="optional",t._zod.optout="optional",rt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),rt(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${co(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,s=e.innerType._zod.run(r,i);return s instanceof Promise?s.then(o=>zo(o,n)):zo(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,i)}});var Lo=j("$ZodDefault",(t,e)=>{Ae.init(t,e),t._zod.optin="optional",rt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>To(s,e)):To(n,e)}});function To(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var No=j("$ZodCustom",(t,e)=>{Xt.init(t,e),Ae.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{let i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Co(s,r,i,t));Co(n,r,i,t)}});function Co(t,e,r,i){if(!t){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(Gi(n))}}function Do(t,e){return new t({type:"string",...Fe(e)})}function jo(t,e){return new t({type:"number",checks:[],...Fe(e)})}function Uo(t,e){return new t({type:"boolean",...Fe(e)})}function Vi(t,e){return new Eo({check:"string_format",format:"regex",...Fe(e),pattern:t})}function Ho(t,e,r){let i=Fe(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}var Ue=j("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ae.init(t,e),t.def=e,t.type=e.type,t.parse=(r,i)=>Or(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>Yt(t,r,i),t.parseAsync=async(r,i)=>Mr(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>Jt(t,r,i),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),t.with=t.check,t.clone=(r,i)=>Hi(t,r,i),t.brand=()=>t,t.register=((r,i)=>(r.add(t,i),t)),t.apply=r=>r(t)}),ic=j("ZodMiniString",(t,e)=>{Io.init(t,e),Ue.init(t,e)});function lt(t){return Do(ic,t)}var nc=j("ZodMiniNumber",(t,e)=>{Ao.init(t,e),Ue.init(t,e)});function Bo(t){return jo(nc,t)}var sc=j("ZodMiniBoolean",(t,e)=>{Ro.init(t,e),Ue.init(t,e)});function ct(t){return Uo(sc,t)}var oc=j("ZodMiniArray",(t,e)=>{Oo.init(t,e),Ue.init(t,e)});function qi(t,e){return new oc({type:"array",element:t,...Fe(e)})}var ac=j("ZodMiniObject",(t,e)=>{Mo.init(t,e),Ue.init(t,e),rt(t,"shape",()=>e.shape)});function Wi(t,e){let r={type:"object",shape:t??{},...Fe(e)};return new ac(r)}var uc=j("ZodMiniEnum",(t,e)=>{Fo.init(t,e),Ue.init(t,e),t.options=Object.values(e.entries)});function Go(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new uc({type:"enum",entries:r,...Fe(e)})}var lc=j("ZodMiniOptional",(t,e)=>{Zo.init(t,e),Ue.init(t,e)});function Pe(t){return new lc({type:"optional",innerType:t})}var cc=j("ZodMiniDefault",(t,e)=>{Lo.init(t,e),Ue.init(t,e)});function Pt(t,e){return new cc({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Ui(e)}})}var hc=j("ZodMiniCustom",(t,e)=>{No.init(t,e),Ue.init(t,e)});function Ki(t,e){return Ho(hc,t??(()=>!0),e)}var Zr="https://in.dev.heycatch.ai",nt="dev",st="0.7.0-dev.974",Vo="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ze(){return typeof globalThis.window<"u"}function fc(t){return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"||t.endsWith(".localhost")||t==="heycatch.ai"||t.endsWith(".heycatch.ai")||/^10\.\d+\.\d+\.\d+$/.test(t)||/^192\.168\.\d+\.\d+$/.test(t)||/^172\.(?:1[6-9]|2\d|3[01])\.\d+\.\d+$/.test(t)}function qo({stage:t,hostname:e}){return t!=="dev"||fc(e)?null:`[HeyCatch] REFUSING to start: this is an internal development build (v${st}) running on "${e}". No events will be sent. Install the latest stable version instead - resolve it with \`npm view @heycatch/sdk version\` (never a \`-dev.N\` version) - and re-verify against https://heycatch.ai/agents.md`}var it="unknown",_c=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Wo=Wi({projectKey:lt({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Vi(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:Pt(qi(lt()),[]),install:Pt(Wi({framework:Pt(lt(),it),frameworkVersion:Pt(lt(),it),agent:Pt(lt(),it)}),{framework:it,frameworkVersion:it,agent:it}),autocapture:Pe(ct()),maskAllText:Pe(ct()),maskAllElementAttributes:Pe(ct()),propertyDenylist:Pe(qi(lt())),sanitizeProperties:Pe(Ki(t=>typeof t=="function")),beforeSend:Pe(Ki(t=>typeof t=="function"||Array.isArray(t)&&t.every(e=>typeof e=="function"))),persistence:Pe(Go(_c)),disablePersistence:Pe(ct()),cookieExpirationDays:Pe(Bo()),optOutCapturingByDefault:Pe(ct()),respectDnt:Pe(ct())}),Ko=["nextjs","vite-react","react","vue","svelte","astro","angular","react-native","web"],Yo=["lovable","bolt","v0","replit","cursor","claude-code","codex","windsurf","other"];var vc=new RegExp(String.raw`^\/(${Li})\/?$`),gc=1e3;function mc(t){return new URLSearchParams({utm_source:no,utm_campaign:t}).toString()}var yc=["utm_source","utm_medium","utm_campaign"];function Lr(){if(!Ze())return!1;let t=vc.exec(globalThis.location.pathname);if(!t)return!1;let e=t[1];return e===void 0?!1:(globalThis.location.replace(`/?${mc(e)}`),!0)}function Jo(){new URLSearchParams(globalThis.location.search).get("utm_campaign")!==null&&setTimeout(()=>{let e=new URLSearchParams(globalThis.location.search);if(e.get("utm_campaign")===null)return;for(let i of yc)e.delete(i);let r=e.toString();globalThis.history.replaceState(globalThis.history.state,"",globalThis.location.pathname+(r===""?"":`?${r}`)+globalThis.location.hash)},gc)}var v=typeof window<"u"?window:void 0,he=typeof globalThis<"u"?globalThis:v,fe=he?.navigator,S=he?.document,ne=he?.location,Fs=he?.fetch,En=he!=null&&he.XMLHttpRequest&&"withCredentials"in new he.XMLHttpRequest?he.XMLHttpRequest:void 0,Xo=he?.AbortController,bc=he?.CompressionStream,ye=fe?.userAgent;function Ka(){return!(!v||v.navigator.onLine===!1)}var Qt=typeof globalThis<"u"?globalThis:v;Qt&&typeof self>"u"&&(Qt.self=Qt),Qt&&typeof File>"u"&&(Qt.File=function(){});var T=v??{},D={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function Qo(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(l){return void r(l)}a.done?e(u):Promise.resolve(u).then(i,n)}function ie(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(u){Qo(s,i,n,o,a,"next",u)}function a(u){Qo(s,i,n,o,a,"throw",u)}o(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},y.apply(null,arguments)}function Ya(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var ea=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function ta(t){return typeof t=="string"||t}function ra(t){return typeof t=="string"?t:void 0}var er,xc=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],We=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),ia=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),wc=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],$c=["token"],Ja="NativeGzipValidationError",kn=t=>t.length>=2&&t[0]===31&&t[1]===139,na=(t,e)=>t===ia.GZipJS||e===ia.GZipJS||e==="gzip",sa=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Nr=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Ja,e},Ec=(function(){var t=ie((function*(e,r){18>e.size&&Nr("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());kn(i)&&i[2]===8||Nr("invalid-header");var n=new DataView(yield e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(er)return er;er=[];for(var c=0;256>c;c++){for(var h=c,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;er[c]=h>>>0}return er})(),u=4294967295,l=0;o.length>l;l++)u=a[255&(u^o[l])]^u>>>8;return(4294967295^u)>>>0})(r)&&Nr("invalid-crc");var s=r.length>>>0;n.getUint32(4,!0)!==s&&Nr("invalid-size")}));return function(e,r){return t.apply(this,arguments)}})();function Sn(){return Sn=ie((function*(t,e,r){e===void 0&&(e=!0);try{var i=new TextEncoder().encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),o=s.write(i).then((()=>s.close())).catch((function(){var l=ie((function*(c){try{yield s.abort(c)}catch{}throw c}));return function(c){return l.apply(this,arguments)}})()),a=new Response(n.readable).blob(),u=(yield Promise.all([a,o]))[0];return yield Ec(u,i),u}catch(l){if(r!=null&&r.rethrow)throw l;return e&&console.error("Failed to gzip compress data",l),null}})),Sn.apply(this,arguments)}var kc=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],oa=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return kc.concat(e).some((i=>{var n=i.toLowerCase();return r.indexOf(n)!==-1}))};function A(t,e){return t.indexOf(e)!==-1}var Ai=function(t){return t.trim()},Pn=function(t){return t.replace(/^\$/,"")};function Xa(t){var e,r=[];return(e=JSON.stringify(t,(function(i,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(n))return"[Circular]";r.push(n)}return n}})))!==null&&e!==void 0?e:"null"}var Qa=Object.prototype,eu=Qa.hasOwnProperty,Ri=Qa.toString,R=Array.isArray||function(t){return Ri.call(t)==="[object Array]"},Oe=t=>typeof t=="function",J=t=>t===Object(t)&&!R(t),ot=t=>{if(J(t)){for(var e in t)if(eu.call(t,e))return!1;return!0}return!1},x=t=>t===void 0,H=t=>Ri.call(t)=="[object String]",zn=t=>H(t)&&t.trim().length===0,ve=t=>t===null,O=t=>x(t)||ve(t),ce=t=>Ri.call(t)=="[object Number]"&&t==t,Ve=t=>ce(t)&&t>0,Me=t=>Ri.call(t)==="[object Boolean]",Sc=t=>t instanceof FormData,Pc=t=>A(wc,t),zc=t=>A($c,t);function tu(t){return t===null||typeof t!="object"}function ri(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Zs(t){return typeof Event<"u"&&(function(e,r){try{return e instanceof r}catch{return!1}})(t,Event)}var Tc=[!0,"true",1,"1","yes"],Yi=t=>A(Tc,t),Cc=[!1,"false",0,"0","no"];function Ne(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),ce(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),Ne(n||r,e,r,i))}var Tn=class{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Ne(e.bucketSize,0,100,e.Ge),this.Qe=Ne(e.refillRate,0,this.Ze,e.Ge),this.Je=Ne(e.refillInterval,0,864e5,e.Ge)}Ke(e,r){var i=Math.floor((r-e.lastAccess)/this.Je);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qe,this.Ze),e.lastAccess=e.lastAccess+i*this.Je)}consumeRateLimit(e){var r,i=Date.now(),n=String(e),s=this.$e[n];return s?this.Ke(s,i):this.$e[n]=s={tokens:this.Ze,lastAccess:i},s.tokens===0||(s.tokens--,s.tokens===0&&((r=this.ze)==null||r.call(this,e)),s.tokens===0)}stop(){this.$e={}}},$e="Mobile",ii="iOS",Qe="Android",Nt="Tablet",ru=Qe+" "+Nt,iu="iPad",nu="Apple",su=nu+" Watch",_r="Safari",Dt="BlackBerry",ou="Samsung",au=ou+"Browser",uu=ou+" Internet",wt="Chrome",Ic=wt+" OS",lu=wt+" "+ii,Ls="Internet Explorer",cu=Ls+" "+$e,Ns="Opera",Ac=Ns+" Mini",Ds="Edge",hu="Microsoft "+Ds,Zt="Firefox",du=Zt+" "+ii,wr="Nintendo",$r="PlayStation",Lt="Xbox",pu=Qe+" "+$e,fu=$e+" "+_r,cr="Windows",Cn=cr+" Phone",aa="Nokia",In="Ouya",_u="Generic",Rc=_u+" "+$e.toLowerCase(),vu=_u+" "+Nt.toLowerCase(),An="Konqueror",gu="Oculus Browser",ni="Vivaldi",mu="Yandex",si="Whale",Rn="DuckDuckGo",yu="Pale Moon",oi="Waterfox",vr="Brave",bu="Google Search App",te="(\\d+(\\.\\d+)?)",Ji=new RegExp("Version/"+te),Oc=new RegExp(Lt,"i"),Mc=new RegExp($r+" \\w+","i"),Fc=new RegExp(wr+" \\w+","i"),js=new RegExp(Dt+"|PlayBook|BB10","i"),Zc={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},xu=function(t,e,r,i){e=e||"";var n=(function(s){return s!=null&&s.brave?vr:null})(r);return n||(i!=null&&i.detectGoogleSearchApp&&A(t,"GSA/")?bu:A(t," OPR/")&&A(t,"Mini")?Ac:A(t," OPR/")?Ns:js.test(t)?Dt:A(t,"IE"+$e)||A(t,"WPDesktop")?cu:A(t,"OculusBrowser")?gu:A(t,au)?uu:A(t,Ds)||A(t,"Edg/")?hu:A(t,ni+"/")?ni:A(t,"YaBrowser/")?mu:A(t,si+"/")?si:A(t,Rn+"/")||A(t,"Ddg/")?Rn:A(t,"FBIOS")?"Facebook "+$e:A(t,"UCWEB")||A(t,"UCBrowser")?"UC Browser":A(t,"CriOS")?lu:A(t,"CrMo")||A(t,wt)?wt:A(t,Qe)&&A(t,_r)?pu:A(t,"FxiOS")?du:A(t.toLowerCase(),An.toLowerCase())?An:A(t,vr+"/")?vr:((s,o)=>o&&A(o,nu)||(function(a){return A(a,_r)&&!A(a,wt)&&!A(a,Qe)})(s))(t,e)?A(t,$e)?fu:_r:A(t,"PaleMoon/")?yu:A(t,oi+"/")?oi:A(t,Zt)?Zt:A(t,"MSIE")||A(t,"Trident/")?Ls:A(t,"Gecko")?Zt:"")},Lc={[cu]:[new RegExp("rv:"+te)],[hu]:[new RegExp(Ds+"?\\/"+te)],[wt]:[new RegExp("("+wt+"|CrMo)\\/"+te)],[lu]:[new RegExp("CriOS\\/"+te)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+te)],[_r]:[Ji],[fu]:[Ji],[Ns]:[new RegExp("(Opera|OPR)\\/"+te)],[Zt]:[new RegExp(Zt+"\\/"+te)],[du]:[new RegExp("FxiOS\\/"+te)],[An]:[new RegExp("Konqueror[:/]?"+te,"i")],[Dt]:[new RegExp(Dt+" "+te),Ji],[pu]:[new RegExp("android\\s"+te,"i")],[uu]:[new RegExp(au+"\\/"+te)],[gu]:[new RegExp("OculusBrowser\\/"+te)],[ni]:[new RegExp(ni+"\\/"+te)],[mu]:[new RegExp("YaBrowser\\/"+te)],[si]:[new RegExp(si+"\\/"+te)],[vr]:[new RegExp(vr+"\\/"+te)],[Rn]:[new RegExp("(DuckDuckGo|Ddg)\\/"+te)],[yu]:[new RegExp("PaleMoon\\/"+te)],[oi]:[new RegExp(oi+"\\/"+te)],[bu]:[new RegExp("GSA\\/"+te)],[Ls]:[new RegExp("(rv:|MSIE )"+te)],Mozilla:[new RegExp("rv:"+te)]},Nc=function(t,e,r,i){var n=xu(t,e,r,i),s=Lc[n];if(x(s))return null;for(var o=0;s.length>o;o++){var a=t.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},ua=[[new RegExp(Lt+"; "+Lt+" (.*?)[);]","i"),t=>[Lt,t&&t[1]||""]],[new RegExp(wr,"i"),[wr,""]],[new RegExp($r,"i"),[$r,""]],[js,[Dt,""]],[new RegExp(cr,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Cn,""];if(new RegExp($e).test(e)&&!/IEMobile\b/.test(e))return[cr+" "+$e,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var i=Zc[r[1]]||"";return/arm/i.test(e)&&(i="RT"),[cr,i]}return[cr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ii,[t[3],t[4],t[5]||"0"].join(".")]:[ii,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=x(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Qe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qe+")","i"),t=>t&&t[2]?[Qe,[t[2],t[3],t[4]||"0"].join(".")]:[Qe,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ic,""]],[/Linux|debian/i,["Linux",""]]],la=function(t){return Fc.test(t)?wr:Mc.test(t)?$r:Oc.test(t)?Lt:new RegExp(In,"i").test(t)?In:new RegExp("("+Cn+"|WPDesktop)","i").test(t)?Cn:/iPad/.test(t)?iu:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?su:js.test(t)?Dt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(aa,"i").test(t)?aa:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp($e).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Qe:ru:new RegExp("(pda|"+$e+")","i").test(t)?Rc:new RegExp(Nt,"i").test(t)&&!new RegExp(Nt+" pc","i").test(t)?vu:""},Dc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ca(t,e){return typeof(r=t)=="string"&&Dc.test(r)?t:e();var r}function at(t){return t&&t.split("#")[0]}function Kr(t,e){var r=setTimeout(t,e);return r?.unref&&r?.unref(),r}var jc=t=>t instanceof Error,wu={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Uc=wu.info;function $u(t){if(Me(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(R(t))return{arrayValue:{values:t.map((e=>$u(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function ai(t){var e=[];for(var r in t){var i=t[r];ve(i)||x(i)||e.push({key:r,value:$u(i)})}return e}function Hc(t,e){var r=wu[t.level||"info"]||Uc,i=r.text,n=r.number,s=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),O(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),O(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=y({},o,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:n,severityText:i,body:{stringValue:t.body},attributes:ai(a)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),x(t.trace_flags)||(u.flags=t.trace_flags),u}function Eu(t,e,r){return y({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function ku(t,e,r,i){return{resourceLogs:[{resource:{attributes:ai(e)},scopeLogs:[{scope:{name:r,version:i},logRecords:t}]}]}}var Bc=class{constructor(t,e,r,i,n,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=r,this.Ye=i,this.Xe=n,this.et=s,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.wt(t);if(e!==null)if(e.body){if(this.xt()){var r={record:Hc(e,this.Ye())};this.Xe((()=>this.kt(r)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=R(e)?e:[e],i=t;for(var n of r)try{var s=n(i);if(!s)return this.Ge.info("Log was rejected in beforeSend function"),null;i=s}catch(o){return this.Ge.error("Error in beforeSend function for log:",o),null}return i}xt(){if(this.yt===void 0)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return ie((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return ie((function*(){var e;t.bt();var r=(e=t._instance.getPersistedProperty(We.LogsQueue))!==null&&e!==void 0?e:[];if(r.length!==0)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o;t.it=0;var a=Math.min(r.length,t.vt),u=r.slice(0,a),l=ku(u.map((h=>h.record)),t.Ct(),(s=t.tt)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),c=yield t._instance.Tt(l);if(c.kind==="too-large"&&u.length>1)t.vt=Math.max(1,Math.floor(u.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.vt);else if(c.kind==="retry-later"||(c.kind==="too-large"?t.Ge.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&t.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(u.length),r=(o=t._instance.getPersistedProperty(We.LogsQueue))!==null&&o!==void 0?o:[],n+=u.length,c.kind==="fatal"))throw c.error}}))()}It(t){var e=this;return ie((function*(){var r,i=Math.max(0,t-e.it),n=(r=e._instance.getPersistedProperty(We.LogsQueue))!==null&&r!==void 0?r:[];e._instance.setPersistedProperty(We.LogsQueue,n.slice(i)),yield e.et()}))()}Ct(){return Eu(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var r=(e=this._instance.getPersistedProperty(We.LogsQueue))!==null&&e!==void 0?e:[];this.dt>r.length||(r.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(We.LogsQueue,r),this.ht>r.length?this.Mt():this._t()}}Mt(t){t===void 0&&(t=this.ct),this.Et||(this.Et=Kr((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(We.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ie((function*(){e.bt();var r=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([r,new Promise((i=>Kr(i,t)))]):yield r}))()}flushWithTimeout(t){var e=this;return ie((function*(){var r=!1,i=e.flush(),n=new Promise((s=>Kr((()=>{r=!0,s()}),t)));try{yield Promise.race([i,n])}finally{r&&i.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}},Xi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ha(t){return String(t)+"000000"}function da(t,e,r,i){var n="";return i&&(n=Object.keys(i).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(i[s]))).join(",")),t+"\0"+e+"\0"+(r??"")+"\0"+n}var Gc=class{constructor(t,e,r){this._instance=t,this.Te=e,this.Ge=r,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,r){e===void 0&&(e=1),this.Nt({name:t,type:"count",value:e,unit:r?.unit,attributes:r?.attributes})}gauge(t,e,r){this.Nt({name:t,type:"gauge",value:e,unit:r?.unit,attributes:r?.attributes})}histogram(t,e,r){this.Nt({name:t,type:"histogram",value:e,unit:r?.unit,attributes:r?.attributes})}flush(){var t=this,e=this.rt,r=(function(){var n=ie((function*(){e&&(yield e.catch((()=>{}))),yield t.Dt()}));return function(){return n.apply(this,arguments)}})(),i=r().finally((()=>{this.rt===i&&(this.rt=null)}));return this.rt=i,i}drainWindow(){if(this.Ot.size===0)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=e.attributes?y({},e.attributes):void 0,i=da(e.type,e.name,e.unit,r)}catch(o){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var n=this.Ot.get(i);if(!n){if(!this.jt())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(i,n)}var s=this.Lt.get(e.name);s===void 0?this.Lt.set(e.name,e.type):s===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+s+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(n,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var r;switch(t.type){case"count":t.total=((r=t.total)!==null&&r!==void 0?r:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Xi.length+1).fill(0)});var i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[(function(n,s){for(var o=0;s.length>o;o++)if(s[o]>=n)return o;return s.length})(e,Xi)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=R(e)?e:[e],i=t;for(var n of r)try{var s=n(i);if(!s)return this.Ge.info("Metric was rejected in beforeSend function"),null;i=s}catch(o){return this.Ge.error("Error in beforeSend function for metric:",o),null}return i}Mt(){this.Et||(this.Et=Kr((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return ie((function*(){if(t.Ot.size!==0){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var r=t.At,i=yield t._instance.Bt(t.qt(e));if(r===t.At)switch(i.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",i.error)}}}))()}qt(t){return e=this.zt(t),r=(function(s,o,a){return y({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ai(r)},scopeMetrics:[{scope:{name:i,version:n},metrics:e}]}]};var e,r,i,n}zt(t){var e=ha(Date.now()),r=new Map;for(var i of t.values()){var n,s=da(i.type,i.name,i.unit,void 0),o=r.get(s);o||(o=y({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=ai((n=i.attributes)!==null&&n!==void 0?n:{}),u=ha(i.windowStartMs);if(i.type==="count"){var l,c={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:(l=i.total)!==null&&l!==void 0?l:0};o.sum.dataPoints.push(c)}else if(i.type==="gauge"){var h,d={attributes:a,timeUnixNano:e,asDouble:(h=i.last)!==null&&h!==void 0?h:0};o.gauge.dataPoints.push(d)}else i.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Xi})}return Array.from(r.values())}Ut(t){var e,r;for(var i of t){var n=i[0],s=i[1],o=this.Ot.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((r=s.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.jt()&&this.Ot.set(n,s)}}},Dr,pa,Qi;function Vc(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return Qi&&r.length===pa||(pa=r.length,Qi=r.reduce(((i,n)=>{Dr||(Dr={});var s=Dr[n];if(s)i[s[0]]=s[1];else for(var o=t(n),a=o.length-1;a>=0;a--){var u=o[a],l=u?.filename,c=e[n];if(l&&c){i[l]=c,Dr[n]=[l,c];break}}return i}),{})),Qi}}var On=class{constructor(e,r,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=r,this.modifiers=i}buildFromUnknown(e,r){r===void 0&&(r={});var i=r&&r.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,r,0).apply(e),s=this.buildParsingContext(r),o=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var r=this;return ie((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&R(i.stacktrace.frames)&&(i.stacktrace.frames=yield r.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var i,n;return e.cause!=null&&(i=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),y({},e,{cause:i,stack:n})}applyChunkIds(e,r){return e.map((i=>(i.filename&&r&&(i.chunk_id=r[i.filename]),i)))}applyCoercers(e,r){for(var i of this.coercers)if(i.match(e))return i.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return ie((function*(){var i=e;for(var n of r.modifiers)i=yield n(i);return i}))()}convertToExceptionList(e,r){var i,n,s,o={type:e.type,value:e.value,mechanism:{type:(i=r.type)!==null&&i!==void 0?i:"generic",handled:(n=r.handled)===null||n===void 0||n,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,y({},r,{handled:!0}))),a}buildParsingContext(e){var r;return{chunkIdMap:Vc(this.stackParser),skipFirstLines:(r=e.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(e,r,i){i===void 0&&(i=0);var n=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,r,o);return this.applyCoercers(s,a)}};return y({},r,{syntheticException:i==0?r.syntheticException:void 0,mechanism:e,apply:s=>n(s,i),next:s=>n(s,i+1)})}},jt="?";function Mn(t,e,r,i,n){var s={platform:t,filename:e,function:r==="<anonymous>"?jt:r,in_app:!0};return x(i)||(s.lineno=i),x(n)||(s.colno=n),s}var Su=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,i=t.indexOf("safari-web-extension")!==-1;return r||i?[t.indexOf("@")!==-1?t.split("@")[0]:jt,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},qc=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wc=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Kc=/\((\S*)(?::(\d+))(?::(\d+))\)/,Yc=(t,e)=>{var r=qc.exec(t);if(r)return Mn(e,r[1],jt,+r[2],+r[3]);var i=Wc.exec(t);if(i){if(i[2]&&i[2].indexOf("eval")===0){var n=Kc.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=Su(i[1]||jt,i[2]);return Mn(e,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Jc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qc=(t,e)=>{var r=Jc.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=Xc.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||jt,o=Su(s,n);return Mn(e,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},fa=/\(error: (.*)\)/,Fn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var i=H(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return ri(e,"DOMException")}isDOMError(e){return ri(e,"DOMError")}},Zn=class{match(e){return(r=>r instanceof Error)(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Ln=class{constructor(){}match(e){return ri(e,"ErrorEvent")&&e.error!=null}coerce(e,r){var i;return r.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},eh=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Nn=class{match(e){return typeof e=="string"}coerce(e,r){var i,n=this.getInfos(e),s=n[0],o=n[1];return{type:s??"Error",value:o??e,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var r="Error",i=e,n=e.match(eh);return n&&(r=n[1],i=n[2]),[r,i]}},th=["fatal","error","warning","log","info","debug"];function Pu(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(e>=n.length)return i===r.length?n:n.length>e?n.slice(0,e)+"...":n}return""}var Dn=class{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var i,n=this.getErrorPropertyFromObject(e);return n?r.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=r.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Zs(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+Pu(e)}isSeverityLevel(e){return H(e)&&!zn(e)&&th.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var i=e[r];if(jc(i))return i}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}},jn=class{match(e){return Zs(e)}coerce(e,r){var i,n=e.constructor.name;return{type:n,value:n+" captured as exception with keys: "+Pu(e),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Un=class{match(e){return tu(e)}coerce(e,r){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Hn=class{match(e){return ri(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Zs(e))return!1;try{var r=e.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(e,r){var i,n=this.getUnhandledRejectionReason(e);return tu(n)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(n),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ui="$message",li="$timestamp",rh=new Set([ui,li]),en={enabled:!0,max_bytes:32768};function ci(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:en.enabled,max_bytes:ih(t.max_bytes,en.max_bytes)}:y({},en)}var Bn=class{constructor(e){this.Vt=[],this.Wt=0,this.Te=ci(e)}setConfig(e){this.Te=ci(e),this.Zt()}add(e){var r=(function(n){var s;try{s=Xa(n)}catch{return}try{var o=JSON.parse(s);if(!J(o))return;var a=o,u=a[ui],l=a[li];return!H(u)||u.trim().length===0||!H(l)&&!ce(l)?void 0:{step:a,json:s}}catch{return}})(e);if(r){var i=(function(n){if(typeof TextEncoder<"u")return new TextEncoder().encode(n).length;for(var s=encodeURIComponent(n),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o})(r.json);i>this.Te.max_bytes||(this.Vt.push({step:r.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((e=>e.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var e=this.Vt.shift();e&&(this.Wt-=e.bytes)}}};function ih(t,e){if(!ce(t)||t===1/0||t===-1/0)return e;var r=Math.floor(t);return 0>r?e:r}var zu=function(t,e){var r=(e===void 0?{}:e).debugEnabled,i={k(n){if(v&&(D.DEBUG||v.POSTHOG_DEBUG||r)&&!x(v.console)&&v.console){for(var s=("__rrweb_original__"in v.console[n])?v.console[n].__rrweb_original__:v.console[n],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},debug(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("debug",...s)},info(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("log",...s)},warn(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("warn",...s)},error(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];i.k("error",...s)},critical(){for(var n=arguments.length,s=new Array(n),o=0;n>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(n){i.error("You must initialize PostHog before calling "+n)},createLogger:(n,s)=>zu(t+" "+n,s)};return i},w=zu("[PostHog.js]"),X=w.createLogger,nh=X("[ExternalScriptsLoader]"),tn=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return nh.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var i=S?.querySelectorAll("script");if(i){for(var n,s=function(){if(i[o].src===e){var u=i[o];return u.__posthog_loading_callback_fired?{v:r()}:(u.addEventListener("load",(l=>{u.__posthog_loading_callback_fired=!0,r(void 0,l)})),u.onerror=l=>r(l),{v:void 0})}},o=0;i.length>o;o++)if(n=s())return n.v}var a=()=>{if(!S)return r("document not found");var u=S.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=h=>{u.__posthog_loading_callback_fired=!0,r(void 0,h)},u.onerror=h=>r(h),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")S.head.appendChild(u);else{var l,c=S.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(u,c[0]):S.body.appendChild(u)}};S!=null&&S.body?a():S?.addEventListener("DOMContentLoaded",a)};T.__PosthogExtensions__=T.__PosthogExtensions__||{},T.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e!=="remote-config"){var i;if(t.config.strict_script_versioning)i=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var n="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;n=n+"&t="+Math.floor(Date.now()/s)*s}i=t.requestRouter.endpointFor("assets",n)}tn(t,i,r)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");tn(t,o,r)}},T.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var i=t.requestRouter.endpointFor("api",e);tn(t,i,r)};D.DEBUG=!1,D.LIB_VERSION="1.407.6",D.LIB_NAME="web";var Tu="$people_distinct_id",hi="$device_id",rn="$device_model",hr="__alias",dr="__timers",Gn="$autocapture_disabled_server_side",Vn="$heatmaps_enabled_server_side",qn="$exception_capture_enabled_server_side",Wn="$error_tracking_suppression_rules",Kn="$error_tracking_capture_extension_exceptions",Yn="$web_vitals_enabled_server_side",Us="$dead_clicks_enabled_server_side",Hs="$product_tours_enabled_server_side",Jn="$web_vitals_allowed_metrics",xt="$session_recording_remote_config",Cu="$replay_sample_rate",Iu="$replay_override_sampling",Au="$replay_override_linked_flag",Ru="$replay_override_url_trigger",Ou="$replay_override_event_trigger",Mt="$sesid",Bs="$session_is_sampled",bt="$enabled_feature_flags",Yr="$active_feature_flags",pr="$early_access_features",Xn="$feature_flag_details",Jr="$feature_flag_payloads",Qn="$feature_flag_request_id",di="$minimal_flag_called_events",qe="$override_feature_flags",At="$override_feature_flag_payloads",gt="$stored_person_properties",mt="$stored_group_properties",es="$surveys",pi="$surveys_loaded_at",ts="$surveys_activated",Xr="$surveys_activated_session",fr="ph_product_tours",gr="$flag_call_reported",rs="$flag_call_reported_session_id",is="$feature_flag_errors",Er="$feature_flag_evaluated_at",Re="$user_state",ns="$client_session_props",ss="$capture_rate_limit",os="$initial_campaign_params",as="$initial_referrer_info",fi="$initial_person_info",_i="$epp",jr="$posthog_cookieless",Mu="$cookieless_mode",Fu="$sdk_debug_extensions_init_method",Zu="$sdk_debug_extensions_init_time_ms",Lu="$sdk_debug_recording_script_not_loaded",Gs="PostHog loadExternalDependency extension not found.",yt="on_reject",Ye="always",zt="anonymous",Tt="identified",us="identified_only",vi="visibilitychange",gi="beforeunload",Rt="$pageview",nn="$pageleave",sn="$identify",_a="$groupidentify";function Ur(t,e){R(t)&&t.forEach(e)}function B(t,e){if(!O(t))if(R(t))t.forEach(e);else if(Sc(t))t.forEach(((i,n)=>e(i,n)));else for(var r in t)eu.call(t,r)&&e(t[r],r)}var W=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;e>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)n[s]!==void 0&&(t[s]=n[s]);return t};function Qr(t){for(var e=Object.keys(t),r=e.length,i=new Array(r);r--;)i[r]=[e[r],t[e[r]]];return i}var va=function(t){try{return t()}catch{return}},sh=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];return t.apply(this,r)}catch(n){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(n)}}},Vs=function(t){var e={};return B(t,(function(r,i){(H(r)&&r.length>0||ce(r))&&(e[i]=r)})),e},oh=["herokuapp.com","vercel.app","netlify.app"];function ah(t){var e=t?.hostname;if(!H(e))return!1;var r=e.split(".").slice(-2).join(".");for(var i of oh)if(r===i)return!1;return!0}function re(t,e,r,i){var n=i??{},s=n.capture,o=n.passive;t?.addEventListener(e,r,{capture:s!==void 0&&s,passive:o===void 0||o})}function Nu(t){return t.name==="ph_toolbar_internal"}var Du=t=>{if(S){try{for(var e=t+"=",r=S.cookie.split(";").filter((s=>s.length)),i=0;r.length>i;i++){for(var n=r[i];n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ce(t)&&isFinite(t)&&Math.floor(t)===t});var ls=class t{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,i,n){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||0>e||0>r||0>i||0>n||e>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/256,s[5]=e,s[6]=112|r>>>8,s[7]=r,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=n>>>24,s[13]=n>>>16,s[14]=n>>>8,s[15]=n,new t(s)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;16>r;r++){var i=this.bytes[r]-e.bytes[r];if(i!==0)return Math.sign(i)}return 0}},cs=class{generate(){var e=this.generateOrAbort();if(!x(e))return e;this.S=0;var r=this.generateOrAbort();if(x(r))throw new Error("Could not generate UUID after timestamp reset");return r}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return ls.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new hs}},ga,ju=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};v&&!x(v.crypto)&&crypto.getRandomValues&&(ju=t=>crypto.getRandomValues(t));var hs=class{nextUint32(){return this.R.length>this.O||(ju(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}},Ke=()=>uh().toString(),uh=()=>(ga||(ga=new cs)).generate(),tr="",lh=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Je={N:()=>!!S,D(t){w.error("cookieStore error: "+t)},A:Du,F(t){var e;try{e=JSON.parse(Je.A(t))||{}}catch{}return e},q(t,e,r,i,n){if(!S)return!1;try{var s="",o="",a=(function(c,h){if(h){var d=(function(p,_){if(_===void 0&&(_=S),tr)return tr;if(!_||["localhost","127.0.0.1"].includes(p))return"";for(var m=p.split("."),g=Math.min(m.length,8),E="dmn_chk_"+Ke();!tr&&g--;){var $=m.slice(g).join("."),k=E+"=1;domain=."+$+";path=/";_.cookie=k+";max-age=3",_.cookie.includes(E)&&(_.cookie=k+";max-age=0",tr=$)}return tr})(c);if(!d){var f=(p=>{var _=p.match(lh);return _?_[0]:""})(c);f!==d&&w.info("Warning: cookie subdomain discovery mismatch",f,d),d=f}return d?"; domain=."+d:""}return""})(S.location.hostname,i);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}n&&(o="; secure");var l=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+l.length),S.cookie=l,!0}catch{return!1}},P(t,e){if(S!=null&&S.cookie)try{Je.q(t,"",-1,e)}catch{return}}},on=null,V={N(){if(!ve(on))return on;var t=!0;if(x(v))t=!1;else try{var e="__mplssupport__";V.q(e,"xyz"),V.A(e)!=='"xyz"'&&(t=!1),V.P(e)}catch{t=!1}return t||w.error("localStorage unsupported; falling back to cookie store"),on=t,t},D(t){w.error("localStorage error: "+t)},A(t){try{return v?.localStorage.getItem(t)}catch(e){V.D(e)}return null},F(t){try{return JSON.parse(V.A(t))||{}}catch{}return null},q(t,e){try{return v?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){V.D(r)}return!1},P(t){try{v?.localStorage.removeItem(t)}catch(e){V.D(e)}}},ch=[hi,"distinct_id",Mt,Bs,_i,fi,Re],Hr={},hh={N:()=>!0,D(t){w.error("memoryStorage error: "+t)},A:t=>Hr[t]||null,F:t=>Hr[t]||null,q:(t,e)=>(Hr[t]=e,!0),P(t){delete Hr[t]}},ht=null,le={N(){if(!ve(ht))return ht;if(ht=!0,x(v))ht=!1;else try{var t="__support__";le.q(t,"xyz"),le.A(t)!=='"xyz"'&&(ht=!1),le.P(t)}catch{ht=!1}return ht},D(t){w.error("sessionStorage error: ",t)},A(t){try{return v?.sessionStorage.getItem(t)}catch(e){le.D(e)}return null},F(t){try{return JSON.parse(le.A(t))||null}catch{}return null},q(t,e){try{return v?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){le.D(r)}return!1},P(t){try{v?.sessionStorage.removeItem(t)}catch(e){le.D(e)}}},ds=class{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===Ye||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===yt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Jt.q(this.Kt,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var e=this._instance.config,r=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+r:"__ph_opt_in_out_"+r)}get Qt(){var e=this.Jt.A(this.Kt);return Yi(e)?1:A(Cc,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,r=e==="localStorage"?V:Je;if(!this.Yt||this.Yt!==r){this.Yt=r;var i=e==="localStorage"?Je:V;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Yi(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[fe?.doNotTrack,fe?.msDoNotTrack,T.doNotTrack].some((e=>Yi(e)))}};function Uu(t,e){var r,i=t==null||(r=t.config)==null?void 0:r.get_current_url;if(!Oe(i))return e;try{var n=i(e);return H(n)&&n?n:e}catch(s){return w.error("Error in get_current_url, falling back to window.location.href",s),e}}var Hu="__POSTHOG_TOOLBAR__",dh=1,ph=3,fh=11;function ma(t){return t instanceof Element&&(t.id===Hu||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ut(t){return!!t&&t.nodeType===dh}function we(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Bu(t){return!!t&&t.nodeType===ph}function Gu(t){return!!t&&t.nodeType===fh&&ut(t.host)}var Vu=1e3;function qs(t){return t?Ai(t).split(/\s+/):[]}function ya(t,e){var r=(function(i){var n,s=v==null||(n=v.location)==null?void 0:n.href;return x(s)?void 0:Uu(i,s)})(e);return!!(r&&t&&t.some((i=>r.match(i))))}function mi(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return qs(e)}function qu(t){return O(t)?null:Ai(t).split(/(\s+)/).filter((e=>mr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function kr(t){var e="";return fs(t)&&!Ju(t)&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var i;Bu(r)&&r.textContent&&(e+=(i=qu(r.textContent))!==null&&i!==void 0?i:"")})),Ai(e)}function an(t){var e;return x(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ws=["a","button","form","input","select","textarea","label"];function ps(t,e){if(x(e))return!0;var r,i=function(s){if(e.some((o=>(function(a,u){var l=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!l&&l.call(a,u)}catch{return!1}})(s,o))))return{v:!0}};for(var n of t)if(r=i(n))return r.v;return!1}function Wu(t){var e=t.parentNode;return!(!e||!ut(e))&&e}var _h=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ku=["next","previous","prev",">","<"],vh=[...Ku,"+","-","\u2212","\u2013"],ba=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,xa=[".ph-no-rageclick",".ph-no-capture"],gh=["","text","search","email","password","url","tel","number"];function wa(t,e){if(!v||Ks(t))return!1;var r,i,n,s,o;if(Me(e)?(r=!!e&&xa,i=void 0,n=!1):(r=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:xa,i=e?.content_ignorelist,n=(o=e?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||n&&(function(u){return!(!u||!ut(u))&&(!!we(u,"textarea")||(we(u,"input")?A(gh,(u.getAttribute("type")||"").toLowerCase()):(function(l){if(l.isContentEditable)return!0;var c=l.getAttribute==null?void 0:l.getAttribute("contenteditable");return c==="true"||c===""})(u)))})(t))return!1;var a=Yu(t,!1).targetElementList;return!(function(u,l){if(u===!1||x(u))return!1;var c;if(u===!0)c=Ku;else{if(!R(u))return!1;if(u.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=u.map((h=>h.toLowerCase()))}return l.some((h=>{var d=h.safeText,f=h.ariaLabel;return c.some((p=>ba(d,p)||ba(f,p)))}))})(i,a.map((u=>{var l;return{safeText:kr(u).toLowerCase(),ariaLabel:((l=u.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}})))&&!ps(a,r)}var Ks=t=>!t||we(t,"html")||!ut(t),Yu=(t,e)=>{if(!v||Ks(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[t],n=t;n.parentNode&&!we(n,"body");)if(Gu(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=Wu(n);if(!s)break;if(e||Ws.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=v.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}i.push(s),n=s}return{parentIsUsefulElement:r,targetElementList:i}};function fs(t){for(var e=new Set,r=0,i=t;i.parentNode&&!we(i,"body");i=i.parentNode){if(r++>=Vu||e.has(i))return!1;e.add(i);var n=mi(i);if(A(n,"ph-sensitive")||A(n,"ph-no-capture"))return!1}if(A(mi(t),"ph-include"))return!0;var s=t.type||"";if(H(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!H(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Ju(t){return!!(we(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||we(t,"select")||we(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Xu="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",mh=new RegExp("^(?:"+Xu+")$"),yh=new RegExp(Xu),Qu="\\d{3}-?\\d{2}-?\\d{4}",bh=new RegExp("^("+Qu+")$"),xh=new RegExp("("+Qu+")");function mr(t,e){return e===void 0&&(e=!0),!(O(t)||H(t)&&(t=Ai(t),(e?mh:yh).test((t||"").replace(/[- ]/g,""))||(e?bh:xh).test(t)))}function $a(t){var e=kr(t);return mr(e=(e+" "+el(t)).trim())?e:""}function el(t){var e="";return t&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var i;if(r&&((i=r.tagName)==null?void 0:i.toLowerCase())==="span")try{var n=kr(r);e=(e+" "+n).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+el(r)).trim())}catch(s){w.error("[AutoCapture]",s)}})),e}function Ea(t){return t.replace(/"|\\"/g,'\\"')}function wh(t){var e=t.attr__class;if(e)return R(e)?e:qs(e)}var Br=X("[Dead Clicks]"),$h=()=>!0,Eh=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(Us)),i=t.instance.config.capture_dead_clicks;return Me(i)?i:!!J(i)||r},yi=class{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,r,i){this.instance=e,this.isEnabled=r,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var r=e.config;"captureDeadClicks"in r&&(this.instance.persistence&&this.instance.persistence.register({[Us]:r.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var r,i;(r=T.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture?e():(i=T.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(n=>{n?Br.error("failed to load script",n):e()}))}tr(){var e;if(S){if(!this.Xt&&(e=T.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=J(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};r.__onCapture=this.onCapture,this.onCapture&&(r.capture_dead_swipes=!1),this.Xt=T.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.Xt.start(S),Br.info("starting...")}}else Br.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,Br.info("stopping..."))}},un=X("[SegmentIntegration]"),tl="posthog-js";function rl(t,e){var r=e===void 0?{}:e,i=r.organization,n=r.projectId,s=r.prefix,o=r.severityAllowList,a=o===void 0?["error"]:o,u=r.sendExceptionsToPostHog,l=u===void 0||u;return c=>{var h,d,f,p,_;if(a!=="*"&&!a.includes(c.level)||!t.__loaded)return c;c.tags||(c.tags={});var m=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());c.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var g,E=((h=c.exception)==null?void 0:h.values)||[],$=E.map((z=>y({},z,{stacktrace:z.stacktrace?y({},z.stacktrace,{type:"raw",frames:(z.stacktrace.frames||[]).map((L=>y({},L,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((d=E[0])==null?void 0:d.value)||c.message,$exception_type:(f=E[0])==null?void 0:f.type,$exception_level:c.level,$exception_list:$,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((p=E[0])==null?void 0:p.value)||c.message,$sentry_exception_type:(_=E[0])==null?void 0:_.type,$sentry_tags:c.tags};return i&&n&&(k.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+c.event_id),l&&((g=t.exceptions)==null||g.sendExceptionEvent(k)),c}}var _s=class{constructor(e,r,i,n,s,o){this.name=tl,this.setupOnce=function(a){a(rl(e,{organization:r,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},bi=class{constructor(e){this.rr=(r,i,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:n}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,r){var i,n=this.ar(e,r);return this.ir={pathname:(i=v?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var r;return this.ar(e,(r=this.ir)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,r){var i=this.ir;if(!i)return{$pageview_id:r};var n={$pageview_id:r,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,u=s.maxScrollY,l=s.maxContentHeight,c=s.lastContentY,h=s.maxContentY;if(!(x(o)||x(a)||x(u)||x(l)||x(c)||x(h))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c),h=Math.ceil(h);var d=o>1?Ne(a/o,0,1,w):1,f=o>1?Ne(u/o,0,1,w):1,p=l>1?Ne(c/l,0,1,w):1,_=l>1?Ne(h/l,0,1,w):1;n=W(n,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),n}},ln=["flags","surveys"],kh={[Tu]:{exposure:"hidden"},[hr]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[dr]:{exposure:"hidden"},[Gn]:{exposure:"event"},[Vn]:{exposure:"hidden"},[qn]:{exposure:"event"},[Wn]:{exposure:"hidden"},[Kn]:{exposure:"event"},[Yn]:{exposure:"event"},[Us]:{exposure:"event"},[Hs]:{exposure:"hidden"},[Jn]:{exposure:"event"},[xt]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Bs]:{exposure:"event"},[Cu]:{exposure:"event",shouldSkipFromEventProperties:t=>ve(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[bt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!J(t))return{};for(var e={},r=Object.keys(t),i=0;r.length>i;i++)e["$feature/"+r[i]]=t[r[i]];return e}},[Yr]:{exposure:"event",storageGroup:"flags"},[pr]:{exposure:"hidden"},[Xn]:{exposure:"hidden",storageGroup:"flags"},[Jr]:{exposure:"event",storageGroup:"flags"},[Qn]:{exposure:"event",storageGroup:"flags",volatile:!0},[di]:{exposure:"hidden",storageGroup:"flags"},[qe]:{exposure:"event"},[At]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[es]:{exposure:"hidden",storageGroup:"surveys"},[pi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ts]:{exposure:"event"},[Xr]:{exposure:"hidden"},[fr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[gr]:{exposure:"hidden"},[rs]:{exposure:"hidden"},[is]:{exposure:"hidden"},[Er]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Re]:{exposure:"hidden"},[ns]:{exposure:"hidden"},[ss]:{exposure:"hidden"},[os]:{exposure:"hidden"},[as]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[Iu]:{exposure:"event"},[Au]:{exposure:"event"},[Ru]:{exposure:"event"},[Ou]:{exposure:"event"},[Fu]:{exposure:"event"},[Zu]:{exposure:"event"},[Lu]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Sh=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],dt=t=>{var e=kh[t];if(e)return e;for(var r of Sh){var i=r[1];if(t.indexOf(r[0])===0)return i}},Ft=(t,e)=>{try{return JSON.stringify(t,((r,i)=>typeof i=="bigint"?i.toString():i),e)}catch{return Xa(t)}},xi=t=>{var e=S?.createElement("a");return x(e)?null:(e.href=t,e)},Ut=function(t,e){for(var r,i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===e){r=s;break}}if(!R(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{w.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Sr=function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var h=u[c].split("=");R(h)&&(e.includes(h[0])?l.push(h[0]+"="+r):l.push(u[c]))}var d=a;return o!=null&&(d+="?"+l.join("&")),n!=null&&(d+="#"+n),d},wi=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},il=(t,e)=>t>=e&&Ka(),nl=(t,e,r,i)=>{if(t===0){if(Ka()){var n=e+1;return n===r&&i(),n}return e}return 0},Gr="https?://(.*)",Ht=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ph=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ht],Pr="<masked>",zh=["li_fat_id"];function sl(t,e,r){if(!S)return{};var i,n=e?[...Ht,...r||[]]:[],s=ol(Sr(S.URL,n,Pr),t),o=(i={},B(zh,(function(a){var u=Du(a);i[a]=u||null})),i);return W(o,s)}function ol(t,e){var r=Ph.concat(e||[]),i={};return B(r,(function(n){var s=Ut(t,n);i[n]=s||null})),i}function al(t){var e=(function(s){return s?s.search(Gr+"google.([^/?]*)")===0?"google":s.search(Gr+"bing.com")===0?"bing":s.search(Gr+"yahoo.com")===0?"yahoo":s.search(Gr+"duckduckgo.com")===0?"duckduckgo":null:null})(t),r=e!="yahoo"?"q":"p",i={};if(!ve(e)){i.$search_engine=e;var n=S?Ut(S.referrer,r):"";n.length&&(i.ph_keyword=n)}return i}function ka(){return navigator.language||navigator.userLanguage}var $i="$direct";function ul(){return S?.referrer||$i}function ll(t,e,r){r===void 0&&(r=!1);var i=t?[...Ht,...e||[]]:[],n=r?at(ne?.href):ne?.href,s=n?.substring(0,1e3);return{r:ul().substring(0,1e3),u:s?Sr(s,i,Pr):void 0}}function cl(t,e){var r;e===void 0&&(e=!1);var i=t.r,n=t.u,s=e?at(n):n,o={$referrer:i,$referring_domain:i==null?void 0:i==$i?$i:(r=xi(i))==null?void 0:r.host};if(s){o.$current_url=s;var a=xi(s);o.$host=a?.host,o.$pathname=a?.pathname;var u=ol(s);W(o,u)}if(i){var l=al(i);W(o,l)}return o}function hl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Th(){try{return new Date().getTimezoneOffset()}catch{return}}var Ch={flags:Er,surveys:pi},Ih=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ct="main",yr=class{constructor(e,r,i){if(i===void 0&&(i=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=i,this.props={},this.cr=!1,this.vr=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,r),this.save(),v){var n=()=>this.flush();re(v,"beforeunload",n,{capture:!1}),re(v,"pagehide",n,{capture:!1})}}mr(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return ce(r)&&r>0?r:0}isDisabled(){return!!this.yr}pr(e){Ih.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r,i=(function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var u=[...ch,...o];return y({},V,{F(l){try{var c={};try{c=Je.F(l)||{}}catch{}var h,d=JSON.parse(V.A(l)||"{}");if(a){var f={};for(var p in c){var _=c[p];ve(_)||_===""||(f[p]=_)}h=W(d,f)}else h=W(c,d);return V.q(l,h),h}catch{}return null},q(l,c,h,d,f,p){var _=V.q(l,c,void 0,void 0,p);try{var m={};u.forEach((g=>{c[g]&&(m[g]=c[g])})),Object.keys(m).length&&Je.q(l,m,h,d,f,p)}catch(g){V.D(g)}return _},P(l,c){try{v?.localStorage.removeItem(l),Je.P(l,c)}catch(h){V.D(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),n=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&V.N()?(r=V,n=!0):s==="localstorage+cookie"&&i.N()?(r=i,n=!0):s==="sessionstorage"&&le.N()?r=le:s==="memory"?r=hh:s==="cookie"?r=Je:i.N()?(r=i,n=!0):r=Je,this.ur=n,r}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var r=e??this.Te.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var i=this.props[Er];return!i||typeof i!="number"||Date.now()-i>r}properties(){var e={};return B(this.props,((r,i)=>{var n=dt(i);if(n?.exposure==="derived"){if(n.shouldSkipFromEventProperties!=null&&n.shouldSkipFromEventProperties(r,i===bt?()=>this._r():()=>!1))return;n.transformToEventProperties&&W(e,n.transformToEventProperties(r))}else if(!n||n.exposure==="event"){if(n!=null&&n.shouldSkipFromEventProperties!=null&&n.shouldSkipFromEventProperties(r,(()=>!1)))return;e[i]=r}})),e}load(){if(!this.yr){var e=this.Jt.F(this.vr);e&&(this.props=W({},e)),this.hr&&this.wr()}}wr(){for(var e of ln){var r=V.F(this.br(e));if(r&&!ot(r)){var i=this.kr(e);i.persisted=!0,this.Sr(e)||(i.fingerprint=this.Cr(r,e)),this.Tr(e,r)||W(this.props,r)}}}Sr(e){return Object.keys(this.props).some((r=>{var i;return((i=dt(r))==null?void 0:i.storageGroup)===e}))}Tr(e,r){var i=Ch[e];if(!i)return!1;var n=r[i],s=this.props[i];return ce(n)&&ce(s)&&s>n}refreshKey(e){var r;if(!this.yr){var i=this.hr?(r=dt(e))==null?void 0:r.storageGroup:void 0,n=i?V.F(this.br(i)):this.Jt.F(this.vr);if(n&&e in n)this.Ir(e,n[e]);else{if(i){var s=this.Jt.F(this.vr);if(s&&e in s)return void this.Ir(e,s[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?x(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){x(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,Ct))}Pr(){var e=this.Fr(),r=e.main,i=e.groups;for(var n of(this.Or(this.Jt,this.vr,r,Ct),ln)){var s,o=i[n];(!ot(o)||(s=this.lr[n])!=null&&s.persisted)&&this.Or(V,this.br(n),o,n)}}Fr(){var e={},r={flags:{},surveys:{}};return B(this.props,((i,n)=>{var s,o=(s=dt(n))==null?void 0:s.storageGroup;o?r[o][n]=i:e[n]=i})),{main:e,groups:r}}Cr(e,r){if(r===Ct)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return B(e,((n,s)=>{var o;i[s]=(o=dt(s))!=null&&o.volatile?"__volatile__":n})),JSON.stringify(i)}Or(e,r,i,n){var s=this.kr(n);if(n===Ct||s.dirty||x(s.fingerprint)){var o;try{if((o=this.Cr(i,n))===s.fingerprint)return void(s.dirty=!1)}catch{o=void 0}e.q(r,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,n!==Ct&&(s.persisted=!0),x(o)||(s.fingerprint=o)):this.Te.debug&&w.warn('failed to persist storage entry "'+r+'"; will retry on next save')}}remove(e){var r=(e===void 0?{}:e).keepGroupEntries,i=r!==void 0&&r;if(x(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var n of ln)V.P(this.br(n));i?delete this.lr[Ct]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,r,i){if(J(e)){x(r)&&(r="None"),this.Lr=x(i)?this.Nr:i;var n=!1;if(B(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==r||(this.Ir(o,s),n=!0)})),n)return this.save(),!0}return!1}register(e,r){if(J(e)){this.Lr=x(r)?this.Nr:r;var i=!1;if(B(e,((n,s)=>{e.hasOwnProperty(s)&&this.props[s]!==n&&(this.Ir(s,n),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=sl(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);ot(Vs(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=S?.referrer)?al(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ul(),$referring_domain:S!=null&&S.referrer&&((e=xi(S.referrer))==null?void 0:e.host)||$i},void 0)}set_initial_person_info(){this.props[os]||this.props[as]||this.register_once({[fi]:ll(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};B([as,os],(n=>{var s=this.props[n];s&&B(s,(function(o,a){e["$initial_"+Pn(a)]=o}))}));var r=this.props[fi];if(r){var i=(function(n,s){s===void 0&&(s=!1);var o=cl(n,s),a={};return B(o,(function(u,l){a["$initial_"+Pn(l)]=u})),a})(r,this.Te.disable_capture_url_hashes);W(e,i)}return e}safe_merge(e){return B(this.props,(function(r,i){i in e||(e[i]=r)})),e}update_config(e,r,i){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var n=e.persistence!==r.persistence||!((u,l)=>{if(u.length!==l.length)return!1;var c=[...u].sort(),h=[...l].sort();return c.every(((d,f)=>d===h[f]))})(e.cookie_persisted_properties||[],r.cookie_persisted_properties||[]),s=n?this.pr(e):this.Jt,o=this.gr(e);if(n||o!==this.hr){var a=this.props;this.clear(),this.Jt=s,this.hr=o,this.props=a,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,r){var i=this.props[dr]||{};i[e]=r,this.Ir(dr,i),this.save()}remove_event_timer(e){var r=this.props[dr]||{},i=r[e];return x(i)||(delete r[e],this.Ir(dr,r),this.save()),i}get_property(e){return this.props[e]}set_property(e,r){this.Ir(e,r),this.save()}Ir(e,r){var i;this.props[e]=r,(i=dt(e))!=null&&i.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var r,i=(r=dt(e))==null?void 0:r.storageGroup;i&&(this.kr(i).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}},pe={GZipJS:"gzip-js",Base64:"base64"},rr={Activation:"events",Cancellation:"cancelEvents"};var cn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Xe={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},hn={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},vs={Popover:"popover",Inline:"inline"};var Ah={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Sa={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Pa=X("[RateLimiter]"),gs=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((n=>{Pa.info((n||"events")+" is quota limited."),this.serverLimits[n]=new Date().getTime()+6e4}))}catch(n){return void Pa.warn('could not rate limit - continuing. Error: "'+n?.message+'"',{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var r,i,n;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),u=(r=(i=this.instance.persistence)==null?void 0:i.get_property(ss))!==null&&r!==void 0?r:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var l=1>u.tokens;return l||e||(u.tokens=Math.max(0,u.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(n=this.instance.persistence)==null||n.set_property(ss,u),{isRateLimited:l,remainingTokens:u.tokens}}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}},ir=X("[RemoteConfig]"),Ei=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=T._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var r,i;(r=T.__PosthogExtensions__)!=null&&r.loadExternalDependency?(i=T.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(r){e(r.json)}})}load(){try{if(this.remoteConfig)return ir.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void ir.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return ir.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((r=>{this.Hr(r),this.Br()}));this.Hr(e),this.Br()}))}catch(e){ir.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&S&&S.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var r=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;r!==0&&(this.zr=setInterval((()=>{this.refresh()}),r))}}Hr(e){var r;e||ir.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded())}};var Te=Uint8Array,_e=Uint16Array,Bt=Uint32Array,Ys=new Te([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Js=new Te([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),za=new Te([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dl=function(t,e){for(var r=new _e(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Bt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},pl=dl(Ys,2),ms=pl[1];pl[0][28]=258,ms[258]=28;for(ys=dl(Js,0)[1],ki=new _e(32768),K=0;32768>K;++K)pt=(43690&K)>>>1|(21845&K)<<1,ki[K]=((65280&(pt=(61680&(pt=(52428&pt)>>>2|(13107&pt)<<2))>>>4|(3855&pt)<<4))>>>8|(255&pt)<<8)>>>1;var pt,ys,ki,K,br=function(t,e,r){for(var i=t.length,n=0,s=new _e(e);i>n;++n)++s[t[n]-1];var o,a=new _e(e);for(n=0;e>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new _e(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],c=e-t[n],h=a[t[n]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[ki[h]>>>u]=l}else for(o=new _e(i),n=0;i>n;++n)o[n]=ki[a[t[n]-1]++]>>>15-t[n];return o},Et=new Te(288);for(K=0;144>K;++K)Et[K]=8;for(K=144;256>K;++K)Et[K]=9;for(K=256;280>K;++K)Et[K]=7;for(K=280;288>K;++K)Et[K]=8;var Si=new Te(32);for(K=0;32>K;++K)Si[K]=5;var Rh=br(Et,9,0),Oh=br(Si,5,0),fl=function(t){return(t/8>>0)+(7&t&&1)},_l=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var i=new(t instanceof _e?_e:t instanceof Bt?Bt:Te)(r-e);return i.set(t.subarray(e,r)),i},He=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},nr=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},dn=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Te(0),0];if(n==1){var o=new Te(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(z,L){return z.f-L.f})),r.push({s:-1,f:25001});var a=r[0],u=r[1],l=0,c=1,h=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=n-1;)a=r[r[h].f>r[l].f?l++:h++],u=r[l!=c&&r[h].f>r[l].f?l++:h++],r[c++]={s:-1,f:a.f+u.f,l:a,r:u};var d=s[0].s;for(i=1;n>i;++i)s[i].s>d&&(d=s[i].s);var f=new _e(d+1),p=bs(r[c-1],f,0);if(p>e){i=0;var _=0,m=p-e,g=1<<m;for(s.sort((function(z,L){return f[L.s]-f[z.s]||z.f-L.f}));n>i;++i){var E=s[i].s;if(e>=f[E])break;_+=g-(1<<p-f[E]),f[E]=e}for(_>>>=m;_>0;){var $=s[i].s;e>f[$]?_-=1<<e-f[$]++-1:++i}for(;i>=0&&_;--i){var k=s[i].s;f[k]==e&&(--f[k],++_)}p=e}return[new Te(f),p]},bs=function(t,e,r){return t.s==-1?Math.max(bs(t.l,e,r+1),bs(t.r,e,r+1)):e[t.s]=r},Ta=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new _e(++e),i=0,n=t[0],s=1,o=function(u){r[i++]=u},a=1;e>=a;++a)if(t[a]==n&&a!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=t[a]}return[r.subarray(0,i),e]},sr=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},xs=function(t,e,r){var i=r.length,n=fl(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Ca=function(t,e,r,i,n,s,o,a,u,l,c){He(e,c++,r),++n[256];for(var h=dn(n,15),d=h[0],f=h[1],p=dn(s,15),_=p[0],m=p[1],g=Ta(d),E=g[0],$=g[1],k=Ta(_),z=k[0],L=k[1],F=new _e(19),b=0;E.length>b;++b)F[31&E[b]]++;for(b=0;z.length>b;++b)F[31&z[b]]++;for(var P=dn(F,7),C=P[0],M=P[1],I=19;I>4&&!C[za[I-1]];--I);var Z,Q,G,N,q=l+5<<3,Y=sr(n,Et)+sr(s,Si)+o,be=sr(n,d)+sr(s,_)+o+14+3*I+sr(F,C)+(2*F[16]+3*F[17]+7*F[18]);if(Y>=q&&be>=q)return xs(e,c,t.subarray(u,u+l));if(He(e,c,1+(Y>be)),c+=2,Y>be){Z=br(d,f,0),Q=d,G=br(_,m,0),N=_;var ke=br(C,M,0);for(He(e,c,$-257),He(e,c+5,L-1),He(e,c+10,I-4),c+=14,b=0;I>b;++b)He(e,c+3*b,C[za[b]]);c+=3*I;for(var ge=[E,z],xe=0;2>xe;++xe){var ee=ge[xe];for(b=0;ee.length>b;++b)He(e,c,ke[oe=31&ee[b]]),c+=C[oe],oe>15&&(He(e,c,ee[b]>>>5&127),c+=ee[b]>>>12)}}else Z=Rh,Q=Et,G=Oh,N=Si;for(b=0;a>b;++b)if(i[b]>255){var oe;nr(e,c,Z[257+(oe=i[b]>>>18&31)]),c+=Q[oe+257],oe>7&&(He(e,c,i[b]>>>23&31),c+=Ys[oe]);var ae=31&i[b];nr(e,c,G[ae]),c+=N[ae],ae>3&&(nr(e,c,i[b]>>>5&8191),c+=Js[ae])}else nr(e,c,Z[i[b]]),c+=Q[i[b]];return nr(e,c,Z[256]),c+Q[256]},Mh=new Bt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fh=(function(){for(var t=new Bt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t})(),pn=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function Zh(t,e){e===void 0&&(e={});var r=(function(){var h=4294967295;return{p(d){for(var f=h,p=0;d.length>p;++p)f=Fh[255&f^d[p]]^f>>>8;h=f},d(){return 4294967295^h}}})(),i=t.length;r.p(t);var n,s,o,a,u,l=(a=10+((n=e).filename&&n.filename.length+1||0),u=8,(function(h,d,f,p,_,m){var g=h.length,E=new Te(p+g+5*(1+Math.floor(g/7e3))+_),$=E.subarray(p,E.length-_),k=0;if(!d||8>g)for(var z=0;g>=z;z+=65535){var L=z+65535;g>L?k=xs($,k,h.subarray(z,L)):($[z]=!0,k=xs($,k,h.subarray(z,g)))}else{for(var F=Mh[d-1],b=F>>>13,P=8191&F,C=(1<<f)-1,M=new _e(32768),I=new _e(C+1),Z=Math.ceil(f/3),Q=2*Z,G=function(Fi){return(h[Fi]^h[Fi+1]<<Z^h[Fi+2]<<Q)&C},N=new Bt(25e3),q=new _e(288),Y=new _e(32),be=0,ke=0,ge=(z=0,0),xe=0,ee=0;g>z;++z){var oe=G(z),ae=32767&z,ue=I[oe];if(M[ae]=ue,I[oe]=ae,z>=xe){var et=g-z;if((be>7e3||ge>24576)&&et>423){k=Ca(h,$,0,N,q,Y,ke,ge,ee,z-ee,k),ge=be=ke=0,ee=z;for(var de=0;286>de;++de)q[de]=0;for(de=0;30>de;++de)Y[de]=0}var Ce=2,tt=0,me=P,Ie=ae-ue&32767;if(et>2&&oe==G(z-Ie))for(var Tr=Math.min(b,et)-1,Gt=Math.min(32767,z),Cr=Math.min(258,et);Gt>=Ie&&--me&&ae!=ue;){if(h[z+Ce]==h[z+Ce-Ie]){for(var Se=0;Cr>Se&&h[z+Se]==h[z+Se-Ie];++Se);if(Se>Ce){if(Ce=Se,tt=Ie,Se>Tr)break;var Ir=Math.min(Ie,Se-2),Vt=0;for(de=0;Ir>de;++de){var Mi=z-Ie+de+32768&32767,eo=Mi-M[Mi]+32768&32767;eo>Vt&&(Vt=eo,ue=Mi)}}}Ie+=(ae=ue)-(ue=M[ae])+32768&32767}if(tt){N[ge++]=268435456|ms[Ce]<<18|ys[tt];var to=31&ms[Ce],ro=31&ys[tt];ke+=Ys[to]+Js[ro],++q[257+to],++Y[ro],xe=z+Ce,++be}else N[ge++]=h[z],++q[h[z]]}}k=Ca(h,$,!0,N,q,Y,ke,ge,ee,z-ee,k)}return _l(E,0,p+fl(k)+_)})(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),c=l.length;return(function(h,d){var f=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&pn(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),f){h[3]=8;for(var p=0;f.length>=p;++p)h[p+10]=f.charCodeAt(p)}})(l,e),pn(l,c-8,r.d()),pn(l,c-4,i),l}var Lh=!!En||!!Fs,vl="text/plain",ei=!1,gl=(t,e)=>{var r=t.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return t;var a=o.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},Xs=function(t,e,r){var i;r===void 0&&(r=!0);var n=t.split("?"),s=n[0],o=n[1],a=y({},e),u=(i=o?.split("&").map((c=>{var h,d=c.split("="),f=d[0],p=r&&(h=a[f])!==null&&h!==void 0?h:d[1];return delete a[f],f+"="+p})))!==null&&i!==void 0?i:[],l=(function(c,h){var d,f;h===void 0&&(h="&");var p=[];return B(c,(function(_,m){x(_)||x(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(_)?_.name:_.toString()),f=encodeURIComponent(m),p[p.length]=f+"="+d)})),p.join(h)})(a);return l&&u.push(l),u.length>0?s+"?"+u.join("&"):s},fn=t=>{if(t.Vr)return t.Vr;var e=t.data,r=t.compression;if(e){if(r===pe.GZipJS){var i=Zh((function(a,u){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new Te(a.length+(a.length>>>1)),h=0,d=function(m){c[h++]=m},f=0;l>f;++f){if(h+5>c.length){var p=new Te(h+8+(l-f<<1));p.set(c),c=p}var _=a.charCodeAt(f);128>_?d(_):2048>_?(d(192|_>>>6),d(128|63&_)):_>55295&&57344>_?(d(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++f))>>>18),d(128|_>>>12&63),d(128|_>>>6&63),d(128|63&_)):(d(224|_>>>12),d(128|_>>>6&63),d(128|63&_))}return _l(c,0,h)})(Ft(e)),{mtime:0});return{contentType:vl,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===pe.Base64){var n=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((u,l)=>String.fromCharCode(parseInt(l,16)))))})(Ft(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Ft(a)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Ft(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ml=t=>{var e,r,i=()=>t.transport==="sendBeacon"?{url:Xs(t.url,{compression:pe.Base64}),encodedBody:fn(y({},t,{compression:pe.Base64,Vr:void 0}))}:{url:gl(t.url,"compression"),encodedBody:fn(y({},t,{compression:void 0,Vr:void 0}))};try{e=fn(t)}catch(n){if(na(t.compression,Ut(t.url,"compression")))return w.error("Failed to gzip request body, sending uncompressed payload",n),i();throw n}return e&&na(t.compression,Ut(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?kn(new Uint8Array(r)):ArrayBuffer.isView(r)&&kn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(ei=!0,i()):{url:t.url,encodedBody:e}},yl=t=>{try{return ml(t)}catch(e){return w.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},Nh=(function(){var t=ie((function*(e){var r=Ft(e.data),i=yield(function(s,o,a){return Sn.apply(this,arguments)})(r,D.DEBUG,{rethrow:!0});if(!i)return e;var n=yield i.arrayBuffer();return y({},e,{Vr:{contentType:vl,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),Dh=/Failed to fetch|NetworkError|Load failed/i,bl=t=>{var e=yl(t);if(e){var r=e.url,i=e.encodedBody,n=i??{},s=n.contentType,o=n.body,a=n.estimatedSize,u=new Headers;B(t.headers,(function(p,_){u.append(_,p)})),s&&u.append("Content-Type",s);var l=null,c=!1;if(Xo){var h=new Xo;l={signal:h.signal,timeout:setTimeout((()=>{var p,_;c=!0,h.abort((p=t.timeout,(_=new Error("PostHog request timed out"+(p?" after "+p+"ms":""))).name="AbortError",_))}),t.timeout)}}var d=p=>{c&&p?.name==="AbortError"||(_=>_?.name==="TypeError"&&Dh.test(_?.message||""))(p)?w.warn(p):w.error(p),t.callback==null||t.callback({statusCode:0,error:p})};try{var f;Fs(r,y({method:t?.method||"GET",headers:u,keepalive:t.method==="POST"&&!t.Wr&&52428.8>(a||0),body:o,signal:(f=l)==null?void 0:f.signal},t.fetchOptions)).then((p=>p.text().then((_=>{var m={statusCode:p.status,text:_};if(p.status===200)try{m.json=JSON.parse(_)}catch(g){w.error(g)}t.callback==null||t.callback(m)})))).catch(d).finally((()=>l?clearTimeout(l.timeout):null))}catch(p){l&&clearTimeout(l.timeout),d(p)}}},ws=t=>{try{var e,r=ml(t),i=r.url,n=r.encodedBody,s=n??{},o=s.body,a=s.estimatedSize;if(!o)return;var u=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(fe.sendBeacon(i,u))return;var l=R(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(R(l)&&l.length>1&&(a??0)>16384){var c=Math.ceil(l.length/2),h=d=>R(t.data)?d:y({},t.data,{batch:d});return ws(y({},t,{data:h(l.slice(0,c))})),void ws(y({},t,{data:h(l.slice(c))}))}w.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),bl(y({},t,{Wr:!0}))}catch(d){w.warn("Beacon send failed",d)}},Ia=(t,e,r,i)=>{var n=i==="query"?e==="POST"?"sent_at":"_":void 0;return Xs(r===pe.GZipJS?gl(t,"compression"):t,y({},n?{[n]:Date.now().toString()}:{},r===pe.GZipJS?{}:{compression:r}))},ti=[];Fs&&ti.push({transport:"fetch",method:bl}),En&&ti.push({transport:"XHR",method(t){var e=yl(t);if(e){var r=new En,i=e.encodedBody;r.open(t.method||"GET",e.url,!0);var n=i??{},s=n.contentType,o=n.body;B(t.headers,(function(a,u){r.setRequestHeader(u,a)})),s&&r.setRequestHeader("Content-Type",s),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(a)}},r.send(o)}}}),fe!=null&&fe.sendBeacon&&ti.push({transport:"sendBeacon",method:ws});var $s=3e3,Es=class{constructor(e,r){this.Zr=!0,this.Gr=[],this.Qr=Ne(r?.flush_interval_ms||$s,250,5e3,w.createLogger("flush interval"),$s),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},r=Object.values(e);[...r.filter((i=>i.url.indexOf("/e")===0)),...r.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ti(y({},i,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var r=this.ei(),i=function(){var s=r[n],o=new Date().getTime();s.data&&R(s.data)&&B(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.ti(s)};for(var n in r)i()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(r){w.error(r)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return B(this.Gr,(r=>{var i,n=r,s=(n?n.batchKey:null)||n.url;x(e[s])&&(e[s]=y({},n,{data:[]})),(i=e[s].data)==null||i.push(n.data)})),this.Gr=[],e}},jh=["retriesPerformedSoFar"],ks=class{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!x(v)&&"onLine"in v.navigator&&(this.ni=v.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},re(v,"online",this.si),re(v,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var r=e.retriesPerformedSoFar,i=Ya(e,jh);Ve(r)&&(i.url=Xs(i.url,{retry_count:r})),this._instance._send_request(y({},i,{callback:n=>{if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(r??0))return void this.kt(y({retriesPerformedSoFar:r},i));n.statusCode===0&&w.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(r??0)+" retries.")}i.callback==null||i.callback(n)}}))}kt(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var i=(function(o){var a=3e3*Math.pow(2,o),u=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-u))})(r),n=Date.now()+i;this.Gr.push({retryAt:n,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),w.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),r=[],i=this.Gr.filter((s=>e>s.retryAt||(r.push(s),!1)));if(this.Gr=r,i.length>0)for(var n of i)this.retriableRequest(n.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,x(v)||(this.si&&(v.removeEventListener("online",this.si),this.si=void 0),this.ai&&(v.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var r=e.requestOptions;try{this._instance._send_request(y({},r,{transport:"sendBeacon"}))}catch(i){w.error(i)}}this.Gr=[]}},Ss=class{constructor(e){this.hi=()=>{var r,i,n,s;this.di||(this.di={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.di.lastScrollY=Math.ceil(a),this.di.maxScrollY=Math.max(a,(r=this.di.maxScrollY)!==null&&r!==void 0?r:0),this.di.maxScrollHeight=Math.max(u,(i=this.di.maxScrollHeight)!==null&&i!==void 0?i:0),this.di.lastContentY=l,this.di.maxContentY=Math.max(l,(n=this.di.maxContentY)!==null&&n!==void 0?n:0),this.di.maxContentHeight=Math.max(c,(s=this.di.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){re(v,"scroll",this.hi,{capture:!0}),re(v,"scrollend",this.hi,{capture:!0}),re(v,"resize",this.hi)}scrollElement(){if(!this.ci)return v?.document.documentElement;var e=R(this.ci)?this.ci:[this.ci];for(var r of e){var i=v?.document.querySelector(r);if(i)return i}}vi(e){var r=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[r]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}},Uh=t=>ll(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes),Pi=class{constructor(e,r,i,n){this.fi=s=>{var o=this.pi();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.gi(this._instance)};this.mi.register({[ns]:a})}},this._instance=e,this.yi=r,this.mi=i,this.gi=n||Uh,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[ns]}getSetOnceProps(){var e,r=(e=this.pi())==null?void 0:e.props;return r?"r"in r?cl(r,this._instance.config.disable_capture_url_hashes):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return B(Vs(this.getSetOnceProps()),((r,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Pn(i)]=r})),e}},zr=class{on(e,r){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(r),()=>{this.bi[e]=this.bi[e].filter((i=>i!==r))}}emit(e,r){for(var i of this.bi[e]||[])i(r);for(var n of this.bi["*"]||[])n(e,r)}constructor(){this.bi={}}},or=X("[SessionId]"),zi=class{on(e,r){return this.wi.on(e,r)}constructor(e,r,i){var n;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new zr,this.Ti=(l,c)=>!(!Ve(l)||!Ve(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ye)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=r||Ke,this.Ri=i||Ke;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ne(this.Te.session_idle_timeout_seconds||1800,60,36e3,or.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var o=le.F(this.Oi),a=le.F(this.Fi);o&&!a?this.Ii=o:le.P(this.Oi),le.q(this.Fi,!0)}if((n=this.Te.bootstrap)!=null&&n.sessionID)try{var u=(l=>{var c=this.Te.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(l){or.error("Invalid sessionID in bootstrap",l)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((r=>r!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&le.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&le.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?le.F(this.Oi):null}qi(e){var r=this.xi;return!ve(r)&&!ve(e)&&5e3>Math.abs(e-r)}$i(e,r,i){var n=r!==this._sessionActivityTimestamp,s=!(e!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=r,this.Mi=e,s&&!n||s&&this.qi(r)||(this.xi=r,this.mi.register({[Mt]:[r,e,i]}))}ji(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return Ve(r)&&r>0}Hi(){this.ji()?this.mi.refreshKey(Mt):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!ve(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var r=this.Ui();r[1]===this.Mi&&r[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Mt]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],r=Ve(e)?e:0,i=Ve(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(r,i)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[Mt];return R(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&v&&(v.removeEventListener(gi,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&le.P(this.Fi)},re(v,gi,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.Te.cookieless_mode===Ye)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=r||new Date().getTime(),n=this.Ui(),s=n[1],o=n[2],a=this.zi(),u=this.Di(),l=Ve(o)&&Math.abs(i-o)>864e5,c=!1,h=!1,d=!s,f=s,p=!d&&!e&&this.Ti(i,a);if(p){(p=this.Vi(i))||or.info("cross-tab refresh kept the session alive",{sessionId:s});var _=this.Ui();s=_[1],o=_[2]}d||p||l?(s=this.Ei(),u=this.Ri(),or.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),o=i,c=!0):(u||(u=this.Ri(),c=!0),(h=s!==f)&&(or.info("adopted cross-tab session id",{sessionId:s,windowId:u}),c=!0));var m=Ve(a)&&e&&!l?a:i,g=Ve(o)?o:new Date().getTime();this.Ni(u),this.$i(s,m,g),e||this.Pi();var E={noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:h};return c&&this.ki.forEach(($=>$(s,u,E))),{sessionId:s,windowId:u,sessionStartTimestamp:g,changeReason:c?E:void 0,lastActivityTimestamp:a}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}},xl=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&oa(r,e))return!0;try{var i=t?.userAgentData;if(i!=null&&i.brands&&i.brands.some((n=>oa(n?.brand,e))))return!0}catch{}return!!t.webdriver};function wl(){return(wl=ie((function*(){var t=fe?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=e?.model;return H(r)&&r.length>0?r:void 0}catch(i){return void w.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var Ti=function(t,e){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Aa(t,e,r){return Ft({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var $l={exact:(t,e)=>e.some((r=>t.some((i=>r===i)))),is_not:(t,e)=>e.every((r=>t.every((i=>r!==i)))),regex:(t,e)=>e.some((r=>t.some((i=>Ti(r,i))))),not_regex:(t,e)=>e.every((r=>t.every((i=>!Ti(r,i))))),icontains:(t,e)=>e.map(Vr).some((r=>t.map(Vr).some((i=>r.includes(i))))),not_icontains:(t,e)=>e.map(Vr).every((r=>t.map(Vr).every((i=>!r.includes(i))))),gt:(t,e)=>e.some((r=>{var i=parseFloat(r);return!isNaN(i)&&t.some((n=>i>parseFloat(n)))})),lt:(t,e)=>e.some((r=>{var i=parseFloat(r);return!isNaN(i)&&t.some((n=>i<parseFloat(n)))}))},Vr=t=>t.toLowerCase();function El(t,e){return!t||Object.entries(t).every((r=>{var i=r[1],n=e?.[r[0]];if(x(n)||ve(n))return!1;var s=[String(n)],o=$l[i.operator];return!!o&&o(i.values,s)}))}var Ps="custom",Ra="i.posthog.com",Hh=/^\/static\//,zs=class{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+Ra,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ps),this.Zi[this.apiHost]}Gi(e){if(Hh.test(e)){var r=this.instance.config.asset_host;if(typeof r=="string")return r.trim().replace(/\/$/,"")||void 0}}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(e==="assets"){var i=this.Gi(r);if(i)return""+i+r}if(this.region===Ps)return this.apiHost+r;var n=Ra+r;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}};function kl(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var U=X("[Surveys]"),Sl="seenSurvey_",Pl=t=>{try{var e=(r=>((i,n)=>""+Sl+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(n))(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(r){U.error("Failed to persist survey seen state",r)}},Bh=[cn.Popover,cn.Widget,cn.API],Gh={ignoreConditions:!1,ignoreDelay:!1,displayType:vs.Popover},Vh=X("[PostHog ExternalIntegrations]"),qh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Ts=class{constructor(e){this._instance=e}er(e,r){var i;(i=T.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(n=>{if(n)return Vh.error("failed to load script",n);r()}))}startIfEnabledOrStop(){var e=this,r=function(){var s,o,a,u=i[0],l=i[1];!l||(s=T.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.er(qh[u],(()=>{var c;(c=T.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[u])==null||c.start(e._instance)})),!l&&(o=T.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[u]&&((a=T.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[u])==null||a.stop())};for(var i of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;r()}}},xr={},_n=0,Ci=()=>{},Oa='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ar="Surveys module not available",Ma="sanitize_properties is deprecated. Use before_send instead",zl="Invalid value for property_denylist config: ",Wh=["token","distinct_id",Mu],Ot="posthog",Tl=!Lh&&ye?.indexOf("MSIE")===-1&&ye?.indexOf("Mozilla")===-1,vn=t=>{var e;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ah(S?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ci,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ne&&H(ne?.search)&&ne.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){w.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:us,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:$s},error_tracking:{},_onCapture:Ci},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:vh,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:r&&r>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r)}))(t))},Kh=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Fa=t=>{var e={};for(var r of Kh){var i=r[0],n=r[1];x(t[i])||(e[n]=t[i])}var s=W({},e,t),o=t.__preview_external_dependency_versioned_paths;return x(o)||(x(t.strict_script_versioning)&&(s.strict_script_versioning=!!o),H(o)&&x(t.asset_host)&&(s.asset_host=o)),R(t.property_blacklist)&&(x(t.property_denylist)?s.property_denylist=t.property_blacklist:R(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:w.error(zl+t.property_denylist)),s},Cs=class{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$t=class t{Ji(e,r){if(e){var i=this.Ki.indexOf(e);i!==-1&&this.Ki.splice(i,1)}return this.Ki.push(r),r.initialize==null||r.initialize(),r}Yi(){return this.config.cookieless_mode===Ye||this.config.cookieless_mode===yt&&this.consent.isRejected()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Cs,this.Xi=!1,this.version=D.LIB_VERSION,this.en=new zr,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=vn(),this.SentryIntegration=_s,this.sentryIntegration=i=>(function(n,s){var o=rl(n,s);return{name:tl,processEvent:a=>o(a)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new Ss(this),this.pageViewManager=new bi(this),this.rateLimiter=new gs(this),this.requestRouter=new zs(this),this.consent=new ds(this),this.externalIntegrations=new Ts(this);var r=(e=t.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(i,n,s)=>{var o=H(i)?{[i]:n}:i;this.setPersonProperties(o),s?.({})},set_once:(i,n,s)=>{var o=H(i)?{[i]:n}:i;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",(i=>w.info('send "'+i?.event+'"',i)))}init(e,r,i){if(i&&i!==Ot){var n,s=(n=xr[i])!==null&&n!==void 0?n:new t;return s._init(e,r,i),xr[i]=s,xr[Ot][i]=s,s}return this._init(e,r,i)}_init(e,r,i){var n,s;r===void 0&&(r={});var o=H(e)?e.trim():"";if(!o)return w.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=vn(r.defaults),r.debug=this.an(r.debug),this.ln=r,this.un=[],r.person_profiles?this.nn=r.person_profiles:r.process_person&&(this.nn=r.process_person);var a=vn(r.defaults),u=Fa(r),l=W({},a,u,{name:i,token:o});J(a.rageclick)&&J(u.rageclick)&&(l.rageclick=W({},a.rageclick,u.rageclick)),J(a.session_recording)&&J(u.session_recording)&&(l.session_recording=W({},a.session_recording,u.session_recording)),this.set_config(l),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:pe.GZipJS;var c=this.hn();this.persistence=new yr(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yr(y({},this.config,{persistence:"sessionStorage"}),c,!1);var h=y({},this.persistence.props),d=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new Es((k=>this.cn(k)),this.config.request_queue_config),this.vn=new ks(this),this.__request_queue=[];var f=this.Yi();if(f||(this.sessionManager=new zi(this),this.sessionPropsManager=new Pi(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(f)}),0)):(w.info("Initializing extensions synchronously"),this.fn(f)),D.DEBUG=D.DEBUG||this.config.debug,D.DEBUG&&w.info("Starting in debug mode",{this:this,config:r,thisC:y({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(n=r.bootstrap)!=null&&n.distinctID||(r.bootstrap=y({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var p=r.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(Re);if(r.bootstrap.isIdentifiedID&&_!=null&&_!==p&&m===zt)this.identify(p);else if(r.bootstrap.isIdentifiedID&&_!=null&&_!==p&&m===Tt)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var g=this.config.get_device_id(Ke()),E=r.bootstrap.isIdentifiedID?g:p;this.persistence.set_property(Re,r.bootstrap.isIdentifiedID?Tt:zt),this.register({distinct_id:p,$device_id:E})}}if(f)this.register_once({distinct_id:jr,$device_id:null},"");else if(!this.get_distinct_id()){var $=this.config.get_device_id(Ke());this.register_once({distinct_id:$,$device_id:$},""),this.persistence.set_property(Re,zt)}return re(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(k,z){var L=k.config.segment;if(!L)return z();(function(F,b){var P=F.config.segment;if(!P)return b();var C=I=>{var Z=()=>I.anonymousId()||Ke();F.config.get_device_id=Z,I.id()&&(F.register({distinct_id:I.id(),$device_id:Z()}),F.persistence.set_property(Re,Tt)),b()},M=P.user();"then"in M&&Oe(M.then)?M.then(C):C(M)})(k,(()=>{L.register((F=>{typeof Promise<"u"&&Promise.resolve||un.warn("This browser does not have Promise support, and can not use the segment integration");var b=(P,C)=>{if(!C)return P;P.event.userId||P.event.anonymousId===F.get_distinct_id()||(un.info("No userId set, resetting PostHog"),F.reset()),P.event.userId&&P.event.userId!==F.get_distinct_id()&&(un.info("UserId set, identifying with PostHog"),F.identify(P.event.userId));var M=F.calculateEventProperties(C,P.event.properties);return P.event.properties=Object.assign({},M,P.event.properties),P};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:P=>b(P,P.event.event),page:P=>b(P,Rt),identify:P=>b(P,sn),screen:P=>b(P,"$screen")}})(k)).then((()=>{z()}))}))})(this,(()=>this.pn())):this.pn(),Oe(this.config._onCapture)&&this.config._onCapture!==Ci&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&w.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return wl.apply(this,arguments)})().then((k=>{k&&this.register({[rn]:k})})).catch(Ci),this}fn(e){var r,i,n,s,o,a,u,l,c=performance.now(),h=y({},t.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ki.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new h.featureFlags(this)),h.exceptions&&this.Ki.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new h.exceptions(this)),h.historyAutocapture&&this.Ki.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ki.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ki.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ki.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ki.push(this.surveys=(n=this.surveys)!==null&&n!==void 0?n:new h.surveys(this)),h.logs&&this.Ki.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new h.logs(this)),h.metrics&&this.Ki.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new h.metrics(this)),h.conversations&&this.Ki.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new h.conversations(this)),h.productTours&&this.Ki.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ki.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ki.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Eh)),h.toolbar&&this.Ki.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new h.toolbar(this)),h.experiments&&this.Ki.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new h.experiments(this)),this.Ki.forEach((f=>{f.initialize&&d.push((()=>{f.initialize==null||f.initialize()}))})),d.push((()=>{if(this.gn){var f=this.gn;this.gn=void 0,this.Hr(f)}})),this.mn(d,c)}mn(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout((()=>{this.mn(e,r)}),0);var i=e.shift();if(i)try{i()}catch(s){w.error("Error initializing extension:",s)}}var n=Math.round(performance.now()-r);this.register_for_session({[Fu]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Zu]:n}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+n+"ms)")}Hr(e){if(!S||!S.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=A(i.supportedCompression,pe.GZipJS)?pe.GZipJS:A(i.supportedCompression,pe.Base64)?pe.Base64:void 0),(r=i.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:us}),this.Ki.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}pn(){try{this.config.loaded(this)}catch(i){w.critical("`loaded` function failed",i)}if(this.bn(),this.config.internal_or_test_user_hostname&&ne!=null&&ne.hostname){var e=ne.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new Ei(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.dn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ur(this.__request_queue,(e=>this.cn(e))),this.__request_queue=[],this.bn()}_handle_unload(){var e,r,i,n,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(r=this.metrics)==null||r.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(nn),(i=this.logs)==null||i.flushLogs("sendBeacon"),(n=this.dn)==null||n.unload(),(s=this.vn)==null||s.unload()):this.xn()&&this.capture(nn,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Tl?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=y({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(x(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(r=>{var i,n,s,o=y({},r);o.timeout=o.timeout||6e4;var a,u,l,c,h,d=(i=o.transport)!==null&&i!==void 0?i:"fetch";d==="sendBeacon"&&x(o.compression)&&o.data&&(o.compression=pe.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(u=(h=(c=R(a=o.data)?a:[a])[0])==null||(l=h.properties)==null?void 0:l.token)!==null&&u!==void 0?u:h?.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(_,m){return m===void 0&&(m=new Date().toISOString()),R(_)?_.map((g=>y({},g,{sent_at:m}))):y({},_,{sent_at:m})})(o.data))),o.url=Ia(o.url,o.method,o.compression,o.timestampMode);var f=ti.filter((_=>!o.disableTransport||!_.transport||!o.disableTransport.includes(_.transport))),p=(n=(s=(function(_,m){for(var g=0;_.length>g;g++)if(_[g].transport===d)return _[g]})(f))==null?void 0:s.method)!==null&&n!==void 0?n:f[0].method;if(!p)throw new Error("No available transport method");d!=="sendBeacon"&&o.data&&o.compression===pe.GZipJS&&bc&&typeof Promise<"u"&&!ei?Nh(o).then((_=>{p(_)})).catch((_=>{if(sa(_))return ei=!0,void p(y({},o,{compression:void 0,url:Ia(r.url,r.method,void 0,r.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var g="name"in m?String(m.name):"";return sa(m)||g===Ja})(_)&&(ei=!0),p(o)})):p(o)})(y({},e,{callback:r=>{var i,n;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(i=(n=this.config).on_request_error)==null||i.call(n,r),e.callback==null||e.callback(r)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){_n++;try{var r,i=[],n=[],s=[];Ur(e,(a=>{if(a)if(R(r=a[0]))s.push(a);else if(Oe(a))try{a.call(this)}catch(u){w.error("Error executing queued PostHog call",a,u)}else R(a)&&r==="alias"?i.push(a):R(a)&&r.indexOf("capture")!==-1&&Oe(this[r])?s.push(a):n.push(a)}));var o=function(a,u){Ur(a,(function(l){try{if(R(l[0])){var c=u;B(l,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else u[l[0]].apply(u,l.slice(1))}catch(h){w.error("Error executing queued PostHog call",l,h)}}))};o(i,this),o(n,this),o(s,this)}finally{_n--}}push(e){if(_n>0&&R(e)&&H(e[0])){var r=t.prototype[e[0]];Oe(r)&&r.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,r,i){var n,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!x(e)&&H(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){r!=null&&r.$current_url&&!H(r?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),e!=="$exception"||i!=null&&i.kn||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=i?.timestamp||h,f=ca(i?.uuid,Ke),p={uuid:f,event:e,properties:this.calculateEventProperties(e,r||{},d,f)};e===Rt&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var _=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(di)===!0;i?.$set&&!_&&(p.$set=i?.$set);var m=i?.$unset;m&&(p.$unset=m);var g,E,$,k=_?void 0:this.Sn(i?.$set_once,e!==_a,e===sn);if(k&&(p.$set_once=k),i!=null&&i._noTruncate||(s=this.config.properties_string_max_length,o=p,a=I=>H(I)?I.slice(0,s):I,u=new Set,p=(function I(Z,Q){if(Z!==Object(Z))return a?a(Z):Z;if(!u.has(Z)){var G;if(u.add(Z),R(Z))G=[],Ur(Z,(q=>{G.push(I(q))}));else{var N={};B(Z,((q,Y)=>{u.has(q)||(N[Y]=I(q,Y))})),G=N}return G}})(o)),p.timestamp=d,x(i?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),_&&(p.properties=(function(I,Z){Z===void 0&&(Z=[]);var Q={},G=N=>{I[N]!==void 0&&(Q[N]=I[N])};return xc.forEach(G),Z.forEach(G),Q})(p.properties,Wh)),e===Xe.DISMISSED||e===Xe.SENT){var z=r?.[hn.SURVEY_ID],L=r?.[hn.SURVEY_ITERATION];Pl({id:z,current_iteration:L}),p.$set=y({},p.$set,{[(g={id:z,current_iteration:L},E=e===Xe.SENT?"responded":"dismissed",$="$survey_"+E+"/"+g.id,g.current_iteration&&g.current_iteration>0&&($="$survey_"+E+"/"+g.id+"/"+g.current_iteration),$)]:!0})}else e===Xe.SHOWN&&(p.$set=y({},p.$set,{[hn.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Ah.SHOWN){var F=r?.[Sa.TOUR_TYPE];F&&(p.$set=y({},p.$set,{[Sa.TOUR_LAST_SEEN_DATE+"/"+F]:new Date().toISOString()}))}var b=y({},p.properties.$set,p.$set);if(ot(b)||this.setPersonPropertiesForFlags(b),!O(this.config.before_send)){var P=this.wt(p);if(!P)return;(p=P).uuid=ca(p.uuid,Ke)}this.en.emit("eventCaptured",p);var C=(n=i?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M={method:"POST",url:C,data:p,compression:"best-available",timestampMode:i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(C)?"body":"capture-body",batchKey:i?._batchKey,transport:i?.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.cn(M):this.dn.enqueue(M),p}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(r=>e(r.event,r)))}calculateEventProperties(e,r,i,n,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return r;var o=s?void 0:this.persistence.remove_event_timer(e),a=y({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Yi()&&(a[Mu]=!0),e==="$snapshot"){var u=y({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!H(a.distinct_id)&&!ce(a.distinct_id)||zn(a.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=(function($,k,z,L){var F,b,P,C;if(L===void 0&&(L=!1),!ye)return{};var M,I=$?[...Ht,...k||[]]:[],Z=(function(Tr){for(var Gt=0;ua.length>Gt;Gt++){var Cr=ua[Gt],Se=Cr[1],Ir=Cr[0].exec(Tr),Vt=Ir&&(Oe(Se)?Se(Ir,Tr):Se);if(Vt)return Vt}return["",""]})(ye),Q=Z[0],G=Z[1],N=(M=typeof navigator<"u"?navigator:void 0)!=null&&M.brave?{brave:!0}:{},q={};x(z)||(q.detectGoogleSearchApp=z);var Y={},be=(F=navigator)==null||(F=F.userAgentData)==null?void 0:F.platform,ke=(b=navigator)==null?void 0:b.maxTouchPoints,ge=v==null||(P=v.screen)==null?void 0:P.width,xe=v==null||(C=v.screen)==null?void 0:C.height,ee=v?.devicePixelRatio;x(be)||(Y.userAgentDataPlatform=be),x(ke)||(Y.maxTouchPoints=ke),x(ge)||(Y.screenWidth=ge),x(xe)||(Y.screenHeight=xe),x(ee)||(Y.devicePixelRatio=ee);var oe,ae,ue,et,de,Ce,tt,me,Ie=W(Vs({$os:Q,$os_version:G,$browser:xu(ye,navigator.vendor,N,q),$device:la(ye),$device_type:(ae=ye,ue=Y,me=la(ae),me===iu||me===ru||me==="Kobo"||me==="Kindle Fire"||me===vu?Nt:me===wr||me===Lt||me===$r||me===In?"Console":me===su?"Wearable":me?$e:ue?.userAgentDataPlatform==="Android"&&((et=ue?.maxTouchPoints)!==null&&et!==void 0?et:0)>0?600>Math.min((de=ue?.screenWidth)!==null&&de!==void 0?de:0,(Ce=ue?.screenHeight)!==null&&Ce!==void 0?Ce:0)/((tt=ue?.devicePixelRatio)!==null&&tt!==void 0?tt:1)?$e:Nt:"Desktop"),$timezone:hl(),$timezone_offset:Th()}),{$current_url:Sr(L?at(ne?.href):ne?.href,I,Pr),$host:ne?.host,$pathname:ne?.pathname,$raw_user_agent:ye.length>1e3?ye.substring(0,997)+"...":ye,$browser_version:Nc(ye,navigator.vendor,N,q),$browser_language:ka(),$browser_language_prefix:(oe=ka(),typeof oe=="string"?oe.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return D.SDK_DIST_CHANNEL&&(Ie.$sdk_dist_channel=D.SDK_DIST_CHANNEL),Ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime()),d=h.windowId;a.$session_id=h.sessionId,a.$window_id=d}this.sessionPropsManager&&W(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&W(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.vn)==null?void 0:f.length}catch($){a.$sdk_debug_error_capturing_properties=String($)}if(this.requestRouter.region===Ps&&(a.$lib_custom_api_host=this.config.api_host),l=e!==Rt||s?e!==nn||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=W(a,l),e===Rt&&S&&(a.title=S.title),!x(o)){var p=i.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}ye&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),m=this.sessionPersistence.properties();B(["$referrer","$referring_domain"],($=>{$ in _&&delete m[$]})),(a=W({},c,_,m,a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?B(this.config.property_denylist,(function($){delete a[$]})):w.error(zl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(w.error(Ma),a=g(a,e));var E=this.Cn();return a.$process_person_profile=E,E&&!s&&this.Tn("_calculate_event_properties"),a}Sn(e,r,i){var n;if(r===void 0&&(r=!0),i===void 0&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return e;var s=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),a=W({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&(w.error(Ma),a=u(a,"$set_once")),r&&(this.Xi=!0),ot(a)?void 0:a}register(e,r){var i;(i=this.persistence)==null||i.register(e,r)}register_once(e,r,i){var n;(n=this.persistence)==null||n.register_once(e,r,i)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e)}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e)}In(e,r){this.register({[e]:r})}getFeatureFlag(e,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var i,n;return(i=(n=this.featureFlags)==null?void 0:n.isFeatureEnabled(e,r))!==null&&i!==void 0?i:r?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,r,i){var n;(n=this.featureFlags)==null||n.updateFlags(e,r,i)}updateEarlyAccessFeatureEnrollment(e,r,i){var n;(n=this.featureFlags)==null||n.updateEarlyAccessFeatureEnrollment(e,r,i)}getEarlyAccessFeatures(e,r,i){var n;return r===void 0&&(r=!1),(n=this.featureFlags)==null?void 0:n.getEarlyAccessFeatures(e,r,i)}on(e,r){return this.en.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ar}),()=>{})}onSessionId(e){var r,i;return(r=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:ar})}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:ar})}renderSurvey(e,r){var i;(i=this.surveys)==null||i.renderSurvey(e,r)}displaySurvey(e,r){var i;r===void 0&&(r=Gh),(i=this.surveys)==null||i.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)==null||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,i;return(r=(i=this.surveys)==null?void 0:i.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:ar}}canRenderSurveyAsync(e,r){var i,n;return r===void 0&&(r=!1),(i=(n=this.surveys)==null?void 0:n.canRenderSurveyAsync(e,r))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:ar})}Mn(e){return!e||zn(e)?(w.critical("Unique user id has not been set in posthog.identify"),!1):e===jr?(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,r,i){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(ce(e)&&(e=e.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.Tn("posthog.identify")){var n=this.get_distinct_id();this.register({$user_id:e}),this.get_property(hi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),e!==n&&e!==this.get_property(hr)&&(this.unregister(hr),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Re)||zt)===zt;e!==n&&o?(this.persistence.set_property(Re,Tt),this.setPersonPropertiesForFlags({$set:r||{},$set_once:i||{}},!1),this.capture(sn,{distinct_id:e,$anon_distinct_id:n},{$set:r||{},$set_once:i||{}}),this.sn=Aa(e,r,i),(s=this.featureFlags)==null||s.setAnonymousDistinctId(n)):(r||i)&&this.setPersonProperties(r,i),e!==n&&(this.reloadFeatureFlags(),this.unregister(gr))}}setPersonProperties(e,r){if((e||r)&&this.Tn("posthog.setPersonProperties")){var i=Aa(this.get_distinct_id(),e,r);this.sn!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.sn=i):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var r,i=(R(e)?e:[e]).filter((n=>H(n)&&n.length>0));i.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((r=this.featureFlags)==null||r.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(e,r,i){if(e&&r){var n=this.getGroups(),s=n[e]!==r;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},n,{[e]:r})}),s||i){var o={$group_type:e,$group_key:r};i&&(o.$group_set=i),this.capture(_a,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),s&&!i&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){var i;r===void 0&&(r=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e){var r;e===void 0&&(e=!0),(r=this.featureFlags)==null||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r){var i;r===void 0&&(r=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(e)}reset(e){var r,i,n,s,o,a,u,l,c,h;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var d,f=this.get_property(hi),p=this.get_property(rn),_=this.get_property(xt);if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(i=this.sessionPersistence)==null||i.clear(),x(_)||(d=this.persistence)==null||d.register({[xt]:_}),(n=this.surveys)==null||n.reset(),(s=this.wn)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.logs)==null||u.reset(),(l=this.metrics)==null||l.reset(),(c=this.persistence)==null||c.set_property(Re,zt),(h=this.sessionManager)==null||h.resetSessionId(),this.sn=null,this.config.cookieless_mode===Ye)this.register_once({distinct_id:jr,$device_id:null},"");else{var m=this.config.get_device_id(Ke());this.register_once({distinct_id:m,$device_id:e?m:f},""),e||x(p)||this.register({[rn]:p})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return ie((function*(){var i,n,s,o,a;r.__loaded?((i=r.logs)==null||i.flushLogs("sendBeacon"),(n=r.metrics)==null||n.flush("sendBeacon"),(s=r.dn)==null||s.unload(),(o=r.vn)==null||o.unload(),(a=r.featureFlags)==null||a.destroy()):w.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,r){var i;this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(i=this.conversations)==null||i.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var r=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.sessionStartTimestamp,n=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r.sessionId);if(e!=null&&e.withTimestamp&&i){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!i)return n;n+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}return n}alias(e,r){return e===this.get_property(Tu)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(x(r)&&(r=this.get_distinct_id()),e!==r?(this.In(hr,e),this.capture("$create_alias",{alias:e,distinct_id:r})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=y({},this.config);if(J(e)){var i,n,s,o,a,u,l,c,h,d,f;W(this.config,Fa(e));var p=this.hn();(i=this.persistence)==null||i.update_config(this.config,r,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yr(y({},this.config,{persistence:"sessionStorage"}),p,!1);var _=this.an(this.config.debug);Me(_)&&(this.config.debug=_),Me(this.config.debug)&&(this.config.debug?(D.DEBUG=!0,V.N()&&V.q("ph_debug",!0),w.info("set_config",{config:e,oldConfig:r,newConfig:y({},this.config)})):(D.DEBUG=!1,V.N()&&V.P("ph_debug"))),(n=this.exceptionObserver)==null||n.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.tracingHeaders)==null||a.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Pn(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(e,r){D.LIB_NAME=e,D.LIB_VERSION=r}startSessionRecording(e){var r,i,n,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),u.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),u.linked_flag&&((n=this.sessionRecording)==null||n.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,r){if(this.exceptions){var i=new Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},n,r))}}addExceptionStep(e,r){var i;(i=this.exceptions)==null||i.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)==null||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)==null?void 0:r.logger)!==null&&e!==void 0?e:t.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,i;return(r=(i=this.toolbar)==null?void 0:i.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Ot;return r!==Ot&&(r=Ot+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(Re))===Tt||((r=this.sessionPersistence)==null?void 0:r.get_property(Re))===Tt}Cn(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===us&&!this._isIdentified()&&ot(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[hr])&&((r=this.persistence)==null||(r=r.props)==null||!r[_i]))}xn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(e){return this.config.person_profiles==="never"?(w.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(_i,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==yt)}Pn(){var e,r,i,n,s=this.hn();return((e=this.persistence)==null?void 0:e.yr)!==s&&((i=this.persistence)==null||i.set_disabled(s)),((r=this.sessionPersistence)==null?void 0:r.yr)!==s&&((n=this.sessionPersistence)==null||n.set_disabled(s)),s}opt_in_capturing(e){var r;if(this.config.cookieless_mode!==Ye){if(this.Yi()){var i,n,s,o,a;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=new zi(this),this.pageViewManager=new bi(this),this.persistence&&(this.sessionPropsManager=new Pi(this,this.sessionManager,this.persistence));var u,l=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=t.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ji(this.sessionRecording,new l(this)),this.yn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.yn)))}var c,h;this.consent.optInOut(!0),this.Pn(),this.bn(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==yt&&((c=this.surveys)==null||c.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else w.warn(Oa)}opt_out_capturing(){var e,r,i;this.config.cookieless_mode!==Ye?(this.config.cookieless_mode===yt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===yt&&(this.register({distinct_id:jr,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):w.warn(Oa)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ye||(this.config.cookieless_mode===yt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return fe?xl(fe,this.config.custom_blocked_useragents):void 0}_n(){S&&(S.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(Rt,{title:S.title},{send_instantly:!0}),this.rn&&(S.removeEventListener(vi,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),re(S,vi,this.rn)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ur(){var e=this.ln||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,i,n,s,o){var a=i in r&&!O(r[i]),u=n in r&&!O(r[n]);return a?r[i]:!!u&&(o&&o.warn("Config field '"+n+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),r[n])})(e,"advanced_disable_flags","advanced_disable_decide",0,w)}wt(e){var r;if(O(this.config.before_send))return e;var i=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(zc),n=R(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var o of n){if(s=o(s),O(s)){var a="Event '"+e.event+"' was rejected in beforeSend function";return Pc(e.event)?w.warn(a+". This can cause unexpected behavior."):w.info(a),null}s.properties&&!ot(s.properties)||w.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of i)if(s.properties&&O(s.properties[u]))return w.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(i)})}an(e){var r=Me(e)&&!e,i=V.N()&&V.A("ph_debug")==="true";return!r&&(!!i||e)}};$t.__defaultExtensionClasses={},$t.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var r=0;e.length>r;r++)t.prototype[e[r]]=sh(t.prototype[e[r]])})($t,["identify"]);var Ii=class{constructor(e){this.disabled=e===!1;var r=J(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,i){if(this.disabled)return!1;var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(r-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:e,y:r,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:i}];return!1}},gn="$copy_autocapture",mn=X("[AutoCapture]");function yn(t,e){return e.length>t?e.slice(0,t)+"...":e}function Yh(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ut(e));return e}function Jh(t,e){var r,i,n=e.e,s=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,u=e.elementsChainAsString,l=e.disableCaptureUrlHashes;if(!ut(t))return{props:{}};for(var c=[t],h=new Set([t]),d=t;d.parentNode&&!we(d,"body")&&Vu>c.length;)if(Gu(d.parentNode)){var f=d.parentNode.host;if(h.has(f))break;h.add(f),c.push(f),d=f}else{if(!ut(d.parentNode)||h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}var p,_,m=[],g={},E=!1,$=!1;if(B(c,(b=>{var P=fs(b);if(we(b,"a")){var C=b.getAttribute("href");E=!!(P&&C&&mr(C))&&(l?at(C):C)}A(mi(b),"ph-no-capture")&&($=!0),m.push((function(I,Z,Q,G,N){N===void 0&&(N=!1);var q=I.tagName.toLowerCase(),Y={tag_name:q};Ws.indexOf(q)>-1&&!Q&&(Y.$el_text=q.toLowerCase()==="a"||q.toLowerCase()==="button"?yn(1024,$a(I)):yn(1024,kr(I)));var be=mi(I);be.length>0&&(Y.classes=be.filter((function(ee){return ee!==""}))),B(I.attributes,(function(ee){var oe;if((!Ju(I)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&(G==null||!G.includes(ee.name))&&!Z&&mr(ee.value)&&(!H(oe=ee.name)||oe.substring(0,10)!=="_ngcontent"&&oe.substring(0,7)!=="_nghost")){var ae=ee.value;ee.name==="class"&&(ae=qs(ae).join(" ")),Y["attr__"+ee.name]=yn(1024,ee.name==="href"&&N?at(ae):ae)}}));for(var ke=1,ge=1,xe=I;xe=Yh(xe);)ke++,xe.tagName===I.tagName&&ge++;return Y.nth_child=ke,Y.nth_of_type=ge,Y})(b,s,o,a,l));var M=(function(I){if(!fs(I))return{};var Z={};return B(I.attributes,(function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){var G=Q.name.replace("data-ph-capture-attribute-",""),N=Q.value;G&&N&&mr(N)&&(Z[G]=N)}})),Z})(b);W(g,M)})),$)return{props:{},explicitNoCapture:$};if(o||(m[0].$el_text=we(t,"a")||we(t,"button")?$a(t):kr(t)),E){var k,z;m[0].attr__href=E;var L=(k=xi(E))==null?void 0:k.host,F=v==null||(z=v.location)==null?void 0:z.host;L&&F&&L!==F&&(p=E)}return{props:W({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(_=m,(function(b){return b.map((P=>{var C,M,I="";if(P.tag_name&&(I+=P.tag_name),P.attr_class)for(var Z of(P.attr_class.sort(),P.attr_class))I+="."+Z.replace(/"/g,"");var Q=y({},P.text?{text:P.text}:{},{"nth-child":(C=P.nth_child)!==null&&C!==void 0?C:0,"nth-of-type":(M=P.nth_of_type)!==null&&M!==void 0?M:0},P.href?{href:P.href}:{},P.attr_id?{attr_id:P.attr_id}:{},P.attributes),G={};return Qr(Q).sort(((N,q)=>N[0].localeCompare(q[0]))).forEach((N=>{var q=N[1];return G[Ea(N[0].toString())]=Ea(q.toString())})),(I+=":")+Qr(G).map((N=>N[0]+'="'+N[1]+'"')).join("")})).join(";")})((function(b){return b.map((P=>{var C,M,I={text:(C=P.$el_text)==null?void 0:C.slice(0,400),tag_name:P.tag_name,href:(M=P.attr__href)==null?void 0:M.slice(0,2048),attr_class:wh(P),attr_id:P.attr__id,nth_child:P.nth_child,nth_of_type:P.nth_of_type,attributes:{}};return Qr(P).filter((Z=>Z[0].indexOf("attr__")===0)).forEach((Z=>I.attributes[Z[0]]=Z[1])),I}))})(_)))},(r=m[0])!=null&&r.$el_text?{$el_text:(i=m[0])==null?void 0:i.$el_text}:{},p&&n.type==="click"?{$external_click_url:p}:{},g)}}var ur=X("[ExceptionAutocapture]"),Za=()=>{},Xh=X("[TracingHeaders]"),ft=X("[Web Vitals]"),La=9e5,Na="disabled",Da="lazy_loading",lr="awaiting_config",qr="missing_config";X("[SessionRecording]"),X("[SessionRecording]");var Is="[SessionRecording]",Be=X(Is),Qh=X("[Heatmaps]");function bn(t){return J(t)&&"clientX"in t&&"clientY"in t&&ce(t.clientX)&&ce(t.clientY)}var xn=X("[Product Tours]"),wn=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Hs))},ed=["$set_once","$set"],Le=X("[SiteApps]"),ja="Error while initializing PostHog app with config id ";function It(t,e,r){if(O(t))return!1;switch(r){case"exact":return t===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var As=class{constructor(e){this.Fn=new zr,this.Ln=(r,i)=>this.$n(r,i)&&this.An(r,i)&&this.Nn(r,i)&&this.Dn(r,i),this.$n=(r,i)=>i==null||!i.event||r?.event===i?.event,this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,r;x((e=this._instance)==null?void 0:e._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((i,n)=>{this.on(i,n)}))}register(e){var r,i;if(!x((r=this._instance)==null?void 0:r._addCaptureHook)&&(e.forEach((o=>{var a,u;(a=this.jn)==null||a.add(o),(u=o.steps)==null||u.forEach((l=>{var c;(c=this.qn)==null||c.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var n,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(s)}}on(e,r){var i;r!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(r.event))&&this.jn&&((i=this.jn)==null?void 0:i.size)>0&&this.jn.forEach((n=>{this.Hn(r,n)&&this.Fn.emit("actionCaptured",n.name)}))}Bn(e){this.onAction("actionCaptured",(r=>e(r)))}Hn(e,r){if(r?.steps==null)return!1;for(var i of r.steps)if(this.Ln(e,i))return!0;return!1}onAction(e,r){return this.Fn.on(e,r)}An(e,r){if(r!=null&&r.url){var i,n=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!n||typeof n!="string"||!It(n,r.url,r.url_matching||"contains"))return!1}return!0}Nn(e,r){return!!this.Un(e,r)&&!!this.zn(e,r)&&!!this.Vn(e,r)}Un(e,r){var i;if(r==null||!r.href)return!0;var n=this.Wn(e);if(n.length>0)return n.some((a=>It(a.href,r.href,r.href_matching||"exact")));var s,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&It((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",r.href,r.href_matching||"exact")}zn(e,r){var i;if(r==null||!r.text)return!0;var n=this.Wn(e);if(n.length>0)return n.some((l=>It(l.text,r.text,r.text_matching||"exact")||It(l.$el_text,r.text,r.text_matching||"exact")));var s,o,a,u=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!u&&(s=(function(l){for(var c,h=[],d=/(?::|")text="(.*?)"/g;!O(c=d.exec(l));)h.includes(c[1])||h.push(c[1]);return h})(u),o=r.text,a=r.text_matching||"exact",s.some((l=>It(l,o,a))))}Vn(e,r){var i,n;if(r==null||!r.selector)return!0;var s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(s!=null&&s.includes(r.selector))return!0;var o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";if(r.selector_regex&&o)try{return new RegExp(r.selector_regex).test(o)}catch{return!1}return!1}Wn(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e?.properties.$elements}Dn(e,r){return r==null||!r.properties||r.properties.length===0||El(r.properties.reduce(((i,n)=>{var s=R(n.value)?n.value.map(String):n.value!=null?[String(n.value)]:[];return i[n.key]={values:s,operator:n.operator||"exact"},i}),{}),e?.properties)}},Rs=class{constructor(e){var r;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(r=this._instance)==null||r.onSessionId==null||r.onSessionId((i=>this.Kn(i)))}Yn(e,r){return!!e&&El(e.propertyFilters,r?.properties)}Xn(e,r){var i=new Map;return e.forEach((n=>{var s;(s=n.conditions)==null||(s=s[r])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=i.get(o.name)||[];a.push(n.id),i.set(o.name,a)}}))})),i}es(e,r,i){var n=(i===rr.Activation?this.Gn:this.Qn).get(e),s=[];return this.ts((o=>{s=o.filter((a=>n?.includes(a.id)))})),s.filter((o=>{var a,u=(a=o.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((l=>l.name===e));return this.Yn(u,r)}))}register(e){var r;x((r=this._instance)==null?void 0:r._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var r=e.filter((i=>{var n,s;return((n=i.conditions)==null?void 0:n.actions)&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));r.length!==0&&(this.ss==null&&(this.ss=new As(this._instance),this.ss.init(),this.ss.Bn((i=>{this.onAction(i)}))),r.forEach((i=>{var n,s,o,a,u;i.conditions&&(n=i.conditions)!=null&&n.actions&&(s=i.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ss)==null||a.register(i.conditions.actions.values),(u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((l=>{if(l&&l.name){var c=this.Jn.get(l.name);c&&c.push(i.id),this.Jn.set(l.name,c||[i.id])}})))})))}rs(e){var r,i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));i.length===0&&n.length===0||((r=this._instance)==null||r._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Gn=this.Xn(e,rr.Activation),this.Qn=this.Xn(e,rr.Cancellation))}onEvent(e,r){var i,n,s=this.os(),o=(r==null||(i=r.properties)==null?void 0:i.$survey_id)||(r==null||(n=r.properties)==null?void 0:n.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.ls(e,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.us([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),void this.hs(o)}if(this.Qn.has(e)){var u=this.es(e,r,rr.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((c=>c.id))}),this.us(u.map((c=>c.id))),u.forEach((c=>this.ds(c.id))))}if(this.Gn.has(e)){s.info("event name matched",{event:e,eventPayload:r,items:this.Gn.get(e)});var l=this.es(e,r,rr.Activation);this.cs(l.map((c=>c.id)))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){e.length!==0&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter((i=>i!==e));var r=this.vs();r.includes(e)||(this.fs([...r,e]),this.ps())}us(e){var r=new Set(e);this.Zn=this.Zn.filter((s=>!r.has(s)));var i=this.gs(),n=i.filter((s=>!r.has(s)));n.length!==i.length&&(this.fs(n),n.length===0&&this.ys())}gs(){var e,r=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r])||[]}vs(){var e,r,i=this.gs();if(i.length===0)return[];var n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],s=(r=this._instance)==null||r.get_session_id==null?void 0:r.get_session_id();return s&&n===s?i:[]}ps(){var e,r=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();r&&this.ws(r)}ys(){this.xs()}Kn(e){var r,i=(r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[this._s()];i&&i!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((e=>!this.ks(e)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}},Os=class extends Rs{constructor(e){super(e)}bs(){return ts}_s(){return Xr}Cs(){return Xe.SHOWN}ts(e){var r;(r=this._instance)==null||r.getSurveys(e)}ds(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}os(){return U}fs(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[ts]:e})}ws(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[Xr]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Xr)}ks(){return!1}ls(e,r){var i;this.ts((s=>{i=s.find((o=>o.id===r))}));var n=!i||(function(s){var o;return kl(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"})(i);return n?e===Xe.SHOWN?"consume":"ignore":e===Xe.SHOWN?"persist":e===Xe.DISMISSED||e===Xe.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Wr="SDK is not enabled or survey functionality is not yet loaded",Ua="Disabled. Not loading surveys.",td=v!=null&&v.location?wi(v.location.hash,"__posthog")||wi(location.hash,"state"):null,Ha="_postHogToolbarParams",Ba=X("[Toolbar]"),se=X("[FeatureFlags]"),_t=X("[FeatureFlags]",{debugEnabled:!0}),$n=`" failed. Feature flags didn't load in time.`,Ga=t=>{for(var e={},r=0;t.length>r;r++)e[t[r]]=!0;return e},Va=t=>{var e={};for(var r of Qr(t||{})){var i=r[1];i&&(e[r[0]]=i)}return e},Ge=X("[Error tracking]"),qa="Refusing to render web experiment since the viewer is a likely bot",rd={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Ti(e,t),not_regex:(t,e)=>!Ti(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},Ms=class t{get Te(){return this._instance.config}constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),r.getWebExperiments((n=>{t.Ts("retrieved web experiments from the server"),r.Is=new Map,n.forEach((s=>{if(s.feature_flag_key){var o;r.Is&&(t.Ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=r.Is)==null||o.set(s.feature_flag_key,s));var a=r._instance.getFeatureFlag(s.feature_flag_key);H(a)&&s.variants[a]&&r.Ms(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var l=s.variants[u];t.Es(l,r._instance)&&r.Ms(s.name,u,l.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())t.Ts(qa);else if(!this.Te.disable_web_experiments){if(O(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ts("applying feature flags",e),e.forEach((r=>{var i;if(this.Is&&(i=this.Is)!=null&&i.has(r)){var n,s=this._instance.getFeatureFlag(r),o=(n=this.Is)==null?void 0:n.get(r);s&&o!=null&&o.variants[s]&&this.Ms(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var r=Ut(e?.search,"__experiment_id"),i=Ut(e?.search,"__experiment_variant");r&&i&&(t.Ts("previewing web experiments "+r+" && "+i),this.getWebExperiments((n=>{this.Rs(parseInt(r),i,n)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,i){if(this.Te.disable_web_experiments&&!i)return e([]);var n=this._instance.get_property("$web_experiments");if(n&&!r)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Rs(e,r,i){var n=i.filter((s=>s.id===e));n&&n.length>0&&(t.Ts("Previewing web experiment ["+n[0].name+"] with variant ["+r+"]"),this.Ms(n[0].name,r,n[0].variants[r].transforms))}static Es(e,r){return!O(e.conditions)&&t.Ps(e,r)&&t.Os(e)}static Ps(e,r){var i;if(O(e.conditions)||O((i=e.conditions)==null?void 0:i.url))return!0;var n=t.getWindowLocation();if(n){var s,o,a,u=Uu(r,n.href);return(s=e.conditions)==null||!s.url||rd[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return v?.location}static Os(e){var r;if(O(e.conditions)||O((r=e.conditions)==null?void 0:r.utm))return!0;var i=sl();if(i.utm_source){var n,s,o,a,u,l,c,h,d=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==i.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==i.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return d&&p&&_&&f}return!1}static Ts(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;r>n;n++)i[n-1]=arguments[n];w.info("[WebExperiments] "+e,i)}Ms(e,r,i){this._is_bot()?t.Ts(qa):r!=="control"?i.forEach((n=>{if(n.selector){var s;t.Ts("applying transform of variant "+r+" for experiment "+e+" ",n);var o=(s=document)==null?void 0:s.querySelectorAll(n.selector);o?.forEach((a=>{var u=a;n.html&&(u.innerHTML=n.html),n.css&&u.setAttribute("style",n.css)}))}})):t.Ts("Control variants leave the page unmodified.")}_is_bot(){return fe&&this._instance?xl(fe,this.Te.custom_blocked_useragents):void 0}},ze=X("[Conversations]"),vt="Conversations not available yet.",Wa="console",Oi={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],v&&re(v,"online",this.Bs)}destroy(){v?.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return(t=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,se.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=(t=this.Te.evaluation_contexts)!==null&&t!==void 0?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(se.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),e!=null&&e.length?e.filter((r=>{var i=r&&typeof r=="string"&&r.trim().length>0;return i||se.error("Invalid evaluation context found:",r,"Expected non-empty string"),i})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!x(t)){if(R(t))return t.filter((e=>{var r=e&&typeof e=="string"&&e.trim().length>0;return r||se.error("Invalid flag key found:",e,"Expected non-empty string"),r}));se.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,r=this._instance.config,i=(t=(e=r.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(i).length){var n,s,o=(n=(s=r.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(i).filter((l=>!!i[l])).reduce(((l,c)=>(l[c]=i[c]||!1,l)),{}),u=Object.keys(o).filter((l=>a[l])).reduce(((l,c)=>(o[c]&&(l[c]=o[c]),l)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,r){var i,n,s=r!=null&&r.merge&&(i=this.zs(bt))!==null&&i!==void 0?i:{},o=r!=null&&r.merge&&(n=this.zs(Jr))!==null&&n!==void 0?n:{},a=y({},s,t),u=y({},o,e),l={};for(var c of Object.entries(a)){var h=c[0],d=c[1];l[h]={key:h,enabled:ta(d),variant:ra(d),reason:void 0,metadata:x(u?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(Xn),e=this.zs(qe),r=this.zs(At);if(!r&&!e)return t||{};var i=W({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var s of n){var o,a,u=i[s],l=e?.[s],c=x(l)?(o=u?.enabled)!==null&&o!==void 0&&o:!!l,h=x(l)?u.variant:typeof l=="string"?l:void 0,d=r?.[s],f=y({},u,{enabled:c,variant:c?h??u?.variant:void 0});c!==u?.enabled&&(f.original_enabled=u?.enabled),h!==u?.variant&&(f.original_variant=u?.variant),d&&(f.metadata=y({},u?.metadata,{payload:d,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),i[s]=f}return this.Fs||(se.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this.Fs=!0),i}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((r=>{var i=t[r];return{key:r,enabled:ta(i),variant:ra(i),payload:ea(e[r])}}))}getFlagVariants(){var t=this.zs(bt),e=this.zs(qe);if(!e)return t||{};for(var r=W({},t),i=Object.keys(e),n=0;i.length>n;n++)r[i[n]]=e[i[n]];return this.Fs||(se.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.Fs=!0),r}getFlagPayloads(){var t=this.zs(Jr),e=this.zs(At);if(!e)return t||{};for(var r=W({},t||{}),i=Object.keys(e),n=0;i.length>n;n++)r[i[n]]=e[i[n]];return this.Fs||(se.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.Fs=!0),r}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,i=this.zs(hi),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.zs(gt)||{},{$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION}),group_properties:this.zs(mt),timezone:hl()};ve(i)||x(i)||(n.$device_id=i),(t!=null&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.Gs()&&(n.evaluation_contexts=this.Zs());var s=this.Qs();x(s)||(n.flag_keys=s);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var l,c,h,d=!0;if(this.Xs(u.statusCode),u.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),d=!1),this.$s=!1,!n.disable_flags||this.Ns){this.Ds=!d;var f=[];u.error?u.error instanceof Error?f.push(u.error.name==="AbortError"?"timeout":"connection_error"):f.push("unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),(l=u.json)!=null&&l.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var p,_=!((c=u.json)==null||(c=c.quotaLimited)==null||!c.includes("feature_flags"));_&&f.push("quota_limited"),(h=this.mi)==null||h.register({[is]:f}),_?se.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(n.disable_flags||this.receivedFeatureFlags((p=u.json)!==null&&p!==void 0?p:{},d,{partialResponse:o}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return il(this.Hs,3)}Xs(t){this.Hs=nl(t,this.Hs,3,(()=>se.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var r;if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFeatureFlagResult(t,e);return(r=i?.variant)!==null&&r!==void 0?r:i?.enabled}}else se.warn('getFeatureFlag for key "'+t+$n)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var r=this.getFlagVariants(),i=t in r,n=r[t],s=this.getFlagPayloads()[t],o=String(n),a=this.zs(Qn)||void 0,u=this.zs(Er)||void 0,l=this.zs(gr)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.zs(rs);h&&h!==d&&(l={},(c=this.mi)==null||c.register({[gr]:l,[rs]:h}))}if((e.send_event||!("send_event"in e))&&(!(t in l)||!l[t].includes(o))){var f,p,_,m,g,E,$,k,z,L,F;R(l[t])?l[t].push(o):l[t]=[o],(f=this.mi)==null||f.register({[gr]:l});var b=this.getFeatureFlagDetails(t),P=[...(p=this.zs(is))!==null&&p!==void 0?p:[]];x(n)&&P.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((_=this.Te.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[t])||null,$used_bootstrap_value:!this.Ds};x(b==null||(g=b.metadata)==null?void 0:g.has_experiment)||(C.$feature_flag_has_experiment=b.metadata.has_experiment),x(b==null||(E=b.metadata)==null?void 0:E.version)||(C.$feature_flag_version=b.metadata.version);var M,I=($=b==null||(k=b.reason)==null?void 0:k.description)!==null&&$!==void 0?$:b==null||(z=b.reason)==null?void 0:z.code;I&&(C.$feature_flag_reason=I),b!=null&&(L=b.metadata)!=null&&L.id&&(C.$feature_flag_id=b.metadata.id),x(b?.original_variant)&&x(b?.original_enabled)||(C.$feature_flag_original_response=x(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(F=b.metadata)!=null&&F.original_payload&&(C.$feature_flag_original_payload=b==null||(M=b.metadata)==null?void 0:M.original_payload),P.length&&(C.$feature_flag_error=P.join(",")),this._instance.capture("$feature_flag_called",C)}if(i)return{key:t,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:ea(s)}}}else se.warn('getFeatureFlagResult for key "'+t+$n)}getRemoteConfigPayload(t,e){var r=this.Te.token,i={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:D.LIB_NAME,$lib_version:D.LIB_VERSION}};this.Gs()&&(i.evaluation_contexts=this.Zs());var n=this.Qs();x(n)||(i.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(s){var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;e(a?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return se.warn('isFeatureEnabled for key "'+t+$n),e.defaultValue;var r=this.getFeatureFlag(t,e);return x(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var i=this.getFlagVariants(),n=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,l,c,h){u===void 0&&(u={}),l===void 0&&(l={}),c===void 0&&(c={});var d=(b=>{var P=b.flags;return P?(b.featureFlags=Object.fromEntries(Object.keys(P).map((C=>{var M;return[C,(M=P[C].variant)!==null&&M!==void 0?M:P[C].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(P).filter((C=>P[C].enabled)).filter((C=>{var M;return(M=P[C].metadata)==null?void 0:M.payload})).map((C=>{var M;return[C,(M=P[C].metadata)==null?void 0:M.payload]})))):b.featureFlags&&se.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(o),f=d.flags,p=d.featureFlags,_=d.featureFlagPayloads;if(p){var m=o.requestId,g=o.evaluatedAt;if(R(p)){se.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(p)for(var $=0;p.length>$;$++)E[p[$]]=!0;a&&a.register({[Yr]:p,[bt]:E,[di]:!1})}else{var k=p,z=_,L=f;if(h!=null&&h.partialResponse)k=y({},u,k),z=y({},l,z),L=y({},c,L);else if(o.errorsWhileComputingFlags)if(f){var F=new Set(Object.keys(f).filter((b=>{var P;return!((P=f[b])!=null&&P.failed)})));k=y({},u,Object.fromEntries(Object.entries(k).filter((b=>F.has(b[0]))))),z=y({},l,Object.fromEntries(Object.entries(z||{}).filter((b=>F.has(b[0]))))),L=y({},c,Object.fromEntries(Object.entries(L||{}).filter((b=>F.has(b[0])))))}else k=y({},u,k),z=y({},l,z),L=y({},c,L);a&&a.register(y({[Yr]:Object.keys(Va(k)),[bt]:k||{},[Jr]:z||{},[Xn]:L||{},[di]:o.minimalFlagCalledEvents===!0},m?{[Qn]:m}:{},g?{[Er]:g}:{}))}}})(t,this.mi,i,n,s,r),e||(this.js=!1),this.eo(e)}}override(t,e){e===void 0&&(e=!1),se.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return se.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.mi.unregister(qe),this.mi.unregister(At),this.eo(),_t.info("All overrides cleared");if(R(t)){var e=Ga(t);return this.mi.register({[qe]:e}),this.eo(),_t.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,i=t;if(this.Fs=!!((r=i.suppressWarning)!==null&&r!==void 0&&r),"flags"in i){if(i.flags===!1)this.mi.unregister(qe),_t.info("Flag overrides cleared");else if(i.flags){if(R(i.flags)){var n=Ga(i.flags);this.mi.register({[qe]:n})}else this.mi.register({[qe]:i.flags});_t.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.mi.unregister(At),_t.info("Payload overrides cleared")):i.payloads&&(this.mi.register({[At]:i.payloads}),_t.info("Payload overrides set",{payloads:i.payloads}))),void this.eo()}if(t&&typeof t=="object")return this.mi.register({[qe]:t}),this.eo(),_t.info("Flag overrides set",{flags:t});se.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),r=e.flags,i=e.flagVariants;try{t(r,i)}catch(n){se.error("Error while running feature flags callback",n)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var i,n=(this.zs(pr)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=y({},this.getFlagVariants(),{[t]:e});(i=this.mi)==null||i.register({[Yr]:Object.keys(Va(a)),[bt]:a}),this.eo()}getEarlyAccessFeatures(t,e,r){e===void 0&&(e=!1);var i=this.zs(pr),n=r?"&"+r.map((s=>"stage="+s)).join("&"):"";if(i&&!e)return t(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+n),method:"GET",timestampMode:"query",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.mi)==null||o.unregister(pr),(a=this.mi)==null||a.register({[pr]:u}),t(u)}}})}ro(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((r=>e[r])),flagVariants:Object.keys(e).filter((r=>e[r])).reduce(((r,i)=>(r[i]=e[i],r)),{})}}eo(t){var e=this.ro(),r=e.flags,i=e.flagVariants;this.featureFlagEventHandlers.forEach((n=>{try{n(r,i,{errorsLoading:t})}catch(s){se.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(gt)||{},i=t?.$set||(t!=null&&t.$set_once?{}:t),n=t?.$set_once,s={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(s[o]=n[o]));this._instance.register({[gt]:y({},r,s,i)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=y({},this.zs(gt)||{});t.forEach((i=>{delete r[i]})),this._instance.register({[gt]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(gt),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(mt)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=y({},r[i],t[i]),delete t[i]})),this._instance.register({[mt]:y({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(mt)||{};this._instance.register({[mt]:y({},e,{[t]:{}})})}else this._instance.unregister(mt)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},id={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!((t=this.io)==null||!t.isStarted)}get status(){var t,e;return this.no===lr||this.no===qr?this.no:(t=(e=this.io)==null?void 0:e.status)!==null&&t!==void 0?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=Na,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Be.error("started without valid sessionManager"),new Error(Is+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===Ye)throw new Error(Is+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!((t=this._instance.get_property(xt))==null||!t.enabled),r=!this.Te.disable_session_recording,i=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&r&&!i}startIfEnabledOrStop(t){var e;if(!this.oo||(e=this.io)==null||!e.isStarted){var r=!x(Object.assign)&&!x(Array.from);this.oo&&r?(this.ao(t),Be.info("starting")):(this.no=Na,this.stopRecording())}}ao(t){var e,r,i;this.oo&&(this.no!==lr&&this.no!==qr&&(this.no=Da),T!=null&&(e=T.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(r=T.__PosthogExtensions__)!=null&&r.initSessionRecording?this.lo(t):(i=T.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.uo,(n=>{if(n)return Be.error("could not load recorder",n);this.lo(t)})))}stopRecording(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.stop()}ho(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.discard()}do(){var t,e;(t=this.mi)==null||t.unregister(Bs),(e=this.mi)==null||e.unregister(Cu)}co(t,e){if(O(t))return null;var r,i=ce(t)?t:parseFloat(t);return typeof(r=i)!="number"||!Number.isFinite(r)||0>r||r>1?(Be.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):i}vo(t){if(this.mi){var e,r,i=this.mi,n=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.co((s=this.Te.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.co(o?.sampleRate,"remote config sampleRate"),l=a??u;O(l)&&this.do();var c=o?.minimumDurationMilliseconds;i.register({[xt]:y({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:y({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:x(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};n(),(e=this.so)==null||e.call(this),this.so=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===lr&&(this.no=qr,Be.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var r;e===void 0&&(e="log"),(r=this.io)!=null&&r.log?this.io.log(t,e):Be.warn("log called before recorder was ready")}get uo(){var t,e,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(xt);return(r==null||(e=r.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}fo(){var t,e,r=this._instance.get_property(xt);if(!r)return!1;try{e=typeof r=="object"?r:JSON.parse(r)}catch(n){return Be.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}var i=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-i}lo(t){var e,r;if((e=T.__PosthogExtensions__)==null||!e.initSessionRecording)return Be.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lu]:!0});if(this.io||(this.io=(r=T.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===qr||this.no===lr?void 0:(this.no=lr,Be.info("persisted remote config is stale, requesting fresh config before starting"),void new Ei(this._instance).load());this.no=Da,this.io.start(t)}onRRwebEmit(t){var e;(e=this.io)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||(e=this.mi)==null||e.register({[Au]:!0}),(t=this.io)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||(e=this.mi)==null||e.register({[Iu]:!0}),(t=this.io)==null||t.overrideSampling()}overrideTrigger(t){var e,r;this.io||(r=this.mi)==null||r.register({[t==="url"?Ru:Ou]:!0}),(e=this.io)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.io)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!((r=this.io)==null||!r.tryAddCustomEvent(t,e))}}},nd={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Ii(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,r=J(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((i=>new RegExp(i))),r.url_ignorelist=(e=r.url_ignorelist)==null?void 0:e.map((i=>new RegExp(i))),r}wo(){if(this.isBrowserSupported()){if(v&&S){var t=r=>{r=r||v?.event;try{this.xo(r)}catch(i){mn.error("Failed to capture event",i)}};if(re(S,"submit",t,{capture:!0}),re(S,"change",t,{capture:!0}),re(S,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=r=>{r=r||v?.event;try{this.xo(r,gn)}catch(i){mn.error("Failed to capture copy/cut event",i)}};re(S,"copy",e,{capture:!0}),re(S,"cut",e,{capture:!0})}}}else mn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var r=e.autocapture_opt_out;Me(r)&&(this.instance.persistence&&this.instance.persistence.register({[Gn]:r}),this.mo=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,r=[];return(e=this._o)==null||e.forEach((i=>{var n=S?.querySelectorAll(i);n?.forEach((s=>{t===s&&r.push(i)}))})),r}get isEnabled(){var t,e,r=(t=this.instance.persistence)==null?void 0:t.props[Gn],i=this.mo,n=this.instance.Ur()&&!this.yo;if(ve(i)&&!Me(r)&&!n)return!1;var s=(e=this.mo)!==null&&e!==void 0?e:!!r;return!!this.instance.config.autocapture&&!s}xo(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var r,i=an(t);Bu(i)&&(i=i.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&wa(i,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var n=e===gn;if(i&&(function(h,d,f,p,_,m){var g;if(!v||Ks(h)||f!=null&&f.url_allowlist&&!ya(f.url_allowlist,m)||f!=null&&f.url_ignorelist&&ya(f.url_ignorelist,m))return!1;if(f!=null&&f.dom_event_allowlist){var E=f.dom_event_allowlist;if(E&&!E.some((b=>d.type===b)))return!1}var $=Yu(h,p),k=$.parentIsUsefulElement,z=$.targetElementList;if(!(function(b,P){var C=P?.element_allowlist;if(x(C))return!0;var M,I=function(Q){if(C.some((G=>Q.tagName.toLowerCase()===G)))return{v:!0}};for(var Z of b)if(M=I(Z))return M.v;return!1})(z,f)||!ps(z,f?.css_selector_allowlist)||ps(z,(g=f?.css_selector_ignorelist)!==null&&g!==void 0?g:_h))return!1;try{var L=v.getComputedStyle(h);if(L&&L.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var F=h.tagName.toLowerCase();switch(F){case"html":return!1;case"form":return(_||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(d.type)>=0;default:return k?(_||["click"]).indexOf(d.type)>=0:(_||["click"]).indexOf(d.type)>=0&&(Ws.indexOf(F)>-1||h.getAttribute("contenteditable")==="true")}})(i,t,this.Te,n,n?["copy","cut"]:void 0,this.instance)){var s=Jh(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),e===gn){var u,l=qu(v==null||(u=v.getSelection())==null?void 0:u.toString()),c=t.type||"clipboard";if(!l)return!1;o.$selected_content=l,o.$copy_type=c}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return Oe(S?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(v&&((e=v.history[t])==null||!e.__posthog_wrapped__)){var r=this;(function(i,n,s){try{if(!(n in i))return Za;var o={next:i[n]},a=s((function(){for(var u=arguments.length,l=new Array(u),c=0;u>c;c++)l[c]=arguments[c];return o.next.apply(this,l)}));return Oe(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),i[n]=a,()=>{if(i[n]!==a)for(var u=i[n];Oe(u)&&u.__posthog_layer__;){var l=u.__posthog_layer__;if(l.next===a)return void(l.next=o.next);u=l.next}else i[n]=o.next}}catch{return Za}})(v.history,t,(i=>function(n,s,o){i.call(this,n,s,o),r.Io(t)}))}}Io(t){try{var e,r=v==null||(e=v.location)==null?void 0:e.pathname;if(!r)return;r!==this.ko&&this.isEnabled&&this._instance.capture(Rt,{navigation_type:t}),this.ko=r}catch(i){w.error("Error capturing "+t+" pageview",i)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};re(v,"popstate",t),this.So=()=>{v&&v.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!((e=this.instance.persistence)==null||!e.props[Vn]),this.rageclicks=new Ii(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return J(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return O(this.Te.capture_heatmaps)?O(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;Qh.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval((t=this.Eo)!==null&&t!==void 0?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vn]:r}),this.Mo=r,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){bn(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=S?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){v&&S&&(this.Fo=this.oi.bind(this),re(v,gi,this.Fo),this.Lo=t=>this.pe(t||v?.event),re(S,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||v?.event),re(S,"mousemove",this.$o,{capture:!0}),this.No=new yi(this.instance,$h,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),re(S,vi,this.Do),this.po=!0)}Po(){var t;v&&S&&(this.Fo&&v.removeEventListener(gi,this.Fo),this.Lo&&S.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&S.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&S.removeEventListener(vi,this.Do),clearTimeout(this.qo),(t=this.No)==null||t.stop(),this.po=!1)}jo(t,e){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),s=(function(o,a,u){for(var l=o;l&&ut(l)&&!we(l,"body");){if(l===u)return!1;var c=void 0;try{var h,d,f;c=(h=(d=(f=l.ownerDocument)==null?void 0:f.defaultView)!==null&&d!==void 0?d:v)==null?void 0:h.getComputedStyle(l).position}catch{return!1}if(A(a,c))return!0;l=Wu(l)}return!1})(an(t),["fixed","sticky"],n);return{x:t.clientX+(s?0:i),y:t.clientY+(s?0:r),target_fixed:s,type:e}}pe(t,e){var r;if(e===void 0&&(e="click"),!ma(t.target)&&bn(t)){var i=this.jo(t,e);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&wa(an(t),this.instance.config.rageclick)&&this.Nt(y({},i,{type:"rageclick"})),this.Nt(i)}}Ao(t){!ma(t.target)&&bn(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(v){var e=this.Te.disable_capture_url_hashes?at(v.location.href):v.location.href,r=this.Te.custom_personal_data_properties,i=this.Te.mask_personal_data_properties?[...Ht,...r||[]]:[],n=Sr(e,i,Pr);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(t)}}oi(){this.R&&!ot(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:yi,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((r,i)=>y({},r,{["$web_vitals_"+i.name+"_event"]:y({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=r=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.zo();if(!x(n))if(O(r?.name)||O(r?.value))ft.error("Invalid metric received",r);else if(!this.Vo||this.Vo>r.value){this.R.url!==n&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),x(this.R.url)&&(this.R.url=n),this.R.firstMetricTimestamp=x(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0);var s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),o=y({},r,{$current_url:n,timestamp:Date.now()});x(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this.R.metrics.push(o),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else ft.error("Ignoring metric with value >= "+this.Vo,r)},this.Wo=()=>{if(!this.po){var r,i,n,s,o=T.__PosthogExtensions__;if(!x(o)&&!x(o.postHogWebVitalsCallbacks)){var a=o.postHogWebVitalsCallbacks;r=a.onLCP,i=a.onCLS,n=a.onFCP,s=a.onINP}r&&i&&n&&s?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uo.bind(this)),this.po=!0):ft.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[Yn]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,r=J(this.Zo)?(t=this.Zo)==null?void 0:t.web_vitals_allowed_metrics:void 0;return O(r)?((e=this._instance.persistence)==null?void 0:e.props[Jn])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(J(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=J(this.Zo)?this.Zo.web_vitals_attribution:void 0;return t!=null&&t}get Vo(){var t=J(this.Zo)&&ce(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:La;return t>0&&6e4>=t?La:t}get isEnabled(){var t=ne?.protocol;if(t!=="http:"&&t!=="https:")return ft.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=J(this.Zo)?this.Zo.web_vitals:Me(this.Zo)?this.Zo:void 0;return Me(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(ft.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var r=J(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=J(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yn]:r}),this._instance.persistence.register({[Jn]:i})),this.Mo=r,this.startIfEnabled()}}}er(t){var e,r;(e=T.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(r=T.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?ft.error("failed to load script",i):t()}))}zo(){var t=v?this._instance.config.disable_capture_url_hashes?at(v.location.href):v.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Ht,...e||[]]:[];return Sr(t,r,Pr)}ft.error("Could not determine current URL")}}},sd={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var r;if(v&&this.isEnabled&&(r=T.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var i=T.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=T.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=T.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=n(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=s(this.captureException.bind(this)))}catch(o){ur.error("failed to start",o),this.Ko()}}},this._instance=t,this.Yo=!((e=this._instance.persistence)==null||!e.props[qn]),this.Xo=new Tn(y({},(function(r){var i,n,s,o;return r===void 0&&(r={}),{refillRate:(i=(n=r.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:r.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:ur})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return J(t)?e=y({},e,t):(x(t)?this.Yo:t)&&(e=y({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ur.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,r;(e=T.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(r=T.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return ur.error("failed to load script",i);t()}))}Ko(){var t,e,r;(t=this.Go)==null||t.call(this),this.Go=void 0,(e=this.Qo)==null||e.call(this),this.Qo=void 0,(r=this.Jo)==null||r.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[qn]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(t){var e,r,i,n=(e=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&e!==void 0?e:"Exception";this.Xo.consumeRateLimit(n)?ur.info("Skipping exception capture because of client rate limiting.",{exception:n}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.ta=[],this.ra=new On([new Fn,new Hn,new Ln,new Zn,new jn,new Dn,new Nn,new Un],(function(i){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;n>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var l=[],c=a.split(`
2
+ `),h=u;c.length>h;h++){var d=c[h];if(1024>=d.length){var f=fa.test(d)?d.replace(fa,"$1"):d;if(!f.match(/\S*Error: /)){for(var p of s){var _=p(f,i);if(_){l.push(_);break}}if(l.length>=50)break}}}return(function(m){if(!m.length)return[];var g=Array.from(m);return g.reverse(),g.slice(0,50).map((E=>{return y({},E,{filename:E.filename||($=g,$[$.length-1]||{}).filename,function:E.function||jt});var $}))})(l)}})("web:javascript",Yc,Qc)),this._instance=t,this.ta=(e=(r=this._instance.persistence)==null?void 0:r.get_property(Wn))!==null&&e!==void 0?e:[],this.ia=ci(this.na()),this.sa=new Bn(this.ia)}onConfigChange(){this.ia=ci(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,r,i;if(t.ok){var n=t.config;if("errorTracking"in n){var s=(e=(r=n.errorTracking)==null?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],o=(i=n.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ta=s,this._instance.persistence&&this._instance.persistence.register({[Wn]:this.ta,[Kn]:o})}}}get oa(){var t,e=!!this._instance.get_property(Kn),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.ra.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!H(t)||t.trim().length===0)return void Ge.warn("Ignoring exception step because message must be a non-empty string");var r=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce(((a,u)=>rh.has(u)?(o.push(u),a):(a[u]=s[u],a)),{}),droppedKeys:o}})(this.aa(e)),i=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Ge.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.sa.add(y({[ui]:t,[li]:new Date().toISOString()},i))}catch(s){Ge.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void Ge.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void Ge.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Ge.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.ia.enabled&&O(t.$exception_steps)?this.va(t):t;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return i&&this.sa.clear(),i}catch(n){return Ge.error("Failed to capture exception event. Dropping this exception.",n),void this.sa.clear()}}catch(n){return void Ge.error("Failed to process exception event. Ignoring this exception.",n)}}va(t){try{var e=this.sa.getAttachable();return e.length===0?t:y({},t,{$exception_steps:e})}catch(r){return Ge.error("Failed to read buffered exception steps. Capturing exception without steps.",r),t}}ha(t){this.ia.enabled&&this.sa.add({[ui]:t,[li]:new Date().toISOString()})}aa(t){return J(t)?y({},t):{}}na(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}ua(t){if(t.length===0)return!1;var e=t.reduce(((r,i)=>{var n=i.type,s=i.value;return H(n)&&n.length>0&&r.$exception_types.push(n),H(s)&&s.length>0&&r.$exception_values.push(s),r}),{$exception_types:[],$exception_values:[]});return this.ta.some((r=>{var i=r.values.map((n=>{var s,o=$l[n.operator],a=R(n.value)?n.value:[n.value],u=(s=e[n.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)}));return r.type==="OR"?i.some(Boolean):i.every(Boolean)}))}da(t){return t.flatMap((e=>{var r,i;return(r=(i=e.stacktrace)==null?void 0:i.frames)!==null&&r!==void 0?r:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ca(t){if(t.length>0){var e,r,i,n,s=(e=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(i=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}la(t){return!O(t)&&R(t)}}},od=y({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var r,i;if(this.mi&&this.mi.register({[Hs]:!!e.productTours}),!wn(this._instance))return!this.fa&&O((r=this.mi)==null?void 0:r.props[fr])||xn.info("product tours disabled; stopping and clearing cached tours"),(i=this.fa)==null||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&wn(this._instance)&&this.er((()=>this.ga()))}er(t){var e,r;(e=T.__PosthogExtensions__)!=null&&e.generateProductTours?t():(r=T.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(i=>{i?xn.error("Could not load product tours script",i):t()}))}ga(){var t;!this.fa&&(t=T.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.fa=T.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!R(this.pa)||e){var r=this.mi;if(r){var i=r.props[fr];if(R(i)&&!e)return this.pa=i,void t(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:n=>{if(wn(this._instance)){var s=n.statusCode;if(s!==200||!n.json){var o="Product Tours API could not be loaded, status: "+s;return xn.error(o),void t([],{isLoaded:!1,error:o})}var a=R(n.json.product_tours)?n.json.product_tours:[];this.pa=a,r&&r.register({[fr]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){O(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;(e=this.fa)==null||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),(e=this.fa)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.fa)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.fa)==null||t.nextStep()}previousStep(){var t;(t=this.fa)==null||t.previousStep()}clearCache(){var t;this.pa=null,(t=this.mi)==null||t.unregister(fr)}resetTour(t){var e;(e=this.fa)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.fa)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.fa)==null||e.cancelPendingTour(t)}}},Oi),ad={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var r=this.globalsForEvent(e);this.ya.push(r),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return(t=T._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,r,i,n,s,o,a;if(!t)throw new Error("Event payload is required");var u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(c)){var d=h[0];u[d]={id:l[d],type:d,properties:h[1]}}var f=t.$set_once,p=t.$set;return{event:y({},Ya(t,ed),{properties:y({},t.properties,p?{$set:y({},(e=(r=t.properties)==null?void 0:r.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:y({},(i=(n=t.properties)==null?void 0:n.$set_once)!==null&&i!==void 0?i:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}wa(t){var e,r=(e=t.tagName)==null?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Le.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Le.error("prepare_external_dependency_script returned null"),null):t}xa(){var t,e,r,i,n,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=S?.defaultView,l=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!l)return()=>{};if(this.ma++,this.ka)return this.Sa();var c=[],h=this,d=new WeakSet,f=(m,g,E)=>{if(m!=null&&m[g]){var $=m[g];m[g]=E($),c.push((()=>{m[g]=$}))}},p=m=>{if(d.has(m))return m;var g=h.wa(m);return g&&d.add(g),g},_=m=>m.map((g=>typeof g=="string"?g:p(g))).filter((g=>!ve(g)));return f(l,"appendChild",(m=>function(g){var E=p(g);return E?m.call(this,E):g})),f(l,"insertBefore",(m=>function(g,E){var $=p(g);return $?m.call(this,$,E):g})),f(l,"replaceChild",(m=>function(g,E){var $=p(g);return $?m.call(this,$,E):E})),[(e=u.Element)==null?void 0:e.prototype,(r=u.Document)==null?void 0:r.prototype,(i=u.DocumentFragment)==null?void 0:i.prototype].forEach((m=>{f(m,"append",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"prepend",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))}))})),[(n=u.Element)==null?void 0:n.prototype,(s=u.CharacterData)==null?void 0:s.prototype,(o=u.DocumentType)==null?void 0:o.prototype].forEach((m=>{f(m,"before",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"after",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];return g.apply(this,_($))})),f(m,"replaceWith",(g=>function(){for(var E=arguments.length,$=new Array(E),k=0;E>k;k++)$[k]=arguments[k];var z=_($);return $.length&&!z.length?void 0:g.apply(this,z)}))})),f((a=u.Element)==null?void 0:a.prototype,"insertAdjacentElement",(m=>function(g,E){var $=p(E);return $?m.call(this,g,$):null})),this.ka=()=>{c.forEach((m=>m())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,this.ma===0&&((e=this.ka)==null||e.call(this)))}}Ca(t,e){e===void 0&&(e=!0);var r=this.xa();try{var i=t(r);return e&&r(),i}catch(n){throw r(),n}}setupSiteApp(t){var e=this.apps[t.id],r=()=>{var o;!e.errored&&this.ya.length&&(Le.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((a=>this.Ca((()=>e.processEvent==null?void 0:e.processEvent(a))))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this._a)==null||o.call(this))},i=!1,n=o=>{e.errored=!o,e.loaded=!0,Le.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),i&&r()};try{var s=this.Ca((o=>t.init({posthog:this._instance,callback(a){o(),n(a)}})),!1).processEvent;s&&(e.processEvent=s),i=!0}catch(o){Le.error(ja+t.id,o),n(!1)}if(i&&e.loaded)try{r()}catch(o){Le.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}Ia(t){var e=this;if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t),i=function(s){try{e.Ca((()=>s.processEvent==null?void 0:s.processEvent(r)))}catch(o){Le.error("Error while processing event "+t.event+" for site app "+s.id,o)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(t){var e,r,i,n=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(u=>this.Ia(u)))):void Le.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this._a)==null||r.call(this),t.ok){var s=t.config;if((i=s.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(){var u,l=a.id,c=a.url;T["__$$ph_site_app_"+l]=n._instance,(u=T.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(n._instance,c,(h=>{if(h)return Le.error(ja+l,h)}))};for(var a of s.siteApps)o()}else Le.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},ud={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,r,i=this.Pa();i?(x(this.Ma)&&(this.Ma=(e=T.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),x(this.Ea)&&(this.Ea=(r=T.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null?void 0:r._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,r;(e=T.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(r=T.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Xh.error("failed to load script",i);t()}))}Oa(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Pa(){var t=this.Oa();return R(t)?(R(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(R(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;(t=this.Ma)==null||t.call(this),(e=this.Ea)==null||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},ld=y({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return U.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(O(e))return U.warn("Flags not loaded yet. Not loading surveys.");var r=R(e);this.Fa=r?e.length>0:e,U.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(i!=null&&i.startsWith(Sl)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((n=>localStorage.removeItem(n)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)U.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)U.info(Ua);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var t=T?.__PosthogExtensions__;if(t){if(!x(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var r=t.generateSurveys;if(r)return void this.Da(r,e);var i=t.loadExternalDependency;if(!i)return void this.qa(Gs);i(this._instance,"surveys",(n=>{n||!t.generateSurveys?this.qa("Could not load surveys script",n):this.Da(t.generateSurveys,e)}))}catch(n){throw this.qa("Error initializing surveys",n),n}finally{this.La=!1}}}else U.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Os(this._instance),U.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){U.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return U.info(Ua),t([]);var r,i=this._instance.get_property(es);if(i&&!e)return t(i,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((n=>t(n.surveys,n.context))):(typeof Promise<"u"&&(this.Aa=new Promise((n=>{r=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:n=>{var s;this.Aa=null;var o=n.statusCode;if(o!==200||!n.json){var a="Surveys API could not be loaded, status: "+o;U.error(a),this.Na=Date.now();var u={isLoaded:!1,error:a};return t([],u),void(r==null||r({surveys:[],context:u}))}this.Na=null;var l,c=n.json.surveys||[],h=c.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(kl(f)||(function(p){var _;return!((_=p.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(f))));h.length>0&&((l=this._surveyEventReceiver)==null||l.register(h)),(s=this._instance.persistence)==null||s.register({[es]:c,[pi]:Date.now()});var d={isLoaded:!0};t(c,d),r?.({surveys:c,context:d})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(pi);return ce(t)&&Date.now()-t>3e5}Ua(){return ce(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var r,i={id:t,current_iteration:(r=e?.iteration)!==null&&r!==void 0?r:null};Pl(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){U.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);U.warn("init was not called")}za(t){var e=null;return this.getSurveys((r=>{var i;e=(i=r.find((n=>n.id===t)))!==null&&i!==void 0?i:null})),e}Va(t){if(O(this._surveyManager))return{eligible:!1,reason:Wr};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(O(this._surveyManager))return{eligible:!1,reason:Wr};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(O(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:Wr};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return O(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Wr})):new Promise((r=>{this.getSurveys((i=>{var n,s=(n=i.find((a=>a.id===t)))!==null&&n!==void 0?n:null;if(s){var o=this.Wa(s);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,r){var i;if(O(this._surveyManager))U.warn("init was not called");else{var n=typeof t=="string"?this.za(t):t;if(n!=null&&n.id)if(Bh.includes(n.type)){var s=S?.querySelector(e);if(s)return(i=n.appearance)!=null&&i.surveyPopupDelaySeconds?(U.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;U.info("Rendering survey "+n.id+" with delay of "+((o=n.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(n,s,r),U.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);U.warn("Survey element not found")}else U.warn("Surveys of type "+n.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(t,e){var r;if(O(this._surveyManager))U.warn("init was not called");else{var i=this.za(t);if(i){var n=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=y({},i,{appearance:y({},i.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==vs.Popover&&e.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.Va(i);if(!s.eligible)return void U.warn("Survey is not eligible to be displayed: ",s.reason)}e.displayType!==vs.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(t){O(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Oi),cd={toolbar:class{constructor(t){this.instance=t}Za(t){T.ph_toolbar_state=t}Ga(){var t;return(t=T.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,r){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),Nu(this.instance.config)||!v||!S)return!1;t=t??v.location,r=r??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var i,n=td||wi(t.hash,"__posthog")||wi(t.hash,"state"),s=n?va((()=>JSON.parse(atob(decodeURIComponent(n)))))||va((()=>JSON.parse(decodeURIComponent(n)))):null;return s&&s.action==="ph_authorize"?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((i=JSON.parse(e.getItem(Ha)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Qa(t){var e=T.ph_load_toolbar||T.ph_load_editor;!O(e)&&Oe(e)?e(t,this.instance):Ba.warn("No toolbar load function found")}loadToolbar(t){var e=!(S==null||!S.getElementById(Hu));if(!v||e)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=y({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(v.localStorage.setItem(Ha,JSON.stringify(y({},i,{source:void 0}))),this.Ga()===2)this.Qa(i);else if(this.Ga()===0){var n;this.Za(1),(n=T.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return Ba.error("[Toolbar] Failed to load",s),void this.Za(0);this.Za(2),this.Qa(i)})),re(v,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(i)}))}return!0}Ja(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,r){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,e,r)}}},hd=y({experiments:Ms},Oi),dd={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;O(e)||(Me(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||Nu(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=T?.__PosthogExtensions__;if(t&&!x(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var r=t.loadExternalDependency;if(!r)return void this.tl(Gs);r(this._instance,"conversations",(i=>{i||!t.initConversations?this.tl("Could not load conversations script",i):this.el(t.initConversations),this.Ya=!1}))}catch(i){this.tl("Error initializing conversations",i),this.Ya=!1}}else ze.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),ze.info("Conversations loaded successfully")}catch(e){this.tl("Error completing conversations initialization",e)}else ze.error("Cannot complete initialization: remote config is null")}tl(t,e){ze.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():ze.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!ve(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var i=this;return ie((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(t,e,r):(ze.warn(vt),null)}))()}getMessages(t,e){var r=this;return ie((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(ze.warn(vt),null)}))()}markAsRead(t){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(ze.warn(vt),null)}))()}getTickets(t){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(ze.warn(vt),null)}))()}requestRestoreLink(t){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(ze.warn(vt),null)}))()}restoreFromToken(t){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(ze.warn(vt),null)}))()}restoreFromUrlToken(){var t=this;return ie((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ze.warn(vt),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}En(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Rn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},pd={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=X("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var r,i;this.Hs=0,(r=this.ol)==null||r.onReconnect(),(i=this.al)==null||i.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.rl=!0),v&&re(v,"online",this.sl)}ll(t,e,r,i){var n,s=(function(o,a){var u,l,c,h,d,f,p,_=(u=o?.flushIntervalMs)!==null&&u!==void 0?u:3e3,m=(l=o?.maxBufferSize)!==null&&l!==void 0?l:100,g=a!=null&&a.consoleCapture?void 0:(c=o?.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,E=x(g)?Math.max(m,2048):Math.max(m,g),$=o?.resourceAttributes;return{serviceName:(h=(d=$?.["service.name"])!==null&&d!==void 0?d:o?.serviceName)!==null&&h!==void 0?h:a?.serviceNameDefault,serviceVersion:(f=$?.["service.version"])!==null&&f!==void 0?f:o?.serviceVersion,environment:(p=$?.["deployment.environment"])!==null&&p!==void 0?p:o?.environment,resourceAttributes:$,beforeSend:o?.beforeSend,flushIntervalMs:_,maxBufferSize:m,maxQueueSize:E,maxBatchRecordsPerPost:100,rateCapWindowMs:_,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((n=this._instance)==null||(n=n.config)==null?void 0:n.logs,r);return[new Bc(this.ul(t,e),s,this.Ge,(()=>this.hl()),(o=>o()),void 0,i),s]}dl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.ol||this.cl!==e){var r;(r=this.ol)==null||r.reset(),this.cl=e;var i=this.ll((()=>this.Gr),(n=>{this.Gr=n}));this.ol=i[0],this.vl=i[1]}return this.ol}fl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.al||this.pl!==e){var r;(r=this.al)==null||r.reset(),this.pl=e;var i=this.ll((()=>this.nl),(n=>{this.nl=n}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Wa);this.al=i[0],this.gl=i[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var r=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!O(r)&&r&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],(t=this.ol)==null||t.reset(),this.nl=[],(e=this.al)==null||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))),this.al&&this.al.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.rl&&!this.il){var t=T?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(r=>{var i;r||(i=t.logs)==null||!i.initializeLogs?this.Ge.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Gs)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:i=>i===We.LogsQueue?t():void 0,setPersistedProperty(i,n){var s;i===We.LogsQueue&&e((s=n)!==null&&s!==void 0?s:[])},Tt:i=>this.Tt(i),getLibraryId:()=>D.LIB_NAME,getLibraryVersion:()=>D.LIB_VERSION}}Tt(t){return new Promise((e=>{if(il(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,i=s=>{r||(r=!0,clearTimeout(n),e(s))},n=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this._l(o),o>=200&&300>o)i({kind:"ok"});else if(o===413)i({kind:"too-large"});else if(o!==0&&o!==429&&500>o)i({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;i({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}}))}_l(t){(t!==0||this._instance.__loaded)&&(this.Hs=nl(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,D.LIB_NAME,(e=>{this.Gr=e})),this.nl.length>0&&this.wl(t,this.nl,this.gl,Wa,(e=>{this.nl=e}))}wl(t,e,r,i,n){if(e.length!==0){var s=e.map((a=>a.record));n([]);var o=ku(s,Eu(r,D.LIB_NAME,D.LIB_VERSION),i,D.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=i,O(n)||(e.sessionStartTimestamp=n),O(s)||(e.lastActivityTimestamp=s)}if(T!=null&&(t=T.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?at(T.location.href):T.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},fd={metrics:class{constructor(t){this.Ge=X("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,r=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.ol&&this.cl===r||((e=this.ol)==null||e.reset(),this.cl=r,this.ol=new Gc(this.ul(),(function(i){var n,s,o,a,u,l=i?.resourceAttributes;return{serviceName:(n=l?.["service.name"])!==null&&n!==void 0?n:i?.serviceName,serviceVersion:(s=l?.["service.version"])!==null&&s!==void 0?s:i?.serviceVersion,environment:(o=l?.["deployment.environment"])!==null&&o!==void 0?o:i?.environment,resourceAttributes:l,beforeSend:i?.beforeSend,flushIntervalMs:(a=i?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(u=i?.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(r),this.Ge)),this.ol}count(t,e,r){e===void 0&&(e=1),this.dl().count(t,e,r)}gauge(t,e,r){this.dl().gauge(t,e,r)}histogram(t,e,r){this.dl().histogram(t,e,r)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((r=>this.Ge.error("PostHog metrics flush failed:",r)))}reset(){var t;(t=this.ol)==null||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:r=>e.Bt(r),getLibraryId:()=>D.LIB_NAME,getLibraryVersion:()=>D.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var i=!1,n=o=>{i||(i=!0,clearTimeout(s),r(o))},s=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(y({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==429&&500>a)n({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var u;n({kind:"retry-later",error:(u=o.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+a)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},_d=y({},Oi,id,nd,sd,od,ad,ld,ud,cd,hd,dd,pd,fd);$t.__defaultExtensionClasses=y({},_d);var Ee=(function(){D.SDK_DIST_CHANNEL="npm";var t=xr[Ot]=new $t;return(function(){function e(){e.done||(e.done=!0,Tl=!1,B(xr,(function(r){r._dom_loaded()})))}S!=null&&S.addEventListener?S.readyState==="complete"?e():re(S,"DOMContentLoaded",e,{capture:!1}):v&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();var Il=!1;function De(){return Il}function vd(){Il=!0}function gd(t){try{return new URL(t.includes("://")?t:`https://${t}`).host}catch{return t}}var md=[{key:"autocapture",triggeredBy:!1,cost:"no automatic click/form-submit capture - the dashboard only sees events you call trackEvent for yourself (pageviews and rage-clicks are captured separately and are unaffected)"},{key:"maskAllText",triggeredBy:!0,cost:"autocaptured elements lose their text, which blanks the recap's friction labels"},{key:"maskAllElementAttributes",triggeredBy:!0,cost:"autocaptured elements lose their attributes, which blanks the recap's friction labels"}];function yd(t){let e=md.filter(i=>t[i.key]===i.triggeredBy);if(e.length===0)return;let r=e.map(i=>`${i.key} - ${i.cost}`).join("; ");console.info(`[HeyCatch] quality note: ${r}`)}var Cl=new Set(["heycatch_agent","heycatch_custom_user_event","heycatch_framework","heycatch_framework_version","heycatch_project_key","heycatch_sdk_stage","heycatch_sdk_version"]);function bd(t){let e=t.filter(r=>Cl.has(r));return e.length>0&&console.error(`[HeyCatch] propertyDenylist cannot exclude HeyCatch's own attribution keys (${e.join(", ")}) - ignoring those entries.`),t.filter(r=>!Cl.has(r))}function xd(t){return{heycatch_sdk_version:st,heycatch_sdk_stage:nt,heycatch_project_key:t.projectKey,heycatch_framework:t.install.framework,heycatch_framework_version:t.install.frameworkVersion,heycatch_agent:t.install.agent}}function wd(t,e){let r=i=>i===null?null:{...i,properties:{...i.properties,...e}};return t===void 0?[r]:[...Array.isArray(t)?t:[t],r]}var Qs=null;function Al(){Qs?.()}function Rl(t){if(De()||!Ze()||Lr())return;let e=qo({stage:nt,hostname:globalThis.location.hostname});if(e!==null){console.error(e);return}let r=Wo.safeParse(t);if(!r.success){let o=r.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}console.info(`[HeyCatch] SDK v${st} (${nt}) initialized \u2192 ${Zr}`);let i={api_host:Zr,defaults:"2026-01-30",disable_compression:!0,disable_session_recording:!0,disable_surveys:!0,advanced_disable_flags:!0,mask_personal_data_properties:!0,opt_out_persistence_by_default:!0,rageclick:!0,...(()=>{let o=[...globalThis.location.host?[globalThis.location.host]:[],...r.data.tracingHosts.map(a=>gd(a))];return o.length>0?{tracing_headers:[...new Set(o)]}:{}})(),...r.data.autocapture===void 0?{}:{autocapture:r.data.autocapture},...r.data.maskAllText===void 0?{}:{mask_all_text:r.data.maskAllText},...r.data.maskAllElementAttributes===void 0?{}:{mask_all_element_attributes:r.data.maskAllElementAttributes},...r.data.propertyDenylist===void 0?{}:{property_denylist:bd(r.data.propertyDenylist)},...r.data.sanitizeProperties===void 0?{}:{sanitize_properties:r.data.sanitizeProperties},...r.data.beforeSend===void 0&&r.data.sanitizeProperties===void 0?{}:{before_send:wd(r.data.beforeSend,xd(r.data))},...r.data.persistence===void 0?{}:{persistence:r.data.persistence},...r.data.disablePersistence===void 0?{}:{disable_persistence:r.data.disablePersistence},...r.data.cookieExpirationDays===void 0?{}:{cookie_expiration:r.data.cookieExpirationDays},...r.data.optOutCapturingByDefault===void 0?{}:{opt_out_capturing_by_default:r.data.optOutCapturingByDefault},...r.data.respectDnt===void 0?{}:{respect_dnt:r.data.respectDnt}};yd(r.data),Ee.init(Vo,i);let{install:n}=r.data,s={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};Qs=()=>{Ee.register({heycatch_sdk_version:st,heycatch_sdk_stage:nt,heycatch_project_key:r.data.projectKey,...s}),Ee.group(io,r.data.projectKey,{key:r.data.projectKey,sdk_version:st,sdk_stage:nt,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,origin:globalThis.location.origin,api_host:Zr})},Qs(),Jo(),vd()}var Ol={in:"[HeyCatch] optInCapturing() was called before init(), so the consent grant was NOT recorded - if init() runs with optOutCapturingByDefault: true, capturing stays off. Call init() first, then optInCapturing() once consent is granted.",out:"[HeyCatch] optOutCapturing() was called before init(), so the withdrawal was NOT recorded - capturing starts when init() runs. Call init() first, or pass optOutCapturingByDefault: true to start with capturing off."};function Ml(){if(!De()){console.warn(Ol.in);return}Ee.opt_in_capturing()}function Fl(){if(!De()){console.warn(Ol.out);return}Ee.opt_out_capturing()}function Zl(t,e,r){if(!(!De()||!Ze())){if(typeof t!="string"||t.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}Ee.identify(t,e,r)}}function Ll(){!De()||!Ze()||(Ee.reset(),Al())}function Nl(t,e,r){if(!(!De()||!Ze())){if(typeof t!="string"||t.length===0){console.error('[HeyCatch] trackEvent() requires a non-empty event name, e.g. track("signup_completed").');return}if(t.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${t}") - that prefix is reserved for built-in events.`);return}Ee.capture(t,{...e,...$d(r),heycatch_custom_user_event:!0})}}function Dl(t,e){!De()||!Ze()||!t&&!e||Ee.setPersonProperties(t,e)}function $d(t){let e={};return t?.set&&(e.$set=t.set),t?.setOnce&&(e.$set_once=t.setOnce),e}var Ed={init:Rl,optInCapturing:Ml,optOutCapturing:Fl,resetIdentity:Ll,setIdentity:Zl,setPersonProperties:Dl,trackEvent:Nl};Lr();0&&(module.exports={KNOWN_FRAMEWORKS,KNOWN_INSTALL_AGENTS,SDK_VERSION,STAGE,UNKNOWN_INSTALL_VALUE,analytics});
3
3
  //# sourceMappingURL=index.cjs.map