posthog-js 1.396.7 → 1.396.8

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/main.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s="1.396.7",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="$device_model",u="__alias",h="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",p="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",_="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$web_vitals_allowed_metrics",b="$session_recording_remote_config",w="$replay_sample_rate",x="$replay_override_sampling",E="$replay_override_linked_flag",S="$replay_override_url_trigger",T="$replay_override_event_trigger",k="$sesid",R="$session_is_sampled",P="$enabled_feature_flags",O="$active_feature_flags",I="$early_access_features",C="$feature_flag_details",A="$feature_flag_payloads",F="$feature_flag_request_id",M="$override_feature_flags",D="$override_feature_flag_payloads",L="$stored_person_properties",N="$stored_group_properties",U="$surveys",j="$surveys_loaded_at",B="$surveys_activated",z="ph_product_tours",H="$flag_call_reported",q="$flag_call_reported_session_id",V="$feature_flag_errors",G="$feature_flag_evaluated_at",W="$user_state",Y="$client_session_props",K="$capture_rate_limit",J="$initial_campaign_params",Q="$initial_referrer_info",X="$initial_person_info",Z="$epp",tt="__POSTHOG_TOOLBAR__",et="$posthog_cookieless",it="$sdk_debug_extensions_init_method",rt="$sdk_debug_extensions_init_time_ms",st="$sdk_debug_recording_script_not_loaded",nt="PostHog loadExternalDependency extension not found.",ot="on_reject",at="always",lt="anonymous",ut="identified",ht="identified_only",dt="visibilitychange",vt="beforeunload",ct="$pageview",pt="$pageleave",ft="$identify",_t="$groupidentify",gt="undefined"!=typeof window?window:void 0,mt="undefined"!=typeof globalThis?globalThis:gt;"undefined"==typeof self&&(mt.self=mt),"undefined"==typeof File&&(mt.File=function(){});var yt=null==mt?void 0:mt.navigator,bt=null==mt?void 0:mt.document,wt=null==mt?void 0:mt.location,xt=null==mt?void 0:mt.fetch,Et=null!=mt&&mt.XMLHttpRequest&&"withCredentials"in new mt.XMLHttpRequest?mt.XMLHttpRequest:void 0,St=null==mt?void 0:mt.AbortController,Tt=null==mt?void 0:mt.CompressionStream,$t=null==yt?void 0:yt.userAgent,kt=null!=gt?gt:{};function Rt(){return!(!gt||!1===gt.navigator.onLine)}var Pt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Ot(t){return"string"==typeof t||t}function It(t){return"string"==typeof t?t:void 0}var Ct,At=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.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}({}),Ft=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Mt=["$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"],Dt=["token"],Lt="NativeGzipValidationError",Nt=t=>t.length>=2&&31===t[0]&&139===t[1],Ut=(t,e)=>t===Ft.GZipJS||e===Ft.GZipJS||"gzip"===e,jt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Bt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Lt,e},zt=function(){var t=e((function*(t,e){18>t.size&&Bt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Nt(i)&&8===i[2]||Bt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Ct)return Ct;Ct=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Ct[t]=e>>>0}return Ct})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Bt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Bt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Ht(){return Ht=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield zt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Ht.apply(this,arguments)}var qt=["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"],Vt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return qt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Gt(t,e){return-1!==t.indexOf(e)}var Wt=function(t){return t.trim()},Yt=function(t){return t.replace(/^\$/,"")},Kt=Object.prototype,Jt=Kt.hasOwnProperty,Qt=Kt.toString,Xt=Array.isArray||function(t){return"[object Array]"===Qt.call(t)},Zt=t=>"function"==typeof t,te=t=>t===Object(t)&&!Xt(t),ee=t=>{if(te(t)){for(var e in t)if(Jt.call(t,e))return!1;return!0}return!1},ie=t=>void 0===t,re=t=>"[object String]"==Qt.call(t),se=t=>re(t)&&0===t.trim().length,ne=t=>null===t,oe=t=>ie(t)||ne(t),ae=t=>"[object Number]"==Qt.call(t)&&t==t,le=t=>ae(t)&&t>0,ue=t=>"[object Boolean]"===Qt.call(t),he=t=>t instanceof FormData,de=t=>Gt(Mt,t),ve=t=>Gt(Dt,t);function ce(t){return null===t||"object"!=typeof t}function pe(t,e){return{}.toString.call(t)==="[object "+e+"]"}function fe(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var _e=[!0,"true",1,"1","yes"],ge=t=>Gt(_e,t),me=[!1,"false",0,"0","no"];function ye(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),ae(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),ye(s||i,e,i,r))}class be{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=ye(t.bucketSize,0,100,t.Ae),this.$e=ye(t.refillRate,0,this.Fe,t.Ae),this.De=ye(t.refillInterval,0,864e5,t.Ae)}Ne(t,e){var i=Math.floor((e-t.lastAccess)/this.De);i>0&&(t.tokens=Math.min(t.tokens+i*this.$e,this.Fe),t.lastAccess=t.lastAccess+i*this.De)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.Ee[r];return s?this.Ne(s,i):this.Ee[r]=s={tokens:this.Fe,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Pe)||e.call(this,t)),0===s.tokens)}stop(){this.Ee={}}}var we="Mobile",xe="iOS",Ee="Android",Se="Tablet",Te=Ee+" "+Se,$e="iPad",ke="Apple",Re=ke+" Watch",Pe="Safari",Oe="BlackBerry",Ie="Samsung",Ce=Ie+"Browser",Ae=Ie+" Internet",Fe="Chrome",Me=Fe+" OS",De=Fe+" "+xe,Le="Internet Explorer",Ne=Le+" "+we,Ue="Opera",je=Ue+" Mini",Be="Edge",ze="Microsoft "+Be,He="Firefox",qe=He+" "+xe,Ve="Nintendo",Ge="PlayStation",We="Xbox",Ye=Ee+" "+we,Ke=we+" "+Pe,Je="Windows",Qe=Je+" Phone",Xe="Nokia",Ze="Ouya",ti="Generic",ei=ti+" "+we.toLowerCase(),ii=ti+" "+Se.toLowerCase(),ri="Konqueror",si="Oculus Browser",ni="Vivaldi",oi="Yandex",ai="Whale",li="DuckDuckGo",ui="Pale Moon",hi="Waterfox",di="Brave",vi="Google Search App",ci="(\\d+(\\.\\d+)?)",pi=new RegExp("Version/"+ci),fi=new RegExp(We,"i"),_i=new RegExp(Ge+" \\w+","i"),gi=new RegExp(Ve+" \\w+","i"),mi=new RegExp(Oe+"|PlayBook|BB10","i"),yi={"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"},bi=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?di:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Gt(t,"GSA/")?vi:Gt(t," OPR/")&&Gt(t,"Mini")?je:Gt(t," OPR/")?Ue:mi.test(t)?Oe:Gt(t,"IE"+we)||Gt(t,"WPDesktop")?Ne:Gt(t,"OculusBrowser")?si:Gt(t,Ce)?Ae:Gt(t,Be)||Gt(t,"Edg/")?ze:Gt(t,ni+"/")?ni:Gt(t,"YaBrowser/")?oi:Gt(t,ai+"/")?ai:Gt(t,li+"/")||Gt(t,"Ddg/")?li:Gt(t,"FBIOS")?"Facebook "+we:Gt(t,"UCWEB")||Gt(t,"UCBrowser")?"UC Browser":Gt(t,"CriOS")?De:Gt(t,"CrMo")||Gt(t,Fe)?Fe:Gt(t,Ee)&&Gt(t,Pe)?Ye:Gt(t,"FxiOS")?qe:Gt(t.toLowerCase(),ri.toLowerCase())?ri:Gt(t,di+"/")?di:((t,e)=>e&&Gt(e,ke)||function(t){return Gt(t,Pe)&&!Gt(t,Fe)&&!Gt(t,Ee)}(t))(t,e)?Gt(t,we)?Ke:Pe:Gt(t,"PaleMoon/")?ui:Gt(t,hi+"/")?hi:Gt(t,He)?He:Gt(t,"MSIE")||Gt(t,"Trident/")?Le:Gt(t,"Gecko")?He:"")},wi={[Ne]:[new RegExp("rv:"+ci)],[ze]:[new RegExp(Be+"?\\/"+ci)],[Fe]:[new RegExp("("+Fe+"|CrMo)\\/"+ci)],[De]:[new RegExp("CriOS\\/"+ci)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ci)],[Pe]:[pi],[Ke]:[pi],[Ue]:[new RegExp("(Opera|OPR)\\/"+ci)],[He]:[new RegExp(He+"\\/"+ci)],[qe]:[new RegExp("FxiOS\\/"+ci)],[ri]:[new RegExp("Konqueror[:/]?"+ci,"i")],[Oe]:[new RegExp(Oe+" "+ci),pi],[Ye]:[new RegExp("android\\s"+ci,"i")],[Ae]:[new RegExp(Ce+"\\/"+ci)],[si]:[new RegExp("OculusBrowser\\/"+ci)],[ni]:[new RegExp(ni+"\\/"+ci)],[oi]:[new RegExp("YaBrowser\\/"+ci)],[ai]:[new RegExp(ai+"\\/"+ci)],[di]:[new RegExp(di+"\\/"+ci)],[li]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ci)],[ui]:[new RegExp("PaleMoon\\/"+ci)],[hi]:[new RegExp(hi+"\\/"+ci)],[vi]:[new RegExp("GSA\\/"+ci)],[Le]:[new RegExp("(rv:|MSIE )"+ci)],Mozilla:[new RegExp("rv:"+ci)]},xi=function(t,e,i,r){var s=bi(t,e,i,r),n=wi[s];if(ie(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ei=[[new RegExp(We+"; "+We+" (.*?)[);]","i"),t=>[We,t&&t[1]||""]],[new RegExp(Ve,"i"),[Ve,""]],[new RegExp(Ge,"i"),[Ge,""]],[mi,[Oe,""]],[new RegExp(Je,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Qe,""];if(new RegExp(we).test(e)&&!/IEMobile\b/.test(e))return[Je+" "+we,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=yi[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Je,r]}return[Je,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xe,[t[3],t[4],t[5]||"0"].join(".")]:[xe,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ie(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ee+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ee+")","i"),t=>t&&t[2]?[Ee,[t[2],t[3],t[4]||"0"].join(".")]:[Ee,""]],[/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/,[Me,""]],[/Linux|debian/i,["Linux",""]]],Si=function(t){return gi.test(t)?Ve:_i.test(t)?Ge:fi.test(t)?We:new RegExp(Ze,"i").test(t)?Ze:new RegExp("("+Qe+"|WPDesktop)","i").test(t)?Qe:/iPad/.test(t)?$e:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Re:mi.test(t)?Oe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Xe,"i").test(t)?Xe:/(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(we).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)?Ee:Te:new RegExp("(pda|"+we+")","i").test(t)?ei:new RegExp(Se,"i").test(t)&&!new RegExp(Se+" pc","i").test(t)?ii:""},Ti=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $i(t,e){return"string"==typeof(i=t)&&Ti.test(i)?t:e();var i}function ki(t){return t?t.split("#")[0]:t}function Ri(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var Pi=t=>t instanceof Error,Oi={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}},Ii=Oi.info;function Ci(t){if(ue(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(Xt(t))return{arrayValue:{values:t.map((t=>Ci(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ai(t){var e=[];for(var i in t){var r=t[i];ne(r)||ie(r)||e.push({key:i,value:Ci(r)})}return e}function Fi(t,e){var r=t.level||"info",{text:s,number:n}=Oi[r]||Ii,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),oe(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),oe(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=i({},a,t.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:Ai(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ie(t.trace_flags)||(u.flags=t.trace_flags),u}function Mi(t,e,r){return i({},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 Di(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ai(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Li=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=i,this.qe=r,this.Be=s,this.je=n,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ye=e.flushIntervalMs,this.Ke=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.it(t);if(null!==e)if(e.body){if(this.nt()){var i={record:Fi(e,this.qe())};this.Be((()=>this.st(i)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var i=Xt(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ae.error("Error in beforeSend function for log:",t),null}return r}nt(){if(void 0===this.et)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return e((function*(){var e;t.tt();var i=null!==(e=t._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ze=0;var a=Math.min(i.length,t.Ke),l=i.slice(0,a),u=Di(l.map((t=>t.record)),t.ut(),null!==(n=t.He)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(u);if("too-large"===h.kind&&l.length>1)t.Ke=Math.max(1,Math.floor(l.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ke);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===h.kind&&t.Se.maxBatchRecordsPerPost>t.Ke&&(t.Ke=Math.min(t.Se.maxBatchRecordsPerPost,t.Ke+1)),yield t.dt(l.length),i=null!==(o=t._instance.getPersistedProperty(At.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}dt(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.ze),s=null!==(e=i._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(At.LogsQueue,s.slice(r)),yield i.je()}))()}ut(){return Mi(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];this.Je>i.length||(i.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(At.LogsQueue,i),this.Qe>i.length?this.ct():this.rt()}}ct(t){void 0===t&&(t=this.Ye),this.vt||(this.vt=Ri((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(At.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.tt();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ri(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ri((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var Ni,Ui,ji;function Bi(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return ji&&i.length===Ui||(Ui=i.length,ji=i.reduce(((i,r)=>{Ni||(Ni={});var s=Ni[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,Ni[r]=[l,u];break}}return i}),{})),ji}}class zi{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&Xt(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:Bi(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Hi="?";function qi(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Hi:i,in_app:!0};return ie(r)||(n.lineno=r),ie(s)||(n.colno=s),n}var Vi=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:Hi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Gi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ki=(t,e)=>{var i=Gi.exec(t);if(i){var[,r,s,n]=i;return qi(e,r,Hi,+s,+n)}var o=Wi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Yi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Vi(o[1]||Hi,o[2]);return qi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ji=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Qi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Xi=(t,e)=>{var i=Ji.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Qi.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||Hi;return[n,s]=Vi(n,s),qi(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Zi=/\(error: (.*)\)/;class tr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=re(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return pe(t,"DOMException")}isDOMError(t){return pe(t,"DOMError")}}class er{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class ir{constructor(){}match(t){return pe(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var rr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class sr{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(rr);return r&&(e=r[1],i=r[2]),[e,i]}}var nr=["fatal","error","warning","log","info","debug"];function or(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class ar{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return fe(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+or(t)}isSeverityLevel(t){return re(t)&&!se(t)&&nr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Pi(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class lr{match(t){return fe(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+or(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class ur{match(t){return ce(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class hr{match(t){return pe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!fe(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return ce(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var dr="$message",vr="$timestamp",cr=new Set([dr,vr]),pr={enabled:!0,max_bytes:32768};function fr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:pr.enabled,max_bytes:gr(t.max_bytes,pr.max_bytes)}:i({},pr)}class _r{constructor(t){this.bt=[],this._t=0,this.Se=fr(t)}setConfig(t){this.Se=fr(t),this.wt()}add(t){var e=function(t){var e,i,r;try{r=[],e=null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}catch(t){return}try{var s=JSON.parse(e);if(!te(s))return;var n=s,o=n[dr],a=n[vr];if(!re(o)||0===o.trim().length)return;if(!re(a)&&!ae(a))return;return{step:n,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Se.max_bytes||(this.bt.push({step:e.step,bytes:i}),this._t+=i,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function gr(t,e){if(!ae(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var mr=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={k(e){if(gt&&(n.DEBUG||kt.POSTHOG_DEBUG||i)&&!ie(gt.console)&&gt.console){for(var r=("__rrweb_original__"in gt.console[e]?gt.console[e].__rrweb_original__:gt.console[e]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>mr(t+" "+e,i)};return r},yr=mr("[PostHog.js]"),br=yr.createLogger;function wr(t,e){Xt(t)&&t.forEach(e)}function xr(t,e){if(!oe(t))if(Xt(t))t.forEach(e);else if(he(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Jt.call(t,i)&&e(t[i],i)}var Er=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Sr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Tr=function(t){try{return t()}catch(t){return}},$r=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){yr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),yr.critical(t)}}},kr=function(t){var e={};return xr(t,(function(t,i){(re(t)&&t.length>0||ae(t))&&(e[i]=t)})),e};var Rr=["herokuapp.com","vercel.app","netlify.app"];function Pr(t){var e=null==t?void 0:t.hostname;if(!re(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Rr)if(i===r)return!1;return!0}function Or(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ir(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ae(t)&&isFinite(t)&&Math.floor(t)===t});class Cr{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Cr(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Cr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Ar{constructor(){this.S=0,this.C=0,this.I=new Dr}generate(){var t=this.generateOrAbort();if(ie(t)){this.S=0;var e=this.generateOrAbort();if(ie(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Cr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Fr,Mr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&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};gt&&!ie(gt.crypto)&&crypto.getRandomValues&&(Mr=t=>crypto.getRandomValues(t));class Dr{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Mr(this.R),this.O=0),this.R[this.O++]}}var Lr=()=>Nr().toString(),Nr=()=>(Fr||(Fr=new Ar)).generate(),Ur="",jr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Br={N:()=>!!bt,D(t){yr.error("cookieStore error: "+t)},A(t){if(bt){try{for(var e=t+"=",i=bt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},F(t){var e;try{e=JSON.parse(Br.A(t))||{}}catch(t){}return e},q(t,e,i,r,s){if(!bt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=bt),Ur)return Ur;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Lr();!Ur&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",Ur=n)}return Ur}(t);if(!i){var r=(t=>{var e=t.match(jr);return e?e[0]:""})(t);r!==i&&yr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(bt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&yr.warn("cookieStore warning: large cookie, len="+u.length),bt.cookie=u,!0}catch(t){return!1}},P(t,e){if(null!=bt&&bt.cookie)try{Br.q(t,"",-1,e)}catch(t){return}}},zr=null,Hr={N(){if(!ne(zr))return zr;var t=!0;if(ie(gt))t=!1;else try{var e="__mplssupport__";Hr.q(e,"xyz"),'"xyz"'!==Hr.A(e)&&(t=!1),Hr.P(e)}catch(e){t=!1}return t||yr.error("localStorage unsupported; falling back to cookie store"),zr=t,t},D(t){yr.error("localStorage error: "+t)},A(t){try{return null==gt?void 0:gt.localStorage.getItem(t)}catch(t){Hr.D(t)}return null},F(t){try{return JSON.parse(Hr.A(t))||{}}catch(t){}return null},q(t,e){try{return null==gt||gt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Hr.D(t)}return!1},P(t){try{null==gt||gt.localStorage.removeItem(t)}catch(t){Hr.D(t)}}},qr=[a,"distinct_id",k,R,Z,X,W],Vr={},Gr={N:()=>!0,D(t){yr.error("memoryStorage error: "+t)},A:t=>Vr[t]||null,F:t=>Vr[t]||null,q:(t,e)=>(Vr[t]=e,!0),P(t){delete Vr[t]}},Wr=null,Yr={N(){if(!ne(Wr))return Wr;if(Wr=!0,ie(gt))Wr=!1;else try{var t="__support__";Yr.q(t,"xyz"),'"xyz"'!==Yr.A(t)&&(Wr=!1),Yr.P(t)}catch(t){Wr=!1}return Wr},D(t){yr.error("sessionStorage error: ",t)},A(t){try{return null==gt?void 0:gt.sessionStorage.getItem(t)}catch(t){Yr.D(t)}return null},F(t){try{return JSON.parse(Yr.A(t))||null}catch(t){}return null},q(t,e){try{return null==gt||gt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Yr.D(t)}return!1},P(t){try{null==gt||gt.sessionStorage.removeItem(t)}catch(t){Yr.D(t)}}};class Kr{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===at||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===ot}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.P(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get St(){var t=this.Ct.A(this.It);return ge(t)?1:Gt(me,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,e="localStorage"===t?Hr:Br;if(!this.Tt||this.Tt!==e){this.Tt=e;var i="localStorage"===t?Br:Hr;i.A(this.It)&&(this.Tt.A(this.It)||this.optInOut(ge(i.A(this.It))),i.P(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[null==yt?void 0:yt.doNotTrack,null==yt?void 0:yt.msDoNotTrack,kt.doNotTrack].some((t=>ge(t)))}}function Jr(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!Zt(r))return e;try{var s=r(e);return re(s)&&s?s:e}catch(t){return yr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Qr=1,Xr=3,Zr=11;function ts(t){return t instanceof Element&&(t.id===tt||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function es(t){return!!t&&t.nodeType===Qr}function is(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function rs(t){return!!t&&t.nodeType===Xr}function ss(t){return!!t&&t.nodeType===Zr&&es(t.host)}function ns(t){return t?Wt(t).split(/\s+/):[]}function os(t,e){var i=function(t){var e,i=null==gt||null==(e=gt.location)?void 0:e.href;return ie(i)?void 0:Jr(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function as(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 ns(e)}function ls(t){return oe(t)?null:Wt(t).split(/(\s+)/).filter((t=>Is(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function us(t){var e="";return Es(t)&&!Ss(t)&&t.childNodes&&t.childNodes.length&&xr(t.childNodes,(function(t){var i;rs(t)&&t.textContent&&(e+=null!==(i=ls(t.textContent))&&void 0!==i?i:"")})),Wt(e)}function hs(t){return ie(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var ds=["a","button","form","input","select","textarea","label"];function vs(t,e){if(ie(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function cs(t){var e=t.parentNode;return!(!e||!es(e))&&e}var ps=[".ph-no-autocapture","[data-ph-no-autocapture]"],fs=["next","previous","prev",">","<"],_s=[...fs,"+","-","−","–"],gs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,ms=[".ph-no-rageclick",".ph-no-capture"],ys=["","text","search","email","password","url","tel","number"];function bs(t,e){if(!gt||ws(t))return!1;var i,r,s,n,o;if(ue(e)?(i=!!e&&ms,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:ms,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!es(t))&&(!!is(t,"textarea")||(is(t,"input")?Gt(ys,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var{targetElementList:a}=xs(t,!1);return!function(t,e){if(!1===t||ie(t))return!1;var i;if(!0===t)i=fs;else{if(!Xt(t))return!1;if(t.length>10)return yr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>gs(e,t)||gs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:us(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!vs(a,i)}var ws=t=>!t||is(t,"html")||!es(t),xs=(t,e)=>{if(!gt||ws(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!is(s,"body");)if(ss(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=cs(s);if(!n)break;if(e||ds.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Es(t){for(var e=t;e.parentNode&&!is(e,"body");e=e.parentNode){var i=as(e);if(Gt(i,"ph-sensitive")||Gt(i,"ph-no-capture"))return!1}if(Gt(as(t),"ph-include"))return!0;var r=t.type||"";if(re(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!re(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ss(t){return!!(is(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||is(t,"select")||is(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ts="(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})",$s=new RegExp("^(?:"+Ts+")$"),ks=new RegExp(Ts),Rs="\\d{3}-?\\d{2}-?\\d{4}",Ps=new RegExp("^("+Rs+")$"),Os=new RegExp("("+Rs+")");function Is(t,e){if(void 0===e&&(e=!0),oe(t))return!1;if(re(t)){if(t=Wt(t),(e?$s:ks).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ps:Os).test(t))return!1}return!0}function Cs(t){var e=us(t);return Is(e=(e+" "+As(t)).trim())?e:""}function As(t){var e="";return t&&t.childNodes&&t.childNodes.length&&xr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=us(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+As(t)).trim())}catch(t){yr.error("[AutoCapture]",t)}})),e}function Fs(t){return t.replace(/"|\\"/g,'\\"')}function Ms(t){var e=t.attr__class;return e?Xt(e)?e:ns(e):void 0}var Ds=br("[Dead Clicks]"),Ls=()=>!0,Ns=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return ue(r)?r:!!te(r)||i};class Us{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Ds.error("failed to load script",e):t()}))}Pt(){var t;if(bt){if(!this.Et&&null!=(t=kt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=te(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.Et=kt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Et.start(bt),Ds.info("starting...")}}else Ds.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,Ds.info("stopping..."))}}var js=br("[SegmentIntegration]");var Bs="posthog-js";function zs(t,e){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===e?{}:e;return e=>{var l,u,h,d,v;if("*"!==o&&!o.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,f=(null==(l=e.exception)?void 0:l.values)||[],_=f.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=f[0])?void 0:u.value)||e.message,$exception_type:null==(h=f[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=f[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=f[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(p=t.exceptions)||p.sendExceptionEvent(g)),e}}class Hs{constructor(t,e,i,r,s,n){this.name=Bs,this.setupOnce=function(o){o(zs(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class qs{constructor(t){this.Rt=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(yr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Rt)}destroy(){var t;null==(t=this.Ft)||t.call(this),this.Ft=void 0}doPageView(t,e){var i,r=this.At(t,e);return this.Ot={pathname:null!==(i=null==gt?void 0:gt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.At(t,null==(e=this.Ot)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ot)?void 0:t.pageViewId}}At(t,e){var i=this.Ot;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(ie(n)||ie(o)||ie(a)||ie(l)||ie(u)||ie(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?ye(o/n,0,1,yr):1,v=n>1?ye(a/n,0,1,yr):1,c=l>1?ye(u/l,0,1,yr):1,p=l>1?ye(h/l,0,1,yr):1;r=Er(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Vs=["flags","surveys"],Gs={[o]:{exposure:"hidden"},[u]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[h]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[p]:{exposure:"hidden"},[f]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[R]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>ne(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"},[P]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!te(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[O]:{exposure:"event",storageGroup:"flags"},[I]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"event",storageGroup:"flags"},[F]:{exposure:"event",storageGroup:"flags",volatile:!0},[M]:{exposure:"event"},[D]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"surveys"},[j]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[B]:{exposure:"event"},[z]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[W]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[T]:{exposure:"event"},[it]:{exposure:"event"},[rt]:{exposure:"event"},[st]:{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"}},Ws=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ys=t=>{var e=Gs[t];if(e)return e;for(var[i,r]of Ws)if(0===t.indexOf(i))return r},Ks=t=>{var e=null==bt?void 0:bt.createElement("a");return ie(e)?null:(e.href=t,e)},Js=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Xt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){yr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Qs=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");Xt(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Xs=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Zs="https?://(.*)",tn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],en=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tn],rn="<masked>",sn=["li_fat_id"];function nn(t,e,i){if(!bt)return{};var r,s=e?[...tn,...i||[]]:[],n=on(Qs(bt.URL,s,rn),t),o=(r={},xr(sn,(function(t){var e=Br.A(t);r[t]=e||null})),r);return Er(o,n)}function on(t,e){var i=en.concat(e||[]),r={};return xr(i,(function(e){var i=Js(t,e);r[e]=i||null})),r}function an(t){var e=function(t){return t?0===t.search(Zs+"google.([^/?]*)")?"google":0===t.search(Zs+"bing.com")?"bing":0===t.search(Zs+"yahoo.com")?"yahoo":0===t.search(Zs+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ne(e)){r.$search_engine=e;var s=bt?Js(bt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function ln(){return navigator.language||navigator.userLanguage}var un="$direct";function hn(){return(null==bt?void 0:bt.referrer)||un}function dn(t,e,i){void 0===i&&(i=!1);var r=t?[...tn,...e||[]]:[],s=i?ki(null==wt?void 0:wt.href):null==wt?void 0:wt.href,n=null==s?void 0:s.substring(0,1e3);return{r:hn().substring(0,1e3),u:n?Qs(n,r,rn):void 0}}function vn(t,e){var i;void 0===e&&(e=!1);var{r:r,u:s}=t,n=e?ki(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==un?un:null==(i=Ks(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ks(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=on(n);Er(o,l)}if(r){var u=an(r);Er(o,u)}return o}function cn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function pn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var fn={flags:G,surveys:j},_n=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gn="main";class mn{constructor(t,e,r){if(void 0===r&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=t,this.qt=r,this.props={},this.Bt=!1,this.jt=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Ct=this.Ht(t),this.Nt=this.Ut(t),this.load(),t.debug&&yr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),gt){var s=()=>this.flush();Or(gt,"beforeunload",s,{capture:!1}),Or(gt,"pagehide",s,{capture:!1})}}zt(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return ae(e)&&e>0?e:0}isDisabled(){return!!this.Vt}Ht(t){-1===_n.indexOf(t.persistence.toLowerCase())&&(yr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...qr,...t];return i({},Hr,{F(t){try{var i={};try{i=Br.F(t)||{}}catch(t){}var r,s=JSON.parse(Hr.A(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ne(a)||""===a||(n[o]=a)}r=Er(s,n)}else r=Er(i,s);return Hr.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Hr.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Br.q(t,l,i,s,n,o)}catch(t){Hr.D(t)}return a},P(t,e){try{null==gt||gt.localStorage.removeItem(t),Br.P(t,e)}catch(t){Hr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Hr.N()?(e=Hr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&Yr.N()?e=Yr:"memory"===n?e=Gr:"cookie"===n?e=Br:r.N()?(e=r,s=!0):e=Br,this.Dt=s,e}Wt(t){return this.jt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var e=null!=t?t:this.Se.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[G];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return xr(this.props,((e,i)=>{var r=Ys(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===P?()=>this.Gt():()=>!1))return;r.transformToEventProperties&&Er(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.Vt){var t=this.Ct.F(this.jt);t&&(this.props=Er({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of Vs){var e=Hr.F(this.Wt(t));if(e&&!ee(e)){var i=this.Qt(t);i.persisted=!0,this.Jt(t)||(i.fingerprint=this.Yt(e,t)),this.Kt(t,e)||Er(this.props,e)}}}Jt(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Ys(e))?void 0:i.storageGroup)===t}))}Kt(t,e){var i=fn[t];if(!i)return!1;var r=e[i],s=this.props[i];return ae(r)&&ae(s)&&s>r}refreshKey(t){var e;if(!this.Vt){var i=this.Nt?null==(e=Ys(t))?void 0:e.storageGroup:void 0,r=i?Hr.F(this.Wt(i)):this.Ct.F(this.jt);if(r&&t in r)this.Xt(t,r[t]);else{if(i){var s=this.Ct.F(this.jt);if(s&&t in s)return void this.Xt(t,s[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?ie(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){ie(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,gn))}ir(){var{main:t,groups:e}=this.sr();for(var i of(this.nr(this.Ct,this.jt,t,gn),Vs)){var r,s=e[i];(!ee(s)||null!=(r=this.$t[i])&&r.persisted)&&this.nr(Hr,this.Wt(i),s,i)}}sr(){var t={},e={};for(var i of Vs)e[i]={};return xr(this.props,((i,r)=>{var s,n=null==(s=Ys(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Yt(t,e){if(e===gn)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var i={};return xr(t,((t,e)=>{var r;i[e]=null!=(r=Ys(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}nr(t,e,i,r){var s=this.Qt(r);if(r===gn||s.dirty||ie(s.fingerprint)){var n;try{if((n=this.Yt(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.ar,this.lr,this.ur,this.Se.debug)?(s.dirty=!1,r!==gn&&(s.persisted=!0),ie(n)||(s.fingerprint=n)):this.Se.debug&&yr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(ie(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.P(this.jt,!1),this.Ct.P(this.jt,!0),!e&&this.qt)for(var i of Vs)Hr.P(this.Wt(i));e?delete this.$t[gn]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(te(t)){ie(e)&&(e="None"),this.ar=ie(i)?this.hr:i;var r=!1;if(xr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Xt(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(te(t)){this.ar=ie(e)?this.hr:e;var i=!1;if(xr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Xt(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.Bt){var t=nn(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ee(kr(t))||this.register(t),this.Bt=!0}}update_search_keyword(){var t;this.register((t=null==bt?void 0:bt.referrer)?an(t):{})}update_referrer_info(){var t;this.register_once({$referrer:hn(),$referring_domain:null!=bt&&bt.referrer&&(null==(t=Ks(bt.referrer))?void 0:t.host)||un},void 0)}set_initial_person_info(){this.props[J]||this.props[Q]||this.register_once({[X]:dn(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};xr([Q,J],(e=>{var i=this.props[e];i&&xr(i,(function(e,i){t["$initial_"+Yt(i)]=e}))}));var e=this.props[X];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=vn(t,e),r={};return xr(i,(function(t,e){r["$initial_"+Yt(e)]=t})),r}(e,this.Se.disable_capture_url_hashes);Er(t,i)}return t}safe_merge(t){return xr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.hr=this.ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),s=r?this.Ht(t):this.Ct,n=this.Ut(t);if(r||n!==this.Nt){var o=this.props;this.clear(),this.Ct=s,this.Nt=n,this.props=o,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[h]||{};i[t]=e,this.Xt(h,i),this.save()}remove_event_timer(t){var e=this.props[h]||{},i=e[t];return ie(i)||(delete e[t],this.Xt(h,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Xt(t,e),this.save()}Xt(t,e){var i;this.props[t]=e,null!=(i=Ys(t))&&i.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var e,i=null==(e=Ys(t))?void 0:e.storageGroup;i&&(this.Qt(i).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var yn={Activation:"events",Cancellation:"cancelEvents"},bn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},wn={Once:"once",Recurring:"recurring",Always:"always"},xn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},En={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"},Sn={Popover:"popover",Inline:"inline"},Tn={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"},$n={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"},kn=br("[RateLimiter]");class Rn{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{kn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void kn.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(K))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(K,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Pn=br("[RemoteConfig]");class On{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=kt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}cr(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return Pn.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void Pn.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return Pn.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((t=>{this.pr(t),this.gr()}));this.pr(t),this.gr()}))}catch(t){Pn.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&bt&&"hidden"!==bt.visibilityState&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.yr=setInterval((()=>{this.refresh()}),e))}}pr(t){var e;t||Pn.error("Failed to fetch remote config from PostHog."),this._instance.pr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var In={GZipJS:"gzip-js",Base64:"base64"},Cn=Uint8Array,An=Uint16Array,Fn=Uint32Array,Mn=new Cn([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]),Dn=new Cn([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]),Ln=new Cn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nn=function(t,e){for(var i=new An(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Fn(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Un=Nn(Mn,2),jn=Un[1];Un[0][28]=258,jn[258]=28;for(var Bn=Nn(Dn,0)[1],zn=new An(32768),Hn=0;32768>Hn;++Hn){var qn=(43690&Hn)>>>1|(21845&Hn)<<1;zn[Hn]=((65280&(qn=(61680&(qn=(52428&qn)>>>2|(13107&qn)<<2))>>>4|(3855&qn)<<4))>>>8|(255&qn)<<8)>>>1}var Vn=function(t,e,i){for(var r=t.length,s=0,n=new An(e);r>s;++s)++n[t[s]-1];var o,a=new An(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new An(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[zn[d]>>>l]=u}else for(o=new An(r),s=0;r>s;++s)o[s]=zn[a[t[s]-1]++]>>>15-t[s];return o},Gn=new Cn(288);for(Hn=0;144>Hn;++Hn)Gn[Hn]=8;for(Hn=144;256>Hn;++Hn)Gn[Hn]=9;for(Hn=256;280>Hn;++Hn)Gn[Hn]=7;for(Hn=280;288>Hn;++Hn)Gn[Hn]=8;var Wn=new Cn(32);for(Hn=0;32>Hn;++Hn)Wn[Hn]=5;var Yn=Vn(Gn,9,0),Kn=Vn(Wn,5,0),Jn=function(t){return(t/8>>0)+(7&t&&1)},Qn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof An?An:t instanceof Fn?Fn:Cn)(i-e);return r.set(t.subarray(e,i)),r},Xn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Zn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},to=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Cn(0),0];if(1==s){var o=new Cn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new An(v+1),p=eo(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var y=n[r].s;e>c[y]?f-=1<<e-c[y]++-1:++r}for(;r>=0&&f;--r){var b=n[r].s;c[b]==e&&(--c[b],++f)}p=e}return[new Cn(c),p]},eo=function(t,e,i){return-1==t.s?Math.max(eo(t.l,e,i+1),eo(t.r,e,i+1)):e[t.s]=i},io=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new An(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},ro=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},so=function(t,e,i){var r=i.length,s=Jn(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},no=function(t,e,i,r,s,n,o,a,l,u,h){Xn(e,h++,i),++s[256];for(var d=to(s,15),v=d[0],c=d[1],p=to(n,15),f=p[0],_=p[1],g=io(v),m=g[0],y=g[1],b=io(f),w=b[0],x=b[1],E=new An(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=to(E,7),k=T[0],R=T[1],P=19;P>4&&!k[Ln[P-1]];--P);var O,I,C,A,F=u+5<<3,M=ro(s,Gn)+ro(n,Wn)+o,D=ro(s,v)+ro(n,f)+o+14+3*P+ro(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=F&&D>=F)return so(e,h,t.subarray(l,l+u));if(Xn(e,h,1+(M>D)),h+=2,M>D){O=Vn(v,c,0),I=v,C=Vn(f,_,0),A=f;var L=Vn(k,R,0);for(Xn(e,h,y-257),Xn(e,h+5,x-1),Xn(e,h+10,P-4),h+=14,S=0;P>S;++S)Xn(e,h+3*S,k[Ln[S]]);h+=3*P;for(var N=[m,w],U=0;2>U;++U){var j=N[U];for(S=0;j.length>S;++S)Xn(e,h,L[B=31&j[S]]),h+=k[B],B>15&&(Xn(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=Yn,I=Gn,C=Kn,A=Wn;for(S=0;a>S;++S)if(r[S]>255){var B;Zn(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(Xn(e,h,r[S]>>>23&31),h+=Mn[B]);var z=31&r[S];Zn(e,h,C[z]),h+=A[z],z>3&&(Zn(e,h,r[S]>>>5&8191),h+=Dn[z])}else Zn(e,h,O[r[S]]),h+=I[r[S]];return Zn(e,h,O[256]),h+I[256]},oo=new Fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ao=function(){for(var t=new Fn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),lo=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function uo(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ao[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Cn(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=so(l,u,t.subarray(h,d)):(l[h]=!0,u=so(l,u,t.subarray(h,o)))}else{for(var v=oo[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new An(32768),g=new An(f+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&f},w=new Fn(25e3),x=new An(288),E=new An(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=b(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var A=o-h;if((S>7e3||k>24576)&&A>423){u=no(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)E[F]=0}var M=2,D=0,L=p,N=I-C&32767;if(A>2&&O==b(h-N))for(var U=Math.min(c,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&I!=C;){if(t[h+M]==t[h+M-N]){for(var z=0;B>z&&t[h+z]==t[h+z-N];++z);if(z>M){if(M=z,D=N,z>U)break;var H=Math.min(N,z-2),q=0;for(F=0;H>F;++F){var V=h-N+F+32768&32767,G=V-_[V]+32768&32767;G>q&&(q=G,C=V)}}}N+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|jn[M]<<18|Bn[D];var W=31&jn[M],Y=31&Bn[D];T+=Mn[W]+Dn[Y],++x[257+W],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=no(t,l,!0,w,x,E,T,k,P,h-P,u)}return Qn(a,0,r+Jn(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&lo(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),lo(u,h-8,i.d()),lo(u,h-4,r),u}var ho=!!Et||!!xt,vo="text/plain",co=!1,po=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},fo=function(t,e,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=i({},e),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var e,[i,s]=t.split("="),n=r&&null!==(e=a[i])&&void 0!==e?e:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return xr(t,(function(t,e){ie(t)||ie(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return u&&l.push(u),n+"?"+l.join("&")},_o=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),go=t=>{if(t.xt)return t.xt;var{data:e,compression:i}=t;if(e){if(i===In.GZipJS){var r=uo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Cn(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Cn(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Qn(r,0,s)}(_o(e)),{mtime:0});return{contentType:vo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===In.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(_o(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:_o(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=_o(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},mo=t=>{var e,r,s=()=>({url:po(t.url,"compression"),encodedBody:go(i({},t,{compression:void 0,xt:void 0}))});try{e=go(t)}catch(e){if(Ut(t.compression,Js(t.url,"compression")))return yr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Ut(t.compression,Js(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Nt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Nt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(co=!0,s()):{url:t.url,encodedBody:e}},yo=t=>{try{return mo(t)}catch(e){return yr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},bo=function(){var t=e((function*(t){var e=_o(t.data),r=yield function(t,e,i){return Ht.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{xt:{contentType:vo,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),wo=(t,e)=>fo(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),xo=[];xt&&xo.push({transport:"fetch",method(t){var e,r=yo(t);if(r){var{url:s,encodedBody:n}=r,{contentType:o,body:a,estimatedSize:l}=null!=n?n:{},u=new Headers;xr(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if(St){var v=new St;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;d=!0,v.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}xt(s,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(l||0),body:a,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){yr.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{d&&"AbortError"===(null==e?void 0:e.name)?yr.warn(e):yr.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}}),Et&&xo.push({transport:"XHR",method(t){var e=yo(t);if(e){var i=new Et,{url:r,encodedBody:s}=e;i.open(t.method||"GET",r,!0);var{contentType:n,body:o}=null!=s?s:{};xr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=yt&&yt.sendBeacon&&xo.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:i}=mo(t),{contentType:r,body:s}=null!=i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});yt.sendBeacon(e,n)}catch(t){}}});var Eo=3e3;class So{constructor(t,e){this.br=!0,this._r=[],this.wr=ye((null==e?void 0:e.flush_interval_ms)||Eo,250,5e3,yr.createLogger("flush interval"),Eo),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Er(i({},t,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var e=this.Tr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Xt(i.data)&&xr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Er(i)};for(var r in e)i()}}),this.wr))}Er(t){try{this.kr(t)}catch(t){yr.error(t)}}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return xr(this._r,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ie(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this._r=[],t}}var To=["retriesPerformedSoFar"];class $o{constructor(t){this.Mr=!1,this.Pr=3e3,this._r=[],this._instance=t,this._r=[],this.Rr=!0,!ie(gt)&&"onLine"in gt.navigator&&(this.Rr=gt.navigator.onLine,this.Or=()=>{this.Rr=!0,this.Lr()},this.Fr=()=>{this.Rr=!1},Or(gt,"online",this.Or),Or(gt,"offline",this.Fr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,To);le(e)&&(s.url=fo(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.st(i({retriesPerformedSoFar:e},s));0===t.statusCode&&yr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}st(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this._r.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),yr.warn(s),this.Mr||(this.Mr=!0,this.Ar())}Ar(){if(this.$r&&clearTimeout(this.$r),0===this._r.length)return this.Mr=!1,void(this.$r=void 0);this.$r=setTimeout((()=>{this.Rr&&this._r.length>0&&this.Lr(),this.Ar()}),this.Pr)}Lr(){var t=Date.now(),e=[],i=this._r.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this._r=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.$r&&(clearTimeout(this.$r),this.$r=void 0),this.Mr=!1,ie(gt)||(this.Or&&(gt.removeEventListener("online",this.Or),this.Or=void 0),this.Fr&&(gt.removeEventListener("offline",this.Fr),this.Fr=void 0)),this._r))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){yr.error(t)}this._r=[]}}class ko{constructor(t){this.Dr=()=>{var t,e,i,r;this.Nr||(this.Nr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Nr.lastScrollY=Math.ceil(n),this.Nr.maxScrollY=Math.max(n,null!==(t=this.Nr.maxScrollY)&&void 0!==t?t:0),this.Nr.maxScrollHeight=Math.max(o,null!==(e=this.Nr.maxScrollHeight)&&void 0!==e?e:0),this.Nr.lastContentY=a,this.Nr.maxContentY=Math.max(a,null!==(i=this.Nr.maxContentY)&&void 0!==i?i:0),this.Nr.maxContentHeight=Math.max(l,null!==(r=this.Nr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Nr}resetContext(){var t=this.Nr;return setTimeout(this.Dr,0),t}startMeasuringScrollPosition(){Or(gt,"scroll",this.Dr,{capture:!0}),Or(gt,"scrollend",this.Dr,{capture:!0}),Or(gt,"resize",this.Dr)}scrollElement(){if(!this.qr)return null==gt?void 0:gt.document.documentElement;var t=Xt(this.qr)?this.qr:[this.qr];for(var e of t){var i=null==gt?void 0:gt.document.querySelector(e);if(i)return i}}Br(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.qr){var i=this.scrollElement();return i&&i[e]||0}return gt?"y"===t?gt.scrollY||gt.pageYOffset||gt.document.documentElement.scrollTop||0:gt.scrollX||gt.pageXOffset||gt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Br("y")}scrollX(){return this.Br("x")}}var Ro=t=>dn(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Po{constructor(t,e,i,r){this.jr=t=>{var e=this.Hr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ur(this._instance)};this.zr.register({[Y]:i})}},this._instance=t,this.Vr=e,this.zr=i,this.Ur=r||Ro,this.Vr.onSessionId(this.jr)}Hr(){return this.zr.props[Y]}getSetOnceProps(){var t,e=null==(t=this.Hr())?void 0:t.props;return e?"r"in e?vn(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return xr(kr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Yt(i)]=e})),t}}class Oo{constructor(){this.Wr={}}on(t,e){return this.Wr[t]||(this.Wr[t]=[]),this.Wr[t].push(e),()=>{this.Wr[t]=this.Wr[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Wr[t]||[])i(e);for(var r of this.Wr["*"]||[])r(t,e)}}var Io=br("[SessionId]");class Co{on(t,e){return this.Gr.on(t,e)}constructor(t,e,i){var r;if(this.Zr=null,this.Qr=[],this.Jr=void 0,this.Yr=!1,this.Gr=new Oo,this.Kr=(t,e)=>!(!le(t)||!le(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===at)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.zr=t.persistence,this.Xr=void 0,this.ei=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=e||Lr,this.ri=i||Lr;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*ye(this.Se.session_idle_timeout_seconds||1800,60,36e3,Io.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ii(),this.ni="ph_"+s+"_window_id",this.si="ph_"+s+"_primary_window_exists",this.oi()){var n=Yr.F(this.ni),o=Yr.F(this.si);n&&!o?this.Xr=n:Yr.P(this.ni),Yr.q(this.si,!0)}if(null!=(r=this.Se.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Se.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.ai(this.Se.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Io.error("Invalid sessionID in bootstrap",t)}this.li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ie(this.Qr)&&(this.Qr=[]),this.Qr.push(t),this.ei&&t(this.ei,this.Xr),()=>{this.Qr=this.Qr.filter((e=>e!==t))}}oi(){return"memory"!==this.Se.persistence&&!this.zr.Vt&&Yr.N()}ui(t){t!==this.Xr&&(this.Xr=t,this.oi()&&Yr.q(this.ni,t))}hi(){return this.Xr?this.Xr:this.oi()?Yr.F(this.ni):null}di(t){var e=this.Zr;return!ne(e)&&!ne(t)&&5e3>Math.abs(t-e)}ai(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.ei||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ei=t,s&&!r||s&&this.di(e)||(this.Zr=e,this.zr.register({[k]:[e,t,i]}))}ci(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return le(e)&&e>0}vi(){this.ci()?this.zr.refreshKey(k):(this.zr.flush(),this.zr.load())}fi(){var t;if(!ne(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Zr){this.vi();var[,e,i]=this.pi();e===this.ei&&i===this._sessionStartTimestamp&&(this.Zr=this._sessionActivityTimestamp,this.zr.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.ei)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.zr.flush())}}gi(){var[t]=this.pi(),e=le(t)?t:0,i=le(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}mi(t){return this.vi(),this.Kr(t,this.gi())}pi(){var t=this.zr.props[k];return Xt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Zr=null,clearTimeout(this.yi),this.yi=void 0,this.ai(null,null,null)}destroy(){this.Yr=!0,this.fi(),clearTimeout(this.yi),this.yi=void 0,this.Jr&&gt&&(gt.removeEventListener(vt,this.Jr,{capture:!1}),this.Jr=void 0),this.Qr=[]}li(){this.Jr=()=>{this.fi(),this.oi()&&Yr.P(this.si)},Or(gt,vt,this.Jr,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Se.cookieless_mode===at)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.pi(),n=this.gi(),o=this.hi(),a=le(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.Kr(i,n);v&&((v=this.mi(i))||Io.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.pi()),h||v||a?(r=this.ti(),o=this.ri(),Io.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.ri(),l=!0),(u=r!==d)&&(Io.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=le(n)&&t&&!a?n:i,p=le(s)?s:(new Date).getTime();this.ui(o),this.ai(r,c,p),t||this.ii();var f={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.Qr.forEach((t=>t(r,o,f))),{sessionId:r,windowId:o,sessionStartTimestamp:p,changeReason:l?f:void 0,lastActivityTimestamp:n}}ii(){this.Yr||(clearTimeout(this.yi),this.yi=setTimeout((()=>{if(!this.Yr)if(this.mi((new Date).getTime())){var t=this.ei;this.resetSessionId(),this.Gr.emit("forcedIdleReset",{idleSessionId:t})}else this.ii()}),1.1*this.sessionTimeoutMs))}}var Ao=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Vt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Vt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Fo(){return(Fo=e((function*(){var t=null==yt?void 0:yt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return re(i)&&i.length>0?i:void 0}catch(t){return void yr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var Mo=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function Do(t,e,i){return _o({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Lo={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Mo(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Mo(e,t))))),icontains:(t,e)=>e.map(No).some((e=>t.map(No).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(No).every((e=>t.map(No).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},No=t=>t.toLowerCase();function Uo(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(ie(s)||ne(s))return!1;var n=[String(s)],o=Lo[r.operator];return!!o&&o(r.values,n)}))}var jo="custom",Bo="i.posthog.com",zo=/^\/static\//;class Ho{constructor(t){this.bi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Bo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.bi[this.apiHost]||(this.bi[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":jo),this.bi[this.apiHost]}wi(t){if(zo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.wi(e);if(i)return""+i+e}if(this.region===jo)return this.apiHost+e;var r=Bo+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var qo=br("[Surveys]"),Vo="seenSurvey_",Go=t=>{try{var e=(t=>((t,e)=>{var i=""+Vo+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+Vo+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){qo.error("Failed to persist survey seen state",t)}},Wo=[bn.Popover,bn.Widget,bn.API],Yo={ignoreConditions:!1,ignoreDelay:!1,displayType:Sn.Popover},Ko=br("[PostHog ExternalIntegrations]"),Jo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Qo{constructor(t){this._instance=t}Mt(t,e){var i;null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ko.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=kt.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.Mt(Jo[e],(()=>{var i;null==(i=kt.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=kt.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=kt.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Xo,Zo={},ta=0,ea=()=>{},ia='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ra="Surveys module not available",sa="sanitize_properties is deprecated. Use before_send instead",na="Invalid value for property_denylist config: ",oa="posthog",aa=!ho&&-1===(null==$t?void 0:$t.indexOf("MSIE"))&&-1===(null==$t?void 0:$t.indexOf("Mozilla")),la=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Pr(null==bt?void 0:bt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ea,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:wt&&re(null==wt?void 0:wt.search)&&-1!==wt.search.indexOf("__posthog_debug=true")||!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:"https:"===(null==gt||null==(e=gt.location)?void 0:e.protocol),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(t){yr.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ht,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Eo},error_tracking:{},_onCapture:ea},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:_s,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t)}))(t))},ua=[["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[i,r]of ua)ie(t[i])||(e[r]=t[i]);var s=Er({},e,t),n=t.__preview_external_dependency_versioned_paths;return ie(n)||(ie(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),re(n)&&ie(t.asset_host)&&(s.asset_host=n)),Xt(t.property_blacklist)&&(ie(t.property_denylist)?s.property_denylist=t.property_blacklist:Xt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:yr.error(na+t.property_denylist)),s};class da{constructor(){this.__forceAllowLocalhost=!1}get xi(){return this.__forceAllowLocalhost}set xi(t){yr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class va{ki(t,e){if(t){var i=this.Si.indexOf(t);-1!==i&&this.Si.splice(i,1)}return this.Si.push(e),null==e.initialize||e.initialize(),e}Ci(){return this.config.cookieless_mode===at||this.config.cookieless_mode===ot&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new da,this.Ii=!1,this.version=n.LIB_VERSION,this.Ti=new Oo,this.Si=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=la(),this.SentryIntegration=Hs,this.sentryIntegration=t=>function(t,e){var i=zs(t,e);return{name:Bs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ei=!1,this.Mi=null,this.Pi=null,this.Ri=null,this.scrollManager=new ko(this),this.pageViewManager=new qs(this),this.rateLimiter=new Rn(this),this.requestRouter=new Ho(this),this.consent=new Kr(this),this.externalIntegrations=new Qo(this);var e=null!==(t=va.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=re(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=re(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>yr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==oa){var r,s=null!==(r=Zo[i])&&void 0!==r?r:new va;return s._init(t,e,i),Zo[i]=s,Zo[oa][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;void 0===e&&(e={});var a=re(t)?t.trim():"";if(!a)return yr.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={},e.debug=this.Oi(e.debug),this.Li=e,this.Fi=[],e.person_profiles?this.Pi=e.person_profiles:e.process_person&&(this.Pi=e.process_person);var u=la(e.defaults),h=ha(e),d=Er({},u,h,{name:r,token:a});te(u.rageclick)&&te(h.rageclick)&&(d.rageclick=Er({},u.rageclick,h.rageclick)),te(u.session_recording)&&te(h.session_recording)&&(d.session_recording=Er({},u.session_recording,h.session_recording)),this.set_config(d),this.config.on_xhr_error&&yr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:In.GZipJS;var v=this.Ai();this.persistence=new mn(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(i({},this.config,{persistence:"sessionStorage"}),v,!1);var c=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.$i=new So((t=>this.Di(t)),this.config.request_queue_config),this.Ni=new $o(this),this.__request_queue=[];var f=this.Ci();if(f||(this.sessionManager=new Co(this),this.sessionPropsManager=new Po(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(yr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.qi(f)}),0)):(yr.info("Initializing extensions synchronously"),this.qi(f)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&yr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:c,s:p}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var _=e.bootstrap.distinctID,g=this.get_distinct_id(),m=this.persistence.get_property(W);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===lt)this.identify(_);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ut)yr.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 y=this.config.get_device_id(Lr()),b=e.bootstrap.isIdentifiedID?y:_;this.persistence.set_property(W,e.bootstrap.isIdentifiedID?ut:lt),this.register({distinct_id:_,$device_id:b})}}if(f)this.register_once({distinct_id:et,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Lr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(W,lt)}return Or(gt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Lr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(W,ut)),e()},s=i.user();"then"in s&&Zt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||js.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(js.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(js.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ct),identify:t=>e(t,ft),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Bi())):this.Bi(),Zt(this.config._onCapture)&&this.config._onCapture!==ea&&(yr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&yr.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 Fo.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(ea),this}qi(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},va.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Si.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.Si.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.Si.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Si.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Si.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Si.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Si.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Si.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.Si.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.Si.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Si.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Si.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Si.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Si.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Si.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Ns)),h.toolbar&&this.Si.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Si.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Si.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.ji){var t=this.ji;this.ji=void 0,this.pr(t)}})),this.Hi(d,u)}Hi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Hi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){yr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[it]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rt]:r}),this.config.__preview_deferred_init_extensions&&yr.info("PostHog extensions initialized ("+r+"ms)")}pr(t){var e;if(!bt||!bt.body)return yr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ji=t),this.Ui=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Gt(t.supportedCompression,In.GZipJS)?In.GZipJS:Gt(t.supportedCompression,In.Base64)?In.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:ht}),this.Si.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Bi(){try{this.config.loaded(this)}catch(t){yr.critical("`loaded` function failed",t)}if(this.zi(),this.config.internal_or_test_user_hostname&&null!=wt&&wt.hostname){var t=wt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ci())&&this.Vi()}),1),this.Wi=new On(this),this.Wi.load()}zi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.$i)||t.enable())}_dom_loaded(){this.is_capturing()&&wr(this.__request_queue,(t=>this.Di(t))),this.__request_queue=[],this.zi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),this.config.request_batching?(this.Gi()&&this.capture(pt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.$i)||i.unload(),null==(r=this.Ni)||r.unload()):this.Gi()&&this.capture(pt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?aa?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(ie(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4,n.url=wo(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=xo.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),l=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===o)return t[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===In.GZipJS&&Tt&&"undefined"!=typeof Promise&&!co?bo(n).then((t=>{l(t)})).catch((e=>{if(jt(e))return co=!0,void l(i({},n,{compression:void 0,url:wo(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return jt(t)||e===Lt})(e)&&(co=!0),l(n)})):l(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Di(t){this.Ni?this.Ni.retriableRequest(t):this._send_request(t)}_execute_array(t){ta++;try{var e,i=[],r=[],s=[];wr(t,(t=>{if(t)if(Xt(e=t[0]))s.push(t);else if(Zt(t))try{t.call(this)}catch(e){yr.error("Error executing queued PostHog call",t,e)}else Xt(t)&&"alias"===e?i.push(t):Xt(t)&&-1!==e.indexOf("capture")&&Zt(this[e])?s.push(t):r.push(t)}));var n=function(t,e){wr(t,(function(t){try{if(Xt(t[0])){var i=e;xr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){yr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{ta--}}push(t){if(ta>0&&Xt(t)&&re(t[0])){var e=va.prototype[t[0]];Zt(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!ie(t)&&re(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!re(null==e?void 0:e.$current_url)&&(yr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.Zi||yr.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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=$i(null==r?void 0:r.uuid,Lr),p={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ct&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var f=null==r?void 0:r.$unset;f&&(p.$unset=f);var _,g,m,y=this.Qi(null==r?void 0:r.$set_once,t!==_t,t===ft);if(y&&(p.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=t=>re(t)?t.slice(0,n):t,l=new Set,p=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Xt(e)?(r=[],wr(e,(e=>{r.push(t(e))}))):(r={},xr(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),p.timestamp=v,ie(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),t===xn.DISMISSED||t===xn.SENT){var b=null==e?void 0:e[En.SURVEY_ID],w=null==e?void 0:e[En.SURVEY_ITERATION];Go({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(_={id:b,current_iteration:w},g=t===xn.SENT?"responded":"dismissed",m="$survey_"+g+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(m="$survey_"+g+"/"+_.id+"/"+_.current_iteration),m)]:!0})}else t===xn.SHOWN&&(p.$set=i({},p.$set,{[En.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Tn.SHOWN){var x=null==e?void 0:e[$n.TOUR_TYPE];x&&(p.$set=i({},p.$set,{[$n.TOUR_LAST_SEEN_DATE+"/"+x]:(new Date).toISOString()}))}var E=i({},p.properties.$set,p.$set);if(ee(E)||this.setPersonPropertiesForFlags(E),!oe(this.config.before_send)){var S=this.it(p);if(!S)return;(p=S).uuid=$i(p.uuid,Lr)}this.Ti.emit("eventCaptured",p);var T={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Di(T):this.$i.enqueue(T),p}yr.critical("This capture call is ignored due to client rate limiting.")}}else yr.error("No event name provided to posthog.capture")}else yr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ci()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!re(l.distinct_id)&&!ae(l.distinct_id)||se(l.distinct_id))&&yr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var s,o,a,l;if(void 0===r&&(r=!1),!$t)return{};var u,h,d,v,c,p,f,_,g,m=t?[...tn,...e||[]]:[],[y,b]=function(t){for(var e=0;Ei.length>e;e++){var[i,r]=Ei[e],s=i.exec(t),n=s&&(Zt(r)?r(s,t):r);if(n)return n}return["",""]}($t),w=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},x={detectGoogleSearchApp:i},E=Er(kr({$os:y,$os_version:b,$browser:bi($t,navigator.vendor,w,x),$device:Si($t),$device_type:(d=$t,v={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(o=navigator)?void 0:o.maxTouchPoints,screenWidth:null==gt||null==(a=gt.screen)?void 0:a.width,screenHeight:null==gt||null==(l=gt.screen)?void 0:l.height,devicePixelRatio:null==gt?void 0:gt.devicePixelRatio},g=Si(d),g===$e||g===Te||"Kobo"===g||"Kindle Fire"===g||g===ii?Se:g===Ve||g===We||g===Ge||g===Ze?"Console":g===Re?"Wearable":g?we:"Android"===(null==v?void 0:v.userAgentDataPlatform)&&(null!==(c=null==v?void 0:v.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(p=null==v?void 0:v.screenWidth)&&void 0!==p?p:0,null!==(f=null==v?void 0:v.screenHeight)&&void 0!==f?f:0)/(null!==(_=null==v?void 0:v.devicePixelRatio)&&void 0!==_?_:1)?we:Se:"Desktop"),$timezone:cn(),$timezone_offset:pn()}),{$current_url:Qs(r?ki(null==wt?void 0:wt.href):null==wt?void 0:wt.href,m,rn),$host:null==wt?void 0:wt.host,$pathname:null==wt?void 0:wt.pathname,$raw_user_agent:$t.length>1e3?$t.substring(0,997)+"...":$t,$browser_version:xi($t,navigator.vendor,w,x),$browser_language:ln(),$browser_language_prefix:(h=ln(),"string"==typeof h?h.split("-")[0]:void 0),$screen_height:null==gt?void 0:gt.screen.height,$screen_width:null==gt?void 0:gt.screen.width,$viewport_height:null==gt?void 0:gt.innerHeight,$viewport_width:null==gt?void 0:gt.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return n.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=n.SDK_DIST_CHANNEL),E}(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{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&Er(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Er(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this.Ni)?void 0:p.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===jo&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ct||o?t!==pt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Er(l,h),t===ct&&bt&&(l.title=bt.title),!ie(a)){var f=r.getTime()-a;l.$duration=parseFloat((f/1e3).toFixed(3))}$t&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Er({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Xt(this.config.property_denylist)?xr(this.config.property_denylist,(function(t){delete l[t]})):yr.error(na+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(yr.error(sa),l=_(l,t));var g=this.Ji();return l.$process_person_profile=g,g&&!o&&this.Yi("_calculate_event_properties"),l}Qi(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Ji())return t;if(this.Ii&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Er({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(yr.error(sa),o=a(o,"$set_once")),e&&(this.Ii=!0),ee(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}Ki(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ti.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ra}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:ra})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:ra})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Yo),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:ra}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:ra})}Xi(t){return!t||se(t)?(yr.critical("Unique user id has not been set in posthog.identify"),!1):t===et?(yr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(yr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return yr.uninitializedWarning("posthog.identify");if(ae(t)&&(t=t.toString(),yr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Xi(t)&&this.Yi("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(u)&&(this.unregister(u),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(W)||lt)===lt;t!==r&&n?(this.persistence.set_property(W,ut),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ft,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Ri=Do(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(H))}}setPersonProperties(t,e){if((t||e)&&this.Yi("posthog.setPersonProperties")){var i=Do(this.get_distinct_id(),t,e);this.Ri!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Ri=i):yr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(Xt(t)?t:[t]).filter((t=>re(t)&&t.length>0));0!==i.length&&this.Yi("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ri=null)}group(t,e,r){if(t&&e){var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},s,{[t]:e})}),n||r){var o={$group_type:t,$group_key:e};r&&(o.$group_set=r),this.capture(_t,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else yr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.Yi("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,u,h,d;if(yr.info("reset"),!this.__loaded)return yr.uninitializedWarning("posthog.reset");var v,c=this.get_property(a),p=this.get_property(l),f=this.get_property(b);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),ie(f)||null==(v=this.persistence)||v.register({[b]:f}),null==(r=this.surveys)||r.reset(),null==(s=this.Wi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(u=this.logs)||u.reset(),null==(h=this.persistence)||h.set_property(W,lt),null==(d=this.sessionManager)||d.resetSessionId(),this.Ri=null,this.config.cookieless_mode===at)this.register_once({distinct_id:et,$device_id:null},"");else{var _=this.config.get_device_id(Lr());this.register_once({distinct_id:_,$device_id:t?_:c},""),t||ie(p)||this.register({[l]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s;i.__loaded?(null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(e=i.$i)||e.unload(),null==(r=i.Ni)||r.unload(),null==(s=i.featureFlags)||s.destroy()):yr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.en()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.tn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(o)?(yr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yi("posthog.alias")?(ie(e)&&(e=this.get_distinct_id()),t!==e?(this.Ki(u,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(yr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(te(t)){var r,s,o,a,l,u,h,d,v,c,p;Er(this.config,ha(t));var f=this.Ai();null==(r=this.persistence)||r.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(i({},this.config,{persistence:"sessionStorage"}),f,!1);var _=this.Oi(this.config.debug);ue(_)&&(this.config.debug=_),ue(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Hr.N()&&Hr.q("ph_debug",!0),yr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,Hr.N()&&Hr.P("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(v=this.deadClicksAutocapture)||v.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.rn(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){n.LIB_NAME=t,n.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:va.nn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:oa;return e!==oa&&(e=oa+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(W))===ut||(null==(e=this.sessionPersistence)?void 0:e.get_property(W))===ut}Ji(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ht&&!this._isIdentified()&&ee(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[u])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Z]))}Gi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Ji()||this.Yi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yi(t){return"never"===this.config.person_profiles?(yr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ki(Z,!0),!0)}Ai(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ot)}rn(){var t,e,i,r,s=this.Ai();return(null==(t=this.persistence)?void 0:t.Vt)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Vt)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==at){if(this.Ci()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Co(this),this.pageViewManager=new qs(this),this.persistence&&(this.sessionPropsManager=new Po(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=va.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.ki(this.sessionRecording,new l(this)),this.Ui&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Ui)))}var u,h;this.consent.optInOut(!0),this.rn(),this.zi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ot&&(null==(u=this.surveys)||u.loadIfEnabled()),(ie(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vi()}else yr.warn(ia)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==at?(this.config.cookieless_mode===ot&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rn(),this.config.cookieless_mode===ot&&(this.register({distinct_id:et,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vi(),this.zi())):yr.warn(ia)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===at||(this.config.cookieless_mode===ot?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.rn()}_is_bot(){return yt?Ao(yt,this.config.custom_blocked_useragents):void 0}Vi(){bt&&("visible"===bt.visibilityState?this.Ei||(this.Ei=!0,this.capture(ct,{title:bt.title},{send_instantly:!0}),this.Mi&&(bt.removeEventListener(dt,this.Mi),this.Mi=null)):this.Mi||(this.Mi=this.Vi.bind(this),Or(bt,dt,this.Mi)))}debug(t){!1===t?(null==gt||gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==gt||gt.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}))}mr(){var t,e,i,r,s,n,o=this.Li||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(yr.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):(i="advanced_disable_decide",!1,r=yr,s=(e="advanced_disable_flags")in(t=o)&&!oe(t[e]),n=i in t&&!oe(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}it(t){var e;if(oe(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(ve),r=Xt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),oe(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return de(t.event)?yr.warn(o+". This can cause unexpected behavior."):yr.info(o),null}s.properties&&!ee(s.properties)||yr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&oe(s.properties[a]))return yr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ot)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Oi(t){var e=ue(t)&&!t,i=Hr.N()&&"true"===Hr.A("ph_debug");return!e&&(!!i||t)}}va.__defaultExtensionClasses={},va.nn={trace:Xo=()=>{},debug:Xo,info:Xo,warn:Xo,error:Xo,fatal:Xo},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=$r(t.prototype[e[i]])}(va,["identify"]);class ca{constructor(t){this.disabled=!1===t;var e=te(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var pa="$copy_autocapture",fa=br("[AutoCapture]");function _a(t,e){return e.length>t?e.slice(0,t)+"...":e}function ga(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!es(e));return e}function ma(t,e){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:h}=e;if(!es(t))return{props:{}};for(var d=[t],v=t;v.parentNode&&!is(v,"body");)if(ss(v.parentNode))d.push(v.parentNode.host),v=v.parentNode.host;else{if(!es(v.parentNode))break;d.push(v.parentNode),v=v.parentNode}var c,p,f=[],_={},g=!1,m=!1;if(xr(d,(t=>{var e=Es(t);if(is(t,"a")){var i=t.getAttribute("href");g=!!(e&&i&&Is(i))&&(h?ki(i):i)}Gt(as(t),"ph-no-capture")&&(m=!0),f.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};ds.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?_a(1024,Cs(t)):_a(1024,us(t)));var a=as(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),xr(t.attributes,(function(i){var n;if((!Ss(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Is(i.value)&&(!re(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=ns(a).join(" ")),o["attr__"+i.name]=_a(1024,"href"===i.name&&s?ki(a):a)}}));for(var l=1,u=1,h=t;h=ga(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!Es(t))return{};var e={};return xr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Is(r)&&(e[i]=r)}})),e}(t);Er(_,r)})),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text=is(t,"a")||is(t,"button")?Cs(t):us(t)),g){var y,b;f[0].attr__href=g;var w=null==(y=Ks(g))?void 0:y.host,x=null==gt||null==(b=gt.location)?void 0:b.host;w&&x&&w!==x&&(c=g)}return{props:Er({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(p=f,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return Sr(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[Fs(e.toString())]=Fs(i.toString())})),(s+=":")+Sr(a).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Ms(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Sr(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(p)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var ya=br("[ExceptionAutocapture]"),ba=br("[TracingHeaders]"),wa=br("[Web Vitals]"),xa=9e5,Ea="disabled",Sa="lazy_loading",Ta="awaiting_config",$a="missing_config";br("[SessionRecording]"),br("[SessionRecording]");var ka="[SessionRecording]",Ra=br(ka),Pa=br("[Heatmaps]");function Oa(t){return te(t)&&"clientX"in t&&"clientY"in t&&ae(t.clientX)&&ae(t.clientY)}var Ia=br("[Product Tours]"),Ca=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},Aa=["$set_once","$set"],Fa=br("[SiteApps]"),Ma="Error while initializing PostHog app with config id ";function Da(t,e,i){if(oe(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class La{constructor(t){this.sn=new Oo,this.an=(t,e)=>this.ln(t,e)&&this.un(t,e)&&this.hn(t,e)&&this.dn(t,e),this.ln=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.cn=new Set,this.vn=new Set}init(){var t,e;ie(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!ie(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.vn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.cn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.cn.has(t)||this.cn.has(null==e?void 0:e.event))&&this.vn&&(null==(i=this.vn)?void 0:i.size)>0&&this.vn.forEach((t=>{this.fn(e,t)&&this.sn.emit("actionCaptured",t.name)}))}pn(t){this.onAction("actionCaptured",(e=>t(e)))}fn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.an(t,i))return!0;return!1}onAction(t,e){return this.sn.on(t,e)}un(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Da(r,e.url,e.url_matching||"contains"))return!1}return!0}hn(t,e){return!!this.gn(t,e)&&!!this.mn(t,e)&&!!this.yn(t,e)}gn(t,e){var i;if(null==e||!e.href)return!0;var r=this.bn(t);if(r.length>0)return r.some((t=>Da(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Da((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}mn(t,e){var i;if(null==e||!e.text)return!0;var r=this.bn(t);if(r.length>0)return r.some((t=>Da(t.text,e.text,e.text_matching||"exact")||Da(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!oe(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Da(t,n,o))))}yn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}bn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}dn(t,e){return null==e||!e.properties||0===e.properties.length||Uo(e.properties.reduce(((t,e)=>{var i=Xt(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Na{constructor(t){this._n=[],this._instance=t,this.wn=new Map,this.xn=new Map,this.kn=new Map}Sn(t,e){return!!t&&Uo(t.propertyFilters,null==e?void 0:e.properties)}Cn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}In(t,e,i){var r=(i===yn.Activation?this.wn:this.xn).get(t),s=[];return this.Tn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Sn(n,e)}))}register(t){var e;ie(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.En(t),this.Mn(t))}Mn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Pn&&(this.Pn=new La(this._instance),this.Pn.init(),this.Pn.pn((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Pn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.kn.get(e.name);i&&i.push(t.id),this.kn.set(e.name,i||[t.id])}})))})))}En(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.wn=this.Cn(t,yn.Activation),this.xn=this.Cn(t,yn.Cancellation))}onEvent(t,e){var i,r,s=this.Rn(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.On(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Ln([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Fn(n)}if(this.xn.has(t)){var a=this.In(t,e,yn.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Ln(a.map((t=>t.id))),a.forEach((t=>this.An(t.id))))}if(this.wn.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.wn.get(t)});var l=this.In(t,e,yn.Activation);this.$n(l.map((t=>t.id)))}}onAction(t){this.kn.has(t)&&this.$n(this.kn.get(t)||[])}$n(t){0!==t.length&&(this._n=[...new Set([...this._n,...t])],this.Rn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Fn(t){this._n=this._n.filter((e=>e!==t));var e=this.Dn();e.includes(t)||this.Nn([...e,t])}Ln(t){var e=new Set(t);this._n=this._n.filter((t=>!e.has(t)));var i=this.Dn(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Nn(r)}Dn(){var t,e=this.qn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.Dn(),...this._n])].filter((t=>!this.Bn(t)))}reset(){this._n=[],this.Dn().length>0&&this.Nn([])}getEventToItemsMap(){return this.wn}jn(){return this.Pn}}class Ua extends Na{constructor(t){super(t)}qn(){return B}Hn(){return xn.SHOWN}Tn(t){var e;null==(e=this._instance)||e.getSurveys(t)}An(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Rn(){return qo}Nn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[B]:t})}Bn(){return!1}On(t,e){var i;this.Tn((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e,i,r,s=(null!==(e=null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)&&void 0!==e?e:0)>0;return t.schedule===wn.Always||!(null==(r=t.conditions)||null==(r=r.events)||!r.repeatedActivation||!s)}(i);return r?t===xn.SHOWN?"consume":"ignore":t===xn.SHOWN?"persist":t===xn.DISMISSED||t===xn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ja="SDK is not enabled or survey functionality is not yet loaded",Ba="Disabled. Not loading surveys.",za=null!=gt&&gt.location?Xs(gt.location.hash,"__posthog")||Xs(location.hash,"state"):null,Ha="_postHogToolbarParams",qa=br("[Toolbar]"),Va=br("[FeatureFlags]"),Ga=br("[FeatureFlags]",{debugEnabled:!0}),Wa="\" failed. Feature flags didn't load in time.",Ya=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ka=t=>{var e={};for(var[i,r]of Sr(t||{}))r&&(e[i]=r);return e},Ja=br("[Error tracking]"),Qa="Refusing to render web experiment since the viewer is a likely bot",Xa={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Mo(e,t),not_regex:(t,e)=>!Mo(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Za{get Se(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Za.Un("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(Za.Un("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);re(r)&&t.variants[r]&&e.Vn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Za.Wn(n,e._instance)&&e.Vn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Za.Un(Qa);else if(!this.Se.disable_web_experiments){if(oe(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Za.Un("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Vn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Za.getWindowLocation();if(null!=t&&t.search){var e=Js(null==t?void 0:t.search,"__experiment_id"),i=Js(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Za.Un("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Se.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Za.Un("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Vn(r[0].name,e,r[0].variants[e].transforms))}static Wn(t,e){return!oe(t.conditions)&&Za.Zn(t,e)&&Za.Qn(t)}static Zn(t,e){var i;if(oe(t.conditions)||oe(null==(i=t.conditions)?void 0:i.url))return!0;var r=Za.getWindowLocation();if(r){var s,n,o,a=Jr(e,r.href);return null==(s=t.conditions)||!s.url||Xa[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==gt?void 0:gt.location}static Qn(t){var e;if(oe(t.conditions)||oe(null==(e=t.conditions)?void 0:e.utm))return!0;var i=nn();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Un(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];yr.info("[WebExperiments] "+t,i)}Vn(t,e,i){this._is_bot()?Za.Un(Qa):"control"!==e?i.forEach((i=>{if(i.selector){var r;Za.Un("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Za.Un("Control variants leave the page unmodified.")}_is_bot(){return yt&&this._instance?Ao(yt,this.Se.custom_blocked_useragents):void 0}}var tl=br("[Conversations]"),el="Conversations not available yet.",il="console",rl={featureFlags:class{constructor(t){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=0,this.os=()=>{var t=this.ls();this.ss=0,t&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],gt&&Or(gt,"online",this.os)}destroy(){null==gt||gt.removeEventListener("online",this.os)}get Se(){return this._instance.config}get zr(){return this._instance.persistence}us(t){return this._instance.get_property(t)}hs(){var t,e;return null!==(t=null==(e=this.zr)?void 0:e.Gt(this.Se.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ds(){return!!this.hs()&&(this.ns||this.Kn||(this.ns=!0,Va.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}cs(){var t,e=null!==(t=this.Se.evaluation_contexts)&&void 0!==t?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.rs||(Va.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Va.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}vs(){return this.cs().length>0}fs(){var t=this.Se.flag_keys;if(!ie(t)){if(Xt(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Va.error("Invalid flag key found:",t,"Expected non-empty string"),e}));Va.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.us(P))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.us(A))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var[d,v]of Object.entries(l))h[d]={key:d,enabled:Ot(v),variant:It(v),reason:void 0,metadata:ie(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.us(C),e=this.us(M),r=this.us(D);if(!r&&!e)return t||{};var s=Er({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=ie(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=ie(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],p=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),c&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=p}return this.Jn||(Va.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Jn=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Ot(r),variant:It(r),payload:Pt(e[i])}}))}getFlagVariants(){var t=this.us(P),e=this.us(M);if(!e)return t||{};for(var i=Er({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Va.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.us(A),e=this.us(D);if(!e)return t||{};for(var i=Er({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Va.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.Xn||this.Se.advanced_disable_feature_flags||this.ls()||this.ps||(this._instance.Ti.emit("featureFlagsReloading",!0),this.ps=setTimeout((()=>{this.gs()}),5))}ys(){clearTimeout(this.ps),this.ps=void 0}ensureFlagsLoaded(){this.Yn||this.Kn||this.ps||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Xn=t}gs(t){var e;if(this.ys(),!this._instance.mr()&&!this.ls())if(this.Kn)this.es=!0;else{var r=this.Se.token,s=this.us(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.zr)?void 0:e.get_initial_props())||{},this.us(L)||{}),group_properties:this.us(N),timezone:cn()};ne(s)||ie(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.vs()&&(n.evaluation_contexts=this.cs());var o=this.fs();ie(o)||(n.flag_keys=o);var l=!!this.Se.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this.Se.disable_compression?void 0:In.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(this.bs(t.statusCode),200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!s;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(r=this.zr)||r.register({[V]:o}),u)Va.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.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},s,{partialResponse:l}),this.es&&(this.es=!1,this.gs())}}})}}ls(){return this.ss>=3&&Rt()}bs(t){this.ss=((t,e,i,r)=>{if(0===t){if(Rt()){var s=e+1;return 3===s&&Va.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."),s}return e}return 0})(t,this.ss)}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ds()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Va.warn('getFeatureFlag for key "'+t+Wa)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ds()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.us(F)||void 0,l=this.us(G)||void 0,u=this.us(H)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.us(q);d&&d!==v&&(u={},null==(h=this.zr)||h.register({[H]:u,[q]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,y,b,w,x;Xt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.zr)||c.register({[H]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.us(V))&&void 0!==p?p:[]];ie(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Se.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Se.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.ts};ie(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,R=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;R&&(T.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),ie(null==E?void 0:E.original_variant)&&ie(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=ie(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Pt(n)}}}else Va.warn('getFeatureFlagResult for key "'+t+Wa)}getRemoteConfigPayload(t,e){var i=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.vs()&&(r.evaluation_contexts=this.cs());var s=this.fs();ie(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:In.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return ie(i)?void 0:!!i}Va.warn('isFeatureEnabled for key "'+t+Wa)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.zr){this.Yn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(t,e,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var a=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):t.featureFlags&&Va.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=a.flags,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(Xt(u)){Va.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var p=0;u.length>p;p++)c[u[p]]=!0;e&&e.register({[O]:u,[P]:c})}else{var f=u,_=h,g=l;if(null!=o&&o.partialResponse)f=i({},r,f),_=i({},s,_),g=i({},n,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));f=i({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=i({},r,f),_=i({},s,_),g=i({},n,g);e&&e.register(i({[O]:Object.keys(Ka(f)),[P]:f||{},[A]:_||{},[C]:g||{}},d?{[F]:d}:{},v?{[G]:v}:{}))}}}(t,this.zr,s,n,o,r),e||(this.ns=!1),this._s(e)}}override(t,e){void 0===e&&(e=!1),Va.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.zr)return Va.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.zr.unregister(M),this.zr.unregister(D),this._s(),Ga.info("All overrides cleared");if(Xt(t)){var e=Ya(t);return this.zr.register({[M]:e}),this._s(),Ga.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.zr.unregister(M),Ga.info("Flag overrides cleared");else if(r.flags){if(Xt(r.flags)){var s=Ya(r.flags);this.zr.register({[M]:s})}else this.zr.register({[M]:r.flags});Ga.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.zr.unregister(D),Ga.info("Payload overrides cleared")):r.payloads&&(this.zr.register({[D]:r.payloads}),Ga.info("Payload overrides set",{payloads:r.payloads}))),void this._s()}if(t&&"object"==typeof t)return this.zr.register({[M]:t}),this._s(),Ga.info("Flag overrides set",{flags:t});Va.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Yn){var{flags:e,flagVariants:i}=this.ws();try{t(e,i)}catch(t){Va.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.us(I)||[]).find((e=>e.flagKey===t)),o={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[t]:e});null==(s=this.zr)||s.register({[O]:Object.keys(Ka(l)),[P]:l}),this._s()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.us(I),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.zr)||i.unregister(I),null==(r=this.zr)||r.register({[I]:s}),t(s)}}})}ws(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}_s(t){var{flags:e,flagVariants:i}=this.ws();this.featureFlagEventHandlers.forEach((r=>{try{r(e,i,{errorsLoading:t})}catch(t){Va.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.us(L)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this._instance.register({[L]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.us(L)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[L]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(L),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.us(N)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[N]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.us(N)||{};this._instance.register({[N]:i({},e,{[t]:{}})})}else this._instance.unregister(N)}reset(){this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.ys(),this.Jn=!1,this.ss=0}}},sl={sessionRecording:class{get Se(){return this._instance.config}get zr(){return this._instance.persistence}get started(){var t;return!(null==(t=this.xs)||!t.isStarted)}get status(){var t,e;return this.ks===Ta||this.ks===$a?this.ks:null!==(t=null==(e=this.xs)?void 0:e.status)&&void 0!==t?t:this.ks}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ks=Ea,this.Ss=void 0,this._instance=t,!this._instance.sessionManager)throw Ra.error("started without valid sessionManager"),new Error(ka+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===at)throw new Error(ka+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Cs(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Se.disable_session_recording,r=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return gt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.Cs||null==(e=this.xs)||!e.isStarted){var i=!ie(Object.assign)&&!ie(Array.from);this.Cs&&i?(this.Is(t),Ra.info("starting")):(this.ks=Ea,this.stopRecording())}}Is(t){var e,i,r;this.Cs&&(this.ks!==Ta&&this.ks!==$a&&(this.ks=Sa),null!=kt&&null!=(e=kt.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=kt.__PosthogExtensions__)&&i.initSessionRecording?this.Ts(t):null==(r=kt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Es,(e=>{if(e)return Ra.error("could not load recorder",e);this.Ts(t)})))}stopRecording(){var t,e;null==(t=this.Ss)||t.call(this),this.Ss=void 0,null==(e=this.xs)||e.stop()}Ms(){var t,e;null==(t=this.Ss)||t.call(this),this.Ss=void 0,null==(e=this.xs)||e.discard()}Ps(){var t,e;null==(t=this.zr)||t.unregister(R),null==(e=this.zr)||e.unregister(w)}Rs(t,e){if(oe(t))return null;var i,r=ae(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ra.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Os(t){if(this.zr){var e,r,s=this.zr,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Rs(null==(e=this.Se.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Rs(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;oe(a)&&this.Ps();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ie(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.Ss)||e.call(this),this.Ss=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Os(t),void this.Ms()):(this.Os(t),void this.startIfEnabledOrStop()):(this.ks===Ta&&(this.ks=$a,Ra.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.xs)&&i.log?this.xs.log(t,e):Ra.warn("log called before recorder was ready")}get Es(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Ls(){var t,e,i=this._instance.get_property(b);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return Ra.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}Ts(t){var e,i;if(null==(e=kt.__PosthogExtensions__)||!e.initSessionRecording)return Ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[st]:!0});if(this.xs||(this.xs=null==(i=kt.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.xs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ls()){if(this.ks===$a||this.ks===Ta)return;return this.ks=Ta,Ra.info("persisted remote config is stale, requesting fresh config before starting"),void new On(this._instance).load()}this.ks=Sa,this.xs.start(t)}onRRwebEmit(t){var e;null==(e=this.xs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.xs||null==(e=this.zr)||e.register({[E]:!0}),null==(t=this.xs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.xs||null==(e=this.zr)||e.register({[x]:!0}),null==(t=this.xs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.xs||null==(i=this.zr)||i.register({["url"===t?S:T]:!0}),null==(e=this.xs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.xs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.xs)||!i.tryAddCustomEvent(t,e))}}},nl={autocapture:class{constructor(t){this.Fs=!1,this.As=null,this.$s=!1,this.instance=t,this.rageclicks=new ca(t.config.rageclick),this.Ds=null}initialize(){this.startIfEnabled()}get Se(){var t,e,i=te(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Ns(){if(this.isBrowserSupported()){if(gt&&bt){var t=t=>{t=t||(null==gt?void 0:gt.event);try{this.qs(t)}catch(t){fa.error("Failed to capture event",t)}};if(Or(bt,"submit",t,{capture:!0}),Or(bt,"change",t,{capture:!0}),Or(bt,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=t=>{t=t||(null==gt?void 0:gt.event);try{this.qs(t,pa)}catch(t){fa.error("Failed to capture copy/cut event",t)}};Or(bt,"copy",e,{capture:!0}),Or(bt,"cut",e,{capture:!0})}}}else fa.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Fs&&(this.Ns(),this.Fs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.$s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[d]:!!t.autocapture_opt_out}),this.As=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ds)||e.forEach((e=>{var r=null==bt?void 0:bt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[d];if(ne(this.As)&&!ue(i)&&!this.instance.mr())return!1;var r=null!==(e=this.As)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}qs(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=hs(t);rs(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&bs(r,this.instance.config.rageclick)&&this.qs(t,"$rageclick");var s=e===pa;if(r&&function(t,e,i,r,s,n){var o,a,l,u,h,d;if(void 0===i&&(i=void 0),!gt||ws(t))return!1;if(null!=(o=i)&&o.url_allowlist&&!os(i.url_allowlist,n))return!1;if(null!=(a=i)&&a.url_ignorelist&&os(i.url_ignorelist,n))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var v=i.dom_event_allowlist;if(v&&!v.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:c,targetElementList:p}=xs(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ie(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(p,i))return!1;if(!vs(p,null==(u=i)?void 0:u.css_selector_allowlist))return!1;if(vs(p,null!==(h=null==(d=i)?void 0:d.css_selector_ignorelist)&&void 0!==h?h:ps))return!1;try{var f=gt.getComputedStyle(t);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var _=t.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(ds.indexOf(_)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Se,s,s?["copy","cut"]:void 0,this.instance)){var{props:n,explicitNoCapture:o}=ma(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.$s,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===pa){var l,u=ls(null==gt||null==(l=gt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Zt(null==bt?void 0:bt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Bs=(null==gt||null==(e=gt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.js&&this.js(),this.js=void 0,yr.info("History API monitoring stopped")}monitorHistoryChanges(){gt&&gt.history&&(this.Hs("pushState"),this.Hs("replaceState"),this.Us())}Hs(t){var e;if(gt&&(null==(e=gt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Zt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]===s&&(t[e]=r)}}catch(t){return()=>{}}}(gt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.zs(t)}))}}zs(t){try{var e,i=null==gt||null==(e=gt.location)?void 0:e.pathname;if(!i)return;i!==this.Bs&&this.isEnabled&&this._instance.capture(ct,{navigation_type:t}),this.Bs=i}catch(e){yr.error("Error capturing "+t+" pageview",e)}}Us(){if(!this.js){var t=()=>{this.zs("popstate")};Or(gt,"popstate",t),this.js=()=>{gt&&gt.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.Vs=!1,this.Fs=!1,this.Ws=null,this.instance=t,this.Vs=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new ca(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return te(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return oe(this.Se.capture_heatmaps)?oe(this.Se.enable_heatmaps)?this.Vs:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Fs)return;Pa.info("starting..."),this.Gs(),this.ke()}else{var t;clearInterval(null!==(t=this.Ws)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:e}),this.Vs=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Qs(t){this.fe(t.originalEvent,"deadclick")}ke(){this.Ws&&clearInterval(this.Ws),this.Ws="visible"===(null==bt?void 0:bt.visibilityState)?setInterval(this.Lr.bind(this),this.flushIntervalMilliseconds):null}Gs(){gt&&bt&&(this.Js=this.Lr.bind(this),Or(gt,vt,this.Js),this.Ys=t=>this.fe(t||(null==gt?void 0:gt.event)),Or(bt,"click",this.Ys,{capture:!0}),this.Ks=t=>this.Xs(t||(null==gt?void 0:gt.event)),Or(bt,"mousemove",this.Ks,{capture:!0}),this.eo=new Us(this.instance,Ls,this.Qs.bind(this)),this.eo.startIfEnabledOrStop(),this.ro=this.ke.bind(this),Or(bt,dt,this.ro),this.Fs=!0)}Zs(){var t;gt&&bt&&(this.Js&&gt.removeEventListener(vt,this.Js),this.Ys&&bt.removeEventListener("click",this.Ys,{capture:!0}),this.Ks&&bt.removeEventListener("mousemove",this.Ks,{capture:!0}),this.ro&&bt.removeEventListener(dt,this.ro),clearTimeout(this.io),null==(t=this.eo)||t.stop(),this.Fs=!1)}no(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&es(r)&&!is(r,"body");){if(r===i)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:gt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Gt(e,s))return!0;r=cs(r)}return!1}(hs(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}fe(t,e){var r;if(void 0===e&&(e="click"),!ts(t.target)&&Oa(t)){var s=this.no(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&bs(hs(t),this.instance.config.rageclick)&&this.so(i({},s,{type:"rageclick"})),this.so(s)}}Xs(t){!ts(t.target)&&Oa(t)&&(clearTimeout(this.io),this.io=setTimeout((()=>{this.so(this.no(t,"mousemove"))}),500))}so(t){if(gt){var e=this.Se.disable_capture_url_hashes?ki(gt.location.href):gt.location.href,i=this.Se.custom_personal_data_properties,r=this.Se.mask_personal_data_properties?[...tn,...i||[]]:[],s=Qs(e,r,rn);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}Lr(){this.R&&!ee(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Us,webVitalsAutocapture:class{constructor(t){var e;this.Vs=!1,this.Fs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.oo=()=>{clearTimeout(this.ao),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lo=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.uo();if(!ie(r))if(oe(null==t?void 0:t.name)||oe(null==t?void 0:t.value))wa.error("Invalid metric received",t);else if(!this.ho||this.ho>t.value){this.R.url!==r&&(this.oo(),this.ao=setTimeout(this.oo,this.flushToCaptureTimeoutMs)),ie(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=ie(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var s=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),n=i({},t,{$current_url:r,timestamp:Date.now()});ie(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.oo()}else wa.error("Ignoring metric with value >= "+this.ho,t)},this.do=()=>{if(!this.Fs){var t,e,i,r,s=kt.__PosthogExtensions__;ie(s)||ie(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.lo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.lo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.lo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.lo.bind(this)),this.Fs=!0):wa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Vs=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get co(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=te(this.co)?null==(t=this.co)?void 0:t.web_vitals_allowed_metrics:void 0;return oe(i)?(null==(e=this._instance.persistence)?void 0:e.props[y])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(te(this.co)?this.co.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=te(this.co)?this.co.web_vitals_attribution:void 0;return null!=t&&t}get ho(){var t=te(this.co)&&ae(this.co.__web_vitals_max_value)?this.co.__web_vitals_max_value:xa;return t>0&&6e4>=t?xa:t}get isEnabled(){var t=null==wt?void 0:wt.protocol;if("http:"!==t&&"https:"!==t)return wa.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=te(this.co)?this.co.web_vitals:ue(this.co)?this.co:void 0;return ue(e)?e:this.Vs}startIfEnabled(){this.isEnabled&&!this.Fs&&(wa.info("enabled, starting..."),this.Mt(this.do))}onRemoteConfig(t){if("capturePerformance"in t){var e=te(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=te(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:e}),this._instance.persistence.register({[y]:i})),this.Vs=e,this.startIfEnabled()}}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?wa.error("failed to load script",e):t()}))}uo(){var t=gt?this._instance.config.disable_capture_url_hashes?ki(gt.location.href):gt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...tn,...e||[]]:[];return Qs(t,i,rn)}wa.error("Could not determine current URL")}}},ol={exceptionObserver:class{constructor(t){var e,i,r;this.do=()=>{var t;if(gt&&this.isEnabled&&null!=(t=kt.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=kt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=kt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=kt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.vo&&this.Se.capture_unhandled_errors&&(this.vo=e(this.captureException.bind(this))),!this.fo&&this.Se.capture_unhandled_rejections&&(this.fo=i(this.captureException.bind(this))),!this.po&&this.Se.capture_console_errors&&(this.po=r(this.captureException.bind(this)))}catch(t){ya.error("failed to start",t),this.mo()}}},this._instance=t,this.yo=!(null==(e=this._instance.persistence)||!e.props[c]),this.bo=new be({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Ae:ya}),this.Se=this._o(),this.startIfEnabledOrStop()}_o(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return te(t)?e=i({},e,t):(ie(t)?this.yo:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ya.info("enabled"),this.mo(),this.Mt(this.do)):this.mo()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ya.error("failed to load script",e);t()}))}mo(){var t,e,i;null==(t=this.vo)||t.call(this),this.vo=void 0,null==(e=this.fo)||e.call(this),this.fo=void 0,null==(i=this.po)||i.call(this),this.po=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.yo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.yo}),this.Se=this._o(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this._o()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.bo.consumeRateLimit(s)?ya.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.wo=[],this.xo=new zi([new tr,new hr,new ir,new er,new lr,new ar,new sr,new ur],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Zi.test(l)?l.replace(Zi,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||Hi});var r}))}(n)}}("web:javascript",Ki,Xi)),this._instance=t,this.wo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(p))&&void 0!==e?e:[],this.ko=fr(this.So()),this.Co=new _r(this.ko)}onConfigChange(){this.ko=fr(this.So()),this.Co.setConfig(this.ko)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.wo=s,this._instance.persistence&&this._instance.persistence.register({[p]:this.wo,[f]:n})}}get Io(){var t,e=!!this._instance.get_property(f),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.xo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ko.enabled)try{if(!re(t)||0===t.trim().length)return void Ja.warn("Ignoring exception step because message must be a non-empty string");var r=this.To(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>cr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ja.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Co.add(i({[dr]:t,[vr]:(new Date).toISOString()},s))}catch(t){Ja.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Eo(e)){if(this.Mo(e))return this.Po("Exception dropped: matched a suppression rule"),void Ja.info("Skipping exception capture because a suppression rule matched");if(!this.Io&&this.Ro(e))return this.Po("Exception dropped: thrown by a browser extension"),void Ja.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Oo(e))return this.Po("Exception dropped: thrown by the PostHog SDK"),void Ja.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ko.enabled&&oe(t.$exception_steps)?this.Lo(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Zi:!0});return r&&this.Co.clear(),r}catch(t){return Ja.error("Failed to capture exception event. Dropping this exception.",t),void this.Co.clear()}}catch(t){return void Ja.error("Failed to process exception event. Ignoring this exception.",t)}}Lo(t){try{var e=this.Co.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ja.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Po(t){this.ko.enabled&&this.Co.add({[dr]:t,[vr]:(new Date).toISOString()})}To(t){return te(t)?i({},t):{}}So(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Mo(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return re(i)&&i.length>0&&t.$exception_types.push(i),re(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.wo.some((t=>{var i=t.values.map((t=>{var i,r=Lo[t.operator],s=Xt(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}Ro(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Oo(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Eo(t){return!oe(t)&&Xt(t)}}},al=i({productTours:class{get zr(){return this._instance.persistence}constructor(t){this.Fo=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.zr&&this.zr.register({[m]:!!t.productTours}),!Ca(this._instance))return!this.Fo&&oe(null==(e=this.zr)?void 0:e.props[z])||Ia.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Fo)||i.stop(),this.Fo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Fo&&Ca(this._instance)&&this.Mt((()=>this.$o()))}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ia.error("Could not load product tours script",e):t()}))}$o(){var t;!this.Fo&&null!=(t=kt.__PosthogExtensions__)&&t.generateProductTours&&(this.Fo=kt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Xt(this.Ao)||e){var i=this.zr;if(i){var r=i.props[z];if(Xt(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{if(Ca(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ia.error(s),void t([],{isLoaded:!1,error:s})}var n=Xt(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[z]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){oe(this.Fo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fo.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Fo)||e.showTourById(t)}previewTour(t){this.Fo?this.Fo.previewTour(t):this.Mt((()=>{var e;this.$o(),null==(e=this.Fo)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Fo)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Fo)||t.nextStep()}previousStep(){var t;null==(t=this.Fo)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.zr)||t.unregister(z)}resetTour(t){var e;null==(e=this.Fo)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Fo)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Fo)||e.cancelPendingTour(t)}}},rl),ll={siteApps:class{constructor(t){this.Do=0,this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=kt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.qo.bind(this));this.Bo=()=>{t(),this.No=[],this.Bo=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,p]of Object.entries(v))h[c]={id:d[c],type:c,properties:p};var{$set_once:f,$set:_}=t;return{event:i({},r(t,Aa),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},f?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},f)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}jo(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Fa.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Fa.error("prepare_external_dependency_script returned null"),null):t}Ho(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==bt?void 0:bt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Do++,this.Uo)return this.zo();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},p=t=>{if(v.has(t))return t;var e=d.jo(t);return e&&v.add(e),e},f=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!ne(t)));return c(u,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=f(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.Uo=()=>{h.forEach((t=>t())),this.Uo=void 0},this.zo()}zo(){var t=!1;return()=>{var e;t||(t=!0,this.Do--,0===this.Do&&(null==(e=this.Uo)||e.call(this)))}}Vo(t,e){void 0===e&&(e=!0);var i=this.Ho();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(Fa.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>this.Vo((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Bo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Fa.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Vo((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){Fa.error(Ma+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Fa.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Wo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Go(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Vo((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Fa.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Wo(),void this._instance.on("eventCaptured",(t=>this.Go(t)))):void Fa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Bo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;kt["__$$ph_site_app_"+t]=s._instance,null==(e=kt.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Fa.error(Ma+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Fa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ul={tracingHeaders:class{constructor(t){this.Zo=void 0,this.Qo=void 0,this.Jo=void 0,this.do=()=>{var t,e,i=this.Yo();i?(ie(this.Zo)&&(this.Zo=null==(t=kt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ie(this.Qo)&&(this.Qo=null==(e=kt.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mo()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return ba.error("failed to load script",e);t()}))}Ko(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Yo(){var t=this.Ko();return Xt(t)?(Xt(this.Jo)?this.Jo.splice(0,this.Jo.length,...t):this.Jo=[...t],t.length>0?this.Jo:void 0):(Xt(this.Jo)&&this.Jo.splice(0),this.Jo=t||void 0,this.Jo)}mo(){var t,e;null==(t=this.Zo)||t.call(this),null==(e=this.Qo)||e.call(this),this.Zo=void 0,this.Qo=void 0}startIfEnabledOrStop(){this.Yo()?this.Mt(this.do):this.mo()}}},hl=i({surveys:class{get Se(){return this._instance.config}constructor(t){this.Xo=void 0,this._surveyManager=null,this.ea=!1,this.ta=[],this.ra=null,this.ia=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(oe(e))return qo.warn("Flags not loaded yet. Not loading surveys.");var i=Xt(e);this.Xo=i?e.length>0:e,qo.info("flags response received, isSurveysEnabled: "+this.Xo),this.loadIfEnabled()}}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(Vo)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.ea)qo.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)qo.info(Ba);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())qo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==kt?void 0:kt.__PosthogExtensions__;if(t){if(!ie(this.Xo)||this.Se.advanced_enable_surveys){var e=this.Xo||this.Se.advanced_enable_surveys;this.ea=!0;try{var i=t.generateSurveys;if(i)return void this.na(i,e);var r=t.loadExternalDependency;if(!r)return void this.sa(nt);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.sa("Could not load surveys script",i):this.na(t.generateSurveys,e)}))}catch(t){throw this.sa("Error initializing surveys",t),t}finally{this.ea=!1}}}else qo.error("PostHog Extensions not found.")}}na(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ua(this._instance),qo.info("Surveys loaded successfully"),this.oa({isLoaded:!0})}sa(t,e){qo.error(t,e),this.oa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ta.push(t),this._surveyManager&&this.oa({isLoaded:!0}),()=>{this.ta=this.ta.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Se.disable_surveys)return qo.info(Ba),t([]);var i,r=this._instance.get_property(U);if(r&&!e)return t(r,{isLoaded:!0}),void(this.aa()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this.ra?this.ra.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.ra=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:e=>{var r;this.ra=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;qo.error(n),this.ia=Date.now();var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.ia=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[U]:l,[j]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}aa(){return this.la()&&!this.ra&&!this.ua()}la(){var t=this._instance.get_property(j);return ae(t)&&Date.now()-t>3e5}ua(){return ae(this.ia)&&3e5>Date.now()-this.ia}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Go(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}oa(t){for(var e of this.ta)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){qo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!oe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);qo.warn("init was not called")}ha(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}da(t){if(oe(this._surveyManager))return{eligible:!1,reason:ja};var e="string"==typeof t?this.ha(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(oe(this._surveyManager))return qo.warn("init was not called"),{visible:!1,disabledReason:ja};var e=this.da(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return oe(this._surveyManager)?(qo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ja})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.da(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(oe(this._surveyManager))qo.warn("init was not called");else{var s="string"==typeof t?this.ha(t):t;if(null!=s&&s.id)if(Wo.includes(s.type)){var n=null==bt?void 0:bt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(qo.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;qo.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),qo.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);qo.warn("Survey element not found")}else qo.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qo.warn("Survey not found")}}displaySurvey(t,e){var r;if(oe(this._surveyManager))qo.warn("init was not called");else{var s=this.ha(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Sn.Popover&&e.initialResponses&&qo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void qo.warn("Survey is not eligible to be displayed: ",o.disabledReason)}e.displayType!==Sn.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else qo.warn("Survey not found")}}cancelPendingSurvey(t){oe(this._surveyManager)?qo.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},rl),dl={toolbar:class{constructor(t){this.instance=t}ca(t){kt.ph_toolbar_state=t}va(){var t;return null!==(t=kt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ir(this.instance.config))return!1;if(!gt||!bt)return!1;t=null!=t?t:gt.location,i=null!=i?i:gt.history;try{if(!e){try{gt.localStorage.setItem("test","test"),gt.localStorage.removeItem("test")}catch(t){return!1}e=null==gt?void 0:gt.localStorage}var r,s=za||Xs(t.hash,"__posthog")||Xs(t.hash,"state"),n=s?Tr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Tr((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ha)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}fa(t){var e=kt.ph_load_toolbar||kt.ph_load_editor;!oe(e)&&Zt(e)?e(t,this.instance):qa.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==bt||!bt.getElementById(tt));if(!gt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(gt.localStorage.setItem(Ha,JSON.stringify(i({},s,{source:void 0}))),2===this.va())this.fa(s);else if(0===this.va()){var n;this.ca(1),null==(n=kt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return qa.error("[Toolbar] Failed to load",t),void this.ca(0);this.ca(2),this.fa(s)})),Or(gt,"turbolinks:load",(()=>{this.ca(0),this.loadToolbar(s)}))}return!0}pa(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},vl=i({experiments:Za},rl),cl=i({},rl,sl,nl,ol,al,ll,hl,ul,dl,vl,{conversations:class{constructor(t){this.ga=void 0,this._conversationsManager=null,this.ma=!1,this.ya=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;oe(e)||(ue(e)?this.ga=e:(this.ga=e.enabled,this.ya=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ga=void 0,this.ya=null}loadIfEnabled(){if(!(this._conversationsManager||this.ma||this._instance.config.disable_conversations||Ir(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==kt?void 0:kt.__PosthogExtensions__;if(t&&!ie(this.ga)&&this.ga)if(this.ya&&this.ya.token){this.ma=!0;try{var e=t.initConversations;if(e)return this.ba(e),void(this.ma=!1);var i=t.loadExternalDependency;if(!i)return void this._a(nt);i(this._instance,"conversations",(e=>{e||!t.initConversations?this._a("Could not load conversations script",e):this.ba(t.initConversations),this.ma=!1}))}catch(t){this._a("Error initializing conversations",t),this.ma=!1}}else tl.error("Conversations enabled but missing token in remote config.")}}ba(t){if(this.ya)try{this._conversationsManager=t(this.ya,this._instance),tl.info("Conversations loaded successfully")}catch(t){this._a("Error completing conversations initialization",t)}else tl.error("Cannot complete initialization: remote config is null")}_a(t,e){tl.error(t,e),this._conversationsManager=null,this.ma=!1}show(){this._conversationsManager?this._conversationsManager.show():tl.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ga&&!ne(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(tl.warn(el),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(tl.warn(el),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(tl.warn(el),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(tl.warn(el),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(tl.warn(el),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(tl.warn(el),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(tl.warn(el),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}en(){var t;null==(t=this._conversationsManager)||t.setIdentity()}tn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var e;this.wa=!1,this.xa=!1,this.Ae=br("[logs]"),this._r=[],this.ka=[],this.Sa=()=>{var t,e;null==(t=this.Ca)||t.onReconnect(),null==(e=this.Ia)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.wa=!0),gt&&Or(gt,"online",this.Sa)}Ta(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ie(d)?Math.max(h,2048):Math.max(h,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new Li(this.Ea(t,e),n,this.Ae,(()=>this.Ma()),(t=>t()),void 0,r),n]}Pa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.Ca&&this.Ra===i||(null==(e=this.Ca)||e.reset(),this.Ra=i,[this.Ca,this.Oa]=this.Ta((()=>this._r),(t=>{this._r=t}))),this.Ca}La(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.Ia&&this.Fa===i||(null==(e=this.Ia)||e.reset(),this.Fa=i,[this.Ia,this.Aa]=this.Ta((()=>this.ka),(t=>{this.ka=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},il)),this.Ia}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!oe(i)&&i&&(this.wa=!0,this.loadIfEnabled())}reset(){var t,e;this._r=[],null==(t=this.Ca)||t.reset(),this.ka=[],null==(e=this.Ia)||e.reset()}captureLog(t){this.Pa().captureLog(t)}le(t){this.La().captureLog(t)}get logger(){return this.$a||(this.$a={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.$a}flushLogs(t){t?this.Da(t):(this.Ca&&this.Ca.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.Ia&&this.Ia.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.wa&&!this.xa){var t=null==kt?void 0:kt.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ae.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.xa=!0)})):this.Ae.error(nt)}else this.Ae.error("PostHog Extensions not found.")}}Ea(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===At.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===At.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},ht:t=>this.ht(t),getLibraryId:()=>n.LIB_NAME,getLibraryVersion:()=>n.LIB_VERSION}}ht(t){return new Promise((e=>{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Na(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}))}Da(t){this._r.length>0&&this.qa(t,this._r,this.Oa,n.LIB_NAME,(t=>{this._r=t})),this.ka.length>0&&this.qa(t,this.ka,this.Aa,il,(t=>{this.ka=t}))}qa(t,e,i,r,s){if(0!==e.length){var o=e.map((t=>t.record));s([]);var a=Di(o,Mi(i,n.LIB_NAME,n.LIB_VERSION),r,n.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Na(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Na(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Ma(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=r,oe(s)||(e.sessionStartTimestamp=s),oe(n)||(e.lastActivityTimestamp=n)}if(null!=kt&&null!=(t=kt.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?ki(kt.location.href):kt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}});va.__defaultExtensionClasses=i({},cl);var pl=br("[ExternalScriptsLoader]"),fl=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return pl.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==bt?void 0:bt.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===e){var t=r[o];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!bt)return i("document not found");var r=bt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)bt.head.appendChild(r);else{var s,n=bt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):bt.body.appendChild(r)}};null!=bt&&bt.body?a():null==bt||bt.addEventListener("DOMContentLoaded",a)};kt.__PosthogExtensions__=kt.__PosthogExtensions__||{},kt.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}fl(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");fl(t,o,i)}},kt.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);fl(t,r,i)};var _l=function(){n.SDK_DIST_CHANNEL="npm";var t=Zo[oa]=new va;return function(){function t(){t.done||(t.done=!0,aa=!1,xr(Zo,(function(t){t._dom_loaded()})))}null!=bt&&bt.addEventListener?"complete"===bt.readyState?t():Or(bt,"DOMContentLoaded",t,{capture:!1}):gt&&yr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=In,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Sn,exports.PostHog=va,exports.ProductTourEventName=Tn,exports.ProductTourEventProperties=$n,exports.SurveyEventName=xn,exports.SurveyEventProperties=En,exports.SurveyEventType=yn,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule=wn,exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=bn,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=_l,exports.posthog=_l,exports.severityLevels=["fatal","error","warning","log","info","debug"];
1
+ "use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s="1.396.8",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="$device_model",u="__alias",h="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",p="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",_="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$web_vitals_allowed_metrics",b="$session_recording_remote_config",w="$replay_sample_rate",x="$replay_override_sampling",E="$replay_override_linked_flag",S="$replay_override_url_trigger",T="$replay_override_event_trigger",k="$sesid",R="$session_is_sampled",P="$enabled_feature_flags",O="$active_feature_flags",I="$early_access_features",C="$feature_flag_details",A="$feature_flag_payloads",F="$feature_flag_request_id",M="$override_feature_flags",D="$override_feature_flag_payloads",L="$stored_person_properties",N="$stored_group_properties",U="$surveys",j="$surveys_loaded_at",B="$surveys_activated",z="ph_product_tours",H="$flag_call_reported",q="$flag_call_reported_session_id",V="$feature_flag_errors",G="$feature_flag_evaluated_at",W="$user_state",Y="$client_session_props",K="$capture_rate_limit",J="$initial_campaign_params",Q="$initial_referrer_info",X="$initial_person_info",Z="$epp",tt="__POSTHOG_TOOLBAR__",et="$posthog_cookieless",it="$sdk_debug_extensions_init_method",rt="$sdk_debug_extensions_init_time_ms",st="$sdk_debug_recording_script_not_loaded",nt="PostHog loadExternalDependency extension not found.",ot="on_reject",at="always",lt="anonymous",ut="identified",ht="identified_only",dt="visibilitychange",vt="beforeunload",ct="$pageview",pt="$pageleave",ft="$identify",_t="$groupidentify",gt="undefined"!=typeof window?window:void 0,mt="undefined"!=typeof globalThis?globalThis:gt;"undefined"==typeof self&&(mt.self=mt),"undefined"==typeof File&&(mt.File=function(){});var yt=null==mt?void 0:mt.navigator,bt=null==mt?void 0:mt.document,wt=null==mt?void 0:mt.location,xt=null==mt?void 0:mt.fetch,Et=null!=mt&&mt.XMLHttpRequest&&"withCredentials"in new mt.XMLHttpRequest?mt.XMLHttpRequest:void 0,St=null==mt?void 0:mt.AbortController,Tt=null==mt?void 0:mt.CompressionStream,$t=null==yt?void 0:yt.userAgent,kt=null!=gt?gt:{};function Rt(){return!(!gt||!1===gt.navigator.onLine)}var Pt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Ot(t){return"string"==typeof t||t}function It(t){return"string"==typeof t?t:void 0}var Ct,At=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.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}({}),Ft=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Mt=["$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"],Dt=["token"],Lt="NativeGzipValidationError",Nt=t=>t.length>=2&&31===t[0]&&139===t[1],Ut=(t,e)=>t===Ft.GZipJS||e===Ft.GZipJS||"gzip"===e,jt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Bt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Lt,e},zt=function(){var t=e((function*(t,e){18>t.size&&Bt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Nt(i)&&8===i[2]||Bt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Ct)return Ct;Ct=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Ct[t]=e>>>0}return Ct})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Bt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Bt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Ht(){return Ht=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield zt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Ht.apply(this,arguments)}var qt=["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"],Vt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return qt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Gt(t,e){return-1!==t.indexOf(e)}var Wt=function(t){return t.trim()},Yt=function(t){return t.replace(/^\$/,"")},Kt=Object.prototype,Jt=Kt.hasOwnProperty,Qt=Kt.toString,Xt=Array.isArray||function(t){return"[object Array]"===Qt.call(t)},Zt=t=>"function"==typeof t,te=t=>t===Object(t)&&!Xt(t),ee=t=>{if(te(t)){for(var e in t)if(Jt.call(t,e))return!1;return!0}return!1},ie=t=>void 0===t,re=t=>"[object String]"==Qt.call(t),se=t=>re(t)&&0===t.trim().length,ne=t=>null===t,oe=t=>ie(t)||ne(t),ae=t=>"[object Number]"==Qt.call(t)&&t==t,le=t=>ae(t)&&t>0,ue=t=>"[object Boolean]"===Qt.call(t),he=t=>t instanceof FormData,de=t=>Gt(Mt,t),ve=t=>Gt(Dt,t);function ce(t){return null===t||"object"!=typeof t}function pe(t,e){return{}.toString.call(t)==="[object "+e+"]"}function fe(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var _e=[!0,"true",1,"1","yes"],ge=t=>Gt(_e,t),me=[!1,"false",0,"0","no"];function ye(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),ae(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),ye(s||i,e,i,r))}class be{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=ye(t.bucketSize,0,100,t.Ae),this.$e=ye(t.refillRate,0,this.Fe,t.Ae),this.De=ye(t.refillInterval,0,864e5,t.Ae)}Ne(t,e){var i=Math.floor((e-t.lastAccess)/this.De);i>0&&(t.tokens=Math.min(t.tokens+i*this.$e,this.Fe),t.lastAccess=t.lastAccess+i*this.De)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.Ee[r];return s?this.Ne(s,i):this.Ee[r]=s={tokens:this.Fe,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Pe)||e.call(this,t)),0===s.tokens)}stop(){this.Ee={}}}var we="Mobile",xe="iOS",Ee="Android",Se="Tablet",Te=Ee+" "+Se,$e="iPad",ke="Apple",Re=ke+" Watch",Pe="Safari",Oe="BlackBerry",Ie="Samsung",Ce=Ie+"Browser",Ae=Ie+" Internet",Fe="Chrome",Me=Fe+" OS",De=Fe+" "+xe,Le="Internet Explorer",Ne=Le+" "+we,Ue="Opera",je=Ue+" Mini",Be="Edge",ze="Microsoft "+Be,He="Firefox",qe=He+" "+xe,Ve="Nintendo",Ge="PlayStation",We="Xbox",Ye=Ee+" "+we,Ke=we+" "+Pe,Je="Windows",Qe=Je+" Phone",Xe="Nokia",Ze="Ouya",ti="Generic",ei=ti+" "+we.toLowerCase(),ii=ti+" "+Se.toLowerCase(),ri="Konqueror",si="Oculus Browser",ni="Vivaldi",oi="Yandex",ai="Whale",li="DuckDuckGo",ui="Pale Moon",hi="Waterfox",di="Brave",vi="Google Search App",ci="(\\d+(\\.\\d+)?)",pi=new RegExp("Version/"+ci),fi=new RegExp(We,"i"),_i=new RegExp(Ge+" \\w+","i"),gi=new RegExp(Ve+" \\w+","i"),mi=new RegExp(Oe+"|PlayBook|BB10","i"),yi={"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"},bi=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?di:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Gt(t,"GSA/")?vi:Gt(t," OPR/")&&Gt(t,"Mini")?je:Gt(t," OPR/")?Ue:mi.test(t)?Oe:Gt(t,"IE"+we)||Gt(t,"WPDesktop")?Ne:Gt(t,"OculusBrowser")?si:Gt(t,Ce)?Ae:Gt(t,Be)||Gt(t,"Edg/")?ze:Gt(t,ni+"/")?ni:Gt(t,"YaBrowser/")?oi:Gt(t,ai+"/")?ai:Gt(t,li+"/")||Gt(t,"Ddg/")?li:Gt(t,"FBIOS")?"Facebook "+we:Gt(t,"UCWEB")||Gt(t,"UCBrowser")?"UC Browser":Gt(t,"CriOS")?De:Gt(t,"CrMo")||Gt(t,Fe)?Fe:Gt(t,Ee)&&Gt(t,Pe)?Ye:Gt(t,"FxiOS")?qe:Gt(t.toLowerCase(),ri.toLowerCase())?ri:Gt(t,di+"/")?di:((t,e)=>e&&Gt(e,ke)||function(t){return Gt(t,Pe)&&!Gt(t,Fe)&&!Gt(t,Ee)}(t))(t,e)?Gt(t,we)?Ke:Pe:Gt(t,"PaleMoon/")?ui:Gt(t,hi+"/")?hi:Gt(t,He)?He:Gt(t,"MSIE")||Gt(t,"Trident/")?Le:Gt(t,"Gecko")?He:"")},wi={[Ne]:[new RegExp("rv:"+ci)],[ze]:[new RegExp(Be+"?\\/"+ci)],[Fe]:[new RegExp("("+Fe+"|CrMo)\\/"+ci)],[De]:[new RegExp("CriOS\\/"+ci)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ci)],[Pe]:[pi],[Ke]:[pi],[Ue]:[new RegExp("(Opera|OPR)\\/"+ci)],[He]:[new RegExp(He+"\\/"+ci)],[qe]:[new RegExp("FxiOS\\/"+ci)],[ri]:[new RegExp("Konqueror[:/]?"+ci,"i")],[Oe]:[new RegExp(Oe+" "+ci),pi],[Ye]:[new RegExp("android\\s"+ci,"i")],[Ae]:[new RegExp(Ce+"\\/"+ci)],[si]:[new RegExp("OculusBrowser\\/"+ci)],[ni]:[new RegExp(ni+"\\/"+ci)],[oi]:[new RegExp("YaBrowser\\/"+ci)],[ai]:[new RegExp(ai+"\\/"+ci)],[di]:[new RegExp(di+"\\/"+ci)],[li]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ci)],[ui]:[new RegExp("PaleMoon\\/"+ci)],[hi]:[new RegExp(hi+"\\/"+ci)],[vi]:[new RegExp("GSA\\/"+ci)],[Le]:[new RegExp("(rv:|MSIE )"+ci)],Mozilla:[new RegExp("rv:"+ci)]},xi=function(t,e,i,r){var s=bi(t,e,i,r),n=wi[s];if(ie(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ei=[[new RegExp(We+"; "+We+" (.*?)[);]","i"),t=>[We,t&&t[1]||""]],[new RegExp(Ve,"i"),[Ve,""]],[new RegExp(Ge,"i"),[Ge,""]],[mi,[Oe,""]],[new RegExp(Je,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Qe,""];if(new RegExp(we).test(e)&&!/IEMobile\b/.test(e))return[Je+" "+we,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=yi[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Je,r]}return[Je,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xe,[t[3],t[4],t[5]||"0"].join(".")]:[xe,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ie(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ee+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ee+")","i"),t=>t&&t[2]?[Ee,[t[2],t[3],t[4]||"0"].join(".")]:[Ee,""]],[/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/,[Me,""]],[/Linux|debian/i,["Linux",""]]],Si=function(t){return gi.test(t)?Ve:_i.test(t)?Ge:fi.test(t)?We:new RegExp(Ze,"i").test(t)?Ze:new RegExp("("+Qe+"|WPDesktop)","i").test(t)?Qe:/iPad/.test(t)?$e:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Re:mi.test(t)?Oe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Xe,"i").test(t)?Xe:/(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(we).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)?Ee:Te:new RegExp("(pda|"+we+")","i").test(t)?ei:new RegExp(Se,"i").test(t)&&!new RegExp(Se+" pc","i").test(t)?ii:""},Ti=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $i(t,e){return"string"==typeof(i=t)&&Ti.test(i)?t:e();var i}function ki(t){return t?t.split("#")[0]:t}function Ri(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var Pi=t=>t instanceof Error,Oi={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}},Ii=Oi.info;function Ci(t){if(ue(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(Xt(t))return{arrayValue:{values:t.map((t=>Ci(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ai(t){var e=[];for(var i in t){var r=t[i];ne(r)||ie(r)||e.push({key:i,value:Ci(r)})}return e}function Fi(t,e){var r=t.level||"info",{text:s,number:n}=Oi[r]||Ii,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),oe(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),oe(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=i({},a,t.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:Ai(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ie(t.trace_flags)||(u.flags=t.trace_flags),u}function Mi(t,e,r){return i({},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 Di(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ai(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Li=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=i,this.qe=r,this.Be=s,this.je=n,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ye=e.flushIntervalMs,this.Ke=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.it(t);if(null!==e)if(e.body){if(this.nt()){var i={record:Fi(e,this.qe())};this.Be((()=>this.st(i)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var i=Xt(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ae.error("Error in beforeSend function for log:",t),null}return r}nt(){if(void 0===this.et)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return e((function*(){var e;t.tt();var i=null!==(e=t._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ze=0;var a=Math.min(i.length,t.Ke),l=i.slice(0,a),u=Di(l.map((t=>t.record)),t.ut(),null!==(n=t.He)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(u);if("too-large"===h.kind&&l.length>1)t.Ke=Math.max(1,Math.floor(l.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ke);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===h.kind&&t.Se.maxBatchRecordsPerPost>t.Ke&&(t.Ke=Math.min(t.Se.maxBatchRecordsPerPost,t.Ke+1)),yield t.dt(l.length),i=null!==(o=t._instance.getPersistedProperty(At.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}dt(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.ze),s=null!==(e=i._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(At.LogsQueue,s.slice(r)),yield i.je()}))()}ut(){return Mi(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(At.LogsQueue))&&void 0!==e?e:[];this.Je>i.length||(i.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(At.LogsQueue,i),this.Qe>i.length?this.ct():this.rt()}}ct(t){void 0===t&&(t=this.Ye),this.vt||(this.vt=Ri((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(At.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.tt();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ri(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ri((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var Ni,Ui,ji;function Bi(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return ji&&i.length===Ui||(Ui=i.length,ji=i.reduce(((i,r)=>{Ni||(Ni={});var s=Ni[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,Ni[r]=[l,u];break}}return i}),{})),ji}}class zi{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&Xt(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:Bi(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Hi="?";function qi(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Hi:i,in_app:!0};return ie(r)||(n.lineno=r),ie(s)||(n.colno=s),n}var Vi=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:Hi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Gi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ki=(t,e)=>{var i=Gi.exec(t);if(i){var[,r,s,n]=i;return qi(e,r,Hi,+s,+n)}var o=Wi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Yi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Vi(o[1]||Hi,o[2]);return qi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ji=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Qi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Xi=(t,e)=>{var i=Ji.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Qi.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||Hi;return[n,s]=Vi(n,s),qi(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Zi=/\(error: (.*)\)/;class tr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=re(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return pe(t,"DOMException")}isDOMError(t){return pe(t,"DOMError")}}class er{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class ir{constructor(){}match(t){return pe(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var rr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class sr{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(rr);return r&&(e=r[1],i=r[2]),[e,i]}}var nr=["fatal","error","warning","log","info","debug"];function or(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class ar{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return fe(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+or(t)}isSeverityLevel(t){return re(t)&&!se(t)&&nr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Pi(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class lr{match(t){return fe(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+or(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class ur{match(t){return ce(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class hr{match(t){return pe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!fe(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return ce(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var dr="$message",vr="$timestamp",cr=new Set([dr,vr]),pr={enabled:!0,max_bytes:32768};function fr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:pr.enabled,max_bytes:gr(t.max_bytes,pr.max_bytes)}:i({},pr)}class _r{constructor(t){this.bt=[],this._t=0,this.Se=fr(t)}setConfig(t){this.Se=fr(t),this.wt()}add(t){var e=function(t){var e,i,r;try{r=[],e=null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}catch(t){return}try{var s=JSON.parse(e);if(!te(s))return;var n=s,o=n[dr],a=n[vr];if(!re(o)||0===o.trim().length)return;if(!re(a)&&!ae(a))return;return{step:n,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Se.max_bytes||(this.bt.push({step:e.step,bytes:i}),this._t+=i,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function gr(t,e){if(!ae(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var mr=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={k(e){if(gt&&(n.DEBUG||kt.POSTHOG_DEBUG||i)&&!ie(gt.console)&&gt.console){for(var r=("__rrweb_original__"in gt.console[e]?gt.console[e].__rrweb_original__:gt.console[e]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>mr(t+" "+e,i)};return r},yr=mr("[PostHog.js]"),br=yr.createLogger;function wr(t,e){Xt(t)&&t.forEach(e)}function xr(t,e){if(!oe(t))if(Xt(t))t.forEach(e);else if(he(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Jt.call(t,i)&&e(t[i],i)}var Er=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Sr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Tr=function(t){try{return t()}catch(t){return}},$r=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){yr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),yr.critical(t)}}},kr=function(t){var e={};return xr(t,(function(t,i){(re(t)&&t.length>0||ae(t))&&(e[i]=t)})),e};var Rr=["herokuapp.com","vercel.app","netlify.app"];function Pr(t){var e=null==t?void 0:t.hostname;if(!re(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Rr)if(i===r)return!1;return!0}function Or(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ir(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ae(t)&&isFinite(t)&&Math.floor(t)===t});class Cr{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Cr(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Cr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Ar{constructor(){this.S=0,this.C=0,this.I=new Dr}generate(){var t=this.generateOrAbort();if(ie(t)){this.S=0;var e=this.generateOrAbort();if(ie(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Cr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Fr,Mr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&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};gt&&!ie(gt.crypto)&&crypto.getRandomValues&&(Mr=t=>crypto.getRandomValues(t));class Dr{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Mr(this.R),this.O=0),this.R[this.O++]}}var Lr=()=>Nr().toString(),Nr=()=>(Fr||(Fr=new Ar)).generate(),Ur="",jr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Br={N:()=>!!bt,D(t){yr.error("cookieStore error: "+t)},A(t){if(bt){try{for(var e=t+"=",i=bt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},F(t){var e;try{e=JSON.parse(Br.A(t))||{}}catch(t){}return e},q(t,e,i,r,s){if(!bt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=bt),Ur)return Ur;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Lr();!Ur&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",Ur=n)}return Ur}(t);if(!i){var r=(t=>{var e=t.match(jr);return e?e[0]:""})(t);r!==i&&yr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(bt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&yr.warn("cookieStore warning: large cookie, len="+u.length),bt.cookie=u,!0}catch(t){return!1}},P(t,e){if(null!=bt&&bt.cookie)try{Br.q(t,"",-1,e)}catch(t){return}}},zr=null,Hr={N(){if(!ne(zr))return zr;var t=!0;if(ie(gt))t=!1;else try{var e="__mplssupport__";Hr.q(e,"xyz"),'"xyz"'!==Hr.A(e)&&(t=!1),Hr.P(e)}catch(e){t=!1}return t||yr.error("localStorage unsupported; falling back to cookie store"),zr=t,t},D(t){yr.error("localStorage error: "+t)},A(t){try{return null==gt?void 0:gt.localStorage.getItem(t)}catch(t){Hr.D(t)}return null},F(t){try{return JSON.parse(Hr.A(t))||{}}catch(t){}return null},q(t,e){try{return null==gt||gt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Hr.D(t)}return!1},P(t){try{null==gt||gt.localStorage.removeItem(t)}catch(t){Hr.D(t)}}},qr=[a,"distinct_id",k,R,Z,X,W],Vr={},Gr={N:()=>!0,D(t){yr.error("memoryStorage error: "+t)},A:t=>Vr[t]||null,F:t=>Vr[t]||null,q:(t,e)=>(Vr[t]=e,!0),P(t){delete Vr[t]}},Wr=null,Yr={N(){if(!ne(Wr))return Wr;if(Wr=!0,ie(gt))Wr=!1;else try{var t="__support__";Yr.q(t,"xyz"),'"xyz"'!==Yr.A(t)&&(Wr=!1),Yr.P(t)}catch(t){Wr=!1}return Wr},D(t){yr.error("sessionStorage error: ",t)},A(t){try{return null==gt?void 0:gt.sessionStorage.getItem(t)}catch(t){Yr.D(t)}return null},F(t){try{return JSON.parse(Yr.A(t))||null}catch(t){}return null},q(t,e){try{return null==gt||gt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Yr.D(t)}return!1},P(t){try{null==gt||gt.sessionStorage.removeItem(t)}catch(t){Yr.D(t)}}};class Kr{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===at||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===ot}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.P(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get St(){var t=this.Ct.A(this.It);return ge(t)?1:Gt(me,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,e="localStorage"===t?Hr:Br;if(!this.Tt||this.Tt!==e){this.Tt=e;var i="localStorage"===t?Br:Hr;i.A(this.It)&&(this.Tt.A(this.It)||this.optInOut(ge(i.A(this.It))),i.P(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[null==yt?void 0:yt.doNotTrack,null==yt?void 0:yt.msDoNotTrack,kt.doNotTrack].some((t=>ge(t)))}}function Jr(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!Zt(r))return e;try{var s=r(e);return re(s)&&s?s:e}catch(t){return yr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Qr=1,Xr=3,Zr=11;function ts(t){return t instanceof Element&&(t.id===tt||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function es(t){return!!t&&t.nodeType===Qr}function is(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function rs(t){return!!t&&t.nodeType===Xr}function ss(t){return!!t&&t.nodeType===Zr&&es(t.host)}function ns(t){return t?Wt(t).split(/\s+/):[]}function os(t,e){var i=function(t){var e,i=null==gt||null==(e=gt.location)?void 0:e.href;return ie(i)?void 0:Jr(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function as(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 ns(e)}function ls(t){return oe(t)?null:Wt(t).split(/(\s+)/).filter((t=>Is(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function us(t){var e="";return Es(t)&&!Ss(t)&&t.childNodes&&t.childNodes.length&&xr(t.childNodes,(function(t){var i;rs(t)&&t.textContent&&(e+=null!==(i=ls(t.textContent))&&void 0!==i?i:"")})),Wt(e)}function hs(t){return ie(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var ds=["a","button","form","input","select","textarea","label"];function vs(t,e){if(ie(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function cs(t){var e=t.parentNode;return!(!e||!es(e))&&e}var ps=[".ph-no-autocapture","[data-ph-no-autocapture]"],fs=["next","previous","prev",">","<"],_s=[...fs,"+","-","−","–"],gs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,ms=[".ph-no-rageclick",".ph-no-capture"],ys=["","text","search","email","password","url","tel","number"];function bs(t,e){if(!gt||ws(t))return!1;var i,r,s,n,o;if(ue(e)?(i=!!e&&ms,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:ms,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!es(t))&&(!!is(t,"textarea")||(is(t,"input")?Gt(ys,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var{targetElementList:a}=xs(t,!1);return!function(t,e){if(!1===t||ie(t))return!1;var i;if(!0===t)i=fs;else{if(!Xt(t))return!1;if(t.length>10)return yr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>gs(e,t)||gs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:us(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!vs(a,i)}var ws=t=>!t||is(t,"html")||!es(t),xs=(t,e)=>{if(!gt||ws(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!is(s,"body");)if(ss(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=cs(s);if(!n)break;if(e||ds.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Es(t){for(var e=t;e.parentNode&&!is(e,"body");e=e.parentNode){var i=as(e);if(Gt(i,"ph-sensitive")||Gt(i,"ph-no-capture"))return!1}if(Gt(as(t),"ph-include"))return!0;var r=t.type||"";if(re(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!re(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ss(t){return!!(is(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||is(t,"select")||is(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ts="(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})",$s=new RegExp("^(?:"+Ts+")$"),ks=new RegExp(Ts),Rs="\\d{3}-?\\d{2}-?\\d{4}",Ps=new RegExp("^("+Rs+")$"),Os=new RegExp("("+Rs+")");function Is(t,e){if(void 0===e&&(e=!0),oe(t))return!1;if(re(t)){if(t=Wt(t),(e?$s:ks).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ps:Os).test(t))return!1}return!0}function Cs(t){var e=us(t);return Is(e=(e+" "+As(t)).trim())?e:""}function As(t){var e="";return t&&t.childNodes&&t.childNodes.length&&xr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=us(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+As(t)).trim())}catch(t){yr.error("[AutoCapture]",t)}})),e}function Fs(t){return t.replace(/"|\\"/g,'\\"')}function Ms(t){var e=t.attr__class;return e?Xt(e)?e:ns(e):void 0}var Ds=br("[Dead Clicks]"),Ls=()=>!0,Ns=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return ue(r)?r:!!te(r)||i};class Us{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Ds.error("failed to load script",e):t()}))}Pt(){var t;if(bt){if(!this.Et&&null!=(t=kt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=te(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.Et=kt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Et.start(bt),Ds.info("starting...")}}else Ds.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,Ds.info("stopping..."))}}var js=br("[SegmentIntegration]");var Bs="posthog-js";function zs(t,e){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===e?{}:e;return e=>{var l,u,h,d,v;if("*"!==o&&!o.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,f=(null==(l=e.exception)?void 0:l.values)||[],_=f.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=f[0])?void 0:u.value)||e.message,$exception_type:null==(h=f[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=f[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=f[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(p=t.exceptions)||p.sendExceptionEvent(g)),e}}class Hs{constructor(t,e,i,r,s,n){this.name=Bs,this.setupOnce=function(o){o(zs(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class qs{constructor(t){this.Rt=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(yr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Rt)}destroy(){var t;null==(t=this.Ft)||t.call(this),this.Ft=void 0}doPageView(t,e){var i,r=this.At(t,e);return this.Ot={pathname:null!==(i=null==gt?void 0:gt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.At(t,null==(e=this.Ot)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ot)?void 0:t.pageViewId}}At(t,e){var i=this.Ot;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(ie(n)||ie(o)||ie(a)||ie(l)||ie(u)||ie(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?ye(o/n,0,1,yr):1,v=n>1?ye(a/n,0,1,yr):1,c=l>1?ye(u/l,0,1,yr):1,p=l>1?ye(h/l,0,1,yr):1;r=Er(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Vs=["flags","surveys"],Gs={[o]:{exposure:"hidden"},[u]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[h]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[p]:{exposure:"hidden"},[f]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[R]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>ne(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"},[P]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!te(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[O]:{exposure:"event",storageGroup:"flags"},[I]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"event",storageGroup:"flags"},[F]:{exposure:"event",storageGroup:"flags",volatile:!0},[M]:{exposure:"event"},[D]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"surveys"},[j]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[B]:{exposure:"event"},[z]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[W]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[T]:{exposure:"event"},[it]:{exposure:"event"},[rt]:{exposure:"event"},[st]:{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"}},Ws=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ys=t=>{var e=Gs[t];if(e)return e;for(var[i,r]of Ws)if(0===t.indexOf(i))return r},Ks=t=>{var e=null==bt?void 0:bt.createElement("a");return ie(e)?null:(e.href=t,e)},Js=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Xt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){yr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Qs=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");Xt(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Xs=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Zs="https?://(.*)",tn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],en=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tn],rn="<masked>",sn=["li_fat_id"];function nn(t,e,i){if(!bt)return{};var r,s=e?[...tn,...i||[]]:[],n=on(Qs(bt.URL,s,rn),t),o=(r={},xr(sn,(function(t){var e=Br.A(t);r[t]=e||null})),r);return Er(o,n)}function on(t,e){var i=en.concat(e||[]),r={};return xr(i,(function(e){var i=Js(t,e);r[e]=i||null})),r}function an(t){var e=function(t){return t?0===t.search(Zs+"google.([^/?]*)")?"google":0===t.search(Zs+"bing.com")?"bing":0===t.search(Zs+"yahoo.com")?"yahoo":0===t.search(Zs+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ne(e)){r.$search_engine=e;var s=bt?Js(bt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function ln(){return navigator.language||navigator.userLanguage}var un="$direct";function hn(){return(null==bt?void 0:bt.referrer)||un}function dn(t,e,i){void 0===i&&(i=!1);var r=t?[...tn,...e||[]]:[],s=i?ki(null==wt?void 0:wt.href):null==wt?void 0:wt.href,n=null==s?void 0:s.substring(0,1e3);return{r:hn().substring(0,1e3),u:n?Qs(n,r,rn):void 0}}function vn(t,e){var i;void 0===e&&(e=!1);var{r:r,u:s}=t,n=e?ki(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==un?un:null==(i=Ks(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ks(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=on(n);Er(o,l)}if(r){var u=an(r);Er(o,u)}return o}function cn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function pn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var fn={flags:G,surveys:j},_n=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gn="main";class mn{constructor(t,e,r){if(void 0===r&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=t,this.qt=r,this.props={},this.Bt=!1,this.jt=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Ct=this.Ht(t),this.Nt=this.Ut(t),this.load(),t.debug&&yr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),gt){var s=()=>this.flush();Or(gt,"beforeunload",s,{capture:!1}),Or(gt,"pagehide",s,{capture:!1})}}zt(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return ae(e)&&e>0?e:0}isDisabled(){return!!this.Vt}Ht(t){-1===_n.indexOf(t.persistence.toLowerCase())&&(yr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...qr,...t];return i({},Hr,{F(t){try{var i={};try{i=Br.F(t)||{}}catch(t){}var r,s=JSON.parse(Hr.A(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ne(a)||""===a||(n[o]=a)}r=Er(s,n)}else r=Er(i,s);return Hr.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Hr.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Br.q(t,l,i,s,n,o)}catch(t){Hr.D(t)}return a},P(t,e){try{null==gt||gt.localStorage.removeItem(t),Br.P(t,e)}catch(t){Hr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Hr.N()?(e=Hr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&Yr.N()?e=Yr:"memory"===n?e=Gr:"cookie"===n?e=Br:r.N()?(e=r,s=!0):e=Br,this.Dt=s,e}Wt(t){return this.jt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var e=null!=t?t:this.Se.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[G];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return xr(this.props,((e,i)=>{var r=Ys(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===P?()=>this.Gt():()=>!1))return;r.transformToEventProperties&&Er(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.Vt){var t=this.Ct.F(this.jt);t&&(this.props=Er({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of Vs){var e=Hr.F(this.Wt(t));if(e&&!ee(e)){var i=this.Qt(t);i.persisted=!0,this.Jt(t)||(i.fingerprint=this.Yt(e,t)),this.Kt(t,e)||Er(this.props,e)}}}Jt(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Ys(e))?void 0:i.storageGroup)===t}))}Kt(t,e){var i=fn[t];if(!i)return!1;var r=e[i],s=this.props[i];return ae(r)&&ae(s)&&s>r}refreshKey(t){var e;if(!this.Vt){var i=this.Nt?null==(e=Ys(t))?void 0:e.storageGroup:void 0,r=i?Hr.F(this.Wt(i)):this.Ct.F(this.jt);if(r&&t in r)this.Xt(t,r[t]);else{if(i){var s=this.Ct.F(this.jt);if(s&&t in s)return void this.Xt(t,s[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?ie(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){ie(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,gn))}ir(){var{main:t,groups:e}=this.sr();for(var i of(this.nr(this.Ct,this.jt,t,gn),Vs)){var r,s=e[i];(!ee(s)||null!=(r=this.$t[i])&&r.persisted)&&this.nr(Hr,this.Wt(i),s,i)}}sr(){var t={},e={};for(var i of Vs)e[i]={};return xr(this.props,((i,r)=>{var s,n=null==(s=Ys(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Yt(t,e){if(e===gn)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var i={};return xr(t,((t,e)=>{var r;i[e]=null!=(r=Ys(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}nr(t,e,i,r){var s=this.Qt(r);if(r===gn||s.dirty||ie(s.fingerprint)){var n;try{if((n=this.Yt(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.ar,this.lr,this.ur,this.Se.debug)?(s.dirty=!1,r!==gn&&(s.persisted=!0),ie(n)||(s.fingerprint=n)):this.Se.debug&&yr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(ie(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.P(this.jt,!1),this.Ct.P(this.jt,!0),!e&&this.qt)for(var i of Vs)Hr.P(this.Wt(i));e?delete this.$t[gn]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(te(t)){ie(e)&&(e="None"),this.ar=ie(i)?this.hr:i;var r=!1;if(xr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Xt(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(te(t)){this.ar=ie(e)?this.hr:e;var i=!1;if(xr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Xt(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.Bt){var t=nn(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ee(kr(t))||this.register(t),this.Bt=!0}}update_search_keyword(){var t;this.register((t=null==bt?void 0:bt.referrer)?an(t):{})}update_referrer_info(){var t;this.register_once({$referrer:hn(),$referring_domain:null!=bt&&bt.referrer&&(null==(t=Ks(bt.referrer))?void 0:t.host)||un},void 0)}set_initial_person_info(){this.props[J]||this.props[Q]||this.register_once({[X]:dn(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};xr([Q,J],(e=>{var i=this.props[e];i&&xr(i,(function(e,i){t["$initial_"+Yt(i)]=e}))}));var e=this.props[X];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=vn(t,e),r={};return xr(i,(function(t,e){r["$initial_"+Yt(e)]=t})),r}(e,this.Se.disable_capture_url_hashes);Er(t,i)}return t}safe_merge(t){return xr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.hr=this.ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),s=r?this.Ht(t):this.Ct,n=this.Ut(t);if(r||n!==this.Nt){var o=this.props;this.clear(),this.Ct=s,this.Nt=n,this.props=o,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[h]||{};i[t]=e,this.Xt(h,i),this.save()}remove_event_timer(t){var e=this.props[h]||{},i=e[t];return ie(i)||(delete e[t],this.Xt(h,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Xt(t,e),this.save()}Xt(t,e){var i;this.props[t]=e,null!=(i=Ys(t))&&i.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var e,i=null==(e=Ys(t))?void 0:e.storageGroup;i&&(this.Qt(i).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var yn={Activation:"events",Cancellation:"cancelEvents"},bn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},wn={Once:"once",Recurring:"recurring",Always:"always"},xn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},En={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"},Sn={Popover:"popover",Inline:"inline"},Tn={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"},$n={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"},kn=br("[RateLimiter]");class Rn{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{kn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void kn.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(K))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(K,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Pn=br("[RemoteConfig]");class On{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=kt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}cr(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return Pn.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void Pn.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return Pn.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((t=>{this.pr(t),this.gr()}));this.pr(t),this.gr()}))}catch(t){Pn.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&bt&&"hidden"!==bt.visibilityState&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.yr=setInterval((()=>{this.refresh()}),e))}}pr(t){var e;t||Pn.error("Failed to fetch remote config from PostHog."),this._instance.pr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var In={GZipJS:"gzip-js",Base64:"base64"},Cn=Uint8Array,An=Uint16Array,Fn=Uint32Array,Mn=new Cn([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]),Dn=new Cn([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]),Ln=new Cn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nn=function(t,e){for(var i=new An(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Fn(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Un=Nn(Mn,2),jn=Un[1];Un[0][28]=258,jn[258]=28;for(var Bn=Nn(Dn,0)[1],zn=new An(32768),Hn=0;32768>Hn;++Hn){var qn=(43690&Hn)>>>1|(21845&Hn)<<1;zn[Hn]=((65280&(qn=(61680&(qn=(52428&qn)>>>2|(13107&qn)<<2))>>>4|(3855&qn)<<4))>>>8|(255&qn)<<8)>>>1}var Vn=function(t,e,i){for(var r=t.length,s=0,n=new An(e);r>s;++s)++n[t[s]-1];var o,a=new An(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new An(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[zn[d]>>>l]=u}else for(o=new An(r),s=0;r>s;++s)o[s]=zn[a[t[s]-1]++]>>>15-t[s];return o},Gn=new Cn(288);for(Hn=0;144>Hn;++Hn)Gn[Hn]=8;for(Hn=144;256>Hn;++Hn)Gn[Hn]=9;for(Hn=256;280>Hn;++Hn)Gn[Hn]=7;for(Hn=280;288>Hn;++Hn)Gn[Hn]=8;var Wn=new Cn(32);for(Hn=0;32>Hn;++Hn)Wn[Hn]=5;var Yn=Vn(Gn,9,0),Kn=Vn(Wn,5,0),Jn=function(t){return(t/8>>0)+(7&t&&1)},Qn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof An?An:t instanceof Fn?Fn:Cn)(i-e);return r.set(t.subarray(e,i)),r},Xn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Zn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},to=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Cn(0),0];if(1==s){var o=new Cn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new An(v+1),p=eo(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var y=n[r].s;e>c[y]?f-=1<<e-c[y]++-1:++r}for(;r>=0&&f;--r){var b=n[r].s;c[b]==e&&(--c[b],++f)}p=e}return[new Cn(c),p]},eo=function(t,e,i){return-1==t.s?Math.max(eo(t.l,e,i+1),eo(t.r,e,i+1)):e[t.s]=i},io=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new An(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},ro=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},so=function(t,e,i){var r=i.length,s=Jn(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},no=function(t,e,i,r,s,n,o,a,l,u,h){Xn(e,h++,i),++s[256];for(var d=to(s,15),v=d[0],c=d[1],p=to(n,15),f=p[0],_=p[1],g=io(v),m=g[0],y=g[1],b=io(f),w=b[0],x=b[1],E=new An(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=to(E,7),k=T[0],R=T[1],P=19;P>4&&!k[Ln[P-1]];--P);var O,I,C,A,F=u+5<<3,M=ro(s,Gn)+ro(n,Wn)+o,D=ro(s,v)+ro(n,f)+o+14+3*P+ro(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=F&&D>=F)return so(e,h,t.subarray(l,l+u));if(Xn(e,h,1+(M>D)),h+=2,M>D){O=Vn(v,c,0),I=v,C=Vn(f,_,0),A=f;var L=Vn(k,R,0);for(Xn(e,h,y-257),Xn(e,h+5,x-1),Xn(e,h+10,P-4),h+=14,S=0;P>S;++S)Xn(e,h+3*S,k[Ln[S]]);h+=3*P;for(var N=[m,w],U=0;2>U;++U){var j=N[U];for(S=0;j.length>S;++S)Xn(e,h,L[B=31&j[S]]),h+=k[B],B>15&&(Xn(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=Yn,I=Gn,C=Kn,A=Wn;for(S=0;a>S;++S)if(r[S]>255){var B;Zn(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(Xn(e,h,r[S]>>>23&31),h+=Mn[B]);var z=31&r[S];Zn(e,h,C[z]),h+=A[z],z>3&&(Zn(e,h,r[S]>>>5&8191),h+=Dn[z])}else Zn(e,h,O[r[S]]),h+=I[r[S]];return Zn(e,h,O[256]),h+I[256]},oo=new Fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ao=function(){for(var t=new Fn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),lo=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function uo(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ao[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Cn(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=so(l,u,t.subarray(h,d)):(l[h]=!0,u=so(l,u,t.subarray(h,o)))}else{for(var v=oo[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new An(32768),g=new An(f+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&f},w=new Fn(25e3),x=new An(288),E=new An(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=b(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var A=o-h;if((S>7e3||k>24576)&&A>423){u=no(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)E[F]=0}var M=2,D=0,L=p,N=I-C&32767;if(A>2&&O==b(h-N))for(var U=Math.min(c,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&I!=C;){if(t[h+M]==t[h+M-N]){for(var z=0;B>z&&t[h+z]==t[h+z-N];++z);if(z>M){if(M=z,D=N,z>U)break;var H=Math.min(N,z-2),q=0;for(F=0;H>F;++F){var V=h-N+F+32768&32767,G=V-_[V]+32768&32767;G>q&&(q=G,C=V)}}}N+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|jn[M]<<18|Bn[D];var W=31&jn[M],Y=31&Bn[D];T+=Mn[W]+Dn[Y],++x[257+W],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=no(t,l,!0,w,x,E,T,k,P,h-P,u)}return Qn(a,0,r+Jn(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&lo(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),lo(u,h-8,i.d()),lo(u,h-4,r),u}var ho=!!Et||!!xt,vo="text/plain",co=!1,po=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},fo=function(t,e,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=i({},e),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var e,[i,s]=t.split("="),n=r&&null!==(e=a[i])&&void 0!==e?e:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return xr(t,(function(t,e){ie(t)||ie(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return u&&l.push(u),n+"?"+l.join("&")},_o=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),go=t=>{if(t.xt)return t.xt;var{data:e,compression:i}=t;if(e){if(i===In.GZipJS){var r=uo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Cn(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Cn(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Qn(r,0,s)}(_o(e)),{mtime:0});return{contentType:vo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===In.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(_o(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:_o(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=_o(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},mo=t=>{var e,r,s=()=>({url:po(t.url,"compression"),encodedBody:go(i({},t,{compression:void 0,xt:void 0}))});try{e=go(t)}catch(e){if(Ut(t.compression,Js(t.url,"compression")))return yr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Ut(t.compression,Js(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Nt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Nt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(co=!0,s()):{url:t.url,encodedBody:e}},yo=t=>{try{return mo(t)}catch(e){return yr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},bo=function(){var t=e((function*(t){var e=_o(t.data),r=yield function(t,e,i){return Ht.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{xt:{contentType:vo,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),wo=(t,e)=>fo(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),xo=[];xt&&xo.push({transport:"fetch",method(t){var e,r=yo(t);if(r){var{url:s,encodedBody:n}=r,{contentType:o,body:a,estimatedSize:l}=null!=n?n:{},u=new Headers;xr(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if(St){var v=new St;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;d=!0,v.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}xt(s,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(l||0),body:a,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){yr.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{d&&"AbortError"===(null==e?void 0:e.name)?yr.warn(e):yr.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}}),Et&&xo.push({transport:"XHR",method(t){var e=yo(t);if(e){var i=new Et,{url:r,encodedBody:s}=e;i.open(t.method||"GET",r,!0);var{contentType:n,body:o}=null!=s?s:{};xr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=yt&&yt.sendBeacon&&xo.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:i}=mo(t),{contentType:r,body:s}=null!=i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});yt.sendBeacon(e,n)}catch(t){}}});var Eo=3e3;class So{constructor(t,e){this.br=!0,this._r=[],this.wr=ye((null==e?void 0:e.flush_interval_ms)||Eo,250,5e3,yr.createLogger("flush interval"),Eo),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Er(i({},t,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var e=this.Tr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Xt(i.data)&&xr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Er(i)};for(var r in e)i()}}),this.wr))}Er(t){try{this.kr(t)}catch(t){yr.error(t)}}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return xr(this._r,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ie(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this._r=[],t}}var To=["retriesPerformedSoFar"];class $o{constructor(t){this.Mr=!1,this.Pr=3e3,this._r=[],this._instance=t,this._r=[],this.Rr=!0,!ie(gt)&&"onLine"in gt.navigator&&(this.Rr=gt.navigator.onLine,this.Or=()=>{this.Rr=!0,this.Lr()},this.Fr=()=>{this.Rr=!1},Or(gt,"online",this.Or),Or(gt,"offline",this.Fr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,To);le(e)&&(s.url=fo(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.st(i({retriesPerformedSoFar:e},s));0===t.statusCode&&yr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}st(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this._r.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),yr.warn(s),this.Mr||(this.Mr=!0,this.Ar())}Ar(){if(this.$r&&clearTimeout(this.$r),0===this._r.length)return this.Mr=!1,void(this.$r=void 0);this.$r=setTimeout((()=>{this.Rr&&this._r.length>0&&this.Lr(),this.Ar()}),this.Pr)}Lr(){var t=Date.now(),e=[],i=this._r.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this._r=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.$r&&(clearTimeout(this.$r),this.$r=void 0),this.Mr=!1,ie(gt)||(this.Or&&(gt.removeEventListener("online",this.Or),this.Or=void 0),this.Fr&&(gt.removeEventListener("offline",this.Fr),this.Fr=void 0)),this._r))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){yr.error(t)}this._r=[]}}class ko{constructor(t){this.Dr=()=>{var t,e,i,r;this.Nr||(this.Nr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Nr.lastScrollY=Math.ceil(n),this.Nr.maxScrollY=Math.max(n,null!==(t=this.Nr.maxScrollY)&&void 0!==t?t:0),this.Nr.maxScrollHeight=Math.max(o,null!==(e=this.Nr.maxScrollHeight)&&void 0!==e?e:0),this.Nr.lastContentY=a,this.Nr.maxContentY=Math.max(a,null!==(i=this.Nr.maxContentY)&&void 0!==i?i:0),this.Nr.maxContentHeight=Math.max(l,null!==(r=this.Nr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Nr}resetContext(){var t=this.Nr;return setTimeout(this.Dr,0),t}startMeasuringScrollPosition(){Or(gt,"scroll",this.Dr,{capture:!0}),Or(gt,"scrollend",this.Dr,{capture:!0}),Or(gt,"resize",this.Dr)}scrollElement(){if(!this.qr)return null==gt?void 0:gt.document.documentElement;var t=Xt(this.qr)?this.qr:[this.qr];for(var e of t){var i=null==gt?void 0:gt.document.querySelector(e);if(i)return i}}Br(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.qr){var i=this.scrollElement();return i&&i[e]||0}return gt?"y"===t?gt.scrollY||gt.pageYOffset||gt.document.documentElement.scrollTop||0:gt.scrollX||gt.pageXOffset||gt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Br("y")}scrollX(){return this.Br("x")}}var Ro=t=>dn(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Po{constructor(t,e,i,r){this.jr=t=>{var e=this.Hr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ur(this._instance)};this.zr.register({[Y]:i})}},this._instance=t,this.Vr=e,this.zr=i,this.Ur=r||Ro,this.Vr.onSessionId(this.jr)}Hr(){return this.zr.props[Y]}getSetOnceProps(){var t,e=null==(t=this.Hr())?void 0:t.props;return e?"r"in e?vn(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return xr(kr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Yt(i)]=e})),t}}class Oo{constructor(){this.Wr={}}on(t,e){return this.Wr[t]||(this.Wr[t]=[]),this.Wr[t].push(e),()=>{this.Wr[t]=this.Wr[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Wr[t]||[])i(e);for(var r of this.Wr["*"]||[])r(t,e)}}var Io=br("[SessionId]");class Co{on(t,e){return this.Gr.on(t,e)}constructor(t,e,i){var r;if(this.Zr=null,this.Qr=[],this.Jr=void 0,this.Yr=!1,this.Gr=new Oo,this.Kr=(t,e)=>!(!le(t)||!le(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===at)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.zr=t.persistence,this.Xr=void 0,this.ei=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=e||Lr,this.ri=i||Lr;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*ye(this.Se.session_idle_timeout_seconds||1800,60,36e3,Io.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ii(),this.ni="ph_"+s+"_window_id",this.si="ph_"+s+"_primary_window_exists",this.oi()){var n=Yr.F(this.ni),o=Yr.F(this.si);n&&!o?this.Xr=n:Yr.P(this.ni),Yr.q(this.si,!0)}if(null!=(r=this.Se.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Se.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.ai(this.Se.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Io.error("Invalid sessionID in bootstrap",t)}this.li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ie(this.Qr)&&(this.Qr=[]),this.Qr.push(t),this.ei&&t(this.ei,this.Xr),()=>{this.Qr=this.Qr.filter((e=>e!==t))}}oi(){return"memory"!==this.Se.persistence&&!this.zr.Vt&&Yr.N()}ui(t){t!==this.Xr&&(this.Xr=t,this.oi()&&Yr.q(this.ni,t))}hi(){return this.Xr?this.Xr:this.oi()?Yr.F(this.ni):null}di(t){var e=this.Zr;return!ne(e)&&!ne(t)&&5e3>Math.abs(t-e)}ai(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.ei||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ei=t,s&&!r||s&&this.di(e)||(this.Zr=e,this.zr.register({[k]:[e,t,i]}))}ci(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return le(e)&&e>0}vi(){this.ci()?this.zr.refreshKey(k):(this.zr.flush(),this.zr.load())}fi(){var t;if(!ne(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Zr){this.vi();var[,e,i]=this.pi();e===this.ei&&i===this._sessionStartTimestamp&&(this.Zr=this._sessionActivityTimestamp,this.zr.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.ei)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.zr.flush())}}gi(){var[t]=this.pi(),e=le(t)?t:0,i=le(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}mi(t){return this.vi(),this.Kr(t,this.gi())}pi(){var t=this.zr.props[k];return Xt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Zr=null,clearTimeout(this.yi),this.yi=void 0,this.ai(null,null,null)}destroy(){this.Yr=!0,this.fi(),clearTimeout(this.yi),this.yi=void 0,this.Jr&&gt&&(gt.removeEventListener(vt,this.Jr,{capture:!1}),this.Jr=void 0),this.Qr=[]}li(){this.Jr=()=>{this.fi(),this.oi()&&Yr.P(this.si)},Or(gt,vt,this.Jr,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Se.cookieless_mode===at)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.pi(),n=this.gi(),o=this.hi(),a=le(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.Kr(i,n);v&&((v=this.mi(i))||Io.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.pi()),h||v||a?(r=this.ti(),o=this.ri(),Io.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.ri(),l=!0),(u=r!==d)&&(Io.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=le(n)&&t&&!a?n:i,p=le(s)?s:(new Date).getTime();this.ui(o),this.ai(r,c,p),t||this.ii();var f={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.Qr.forEach((t=>t(r,o,f))),{sessionId:r,windowId:o,sessionStartTimestamp:p,changeReason:l?f:void 0,lastActivityTimestamp:n}}ii(){this.Yr||(clearTimeout(this.yi),this.yi=setTimeout((()=>{if(!this.Yr)if(this.mi((new Date).getTime())){var t=this.ei;this.resetSessionId(),this.Gr.emit("forcedIdleReset",{idleSessionId:t})}else this.ii()}),1.1*this.sessionTimeoutMs))}}var Ao=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Vt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Vt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Fo(){return(Fo=e((function*(){var t=null==yt?void 0:yt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return re(i)&&i.length>0?i:void 0}catch(t){return void yr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var Mo=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function Do(t,e,i){return _o({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Lo={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Mo(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Mo(e,t))))),icontains:(t,e)=>e.map(No).some((e=>t.map(No).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(No).every((e=>t.map(No).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},No=t=>t.toLowerCase();function Uo(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(ie(s)||ne(s))return!1;var n=[String(s)],o=Lo[r.operator];return!!o&&o(r.values,n)}))}var jo="custom",Bo="i.posthog.com",zo=/^\/static\//;class Ho{constructor(t){this.bi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Bo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.bi[this.apiHost]||(this.bi[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":jo),this.bi[this.apiHost]}wi(t){if(zo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.wi(e);if(i)return""+i+e}if(this.region===jo)return this.apiHost+e;var r=Bo+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var qo=br("[Surveys]"),Vo="seenSurvey_",Go=t=>{try{var e=(t=>((t,e)=>{var i=""+Vo+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+Vo+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){qo.error("Failed to persist survey seen state",t)}},Wo=[bn.Popover,bn.Widget,bn.API],Yo={ignoreConditions:!1,ignoreDelay:!1,displayType:Sn.Popover},Ko=br("[PostHog ExternalIntegrations]"),Jo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Qo{constructor(t){this._instance=t}Mt(t,e){var i;null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ko.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=kt.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.Mt(Jo[e],(()=>{var i;null==(i=kt.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=kt.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=kt.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Xo,Zo={},ta=0,ea=()=>{},ia='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ra="Surveys module not available",sa="sanitize_properties is deprecated. Use before_send instead",na="Invalid value for property_denylist config: ",oa="posthog",aa=!ho&&-1===(null==$t?void 0:$t.indexOf("MSIE"))&&-1===(null==$t?void 0:$t.indexOf("Mozilla")),la=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Pr(null==bt?void 0:bt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ea,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:wt&&re(null==wt?void 0:wt.search)&&-1!==wt.search.indexOf("__posthog_debug=true")||!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:"https:"===(null==gt||null==(e=gt.location)?void 0:e.protocol),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(t){yr.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ht,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Eo},error_tracking:{},_onCapture:ea},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:_s,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t)}))(t))},ua=[["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[i,r]of ua)ie(t[i])||(e[r]=t[i]);var s=Er({},e,t),n=t.__preview_external_dependency_versioned_paths;return ie(n)||(ie(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),re(n)&&ie(t.asset_host)&&(s.asset_host=n)),Xt(t.property_blacklist)&&(ie(t.property_denylist)?s.property_denylist=t.property_blacklist:Xt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:yr.error(na+t.property_denylist)),s};class da{constructor(){this.__forceAllowLocalhost=!1}get xi(){return this.__forceAllowLocalhost}set xi(t){yr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class va{ki(t,e){if(t){var i=this.Si.indexOf(t);-1!==i&&this.Si.splice(i,1)}return this.Si.push(e),null==e.initialize||e.initialize(),e}Ci(){return this.config.cookieless_mode===at||this.config.cookieless_mode===ot&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new da,this.Ii=!1,this.version=n.LIB_VERSION,this.Ti=new Oo,this.Si=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=la(),this.SentryIntegration=Hs,this.sentryIntegration=t=>function(t,e){var i=zs(t,e);return{name:Bs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ei=!1,this.Mi=null,this.Pi=null,this.Ri=null,this.scrollManager=new ko(this),this.pageViewManager=new qs(this),this.rateLimiter=new Rn(this),this.requestRouter=new Ho(this),this.consent=new Kr(this),this.externalIntegrations=new Qo(this);var e=null!==(t=va.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=re(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=re(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>yr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==oa){var r,s=null!==(r=Zo[i])&&void 0!==r?r:new va;return s._init(t,e,i),Zo[i]=s,Zo[oa][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;void 0===e&&(e={});var a=re(t)?t.trim():"";if(!a)return yr.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={},e.debug=this.Oi(e.debug),this.Li=e,this.Fi=[],e.person_profiles?this.Pi=e.person_profiles:e.process_person&&(this.Pi=e.process_person);var u=la(e.defaults),h=ha(e),d=Er({},u,h,{name:r,token:a});te(u.rageclick)&&te(h.rageclick)&&(d.rageclick=Er({},u.rageclick,h.rageclick)),te(u.session_recording)&&te(h.session_recording)&&(d.session_recording=Er({},u.session_recording,h.session_recording)),this.set_config(d),this.config.on_xhr_error&&yr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:In.GZipJS;var v=this.Ai();this.persistence=new mn(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(i({},this.config,{persistence:"sessionStorage"}),v,!1);var c=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.$i=new So((t=>this.Di(t)),this.config.request_queue_config),this.Ni=new $o(this),this.__request_queue=[];var f=this.Ci();if(f||(this.sessionManager=new Co(this),this.sessionPropsManager=new Po(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(yr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.qi(f)}),0)):(yr.info("Initializing extensions synchronously"),this.qi(f)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&yr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:c,s:p}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var _=e.bootstrap.distinctID,g=this.get_distinct_id(),m=this.persistence.get_property(W);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===lt)this.identify(_);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ut)yr.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 y=this.config.get_device_id(Lr()),b=e.bootstrap.isIdentifiedID?y:_;this.persistence.set_property(W,e.bootstrap.isIdentifiedID?ut:lt),this.register({distinct_id:_,$device_id:b})}}if(f)this.register_once({distinct_id:et,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Lr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(W,lt)}return Or(gt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Lr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(W,ut)),e()},s=i.user();"then"in s&&Zt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||js.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(js.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(js.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ct),identify:t=>e(t,ft),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Bi())):this.Bi(),Zt(this.config._onCapture)&&this.config._onCapture!==ea&&(yr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&yr.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 Fo.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(ea),this}qi(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},va.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Si.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.Si.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.Si.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Si.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Si.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Si.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Si.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Si.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.Si.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.Si.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Si.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Si.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Si.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Si.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Si.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Ns)),h.toolbar&&this.Si.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Si.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Si.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.ji){var t=this.ji;this.ji=void 0,this.pr(t)}})),this.Hi(d,u)}Hi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Hi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){yr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[it]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rt]:r}),this.config.__preview_deferred_init_extensions&&yr.info("PostHog extensions initialized ("+r+"ms)")}pr(t){var e;if(!bt||!bt.body)return yr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ji=t),this.Ui=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Gt(t.supportedCompression,In.GZipJS)?In.GZipJS:Gt(t.supportedCompression,In.Base64)?In.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:ht}),this.Si.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Bi(){try{this.config.loaded(this)}catch(t){yr.critical("`loaded` function failed",t)}if(this.zi(),this.config.internal_or_test_user_hostname&&null!=wt&&wt.hostname){var t=wt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ci())&&this.Vi()}),1),this.Wi=new On(this),this.Wi.load()}zi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.$i)||t.enable())}_dom_loaded(){this.is_capturing()&&wr(this.__request_queue,(t=>this.Di(t))),this.__request_queue=[],this.zi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),this.config.request_batching?(this.Gi()&&this.capture(pt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.$i)||i.unload(),null==(r=this.Ni)||r.unload()):this.Gi()&&this.capture(pt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?aa?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(ie(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4,n.url=wo(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=xo.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),l=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===o)return t[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===In.GZipJS&&Tt&&"undefined"!=typeof Promise&&!co?bo(n).then((t=>{l(t)})).catch((e=>{if(jt(e))return co=!0,void l(i({},n,{compression:void 0,url:wo(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return jt(t)||e===Lt})(e)&&(co=!0),l(n)})):l(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Di(t){this.Ni?this.Ni.retriableRequest(t):this._send_request(t)}_execute_array(t){ta++;try{var e,i=[],r=[],s=[];wr(t,(t=>{if(t)if(Xt(e=t[0]))s.push(t);else if(Zt(t))try{t.call(this)}catch(e){yr.error("Error executing queued PostHog call",t,e)}else Xt(t)&&"alias"===e?i.push(t):Xt(t)&&-1!==e.indexOf("capture")&&Zt(this[e])?s.push(t):r.push(t)}));var n=function(t,e){wr(t,(function(t){try{if(Xt(t[0])){var i=e;xr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){yr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{ta--}}push(t){if(ta>0&&Xt(t)&&re(t[0])){var e=va.prototype[t[0]];Zt(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!ie(t)&&re(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!re(null==e?void 0:e.$current_url)&&(yr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.Zi||yr.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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=$i(null==r?void 0:r.uuid,Lr),p={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ct&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var f=null==r?void 0:r.$unset;f&&(p.$unset=f);var _,g,m,y=this.Qi(null==r?void 0:r.$set_once,t!==_t,t===ft);if(y&&(p.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=t=>re(t)?t.slice(0,n):t,l=new Set,p=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Xt(e)?(r=[],wr(e,(e=>{r.push(t(e))}))):(r={},xr(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),p.timestamp=v,ie(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),t===xn.DISMISSED||t===xn.SENT){var b=null==e?void 0:e[En.SURVEY_ID],w=null==e?void 0:e[En.SURVEY_ITERATION];Go({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(_={id:b,current_iteration:w},g=t===xn.SENT?"responded":"dismissed",m="$survey_"+g+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(m="$survey_"+g+"/"+_.id+"/"+_.current_iteration),m)]:!0})}else t===xn.SHOWN&&(p.$set=i({},p.$set,{[En.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Tn.SHOWN){var x=null==e?void 0:e[$n.TOUR_TYPE];x&&(p.$set=i({},p.$set,{[$n.TOUR_LAST_SEEN_DATE+"/"+x]:(new Date).toISOString()}))}var E=i({},p.properties.$set,p.$set);if(ee(E)||this.setPersonPropertiesForFlags(E),!oe(this.config.before_send)){var S=this.it(p);if(!S)return;(p=S).uuid=$i(p.uuid,Lr)}this.Ti.emit("eventCaptured",p);var T={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Di(T):this.$i.enqueue(T),p}yr.critical("This capture call is ignored due to client rate limiting.")}}else yr.error("No event name provided to posthog.capture")}else yr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ci()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!re(l.distinct_id)&&!ae(l.distinct_id)||se(l.distinct_id))&&yr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var s,o,a,l;if(void 0===r&&(r=!1),!$t)return{};var u,h,d,v,c,p,f,_,g,m=t?[...tn,...e||[]]:[],[y,b]=function(t){for(var e=0;Ei.length>e;e++){var[i,r]=Ei[e],s=i.exec(t),n=s&&(Zt(r)?r(s,t):r);if(n)return n}return["",""]}($t),w=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},x={detectGoogleSearchApp:i},E=Er(kr({$os:y,$os_version:b,$browser:bi($t,navigator.vendor,w,x),$device:Si($t),$device_type:(d=$t,v={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(o=navigator)?void 0:o.maxTouchPoints,screenWidth:null==gt||null==(a=gt.screen)?void 0:a.width,screenHeight:null==gt||null==(l=gt.screen)?void 0:l.height,devicePixelRatio:null==gt?void 0:gt.devicePixelRatio},g=Si(d),g===$e||g===Te||"Kobo"===g||"Kindle Fire"===g||g===ii?Se:g===Ve||g===We||g===Ge||g===Ze?"Console":g===Re?"Wearable":g?we:"Android"===(null==v?void 0:v.userAgentDataPlatform)&&(null!==(c=null==v?void 0:v.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(p=null==v?void 0:v.screenWidth)&&void 0!==p?p:0,null!==(f=null==v?void 0:v.screenHeight)&&void 0!==f?f:0)/(null!==(_=null==v?void 0:v.devicePixelRatio)&&void 0!==_?_:1)?we:Se:"Desktop"),$timezone:cn(),$timezone_offset:pn()}),{$current_url:Qs(r?ki(null==wt?void 0:wt.href):null==wt?void 0:wt.href,m,rn),$host:null==wt?void 0:wt.host,$pathname:null==wt?void 0:wt.pathname,$raw_user_agent:$t.length>1e3?$t.substring(0,997)+"...":$t,$browser_version:xi($t,navigator.vendor,w,x),$browser_language:ln(),$browser_language_prefix:(h=ln(),"string"==typeof h?h.split("-")[0]:void 0),$screen_height:null==gt?void 0:gt.screen.height,$screen_width:null==gt?void 0:gt.screen.width,$viewport_height:null==gt?void 0:gt.innerHeight,$viewport_width:null==gt?void 0:gt.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return n.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=n.SDK_DIST_CHANNEL),E}(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{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&Er(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Er(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this.Ni)?void 0:p.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===jo&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ct||o?t!==pt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Er(l,h),t===ct&&bt&&(l.title=bt.title),!ie(a)){var f=r.getTime()-a;l.$duration=parseFloat((f/1e3).toFixed(3))}$t&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Er({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Xt(this.config.property_denylist)?xr(this.config.property_denylist,(function(t){delete l[t]})):yr.error(na+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(yr.error(sa),l=_(l,t));var g=this.Ji();return l.$process_person_profile=g,g&&!o&&this.Yi("_calculate_event_properties"),l}Qi(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Ji())return t;if(this.Ii&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Er({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(yr.error(sa),o=a(o,"$set_once")),e&&(this.Ii=!0),ee(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}Ki(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ti.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ra}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:ra})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:ra})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Yo),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:ra}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:ra})}Xi(t){return!t||se(t)?(yr.critical("Unique user id has not been set in posthog.identify"),!1):t===et?(yr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(yr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return yr.uninitializedWarning("posthog.identify");if(ae(t)&&(t=t.toString(),yr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Xi(t)&&this.Yi("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(u)&&(this.unregister(u),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(W)||lt)===lt;t!==r&&n?(this.persistence.set_property(W,ut),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ft,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Ri=Do(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(H))}}setPersonProperties(t,e){if((t||e)&&this.Yi("posthog.setPersonProperties")){var i=Do(this.get_distinct_id(),t,e);this.Ri!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Ri=i):yr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(Xt(t)?t:[t]).filter((t=>re(t)&&t.length>0));0!==i.length&&this.Yi("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ri=null)}group(t,e,r){if(t&&e){var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},s,{[t]:e})}),n||r){var o={$group_type:t,$group_key:e};r&&(o.$group_set=r),this.capture(_t,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else yr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.Yi("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,u,h,d;if(yr.info("reset"),!this.__loaded)return yr.uninitializedWarning("posthog.reset");var v,c=this.get_property(a),p=this.get_property(l),f=this.get_property(b);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),ie(f)||null==(v=this.persistence)||v.register({[b]:f}),null==(r=this.surveys)||r.reset(),null==(s=this.Wi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(u=this.logs)||u.reset(),null==(h=this.persistence)||h.set_property(W,lt),null==(d=this.sessionManager)||d.resetSessionId(),this.Ri=null,this.config.cookieless_mode===at)this.register_once({distinct_id:et,$device_id:null},"");else{var _=this.config.get_device_id(Lr());this.register_once({distinct_id:_,$device_id:t?_:c},""),t||ie(p)||this.register({[l]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s;i.__loaded?(null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(e=i.$i)||e.unload(),null==(r=i.Ni)||r.unload(),null==(s=i.featureFlags)||s.destroy()):yr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.en()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.tn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(o)?(yr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yi("posthog.alias")?(ie(e)&&(e=this.get_distinct_id()),t!==e?(this.Ki(u,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(yr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(te(t)){var r,s,o,a,l,u,h,d,v,c,p;Er(this.config,ha(t));var f=this.Ai();null==(r=this.persistence)||r.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(i({},this.config,{persistence:"sessionStorage"}),f,!1);var _=this.Oi(this.config.debug);ue(_)&&(this.config.debug=_),ue(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Hr.N()&&Hr.q("ph_debug",!0),yr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,Hr.N()&&Hr.P("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(v=this.deadClicksAutocapture)||v.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.rn(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){n.LIB_NAME=t,n.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:va.nn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:oa;return e!==oa&&(e=oa+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(W))===ut||(null==(e=this.sessionPersistence)?void 0:e.get_property(W))===ut}Ji(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ht&&!this._isIdentified()&&ee(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[u])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Z]))}Gi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Ji()||this.Yi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yi(t){return"never"===this.config.person_profiles?(yr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ki(Z,!0),!0)}Ai(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ot)}rn(){var t,e,i,r,s=this.Ai();return(null==(t=this.persistence)?void 0:t.Vt)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Vt)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==at){if(this.Ci()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Co(this),this.pageViewManager=new qs(this),this.persistence&&(this.sessionPropsManager=new Po(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=va.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.ki(this.sessionRecording,new l(this)),this.Ui&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Ui)))}var u,h;this.consent.optInOut(!0),this.rn(),this.zi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ot&&(null==(u=this.surveys)||u.loadIfEnabled()),(ie(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vi()}else yr.warn(ia)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==at?(this.config.cookieless_mode===ot&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rn(),this.config.cookieless_mode===ot&&(this.register({distinct_id:et,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vi(),this.zi())):yr.warn(ia)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===at||(this.config.cookieless_mode===ot?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.rn()}_is_bot(){return yt?Ao(yt,this.config.custom_blocked_useragents):void 0}Vi(){bt&&("visible"===bt.visibilityState?this.Ei||(this.Ei=!0,this.capture(ct,{title:bt.title},{send_instantly:!0}),this.Mi&&(bt.removeEventListener(dt,this.Mi),this.Mi=null)):this.Mi||(this.Mi=this.Vi.bind(this),Or(bt,dt,this.Mi)))}debug(t){!1===t?(null==gt||gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==gt||gt.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}))}mr(){var t,e,i,r,s,n,o=this.Li||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(yr.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):(i="advanced_disable_decide",!1,r=yr,s=(e="advanced_disable_flags")in(t=o)&&!oe(t[e]),n=i in t&&!oe(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}it(t){var e;if(oe(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(ve),r=Xt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),oe(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return de(t.event)?yr.warn(o+". This can cause unexpected behavior."):yr.info(o),null}s.properties&&!ee(s.properties)||yr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&oe(s.properties[a]))return yr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ot)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Oi(t){var e=ue(t)&&!t,i=Hr.N()&&"true"===Hr.A("ph_debug");return!e&&(!!i||t)}}va.__defaultExtensionClasses={},va.nn={trace:Xo=()=>{},debug:Xo,info:Xo,warn:Xo,error:Xo,fatal:Xo},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=$r(t.prototype[e[i]])}(va,["identify"]);class ca{constructor(t){this.disabled=!1===t;var e=te(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var pa="$copy_autocapture",fa=br("[AutoCapture]");function _a(t,e){return e.length>t?e.slice(0,t)+"...":e}function ga(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!es(e));return e}function ma(t,e){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:h}=e;if(!es(t))return{props:{}};for(var d=[t],v=t;v.parentNode&&!is(v,"body");)if(ss(v.parentNode))d.push(v.parentNode.host),v=v.parentNode.host;else{if(!es(v.parentNode))break;d.push(v.parentNode),v=v.parentNode}var c,p,f=[],_={},g=!1,m=!1;if(xr(d,(t=>{var e=Es(t);if(is(t,"a")){var i=t.getAttribute("href");g=!!(e&&i&&Is(i))&&(h?ki(i):i)}Gt(as(t),"ph-no-capture")&&(m=!0),f.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};ds.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?_a(1024,Cs(t)):_a(1024,us(t)));var a=as(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),xr(t.attributes,(function(i){var n;if((!Ss(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Is(i.value)&&(!re(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=ns(a).join(" ")),o["attr__"+i.name]=_a(1024,"href"===i.name&&s?ki(a):a)}}));for(var l=1,u=1,h=t;h=ga(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!Es(t))return{};var e={};return xr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Is(r)&&(e[i]=r)}})),e}(t);Er(_,r)})),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text=is(t,"a")||is(t,"button")?Cs(t):us(t)),g){var y,b;f[0].attr__href=g;var w=null==(y=Ks(g))?void 0:y.host,x=null==gt||null==(b=gt.location)?void 0:b.host;w&&x&&w!==x&&(c=g)}return{props:Er({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(p=f,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return Sr(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[Fs(e.toString())]=Fs(i.toString())})),(s+=":")+Sr(a).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Ms(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Sr(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(p)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var ya=br("[ExceptionAutocapture]"),ba=br("[TracingHeaders]"),wa=br("[Web Vitals]"),xa=9e5,Ea="disabled",Sa="lazy_loading",Ta="awaiting_config",$a="missing_config";br("[SessionRecording]"),br("[SessionRecording]");var ka="[SessionRecording]",Ra=br(ka),Pa=br("[Heatmaps]");function Oa(t){return te(t)&&"clientX"in t&&"clientY"in t&&ae(t.clientX)&&ae(t.clientY)}var Ia=br("[Product Tours]"),Ca=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},Aa=["$set_once","$set"],Fa=br("[SiteApps]"),Ma="Error while initializing PostHog app with config id ";function Da(t,e,i){if(oe(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class La{constructor(t){this.sn=new Oo,this.an=(t,e)=>this.ln(t,e)&&this.un(t,e)&&this.hn(t,e)&&this.dn(t,e),this.ln=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.cn=new Set,this.vn=new Set}init(){var t,e;ie(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!ie(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.vn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.cn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.cn.has(t)||this.cn.has(null==e?void 0:e.event))&&this.vn&&(null==(i=this.vn)?void 0:i.size)>0&&this.vn.forEach((t=>{this.fn(e,t)&&this.sn.emit("actionCaptured",t.name)}))}pn(t){this.onAction("actionCaptured",(e=>t(e)))}fn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.an(t,i))return!0;return!1}onAction(t,e){return this.sn.on(t,e)}un(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Da(r,e.url,e.url_matching||"contains"))return!1}return!0}hn(t,e){return!!this.gn(t,e)&&!!this.mn(t,e)&&!!this.yn(t,e)}gn(t,e){var i;if(null==e||!e.href)return!0;var r=this.bn(t);if(r.length>0)return r.some((t=>Da(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Da((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}mn(t,e){var i;if(null==e||!e.text)return!0;var r=this.bn(t);if(r.length>0)return r.some((t=>Da(t.text,e.text,e.text_matching||"exact")||Da(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!oe(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Da(t,n,o))))}yn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}bn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}dn(t,e){return null==e||!e.properties||0===e.properties.length||Uo(e.properties.reduce(((t,e)=>{var i=Xt(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Na{constructor(t){this._n=[],this._instance=t,this.wn=new Map,this.xn=new Map,this.kn=new Map}Sn(t,e){return!!t&&Uo(t.propertyFilters,null==e?void 0:e.properties)}Cn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}In(t,e,i){var r=(i===yn.Activation?this.wn:this.xn).get(t),s=[];return this.Tn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Sn(n,e)}))}register(t){var e;ie(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.En(t),this.Mn(t))}Mn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Pn&&(this.Pn=new La(this._instance),this.Pn.init(),this.Pn.pn((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Pn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.kn.get(e.name);i&&i.push(t.id),this.kn.set(e.name,i||[t.id])}})))})))}En(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.wn=this.Cn(t,yn.Activation),this.xn=this.Cn(t,yn.Cancellation))}onEvent(t,e){var i,r,s=this.Rn(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.On(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Ln([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Fn(n)}if(this.xn.has(t)){var a=this.In(t,e,yn.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Ln(a.map((t=>t.id))),a.forEach((t=>this.An(t.id))))}if(this.wn.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.wn.get(t)});var l=this.In(t,e,yn.Activation);this.$n(l.map((t=>t.id)))}}onAction(t){this.kn.has(t)&&this.$n(this.kn.get(t)||[])}$n(t){0!==t.length&&(this._n=[...new Set([...this._n,...t])],this.Rn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Fn(t){this._n=this._n.filter((e=>e!==t));var e=this.Dn();e.includes(t)||this.Nn([...e,t])}Ln(t){var e=new Set(t);this._n=this._n.filter((t=>!e.has(t)));var i=this.Dn(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Nn(r)}Dn(){var t,e=this.qn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.Dn(),...this._n])].filter((t=>!this.Bn(t)))}reset(){this._n=[],this.Dn().length>0&&this.Nn([])}getEventToItemsMap(){return this.wn}jn(){return this.Pn}}class Ua extends Na{constructor(t){super(t)}qn(){return B}Hn(){return xn.SHOWN}Tn(t){var e;null==(e=this._instance)||e.getSurveys(t)}An(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Rn(){return qo}Nn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[B]:t})}Bn(){return!1}On(t,e){var i;this.Tn((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e,i,r,s=(null!==(e=null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)&&void 0!==e?e:0)>0;return t.schedule===wn.Always||!(null==(r=t.conditions)||null==(r=r.events)||!r.repeatedActivation||!s)}(i);return r?t===xn.SHOWN?"consume":"ignore":t===xn.SHOWN?"persist":t===xn.DISMISSED||t===xn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ja="SDK is not enabled or survey functionality is not yet loaded",Ba="Disabled. Not loading surveys.",za=null!=gt&&gt.location?Xs(gt.location.hash,"__posthog")||Xs(location.hash,"state"):null,Ha="_postHogToolbarParams",qa=br("[Toolbar]"),Va=br("[FeatureFlags]"),Ga=br("[FeatureFlags]",{debugEnabled:!0}),Wa="\" failed. Feature flags didn't load in time.",Ya=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ka=t=>{var e={};for(var[i,r]of Sr(t||{}))r&&(e[i]=r);return e},Ja=br("[Error tracking]"),Qa="Refusing to render web experiment since the viewer is a likely bot",Xa={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Mo(e,t),not_regex:(t,e)=>!Mo(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Za{get Se(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Za.Un("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(Za.Un("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);re(r)&&t.variants[r]&&e.Vn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Za.Wn(n,e._instance)&&e.Vn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Za.Un(Qa);else if(!this.Se.disable_web_experiments){if(oe(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Za.Un("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Vn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Za.getWindowLocation();if(null!=t&&t.search){var e=Js(null==t?void 0:t.search,"__experiment_id"),i=Js(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Za.Un("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Se.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Za.Un("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Vn(r[0].name,e,r[0].variants[e].transforms))}static Wn(t,e){return!oe(t.conditions)&&Za.Zn(t,e)&&Za.Qn(t)}static Zn(t,e){var i;if(oe(t.conditions)||oe(null==(i=t.conditions)?void 0:i.url))return!0;var r=Za.getWindowLocation();if(r){var s,n,o,a=Jr(e,r.href);return null==(s=t.conditions)||!s.url||Xa[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==gt?void 0:gt.location}static Qn(t){var e;if(oe(t.conditions)||oe(null==(e=t.conditions)?void 0:e.utm))return!0;var i=nn();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Un(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];yr.info("[WebExperiments] "+t,i)}Vn(t,e,i){this._is_bot()?Za.Un(Qa):"control"!==e?i.forEach((i=>{if(i.selector){var r;Za.Un("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Za.Un("Control variants leave the page unmodified.")}_is_bot(){return yt&&this._instance?Ao(yt,this.Se.custom_blocked_useragents):void 0}}var tl=br("[Conversations]"),el="Conversations not available yet.",il="console",rl={featureFlags:class{constructor(t){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=0,this.os=()=>{var t=this.ls();this.ss=0,t&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],gt&&Or(gt,"online",this.os)}destroy(){null==gt||gt.removeEventListener("online",this.os)}get Se(){return this._instance.config}get zr(){return this._instance.persistence}us(t){return this._instance.get_property(t)}hs(){var t,e;return null!==(t=null==(e=this.zr)?void 0:e.Gt(this.Se.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ds(){return!!this.hs()&&(this.ns||this.Kn||(this.ns=!0,Va.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}cs(){var t,e=null!==(t=this.Se.evaluation_contexts)&&void 0!==t?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.rs||(Va.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Va.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}vs(){return this.cs().length>0}fs(){var t=this.Se.flag_keys;if(!ie(t)){if(Xt(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Va.error("Invalid flag key found:",t,"Expected non-empty string"),e}));Va.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.us(P))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.us(A))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var[d,v]of Object.entries(l))h[d]={key:d,enabled:Ot(v),variant:It(v),reason:void 0,metadata:ie(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.us(C),e=this.us(M),r=this.us(D);if(!r&&!e)return t||{};var s=Er({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=ie(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=ie(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],p=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),c&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=p}return this.Jn||(Va.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Jn=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Ot(r),variant:It(r),payload:Pt(e[i])}}))}getFlagVariants(){var t=this.us(P),e=this.us(M);if(!e)return t||{};for(var i=Er({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Va.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.us(A),e=this.us(D);if(!e)return t||{};for(var i=Er({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Va.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.Xn||this.Se.advanced_disable_feature_flags||this.ls()||this.ps||(this._instance.Ti.emit("featureFlagsReloading",!0),this.ps=setTimeout((()=>{this.gs()}),5))}ys(){clearTimeout(this.ps),this.ps=void 0}ensureFlagsLoaded(){this.Yn||this.Kn||this.ps||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Xn=t}gs(t){var e;if(this.ys(),!this._instance.mr()&&!this.ls())if(this.Kn)this.es=!0;else{var r=this.Se.token,s=this.us(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.zr)?void 0:e.get_initial_props())||{},this.us(L)||{}),group_properties:this.us(N),timezone:cn()};ne(s)||ie(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.vs()&&(n.evaluation_contexts=this.cs());var o=this.fs();ie(o)||(n.flag_keys=o);var l=!!this.Se.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this.Se.disable_compression?void 0:In.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(this.bs(t.statusCode),200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!s;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(r=this.zr)||r.register({[V]:o}),u)Va.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.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},s,{partialResponse:l}),this.es&&(this.es=!1,this.gs())}}})}}ls(){return this.ss>=3&&Rt()}bs(t){this.ss=((t,e,i,r)=>{if(0===t){if(Rt()){var s=e+1;return 3===s&&Va.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."),s}return e}return 0})(t,this.ss)}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ds()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Va.warn('getFeatureFlag for key "'+t+Wa)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ds()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.us(F)||void 0,l=this.us(G)||void 0,u=this.us(H)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.us(q);d&&d!==v&&(u={},null==(h=this.zr)||h.register({[H]:u,[q]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,y,b,w,x;Xt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.zr)||c.register({[H]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.us(V))&&void 0!==p?p:[]];ie(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Se.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Se.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.ts};ie(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,R=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;R&&(T.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),ie(null==E?void 0:E.original_variant)&&ie(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=ie(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Pt(n)}}}else Va.warn('getFeatureFlagResult for key "'+t+Wa)}getRemoteConfigPayload(t,e){var i=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.vs()&&(r.evaluation_contexts=this.cs());var s=this.fs();ie(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:In.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return ie(i)?void 0:!!i}Va.warn('isFeatureEnabled for key "'+t+Wa)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.zr){this.Yn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(t,e,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var a=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):t.featureFlags&&Va.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=a.flags,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(Xt(u)){Va.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var p=0;u.length>p;p++)c[u[p]]=!0;e&&e.register({[O]:u,[P]:c})}else{var f=u,_=h,g=l;if(null!=o&&o.partialResponse)f=i({},r,f),_=i({},s,_),g=i({},n,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));f=i({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=i({},r,f),_=i({},s,_),g=i({},n,g);e&&e.register(i({[O]:Object.keys(Ka(f)),[P]:f||{},[A]:_||{},[C]:g||{}},d?{[F]:d}:{},v?{[G]:v}:{}))}}}(t,this.zr,s,n,o,r),e||(this.ns=!1),this._s(e)}}override(t,e){void 0===e&&(e=!1),Va.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.zr)return Va.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.zr.unregister(M),this.zr.unregister(D),this._s(),Ga.info("All overrides cleared");if(Xt(t)){var e=Ya(t);return this.zr.register({[M]:e}),this._s(),Ga.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.zr.unregister(M),Ga.info("Flag overrides cleared");else if(r.flags){if(Xt(r.flags)){var s=Ya(r.flags);this.zr.register({[M]:s})}else this.zr.register({[M]:r.flags});Ga.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.zr.unregister(D),Ga.info("Payload overrides cleared")):r.payloads&&(this.zr.register({[D]:r.payloads}),Ga.info("Payload overrides set",{payloads:r.payloads}))),void this._s()}if(t&&"object"==typeof t)return this.zr.register({[M]:t}),this._s(),Ga.info("Flag overrides set",{flags:t});Va.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Yn){var{flags:e,flagVariants:i}=this.ws();try{t(e,i)}catch(t){Va.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.us(I)||[]).find((e=>e.flagKey===t)),o={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[t]:e});null==(s=this.zr)||s.register({[O]:Object.keys(Ka(l)),[P]:l}),this._s()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.us(I),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.zr)||i.unregister(I),null==(r=this.zr)||r.register({[I]:s}),t(s)}}})}ws(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}_s(t){var{flags:e,flagVariants:i}=this.ws();this.featureFlagEventHandlers.forEach((r=>{try{r(e,i,{errorsLoading:t})}catch(t){Va.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.us(L)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this._instance.register({[L]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.us(L)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[L]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(L),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.us(N)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[N]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.us(N)||{};this._instance.register({[N]:i({},e,{[t]:{}})})}else this._instance.unregister(N)}reset(){this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.ys(),this.Jn=!1,this.ss=0}}},sl={sessionRecording:class{get Se(){return this._instance.config}get zr(){return this._instance.persistence}get started(){var t;return!(null==(t=this.xs)||!t.isStarted)}get status(){var t,e;return this.ks===Ta||this.ks===$a?this.ks:null!==(t=null==(e=this.xs)?void 0:e.status)&&void 0!==t?t:this.ks}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ks=Ea,this.Ss=void 0,this._instance=t,!this._instance.sessionManager)throw Ra.error("started without valid sessionManager"),new Error(ka+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===at)throw new Error(ka+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Cs(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Se.disable_session_recording,r=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return gt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.Cs||null==(e=this.xs)||!e.isStarted){var i=!ie(Object.assign)&&!ie(Array.from);this.Cs&&i?(this.Is(t),Ra.info("starting")):(this.ks=Ea,this.stopRecording())}}Is(t){var e,i,r;this.Cs&&(this.ks!==Ta&&this.ks!==$a&&(this.ks=Sa),null!=kt&&null!=(e=kt.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=kt.__PosthogExtensions__)&&i.initSessionRecording?this.Ts(t):null==(r=kt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Es,(e=>{if(e)return Ra.error("could not load recorder",e);this.Ts(t)})))}stopRecording(){var t,e;null==(t=this.Ss)||t.call(this),this.Ss=void 0,null==(e=this.xs)||e.stop()}Ms(){var t,e;null==(t=this.Ss)||t.call(this),this.Ss=void 0,null==(e=this.xs)||e.discard()}Ps(){var t,e;null==(t=this.zr)||t.unregister(R),null==(e=this.zr)||e.unregister(w)}Rs(t,e){if(oe(t))return null;var i,r=ae(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ra.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Os(t){if(this.zr){var e,r,s=this.zr,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Rs(null==(e=this.Se.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Rs(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;oe(a)&&this.Ps();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ie(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.Ss)||e.call(this),this.Ss=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Os(t),void this.Ms()):(this.Os(t),void this.startIfEnabledOrStop()):(this.ks===Ta&&(this.ks=$a,Ra.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.xs)&&i.log?this.xs.log(t,e):Ra.warn("log called before recorder was ready")}get Es(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Ls(){var t,e,i=this._instance.get_property(b);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return Ra.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}Ts(t){var e,i;if(null==(e=kt.__PosthogExtensions__)||!e.initSessionRecording)return Ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[st]:!0});if(this.xs||(this.xs=null==(i=kt.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.xs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ls()){if(this.ks===$a||this.ks===Ta)return;return this.ks=Ta,Ra.info("persisted remote config is stale, requesting fresh config before starting"),void new On(this._instance).load()}this.ks=Sa,this.xs.start(t)}onRRwebEmit(t){var e;null==(e=this.xs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.xs||null==(e=this.zr)||e.register({[E]:!0}),null==(t=this.xs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.xs||null==(e=this.zr)||e.register({[x]:!0}),null==(t=this.xs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.xs||null==(i=this.zr)||i.register({["url"===t?S:T]:!0}),null==(e=this.xs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.xs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.xs)||!i.tryAddCustomEvent(t,e))}}},nl={autocapture:class{constructor(t){this.Fs=!1,this.As=null,this.$s=!1,this.instance=t,this.rageclicks=new ca(t.config.rageclick),this.Ds=null}initialize(){this.startIfEnabled()}get Se(){var t,e,i=te(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Ns(){if(this.isBrowserSupported()){if(gt&&bt){var t=t=>{t=t||(null==gt?void 0:gt.event);try{this.qs(t)}catch(t){fa.error("Failed to capture event",t)}};if(Or(bt,"submit",t,{capture:!0}),Or(bt,"change",t,{capture:!0}),Or(bt,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=t=>{t=t||(null==gt?void 0:gt.event);try{this.qs(t,pa)}catch(t){fa.error("Failed to capture copy/cut event",t)}};Or(bt,"copy",e,{capture:!0}),Or(bt,"cut",e,{capture:!0})}}}else fa.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Fs&&(this.Ns(),this.Fs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.$s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[d]:!!t.autocapture_opt_out}),this.As=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ds)||e.forEach((e=>{var r=null==bt?void 0:bt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[d];if(ne(this.As)&&!ue(i)&&!this.instance.mr())return!1;var r=null!==(e=this.As)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}qs(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=hs(t);rs(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&bs(r,this.instance.config.rageclick)&&this.qs(t,"$rageclick");var s=e===pa;if(r&&function(t,e,i,r,s,n){var o,a,l,u,h,d;if(void 0===i&&(i=void 0),!gt||ws(t))return!1;if(null!=(o=i)&&o.url_allowlist&&!os(i.url_allowlist,n))return!1;if(null!=(a=i)&&a.url_ignorelist&&os(i.url_ignorelist,n))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var v=i.dom_event_allowlist;if(v&&!v.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:c,targetElementList:p}=xs(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ie(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(p,i))return!1;if(!vs(p,null==(u=i)?void 0:u.css_selector_allowlist))return!1;if(vs(p,null!==(h=null==(d=i)?void 0:d.css_selector_ignorelist)&&void 0!==h?h:ps))return!1;try{var f=gt.getComputedStyle(t);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var _=t.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(ds.indexOf(_)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Se,s,s?["copy","cut"]:void 0,this.instance)){var{props:n,explicitNoCapture:o}=ma(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.$s,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===pa){var l,u=ls(null==gt||null==(l=gt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Zt(null==bt?void 0:bt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Bs=(null==gt||null==(e=gt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.js&&this.js(),this.js=void 0,yr.info("History API monitoring stopped")}monitorHistoryChanges(){gt&&gt.history&&(this.Hs("pushState"),this.Hs("replaceState"),this.Us())}Hs(t){var e;if(gt&&(null==(e=gt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Zt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]===s&&(t[e]=r)}}catch(t){return()=>{}}}(gt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.zs(t)}))}}zs(t){try{var e,i=null==gt||null==(e=gt.location)?void 0:e.pathname;if(!i)return;i!==this.Bs&&this.isEnabled&&this._instance.capture(ct,{navigation_type:t}),this.Bs=i}catch(e){yr.error("Error capturing "+t+" pageview",e)}}Us(){if(!this.js){var t=()=>{this.zs("popstate")};Or(gt,"popstate",t),this.js=()=>{gt&&gt.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.Vs=!1,this.Fs=!1,this.Ws=null,this.instance=t,this.Vs=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new ca(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return te(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return oe(this.Se.capture_heatmaps)?oe(this.Se.enable_heatmaps)?this.Vs:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Fs)return;Pa.info("starting..."),this.Gs(),this.ke()}else{var t;clearInterval(null!==(t=this.Ws)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:e}),this.Vs=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Qs(t){this.fe(t.originalEvent,"deadclick")}ke(){this.Ws&&clearInterval(this.Ws),this.Ws="visible"===(null==bt?void 0:bt.visibilityState)?setInterval(this.Lr.bind(this),this.flushIntervalMilliseconds):null}Gs(){gt&&bt&&(this.Js=this.Lr.bind(this),Or(gt,vt,this.Js),this.Ys=t=>this.fe(t||(null==gt?void 0:gt.event)),Or(bt,"click",this.Ys,{capture:!0}),this.Ks=t=>this.Xs(t||(null==gt?void 0:gt.event)),Or(bt,"mousemove",this.Ks,{capture:!0}),this.eo=new Us(this.instance,Ls,this.Qs.bind(this)),this.eo.startIfEnabledOrStop(),this.ro=this.ke.bind(this),Or(bt,dt,this.ro),this.Fs=!0)}Zs(){var t;gt&&bt&&(this.Js&&gt.removeEventListener(vt,this.Js),this.Ys&&bt.removeEventListener("click",this.Ys,{capture:!0}),this.Ks&&bt.removeEventListener("mousemove",this.Ks,{capture:!0}),this.ro&&bt.removeEventListener(dt,this.ro),clearTimeout(this.io),null==(t=this.eo)||t.stop(),this.Fs=!1)}no(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&es(r)&&!is(r,"body");){if(r===i)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:gt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Gt(e,s))return!0;r=cs(r)}return!1}(hs(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}fe(t,e){var r;if(void 0===e&&(e="click"),!ts(t.target)&&Oa(t)){var s=this.no(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&bs(hs(t),this.instance.config.rageclick)&&this.so(i({},s,{type:"rageclick"})),this.so(s)}}Xs(t){!ts(t.target)&&Oa(t)&&(clearTimeout(this.io),this.io=setTimeout((()=>{this.so(this.no(t,"mousemove"))}),500))}so(t){if(gt){var e=this.Se.disable_capture_url_hashes?ki(gt.location.href):gt.location.href,i=this.Se.custom_personal_data_properties,r=this.Se.mask_personal_data_properties?[...tn,...i||[]]:[],s=Qs(e,r,rn);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}Lr(){this.R&&!ee(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Us,webVitalsAutocapture:class{constructor(t){var e;this.Vs=!1,this.Fs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.oo=()=>{clearTimeout(this.ao),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lo=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.uo();if(!ie(r))if(oe(null==t?void 0:t.name)||oe(null==t?void 0:t.value))wa.error("Invalid metric received",t);else if(!this.ho||this.ho>t.value){this.R.url!==r&&(this.oo(),this.ao=setTimeout(this.oo,this.flushToCaptureTimeoutMs)),ie(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=ie(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var s=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),n=i({},t,{$current_url:r,timestamp:Date.now()});ie(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.oo()}else wa.error("Ignoring metric with value >= "+this.ho,t)},this.do=()=>{if(!this.Fs){var t,e,i,r,s=kt.__PosthogExtensions__;ie(s)||ie(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.lo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.lo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.lo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.lo.bind(this)),this.Fs=!0):wa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Vs=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get co(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=te(this.co)?null==(t=this.co)?void 0:t.web_vitals_allowed_metrics:void 0;return oe(i)?(null==(e=this._instance.persistence)?void 0:e.props[y])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(te(this.co)?this.co.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=te(this.co)?this.co.web_vitals_attribution:void 0;return null!=t&&t}get ho(){var t=te(this.co)&&ae(this.co.__web_vitals_max_value)?this.co.__web_vitals_max_value:xa;return t>0&&6e4>=t?xa:t}get isEnabled(){var t=null==wt?void 0:wt.protocol;if("http:"!==t&&"https:"!==t)return wa.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=te(this.co)?this.co.web_vitals:ue(this.co)?this.co:void 0;return ue(e)?e:this.Vs}startIfEnabled(){this.isEnabled&&!this.Fs&&(wa.info("enabled, starting..."),this.Mt(this.do))}onRemoteConfig(t){if("capturePerformance"in t){var e=te(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=te(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:e}),this._instance.persistence.register({[y]:i})),this.Vs=e,this.startIfEnabled()}}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?wa.error("failed to load script",e):t()}))}uo(){var t=gt?this._instance.config.disable_capture_url_hashes?ki(gt.location.href):gt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...tn,...e||[]]:[];return Qs(t,i,rn)}wa.error("Could not determine current URL")}}},ol={exceptionObserver:class{constructor(t){var e,i,r;this.do=()=>{var t;if(gt&&this.isEnabled&&null!=(t=kt.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=kt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=kt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=kt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.vo&&this.Se.capture_unhandled_errors&&(this.vo=e(this.captureException.bind(this))),!this.fo&&this.Se.capture_unhandled_rejections&&(this.fo=i(this.captureException.bind(this))),!this.po&&this.Se.capture_console_errors&&(this.po=r(this.captureException.bind(this)))}catch(t){ya.error("failed to start",t),this.mo()}}},this._instance=t,this.yo=!(null==(e=this._instance.persistence)||!e.props[c]),this.bo=new be({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Ae:ya}),this.Se=this._o(),this.startIfEnabledOrStop()}_o(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return te(t)?e=i({},e,t):(ie(t)?this.yo:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ya.info("enabled"),this.mo(),this.Mt(this.do)):this.mo()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ya.error("failed to load script",e);t()}))}mo(){var t,e,i;null==(t=this.vo)||t.call(this),this.vo=void 0,null==(e=this.fo)||e.call(this),this.fo=void 0,null==(i=this.po)||i.call(this),this.po=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.yo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.yo}),this.Se=this._o(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this._o()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.bo.consumeRateLimit(s)?ya.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.wo=[],this.xo=new zi([new tr,new hr,new ir,new er,new lr,new ar,new sr,new ur],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Zi.test(l)?l.replace(Zi,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||Hi});var r}))}(n)}}("web:javascript",Ki,Xi)),this._instance=t,this.wo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(p))&&void 0!==e?e:[],this.ko=fr(this.So()),this.Co=new _r(this.ko)}onConfigChange(){this.ko=fr(this.So()),this.Co.setConfig(this.ko)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.wo=s,this._instance.persistence&&this._instance.persistence.register({[p]:this.wo,[f]:n})}}get Io(){var t,e=!!this._instance.get_property(f),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.xo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ko.enabled)try{if(!re(t)||0===t.trim().length)return void Ja.warn("Ignoring exception step because message must be a non-empty string");var r=this.To(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>cr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ja.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Co.add(i({[dr]:t,[vr]:(new Date).toISOString()},s))}catch(t){Ja.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Eo(e)){if(this.Mo(e))return this.Po("Exception dropped: matched a suppression rule"),void Ja.info("Skipping exception capture because a suppression rule matched");if(!this.Io&&this.Ro(e))return this.Po("Exception dropped: thrown by a browser extension"),void Ja.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Oo(e))return this.Po("Exception dropped: thrown by the PostHog SDK"),void Ja.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ko.enabled&&oe(t.$exception_steps)?this.Lo(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Zi:!0});return r&&this.Co.clear(),r}catch(t){return Ja.error("Failed to capture exception event. Dropping this exception.",t),void this.Co.clear()}}catch(t){return void Ja.error("Failed to process exception event. Ignoring this exception.",t)}}Lo(t){try{var e=this.Co.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ja.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Po(t){this.ko.enabled&&this.Co.add({[dr]:t,[vr]:(new Date).toISOString()})}To(t){return te(t)?i({},t):{}}So(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Mo(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return re(i)&&i.length>0&&t.$exception_types.push(i),re(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.wo.some((t=>{var i=t.values.map((t=>{var i,r=Lo[t.operator],s=Xt(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}Ro(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Oo(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Eo(t){return!oe(t)&&Xt(t)}}},al=i({productTours:class{get zr(){return this._instance.persistence}constructor(t){this.Fo=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.zr&&this.zr.register({[m]:!!t.productTours}),!Ca(this._instance))return!this.Fo&&oe(null==(e=this.zr)?void 0:e.props[z])||Ia.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Fo)||i.stop(),this.Fo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Fo&&Ca(this._instance)&&this.Mt((()=>this.$o()))}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ia.error("Could not load product tours script",e):t()}))}$o(){var t;!this.Fo&&null!=(t=kt.__PosthogExtensions__)&&t.generateProductTours&&(this.Fo=kt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Xt(this.Ao)||e){var i=this.zr;if(i){var r=i.props[z];if(Xt(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{if(Ca(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ia.error(s),void t([],{isLoaded:!1,error:s})}var n=Xt(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[z]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){oe(this.Fo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fo.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Fo)||e.showTourById(t)}previewTour(t){this.Fo?this.Fo.previewTour(t):this.Mt((()=>{var e;this.$o(),null==(e=this.Fo)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Fo)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Fo)||t.nextStep()}previousStep(){var t;null==(t=this.Fo)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.zr)||t.unregister(z)}resetTour(t){var e;null==(e=this.Fo)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Fo)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Fo)||e.cancelPendingTour(t)}}},rl),ll={siteApps:class{constructor(t){this.Do=0,this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=kt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.qo.bind(this));this.Bo=()=>{t(),this.No=[],this.Bo=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,p]of Object.entries(v))h[c]={id:d[c],type:c,properties:p};var{$set_once:f,$set:_}=t;return{event:i({},r(t,Aa),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},f?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},f)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}jo(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Fa.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Fa.error("prepare_external_dependency_script returned null"),null):t}Ho(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==bt?void 0:bt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Do++,this.Uo)return this.zo();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},p=t=>{if(v.has(t))return t;var e=d.jo(t);return e&&v.add(e),e},f=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!ne(t)));return c(u,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,f(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=f(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.Uo=()=>{h.forEach((t=>t())),this.Uo=void 0},this.zo()}zo(){var t=!1;return()=>{var e;t||(t=!0,this.Do--,0===this.Do&&(null==(e=this.Uo)||e.call(this)))}}Vo(t,e){void 0===e&&(e=!0);var i=this.Ho();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(Fa.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>this.Vo((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Bo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Fa.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Vo((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){Fa.error(Ma+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Fa.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Wo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Go(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Vo((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Fa.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Wo(),void this._instance.on("eventCaptured",(t=>this.Go(t)))):void Fa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Bo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;kt["__$$ph_site_app_"+t]=s._instance,null==(e=kt.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Fa.error(Ma+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Fa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ul={tracingHeaders:class{constructor(t){this.Zo=void 0,this.Qo=void 0,this.Jo=void 0,this.do=()=>{var t,e,i=this.Yo();i?(ie(this.Zo)&&(this.Zo=null==(t=kt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ie(this.Qo)&&(this.Qo=null==(e=kt.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mo()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Mt(t){var e,i;null!=(e=kt.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=kt.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return ba.error("failed to load script",e);t()}))}Ko(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Yo(){var t=this.Ko();return Xt(t)?(Xt(this.Jo)?this.Jo.splice(0,this.Jo.length,...t):this.Jo=[...t],t.length>0?this.Jo:void 0):(Xt(this.Jo)&&this.Jo.splice(0),this.Jo=t||void 0,this.Jo)}mo(){var t,e;null==(t=this.Zo)||t.call(this),null==(e=this.Qo)||e.call(this),this.Zo=void 0,this.Qo=void 0}startIfEnabledOrStop(){this.Yo()?this.Mt(this.do):this.mo()}}},hl=i({surveys:class{get Se(){return this._instance.config}constructor(t){this.Xo=void 0,this._surveyManager=null,this.ea=!1,this.ta=[],this.ra=null,this.ia=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(oe(e))return qo.warn("Flags not loaded yet. Not loading surveys.");var i=Xt(e);this.Xo=i?e.length>0:e,qo.info("flags response received, isSurveysEnabled: "+this.Xo),this.loadIfEnabled()}}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(Vo)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.ea)qo.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)qo.info(Ba);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())qo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==kt?void 0:kt.__PosthogExtensions__;if(t){if(!ie(this.Xo)||this.Se.advanced_enable_surveys){var e=this.Xo||this.Se.advanced_enable_surveys;this.ea=!0;try{var i=t.generateSurveys;if(i)return void this.na(i,e);var r=t.loadExternalDependency;if(!r)return void this.sa(nt);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.sa("Could not load surveys script",i):this.na(t.generateSurveys,e)}))}catch(t){throw this.sa("Error initializing surveys",t),t}finally{this.ea=!1}}}else qo.error("PostHog Extensions not found.")}}na(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ua(this._instance),qo.info("Surveys loaded successfully"),this.oa({isLoaded:!0})}sa(t,e){qo.error(t,e),this.oa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ta.push(t),this._surveyManager&&this.oa({isLoaded:!0}),()=>{this.ta=this.ta.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Se.disable_surveys)return qo.info(Ba),t([]);var i,r=this._instance.get_property(U);if(r&&!e)return t(r,{isLoaded:!0}),void(this.aa()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this.ra?this.ra.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.ra=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:e=>{var r;this.ra=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;qo.error(n),this.ia=Date.now();var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.ia=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[U]:l,[j]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}aa(){return this.la()&&!this.ra&&!this.ua()}la(){var t=this._instance.get_property(j);return ae(t)&&Date.now()-t>3e5}ua(){return ae(this.ia)&&3e5>Date.now()-this.ia}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Go(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}oa(t){for(var e of this.ta)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){qo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!oe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);qo.warn("init was not called")}ha(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}da(t){if(oe(this._surveyManager))return{eligible:!1,reason:ja};var e="string"==typeof t?this.ha(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(oe(this._surveyManager))return qo.warn("init was not called"),{visible:!1,disabledReason:ja};var e=this.da(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return oe(this._surveyManager)?(qo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ja})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.da(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(oe(this._surveyManager))qo.warn("init was not called");else{var s="string"==typeof t?this.ha(t):t;if(null!=s&&s.id)if(Wo.includes(s.type)){var n=null==bt?void 0:bt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(qo.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;qo.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),qo.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);qo.warn("Survey element not found")}else qo.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qo.warn("Survey not found")}}displaySurvey(t,e){var r;if(oe(this._surveyManager))qo.warn("init was not called");else{var s=this.ha(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Sn.Popover&&e.initialResponses&&qo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void qo.warn("Survey is not eligible to be displayed: ",o.disabledReason)}e.displayType!==Sn.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else qo.warn("Survey not found")}}cancelPendingSurvey(t){oe(this._surveyManager)?qo.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},rl),dl={toolbar:class{constructor(t){this.instance=t}ca(t){kt.ph_toolbar_state=t}va(){var t;return null!==(t=kt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ir(this.instance.config))return!1;if(!gt||!bt)return!1;t=null!=t?t:gt.location,i=null!=i?i:gt.history;try{if(!e){try{gt.localStorage.setItem("test","test"),gt.localStorage.removeItem("test")}catch(t){return!1}e=null==gt?void 0:gt.localStorage}var r,s=za||Xs(t.hash,"__posthog")||Xs(t.hash,"state"),n=s?Tr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Tr((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ha)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}fa(t){var e=kt.ph_load_toolbar||kt.ph_load_editor;!oe(e)&&Zt(e)?e(t,this.instance):qa.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==bt||!bt.getElementById(tt));if(!gt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(gt.localStorage.setItem(Ha,JSON.stringify(i({},s,{source:void 0}))),2===this.va())this.fa(s);else if(0===this.va()){var n;this.ca(1),null==(n=kt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return qa.error("[Toolbar] Failed to load",t),void this.ca(0);this.ca(2),this.fa(s)})),Or(gt,"turbolinks:load",(()=>{this.ca(0),this.loadToolbar(s)}))}return!0}pa(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},vl=i({experiments:Za},rl),cl=i({},rl,sl,nl,ol,al,ll,hl,ul,dl,vl,{conversations:class{constructor(t){this.ga=void 0,this._conversationsManager=null,this.ma=!1,this.ya=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;oe(e)||(ue(e)?this.ga=e:(this.ga=e.enabled,this.ya=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ga=void 0,this.ya=null}loadIfEnabled(){if(!(this._conversationsManager||this.ma||this._instance.config.disable_conversations||Ir(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==kt?void 0:kt.__PosthogExtensions__;if(t&&!ie(this.ga)&&this.ga)if(this.ya&&this.ya.token){this.ma=!0;try{var e=t.initConversations;if(e)return this.ba(e),void(this.ma=!1);var i=t.loadExternalDependency;if(!i)return void this._a(nt);i(this._instance,"conversations",(e=>{e||!t.initConversations?this._a("Could not load conversations script",e):this.ba(t.initConversations),this.ma=!1}))}catch(t){this._a("Error initializing conversations",t),this.ma=!1}}else tl.error("Conversations enabled but missing token in remote config.")}}ba(t){if(this.ya)try{this._conversationsManager=t(this.ya,this._instance),tl.info("Conversations loaded successfully")}catch(t){this._a("Error completing conversations initialization",t)}else tl.error("Cannot complete initialization: remote config is null")}_a(t,e){tl.error(t,e),this._conversationsManager=null,this.ma=!1}show(){this._conversationsManager?this._conversationsManager.show():tl.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ga&&!ne(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(tl.warn(el),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(tl.warn(el),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(tl.warn(el),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(tl.warn(el),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(tl.warn(el),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(tl.warn(el),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(tl.warn(el),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}en(){var t;null==(t=this._conversationsManager)||t.setIdentity()}tn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var e;this.wa=!1,this.xa=!1,this.Ae=br("[logs]"),this._r=[],this.ka=[],this.Sa=()=>{var t,e;null==(t=this.Ca)||t.onReconnect(),null==(e=this.Ia)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.wa=!0),gt&&Or(gt,"online",this.Sa)}Ta(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ie(d)?Math.max(h,2048):Math.max(h,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new Li(this.Ea(t,e),n,this.Ae,(()=>this.Ma()),(t=>t()),void 0,r),n]}Pa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.Ca&&this.Ra===i||(null==(e=this.Ca)||e.reset(),this.Ra=i,[this.Ca,this.Oa]=this.Ta((()=>this._r),(t=>{this._r=t}))),this.Ca}La(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.Ia&&this.Fa===i||(null==(e=this.Ia)||e.reset(),this.Fa=i,[this.Ia,this.Aa]=this.Ta((()=>this.ka),(t=>{this.ka=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},il)),this.Ia}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!oe(i)&&i&&(this.wa=!0,this.loadIfEnabled())}reset(){var t,e;this._r=[],null==(t=this.Ca)||t.reset(),this.ka=[],null==(e=this.Ia)||e.reset()}captureLog(t){this.Pa().captureLog(t)}le(t){this.La().captureLog(t)}get logger(){return this.$a||(this.$a={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.$a}flushLogs(t){t?this.Da(t):(this.Ca&&this.Ca.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.Ia&&this.Ia.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.wa&&!this.xa){var t=null==kt?void 0:kt.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ae.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.xa=!0)})):this.Ae.error(nt)}else this.Ae.error("PostHog Extensions not found.")}}Ea(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===At.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===At.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},ht:t=>this.ht(t),getLibraryId:()=>n.LIB_NAME,getLibraryVersion:()=>n.LIB_VERSION}}ht(t){return new Promise((e=>{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Na(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}))}Da(t){this._r.length>0&&this.qa(t,this._r,this.Oa,n.LIB_NAME,(t=>{this._r=t})),this.ka.length>0&&this.qa(t,this.ka,this.Aa,il,(t=>{this.ka=t}))}qa(t,e,i,r,s){if(0!==e.length){var o=e.map((t=>t.record));s([]);var a=Di(o,Mi(i,n.LIB_NAME,n.LIB_VERSION),r,n.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Na(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Na(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Ma(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=r,oe(s)||(e.sessionStartTimestamp=s),oe(n)||(e.lastActivityTimestamp=n)}if(null!=kt&&null!=(t=kt.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?ki(kt.location.href):kt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}});va.__defaultExtensionClasses=i({},cl);var pl=br("[ExternalScriptsLoader]"),fl=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return pl.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==bt?void 0:bt.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===e){var t=r[o];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!bt)return i("document not found");var r=bt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)bt.head.appendChild(r);else{var s,n=bt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):bt.body.appendChild(r)}};null!=bt&&bt.body?a():null==bt||bt.addEventListener("DOMContentLoaded",a)};kt.__PosthogExtensions__=kt.__PosthogExtensions__||{},kt.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}fl(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");fl(t,o,i)}},kt.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);fl(t,r,i)};var _l=function(){n.SDK_DIST_CHANNEL="npm";var t=Zo[oa]=new va;return function(){function t(){t.done||(t.done=!0,aa=!1,xr(Zo,(function(t){t._dom_loaded()})))}null!=bt&&bt.addEventListener?"complete"===bt.readyState?t():Or(bt,"DOMContentLoaded",t,{capture:!1}):gt&&yr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=In,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Sn,exports.PostHog=va,exports.ProductTourEventName=Tn,exports.ProductTourEventProperties=$n,exports.SurveyEventName=xn,exports.SurveyEventProperties=En,exports.SurveyEventType=yn,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule=wn,exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=bn,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=_l,exports.posthog=_l,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map