posthog-js 1.407.7 → 1.407.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={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.407.7",s.LIB_NAME="web";var n="$people_distinct_id",o="$device_id",a="$device_model",l="__alias",u="__timers",h="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",g="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",E="$replay_override_url_trigger",S="$replay_override_event_trigger",k="$sesid",T="$session_is_sampled",R="$enabled_feature_flags",P="$active_feature_flags",O="$early_access_features",I="$feature_flag_details",C="$feature_flag_payloads",M="$feature_flag_request_id",A="$minimal_flag_called_events",F="$override_feature_flags",D="$override_feature_flag_payloads",N="$stored_person_properties",U="$stored_group_properties",L="$surveys",j="$surveys_loaded_at",B="$surveys_activated",z="$surveys_activated_session",H="ph_product_tours",q="$flag_call_reported",V="$flag_call_reported_session_id",G="$feature_flag_errors",W="$feature_flag_evaluated_at",J="$user_state",K="$client_session_props",Y="$capture_rate_limit",Q="$initial_campaign_params",X="$initial_referrer_info",Z="$initial_person_info",tt="$epp",et="$posthog_cookieless",it="$cookieless_mode",rt="$sdk_debug_extensions_init_method",st="$sdk_debug_extensions_init_time_ms",nt="$sdk_debug_recording_script_not_loaded",ot="PostHog loadExternalDependency extension not found.",at="on_reject",lt="always",ut="anonymous",ht="identified",dt="identified_only",vt="visibilitychange",ct="beforeunload",ft="$pageview",pt="$pageleave",_t="$identify",gt="$groupidentify",mt="undefined"!=typeof window?window:void 0,bt="undefined"!=typeof globalThis?globalThis:mt,yt=null==bt?void 0:bt.navigator,wt=null==bt?void 0:bt.document,xt=null==bt?void 0:bt.location,Et=null==bt?void 0:bt.fetch,St=null!=bt&&bt.XMLHttpRequest&&"withCredentials"in new bt.XMLHttpRequest?bt.XMLHttpRequest:void 0,$t=null==bt?void 0:bt.AbortController,kt=null==bt?void 0:bt.CompressionStream,Tt=null==yt?void 0:yt.userAgent;function Rt(){return!(!mt||!1===mt.navigator.onLine)}var Pt="undefined"!=typeof globalThis?globalThis:mt;Pt&&"undefined"==typeof self&&(Pt.self=Pt),Pt&&"undefined"==typeof File&&(Pt.File=function(){});var Ot=null!=mt?mt:{},It=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Ct(t){return"string"==typeof t||t}function Mt(t){return"string"==typeof t?t:void 0}var At,Ft=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Dt=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Nt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Ut=["$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"],Lt=["token"],jt="NativeGzipValidationError",Bt=t=>t.length>=2&&31===t[0]&&139===t[1],zt=(t,e)=>t===Nt.GZipJS||e===Nt.GZipJS||"gzip"===e,Ht=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),qt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=jt,e},Vt=function(){var t=e((function*(t,e){18>t.size&&qt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Bt(i)&&8===i[2]||qt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(At)return At;At=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;At[t]=e>>>0}return At})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&qt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&qt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Gt(){return Gt=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.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]))[0];return yield Vt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Gt.apply(this,arguments)}var Wt=["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"],Jt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Wt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Kt(t,e){return-1!==t.indexOf(e)}var Yt=function(t){return t.trim()},Qt=function(t){return t.replace(/^\$/,"")};function Xt(t){var e,i=[];return null!==(e=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(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var Zt=Object.prototype,te=Zt.hasOwnProperty,ee=Zt.toString,ie=Array.isArray||function(t){return"[object Array]"===ee.call(t)},re=t=>"function"==typeof t,se=t=>t===Object(t)&&!ie(t),ne=t=>{if(se(t)){for(var e in t)if(te.call(t,e))return!1;return!0}return!1},oe=t=>void 0===t,ae=t=>"[object String]"==ee.call(t),le=t=>ae(t)&&0===t.trim().length,ue=t=>null===t,he=t=>oe(t)||ue(t),de=t=>"[object Number]"==ee.call(t)&&t==t,ve=t=>de(t)&&t>0,ce=t=>"[object Boolean]"===ee.call(t),fe=t=>t instanceof FormData,pe=t=>Kt(Ut,t),_e=t=>Kt(Lt,t);function ge(t){return null===t||"object"!=typeof t}function me(t,e){return{}.toString.call(t)==="[object "+e+"]"}function be(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var ye=[!0,"true",1,"1","yes"],we=t=>Kt(ye,t),xe=[!1,"false",0,"0","no"];function Ee(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),de(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),Ee(s||i,e,i,r))}class Se{constructor(t){this.$e={},this.ze=t.ze,this.Ze=Ee(t.bucketSize,0,100,t.Ge),this.Qe=Ee(t.refillRate,0,this.Ze,t.Ge),this.Je=Ee(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var i=Math.floor((e-t.lastAccess)/this.Je);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qe,this.Ze),t.lastAccess=t.lastAccess+i*this.Je)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$e[r];return s?this.Ke(s,i):this.$e[r]=s={tokens:this.Ze,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.ze)||e.call(this,t)),0===s.tokens)}stop(){this.$e={}}}var $e="Mobile",ke="iOS",Te="Android",Re="Tablet",Pe=Te+" "+Re,Oe="iPad",Ie="Apple",Ce=Ie+" Watch",Me="Safari",Ae="BlackBerry",Fe="Samsung",De=Fe+"Browser",Ne=Fe+" Internet",Ue="Chrome",Le=Ue+" OS",je=Ue+" "+ke,Be="Internet Explorer",ze=Be+" "+$e,He="Opera",qe=He+" Mini",Ve="Edge",Ge="Microsoft "+Ve,We="Firefox",Je=We+" "+ke,Ke="Nintendo",Ye="PlayStation",Qe="Xbox",Xe=Te+" "+$e,Ze=$e+" "+Me,ti="Windows",ei=ti+" Phone",ii="Nokia",ri="Ouya",si="Generic",ni=si+" "+$e.toLowerCase(),oi=si+" "+Re.toLowerCase(),ai="Konqueror",li="Oculus Browser",ui="Vivaldi",hi="Yandex",di="Whale",vi="DuckDuckGo",ci="Pale Moon",fi="Waterfox",pi="Brave",_i="Google Search App",gi="(\\d+(\\.\\d+)?)",mi=new RegExp("Version/"+gi),bi=new RegExp(Qe,"i"),yi=new RegExp(Ye+" \\w+","i"),wi=new RegExp(Ke+" \\w+","i"),xi=new RegExp(Ae+"|PlayBook|BB10","i"),Ei={"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"},Si=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?pi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Kt(t,"GSA/")?_i:Kt(t," OPR/")&&Kt(t,"Mini")?qe:Kt(t," OPR/")?He:xi.test(t)?Ae:Kt(t,"IE"+$e)||Kt(t,"WPDesktop")?ze:Kt(t,"OculusBrowser")?li:Kt(t,De)?Ne:Kt(t,Ve)||Kt(t,"Edg/")?Ge:Kt(t,ui+"/")?ui:Kt(t,"YaBrowser/")?hi:Kt(t,di+"/")?di:Kt(t,vi+"/")||Kt(t,"Ddg/")?vi:Kt(t,"FBIOS")?"Facebook "+$e:Kt(t,"UCWEB")||Kt(t,"UCBrowser")?"UC Browser":Kt(t,"CriOS")?je:Kt(t,"CrMo")||Kt(t,Ue)?Ue:Kt(t,Te)&&Kt(t,Me)?Xe:Kt(t,"FxiOS")?Je:Kt(t.toLowerCase(),ai.toLowerCase())?ai:Kt(t,pi+"/")?pi:((t,e)=>e&&Kt(e,Ie)||function(t){return Kt(t,Me)&&!Kt(t,Ue)&&!Kt(t,Te)}(t))(t,e)?Kt(t,$e)?Ze:Me:Kt(t,"PaleMoon/")?ci:Kt(t,fi+"/")?fi:Kt(t,We)?We:Kt(t,"MSIE")||Kt(t,"Trident/")?Be:Kt(t,"Gecko")?We:"")},$i={[ze]:[new RegExp("rv:"+gi)],[Ge]:[new RegExp(Ve+"?\\/"+gi)],[Ue]:[new RegExp("("+Ue+"|CrMo)\\/"+gi)],[je]:[new RegExp("CriOS\\/"+gi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+gi)],[Me]:[mi],[Ze]:[mi],[He]:[new RegExp("(Opera|OPR)\\/"+gi)],[We]:[new RegExp(We+"\\/"+gi)],[Je]:[new RegExp("FxiOS\\/"+gi)],[ai]:[new RegExp("Konqueror[:/]?"+gi,"i")],[Ae]:[new RegExp(Ae+" "+gi),mi],[Xe]:[new RegExp("android\\s"+gi,"i")],[Ne]:[new RegExp(De+"\\/"+gi)],[li]:[new RegExp("OculusBrowser\\/"+gi)],[ui]:[new RegExp(ui+"\\/"+gi)],[hi]:[new RegExp("YaBrowser\\/"+gi)],[di]:[new RegExp(di+"\\/"+gi)],[pi]:[new RegExp(pi+"\\/"+gi)],[vi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+gi)],[ci]:[new RegExp("PaleMoon\\/"+gi)],[fi]:[new RegExp(fi+"\\/"+gi)],[_i]:[new RegExp("GSA\\/"+gi)],[Be]:[new RegExp("(rv:|MSIE )"+gi)],Mozilla:[new RegExp("rv:"+gi)]},ki=function(t,e,i,r){var s=Si(t,e,i,r),n=$i[s];if(oe(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},Ti=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),t=>[Qe,t&&t[1]||""]],[new RegExp(Ke,"i"),[Ke,""]],[new RegExp(Ye,"i"),[Ye,""]],[xi,[Ae,""]],[new RegExp(ti,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ei,""];if(new RegExp($e).test(e)&&!/IEMobile\b/.test(e))return[ti+" "+$e,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ei[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ti,r]}return[ti,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ke,[t[3],t[4],t[5]||"0"].join(".")]:[ke,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=oe(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Te+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Te+")","i"),t=>t&&t[2]?[Te,[t[2],t[3],t[4]||"0"].join(".")]:[Te,""]],[/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/,[Le,""]],[/Linux|debian/i,["Linux",""]]],Ri=function(t){return wi.test(t)?Ke:yi.test(t)?Ye:bi.test(t)?Qe:new RegExp(ri,"i").test(t)?ri:new RegExp("("+ei+"|WPDesktop)","i").test(t)?ei:/iPad/.test(t)?Oe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ce:xi.test(t)?Ae:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ii,"i").test(t)?ii:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp($e).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Te:Pe:new RegExp("(pda|"+$e+")","i").test(t)?ni:new RegExp(Re,"i").test(t)&&!new RegExp(Re+" pc","i").test(t)?oi:""},Pi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Oi(t,e){return"string"==typeof(i=t)&&Pi.test(i)?t:e();var i}function Ii(t){return t?t.split("#")[0]:t}function Ci(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var Mi=t=>t instanceof Error,Ai={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}},Fi=Ai.info;function Di(t){if(ce(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(ie(t))return{arrayValue:{values:t.map((t=>Di(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ni(t){var e=[];for(var i in t){var r=t[i];ue(r)||oe(r)||e.push({key:i,value:Di(r)})}return e}function Ui(t,e){var r=Ai[t.level||"info"]||Fi,s=r.text,n=r.number,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),he(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),he(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:Ni(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),oe(t.trace_flags)||(u.flags=t.trace_flags),u}function Li(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 ji(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ni(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Bi=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=i,this.Ye=r,this.Xe=s,this.et=n,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.wt(t);if(null!==e)if(e.body){if(this.xt()){var i={record:Ui(e,this.Ye())};this.Xe((()=>this.kt(i)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var i=ie(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ge.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ge.error("Error in beforeSend function for log:",t),null}return r}xt(){if(void 0===this.yt)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return e((function*(){var e;t.bt();var i=null!==(e=t._instance.getPersistedProperty(Dt.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.it=0;var a=Math.min(i.length,t.vt),l=i.slice(0,a),u=ji(l.map((t=>t.record)),t.Ct(),null!==(n=t.tt)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.Tt(u);if("too-large"===h.kind&&l.length>1)t.vt=Math.max(1,Math.floor(l.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.vt);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ge.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.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(l.length),i=null!==(o=t._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}It(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.it),s=null!==(e=i._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Dt.LogsQueue,s.slice(r)),yield i.et()}))()}Ct(){return Li(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==e?e:[];this.dt>i.length||(i.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Dt.LogsQueue,i),this.ht>i.length?this.Mt():this._t()}}Mt(t){void 0===t&&(t=this.ct),this.Et||(this.Et=Ci((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(Dt.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.bt();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ci(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ci((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}};var zi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Hi(t){return String(t)+"000000"}function qi(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let Vi=class{constructor(t,e,i){this._instance=t,this.Te=e,this.Ge=i,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,i){void 0===e&&(e=1),this.Nt({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Nt({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Nt({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.rt,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.Dt()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.rt===s&&(this.rt=null)}));return this.rt=s,s}drainWindow(){if(0===this.Ot.size)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=qi(e.type,e.name,e.unit,r)}catch(t){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Ot.get(s);if(!n){if(!this.jt())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(s,n)}var o=this.Lt.get(e.name);void 0===o?this.Lt.set(e.name,e.type):o===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(n,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(zi.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,zi)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var i=ie(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ge.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.Ge.error("Error in beforeSend function for metric:",t),null}return r}Mt(){this.Et||(this.Et=Ci((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return e((function*(){if(0!==t.Ot.size){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var i=t.At,r=yield t._instance.Bt(t.qt(e));if(i===t.At)switch(r.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",r.error)}}}))()}qt(t){return e=this.zt(t),r=function(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})}(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ni(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}zt(t){var e=Hi(Date.now()),r=new Map;for(var s of t.values()){var n,o=qi(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=Ni(null!==(n=s.attributes)&&void 0!==n?n:{}),u=Hi(s.windowStartMs);if("count"===s.type){var h,d={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(h=s.total)&&void 0!==h?h:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:zi})}return Array.from(r.values())}Ut(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.Ot.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.jt()&&this.Ot.set(s,n)}}};var Gi,Wi,Ji;function Ki(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Ji&&i.length===Wi||(Wi=i.length,Ji=i.reduce(((i,r)=>{Gi||(Gi={});var s=Gi[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,Gi[r]=[l,u];break}}return i}),{})),Ji}}class Yi{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&&ie(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:Ki(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 Qi="?";function Xi(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Qi:i,in_app:!0};return oe(r)||(n.lineno=r),oe(s)||(n.colno=s),n}var Zi=(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]:Qi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},tr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,er=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ir=/\((\S*)(?::(\d+))(?::(\d+))\)/,rr=(t,e)=>{var i=tr.exec(t);if(i)return Xi(e,i[1],Qi,+i[2],+i[3]);var r=er.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ir.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Zi(r[1]||Qi,r[2]);return Xi(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},sr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,or=(t,e)=>{var i=sr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=nr.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]||Qi,o=Zi(n,s);return Xi(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ar=/\(error: (.*)\)/;class lr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=ae(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 me(t,"DOMException")}isDOMError(t){return me(t,"DOMError")}}class ur{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 hr{constructor(){}match(t){return me(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 dr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class vr{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(dr);return r&&(e=r[1],i=r[2]),[e,i]}}var cr=["fatal","error","warning","log","info","debug"];function fr(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 pr{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 be(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: "+fr(t)}isSeverityLevel(t){return ae(t)&&!le(t)&&cr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Mi(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class _r{match(t){return be(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+fr(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class gr{match(t){return ge(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 mr{match(t){return me(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!be(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 ge(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 br="$message",yr="$timestamp",wr=new Set([br,yr]),xr={enabled:!0,max_bytes:32768};function Er(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:xr.enabled,max_bytes:$r(t.max_bytes,xr.max_bytes)}:i({},xr)}class Sr{constructor(t){this.Vt=[],this.Wt=0,this.Te=Er(t)}setConfig(t){this.Te=Er(t),this.Zt()}add(t){var e=function(t){var e;try{e=Xt(t)}catch(t){return}try{var i=JSON.parse(e);if(!se(i))return;var r=i,s=r[br],n=r[yr];if(!ae(s)||0===s.trim().length)return;if(!ae(n)&&!de(n))return;return{step:r,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.Te.max_bytes||(this.Vt.push({step:e.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((t=>t.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var t=this.Vt.shift();t&&(this.Wt-=t.bytes)}}}function $r(t,e){if(!de(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var kr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={k(e){if(mt&&(s.DEBUG||mt.POSTHOG_DEBUG||i)&&!oe(mt.console)&&mt.console){for(var r=("__rrweb_original__"in mt.console[e]?mt.console[e].__rrweb_original__:mt.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>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)=>kr(t+" "+e,i)};return r},Tr=kr("[PostHog.js]"),Rr=Tr.createLogger;function Pr(t,e){ie(t)&&t.forEach(e)}function Or(t,e){if(!he(t))if(ie(t))t.forEach(e);else if(fe(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)te.call(t,i)&&e(t[i],i)}var Ir=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 Cr(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 Mr=function(t){try{return t()}catch(t){return}},Ar=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){Tr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Tr.critical(t)}}},Fr=function(t){var e={};return Or(t,(function(t,i){(ae(t)&&t.length>0||de(t))&&(e[i]=t)})),e};var Dr=["herokuapp.com","vercel.app","netlify.app"];function Nr(t){var e=null==t?void 0:t.hostname;if(!ae(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Dr)if(i===r)return!1;return!0}function Ur(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function Lr(t){return"ph_toolbar_internal"===t.name}var jr=t=>{if(wt){try{for(var e=t+"=",i=wt.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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return de(t)&&isFinite(t)&&Math.floor(t)===t});class Br{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/256,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 Br(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 Br(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 zr{generate(){var t=this.generateOrAbort();if(!oe(t))return t;this.S=0;var e=this.generateOrAbort();if(oe(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Br.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new Vr}}var Hr,qr=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};mt&&!oe(mt.crypto)&&crypto.getRandomValues&&(qr=t=>crypto.getRandomValues(t));class Vr{nextUint32(){return this.R.length>this.O||(qr(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Gr=()=>Wr().toString(),Wr=()=>(Hr||(Hr=new zr)).generate(),Jr="",Kr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Yr={N:()=>!!wt,D(t){Tr.error("cookieStore error: "+t)},A:jr,F(t){var e;try{e=JSON.parse(Yr.A(t))||{}}catch(t){}return e},q(t,e,i,r,s){if(!wt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=wt),Jr)return Jr;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_"+Gr();!Jr&&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",Jr=n)}return Jr}(t);if(!i){var r=(t=>{var e=t.match(Kr);return e?e[0]:""})(t);r!==i&&Tr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(wt.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&&Tr.warn("cookieStore warning: large cookie, len="+u.length),wt.cookie=u,!0}catch(t){return!1}},P(t,e){if(null!=wt&&wt.cookie)try{Yr.q(t,"",-1,e)}catch(t){return}}},Qr=null,Xr={N(){if(!ue(Qr))return Qr;var t=!0;if(oe(mt))t=!1;else try{var e="__mplssupport__";Xr.q(e,"xyz"),'"xyz"'!==Xr.A(e)&&(t=!1),Xr.P(e)}catch(e){t=!1}return t||Tr.error("localStorage unsupported; falling back to cookie store"),Qr=t,t},D(t){Tr.error("localStorage error: "+t)},A(t){try{return null==mt?void 0:mt.localStorage.getItem(t)}catch(t){Xr.D(t)}return null},F(t){try{return JSON.parse(Xr.A(t))||{}}catch(t){}return null},q(t,e){try{return null==mt||mt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Xr.D(t)}return!1},P(t){try{null==mt||mt.localStorage.removeItem(t)}catch(t){Xr.D(t)}}},Zr=[o,"distinct_id",k,T,tt,Z,J],ts={},es={N:()=>!0,D(t){Tr.error("memoryStorage error: "+t)},A:t=>ts[t]||null,F:t=>ts[t]||null,q:(t,e)=>(ts[t]=e,!0),P(t){delete ts[t]}},is=null,rs={N(){if(!ue(is))return is;if(is=!0,oe(mt))is=!1;else try{var t="__support__";rs.q(t,"xyz"),'"xyz"'!==rs.A(t)&&(is=!1),rs.P(t)}catch(t){is=!1}return is},D(t){Tr.error("sessionStorage error: ",t)},A(t){try{return null==mt?void 0:mt.sessionStorage.getItem(t)}catch(t){rs.D(t)}return null},F(t){try{return JSON.parse(rs.A(t))||null}catch(t){}return null},q(t,e){try{return null==mt||mt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){rs.D(t)}return!1},P(t){try{null==mt||mt.sessionStorage.removeItem(t)}catch(t){rs.D(t)}}};class ss{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===lt||this.isRejected()||-1===this.consent&&this.Te.cookieless_mode===at}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Jt.q(this.Kt,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Qt(){var t=this.Jt.A(this.Kt);return we(t)?1:Kt(xe,t)?0:-1}get Jt(){var t=this.Te.opt_out_capturing_persistence_type,e="localStorage"===t?Xr:Yr;if(!this.Yt||this.Yt!==e){this.Yt=e;var i="localStorage"===t?Yr:Xr;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(we(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[null==yt?void 0:yt.doNotTrack,null==yt?void 0:yt.msDoNotTrack,Ot.doNotTrack].some((t=>we(t)))}}function ns(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!re(r))return e;try{var s=r(e);return ae(s)&&s?s:e}catch(t){return Tr.error("Error in get_current_url, falling back to window.location.href",t),e}}var os="__POSTHOG_TOOLBAR__",as=1,ls=3,us=11;function hs(t){return t instanceof Element&&(t.id===os||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ds(t){return!!t&&t.nodeType===as}function vs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function cs(t){return!!t&&t.nodeType===ls}function fs(t){return!!t&&t.nodeType===us&&ds(t.host)}var ps=1e3;function _s(t){return t?Yt(t).split(/\s+/):[]}function gs(t,e){var i=function(t){var e,i=null==mt||null==(e=mt.location)?void 0:e.href;return oe(i)?void 0:ns(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function ms(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 _s(e)}function bs(t){return he(t)?null:Yt(t).split(/(\s+)/).filter((t=>zs(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ys(t){var e="";return As(t)&&!Fs(t)&&t.childNodes&&t.childNodes.length&&Or(t.childNodes,(function(t){var i;cs(t)&&t.textContent&&(e+=null!==(i=bs(t.textContent))&&void 0!==i?i:"")})),Yt(e)}function ws(t){var e;return oe(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var xs=["a","button","form","input","select","textarea","label"];function Es(t,e){if(oe(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 Ss(t){var e=t.parentNode;return!(!e||!ds(e))&&e}var $s=[".ph-no-autocapture","[data-ph-no-autocapture]"],ks=["next","previous","prev",">","<"],Ts=[...ks,"+","-","−","–"],Rs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Ps=[".ph-no-rageclick",".ph-no-capture"],Os=["","text","search","email","password","url","tel","number"];function Is(t,e){if(!mt||Cs(t))return!1;var i,r,s,n,o;if(ce(e)?(i=!!e&&Ps,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ps,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||!ds(t))&&(!!vs(t,"textarea")||(vs(t,"input")?Kt(Os,(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 a=Ms(t,!1).targetElementList;return!function(t,e){if(!1===t||oe(t))return!1;var i;if(!0===t)i=ks;else{if(!ie(t))return!1;if(t.length>10)return Tr.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 e=t.safeText,r=t.ariaLabel;return i.some((t=>Rs(e,t)||Rs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:ys(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Es(a,i)}var Cs=t=>!t||vs(t,"html")||!ds(t),Ms=(t,e)=>{if(!mt||Cs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!vs(s,"body");)if(fs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Ss(s);if(!n)break;if(e||xs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=mt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function As(t){for(var e=new Set,i=0,r=t;r.parentNode&&!vs(r,"body");r=r.parentNode){if(i++>=ps||e.has(r))return!1;e.add(r);var s=ms(r);if(Kt(s,"ph-sensitive")||Kt(s,"ph-no-capture"))return!1}if(Kt(ms(t),"ph-include"))return!0;var n=t.type||"";if(ae(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ae(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Fs(t){return!!(vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||vs(t,"select")||vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ds="(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})",Ns=new RegExp("^(?:"+Ds+")$"),Us=new RegExp(Ds),Ls="\\d{3}-?\\d{2}-?\\d{4}",js=new RegExp("^("+Ls+")$"),Bs=new RegExp("("+Ls+")");function zs(t,e){if(void 0===e&&(e=!0),he(t))return!1;if(ae(t)){if(t=Yt(t),(e?Ns:Us).test((t||"").replace(/[- ]/g,"")))return!1;if((e?js:Bs).test(t))return!1}return!0}function Hs(t){var e=ys(t);return zs(e=(e+" "+qs(t)).trim())?e:""}function qs(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Or(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ys(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+qs(t)).trim())}catch(t){Tr.error("[AutoCapture]",t)}})),e}function Vs(t){return t.replace(/"|\\"/g,'\\"')}function Gs(t){var e=t.attr__class;if(e)return ie(e)?e:_s(e)}var Ws=Rr("[Dead Clicks]"),Js=()=>!0,Ks=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(_)),r=t.instance.config.capture_dead_clicks;return ce(r)?r:!!se(r)||i};class Ys{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[_]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Ws.error("failed to load script",e):t()}))}tr(){var t;if(wt){if(!this.Xt&&null!=(t=Ot.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=se(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Xt=Ot.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Xt.start(wt),Ws.info("starting...")}}else Ws.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,Ws.info("stopping..."))}}var Qs=Rr("[SegmentIntegration]");var Xs="posthog-js";function Zs(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,h=void 0===u||u;return e=>{var r,a,u,d,v;if("*"!==l&&!l.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 f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.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==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),h&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class tn{constructor(t,e,i,r,s,n){this.name=Xs,this.setupOnce=function(o){o(Zs(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class en{constructor(t){this.rr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Tr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.rr)}destroy(){var t;null==(t=this.sr)||t.call(this),this.sr=void 0}doPageView(t,e){var i,r=this.ar(t,e);return this.ir={pathname:null!==(i=null==mt?void 0:mt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.ar(t,null==(e=this.ir)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ir)?void 0:t.pageViewId}}ar(t,e){var i=this.ir;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 n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,h=s.maxContentY;if(!(oe(n)||oe(o)||oe(a)||oe(l)||oe(u)||oe(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?Ee(o/n,0,1,Tr):1,v=n>1?Ee(a/n,0,1,Tr):1,c=l>1?Ee(u/l,0,1,Tr):1,f=l>1?Ee(h/l,0,1,Tr):1;r=Ir(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:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var rn=["flags","surveys"],sn={[n]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[T]:{exposure:"event"},[y]:{exposure:"event",shouldSkipFromEventProperties:t=>ue(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"},[R]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!se(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[P]:{exposure:"event",storageGroup:"flags"},[O]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"event",storageGroup:"flags"},[M]:{exposure:"event",storageGroup:"flags",volatile:!0},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"event"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[U]:{exposure:"hidden"},[L]:{exposure:"hidden",storageGroup:"surveys"},[j]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[B]:{exposure:"event"},[z]:{exposure:"hidden"},[H]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[rt]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{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"}},nn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],on=t=>{var e=sn[t];if(e)return e;for(var i of nn){var r=i[1];if(0===t.indexOf(i[0]))return r}},an=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return Xt(t)}},ln=t=>{var e=null==wt?void 0:wt.createElement("a");return oe(e)?null:(e.href=t,e)},un=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(!ie(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Tr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},hn=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("=");ie(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},dn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},vn=(t,e)=>t>=e&&Rt(),cn=(t,e,i,r)=>{if(0===t){if(Rt()){var s=e+1;return s===i&&r(),s}return e}return 0},fn="https?://(.*)",pn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...pn],gn="<masked>",mn=["li_fat_id"];function bn(t,e,i){if(!wt)return{};var r,s=e?[...pn,...i||[]]:[],n=yn(hn(wt.URL,s,gn),t),o=(r={},Or(mn,(function(t){var e=jr(t);r[t]=e||null})),r);return Ir(o,n)}function yn(t,e){var i=_n.concat(e||[]),r={};return Or(i,(function(e){var i=un(t,e);r[e]=i||null})),r}function wn(t){var e=function(t){return t?0===t.search(fn+"google.([^/?]*)")?"google":0===t.search(fn+"bing.com")?"bing":0===t.search(fn+"yahoo.com")?"yahoo":0===t.search(fn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ue(e)){r.$search_engine=e;var s=wt?un(wt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function xn(){return navigator.language||navigator.userLanguage}var En="$direct";function Sn(){return(null==wt?void 0:wt.referrer)||En}function $n(t,e,i){void 0===i&&(i=!1);var r=t?[...pn,...e||[]]:[],s=i?Ii(null==xt?void 0:xt.href):null==xt?void 0:xt.href,n=null==s?void 0:s.substring(0,1e3);return{r:Sn().substring(0,1e3),u:n?hn(n,r,gn):void 0}}function kn(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Ii(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==En?En:null==(i=ln(r))?void 0:i.host};if(n){o.$current_url=n;var a=ln(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=yn(n);Ir(o,l)}if(r){var u=wn(r);Ir(o,u)}return o}function Tn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Rn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Pn={flags:W,surveys:j},On=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],In="main";class Cn{constructor(t,e,r){if(void 0===r&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=!1,this.vr=(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.Jt=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Tr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),mt){var s=()=>this.flush();Ur(mt,"beforeunload",s,{capture:!1}),Ur(mt,"pagehide",s,{capture:!1})}}mr(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return de(e)&&e>0?e:0}isDisabled(){return!!this.yr}pr(t){-1===On.indexOf(t.persistence.toLowerCase())&&(Tr.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=[...Zr,...t];return i({},Xr,{F(t){try{var i={};try{i=Yr.F(t)||{}}catch(t){}var r,s=JSON.parse(Xr.A(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ue(a)||""===a||(n[o]=a)}r=Ir(s,n)}else r=Ir(i,s);return Xr.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Xr.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Yr.q(t,l,i,s,n,o)}catch(t){Xr.D(t)}return a},P(t,e){try{null==mt||mt.localStorage.removeItem(t),Yr.P(t,e)}catch(t){Xr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Xr.N()?(e=Xr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&rs.N()?e=rs:"memory"===n?e=es:"cookie"===n?e=Yr:r.N()?(e=r,s=!0):e=Yr,this.ur=s,e}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var e=null!=t?t:this.Te.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[W];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Or(this.props,((e,i)=>{var r=on(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===R?()=>this._r():()=>!1))return;r.transformToEventProperties&&Ir(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.yr){var t=this.Jt.F(this.vr);t&&(this.props=Ir({},t)),this.hr&&this.wr()}}wr(){for(var t of rn){var e=Xr.F(this.br(t));if(e&&!ne(e)){var i=this.kr(t);i.persisted=!0,this.Sr(t)||(i.fingerprint=this.Cr(e,t)),this.Tr(t,e)||Ir(this.props,e)}}}Sr(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=on(e))?void 0:i.storageGroup)===t}))}Tr(t,e){var i=Pn[t];if(!i)return!1;var r=e[i],s=this.props[i];return de(r)&&de(s)&&s>r}refreshKey(t){var e;if(!this.yr){var i=this.hr?null==(e=on(t))?void 0:e.storageGroup:void 0,r=i?Xr.F(this.br(i)):this.Jt.F(this.vr);if(r&&t in r)this.Ir(t,r[t]);else{if(i){var s=this.Jt.F(this.vr);if(s&&t in s)return void this.Ir(t,s[t])}this.Mr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?oe(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){oe(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,In))}Pr(){var t=this.Fr(),e=t.main,i=t.groups;for(var r of(this.Or(this.Jt,this.vr,e,In),rn)){var s,n=i[r];(!ne(n)||null!=(s=this.lr[r])&&s.persisted)&&this.Or(Xr,this.br(r),n,r)}}Fr(){var t={},e={flags:{},surveys:{}};return Or(this.props,((i,r)=>{var s,n=null==(s=on(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Cr(t,e){if(e===In)return JSON.stringify(t)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return Or(t,((t,e)=>{var r;i[e]=null!=(r=on(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Or(t,e,i,r){var s=this.kr(r);if(r===In||s.dirty||oe(s.fingerprint)){var n;try{if((n=this.Cr(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,r!==In&&(s.persisted=!0),oe(n)||(s.fingerprint=n)):this.Te.debug&&Tr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(oe(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var r of rn)Xr.P(this.br(r));i?delete this.lr[In]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(se(t)){oe(e)&&(e="None"),this.Lr=oe(i)?this.Nr:i;var r=!1;if(Or(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ir(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(se(t)){this.Lr=oe(e)?this.Nr:e;var i=!1;if(Or(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Ir(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Mr(t),this.save())}update_campaign_params(){if(!this.cr){var t=bn(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);ne(Fr(t))||this.register(t),this.cr=!0}}update_search_keyword(){var t;this.register((t=null==wt?void 0:wt.referrer)?wn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Sn(),$referring_domain:null!=wt&&wt.referrer&&(null==(t=ln(wt.referrer))?void 0:t.host)||En},void 0)}set_initial_person_info(){this.props[Q]||this.props[X]||this.register_once({[Z]:$n(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Or([X,Q],(e=>{var i=this.props[e];i&&Or(i,(function(e,i){t["$initial_"+Qt(i)]=e}))}));var e=this.props[Z];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=kn(t,e),r={};return Or(i,(function(t,e){r["$initial_"+Qt(e)]=t})),r}(e,this.Te.disable_capture_url_hashes);Ir(t,i)}return t}safe_merge(t){return Or(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.Nr=this.Lr=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.pr(t):this.Jt,n=this.gr(t);if(r||n!==this.hr){var o=this.props;this.clear(),this.Jt=s,this.hr=n,this.props=o,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ar&&(this.Ar=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.Ir(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return oe(i)||(delete e[t],this.Ir(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ir(t,e),this.save()}Ir(t,e){var i;this.props[t]=e,null!=(i=on(t))&&i.volatile||this.Dr(t)}Mr(t){delete this.props[t],this.Dr(t)}Dr(t){var e,i=null==(e=on(t))?void 0:e.storageGroup;i&&(this.kr(i).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}var Mn={GZipJS:"gzip-js",Base64:"base64"},An={Activation:"events",Cancellation:"cancelEvents"},Fn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Dn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Nn={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"},Un={Popover:"popover",Inline:"inline"},Ln={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"},jn={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"},Bn=Rr("[RateLimiter]");class zn{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=>{Bn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Bn.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 s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Y))&&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(Y,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Hn=Rr("[RemoteConfig]");class qn{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Ot._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}qr(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(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 Hn.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void Hn.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Hn.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Hr(t),this.Br()}));this.Hr(t),this.Br()}))}catch(t){Hn.error("Error loading remote config",t)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&wt&&"hidden"!==wt.visibilityState&&this._instance.reloadFeatureFlags()}Br(){var t;if(!this.zr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.zr=setInterval((()=>{this.refresh()}),e))}}Hr(t){var e;t||Hn.error("Failed to fetch remote config from PostHog."),this._instance.Hr(t?{ok:!0,config:t}:{ok:!1}),!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 Vn=Uint8Array,Gn=Uint16Array,Wn=Uint32Array,Jn=new Vn([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]),Kn=new Vn([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]),Yn=new Vn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qn=function(t,e){for(var i=new Gn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Wn(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]},Xn=Qn(Jn,2),Zn=Xn[1];Xn[0][28]=258,Zn[258]=28;for(var to=Qn(Kn,0)[1],eo=new Gn(32768),io=0;32768>io;++io){var ro=(43690&io)>>>1|(21845&io)<<1;eo[io]=((65280&(ro=(61680&(ro=(52428&ro)>>>2|(13107&ro)<<2))>>>4|(3855&ro)<<4))>>>8|(255&ro)<<8)>>>1}var so=function(t,e,i){for(var r=t.length,s=0,n=new Gn(e);r>s;++s)++n[t[s]-1];var o,a=new Gn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Gn(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[eo[d]>>>l]=u}else for(o=new Gn(r),s=0;r>s;++s)o[s]=eo[a[t[s]-1]++]>>>15-t[s];return o},no=new Vn(288);for(io=0;144>io;++io)no[io]=8;for(io=144;256>io;++io)no[io]=9;for(io=256;280>io;++io)no[io]=7;for(io=280;288>io;++io)no[io]=8;var oo=new Vn(32);for(io=0;32>io;++io)oo[io]=5;var ao=so(no,9,0),lo=so(oo,5,0),uo=function(t){return(t/8>>0)+(7&t&&1)},ho=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Gn?Gn:t instanceof Wn?Wn:Vn)(i-e);return r.set(t.subarray(e,i)),r},vo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},co=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},fo=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 Vn(0),0];if(1==s){var o=new Vn(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 Gn(v+1),f=po(i[h-1],c,0);if(f>e){r=0;var p=0,_=f-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;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}f=e}return[new Vn(c),f]},po=function(t,e,i){return-1==t.s?Math.max(po(t.l,e,i+1),po(t.r,e,i+1)):e[t.s]=i},_o=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Gn(++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]},go=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mo=function(t,e,i){var r=i.length,s=uo(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)},bo=function(t,e,i,r,s,n,o,a,l,u,h){vo(e,h++,i),++s[256];for(var d=fo(s,15),v=d[0],c=d[1],f=fo(n,15),p=f[0],_=f[1],g=_o(v),m=g[0],b=g[1],y=_o(p),w=y[0],x=y[1],E=new Gn(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=fo(E,7),T=k[0],R=k[1],P=19;P>4&&!T[Yn[P-1]];--P);var O,I,C,M,A=u+5<<3,F=go(s,no)+go(n,oo)+o,D=go(s,v)+go(n,p)+o+14+3*P+go(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(F>=A&&D>=A)return mo(e,h,t.subarray(l,l+u));if(vo(e,h,1+(F>D)),h+=2,F>D){O=so(v,c,0),I=v,C=so(p,_,0),M=p;var N=so(T,R,0);for(vo(e,h,b-257),vo(e,h+5,x-1),vo(e,h+10,P-4),h+=14,S=0;P>S;++S)vo(e,h+3*S,T[Yn[S]]);h+=3*P;for(var U=[m,w],L=0;2>L;++L){var j=U[L];for(S=0;j.length>S;++S)vo(e,h,N[B=31&j[S]]),h+=T[B],B>15&&(vo(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=ao,I=no,C=lo,M=oo;for(S=0;a>S;++S)if(r[S]>255){var B;co(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(vo(e,h,r[S]>>>23&31),h+=Jn[B]);var z=31&r[S];co(e,h,C[z]),h+=M[z],z>3&&(co(e,h,r[S]>>>5&8191),h+=Kn[z])}else co(e,h,O[r[S]]),h+=I[r[S]];return co(e,h,O[256]),h+I[256]},yo=new Wn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wo=function(){for(var t=new Wn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xo=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Eo(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=wo[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 Vn(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=mo(l,u,t.subarray(h,d)):(l[h]=!0,u=mo(l,u,t.subarray(h,o)))}else{for(var v=yo[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new Gn(32768),g=new Gn(p+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},w=new Wn(25e3),x=new Gn(288),E=new Gn(32),S=0,k=0,T=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var M=o-h;if((S>7e3||T>24576)&&M>423){u=bo(t,l,0,w,x,E,k,T,P,h-P,u),T=S=k=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var F=2,D=0,N=f,U=I-C&32767;if(M>2&&O==y(h-U))for(var L=Math.min(c,M)-1,j=Math.min(32767,h),B=Math.min(258,M);j>=U&&--N&&I!=C;){if(t[h+F]==t[h+F-U]){for(var z=0;B>z&&t[h+z]==t[h+z-U];++z);if(z>F){if(F=z,D=U,z>L)break;var H=Math.min(U,z-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,G=V-_[V]+32768&32767;G>q&&(q=G,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[T++]=268435456|Zn[F]<<18|to[D];var W=31&Zn[F],J=31&to[D];k+=Jn[W]+Kn[J],++x[257+W],++E[J],R=h+F,++S}else w[T++]=t[h],++x[t[h]]}}u=bo(t,l,!0,w,x,E,k,T,P,h-P,u)}return ho(a,0,r+uo(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&&xo(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),xo(u,h-8,i.d()),xo(u,h-4,r),u}var So=!!St||!!Et,$o="text/plain",ko=!1,To=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Ro=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),u=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Or(t,(function(t,e){oe(t)||oe(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)}(l);return h&&u.push(h),u.length>0?o+"?"+u.join("&"):o},Po=t=>{if(t.Vr)return t.Vr;var e=t.data,i=t.compression;if(e){if(i===Mn.GZipJS){var r=Eo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Vn(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 Vn(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 ho(r,0,s)}(an(e)),{mtime:0});return{contentType:$o,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Mn.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(an(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:an(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=an(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Oo=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Ro(t.url,{compression:Mn.Base64}),encodedBody:Po(i({},t,{compression:Mn.Base64,Vr:void 0}))}:{url:To(t.url,"compression"),encodedBody:Po(i({},t,{compression:void 0,Vr:void 0}))};try{e=Po(t)}catch(e){if(zt(t.compression,un(t.url,"compression")))return Tr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&zt(t.compression,un(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Bt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Bt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(ko=!0,s()):{url:t.url,encodedBody:e}},Io=t=>{try{return Oo(t)}catch(e){return Tr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Co=function(){var t=e((function*(t){var e=an(t.data),r=yield function(t,e,i){return Gt.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{Vr:{contentType:$o,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Mo=/Failed to fetch|NetworkError|Load failed/i,Ao=t=>{var e=Io(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Or(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if($t){var v=new $t;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)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||(t=>"TypeError"===(null==t?void 0:t.name)&&Mo.test((null==t?void 0:t.message)||""))(e)?Tr.warn(e):Tr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;Et(r,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Wr&&52428.8>(l||0),body:a,signal:null==(f=h)?void 0:f.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){Tr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>h?clearTimeout(h.timeout):null))}catch(t){h&&clearTimeout(h.timeout),c(t)}}},Fo=t=>{try{var e,r=Oo(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(yt.sendBeacon(s,u))return;var h=ie(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(ie(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>ie(t.data)?e:i({},t.data,{batch:e});return Fo(i({},t,{data:v(h.slice(0,d))})),void Fo(i({},t,{data:v(h.slice(d))}))}Tr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ao(i({},t,{Wr:!0}))}catch(t){Tr.warn("Beacon send failed",t)}},Do=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Ro(r===Mn.GZipJS?To(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Mn.GZipJS?{}:{compression:r}))},No=[];Et&&No.push({transport:"fetch",method:Ao}),St&&No.push({transport:"XHR",method(t){var e=Io(t);if(e){var i=new St,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Or(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&&No.push({transport:"sendBeacon",method:Fo});var Uo=3e3;class Lo{constructor(t,e){this.Zr=!0,this.Gr=[],this.Qr=Ee((null==e?void 0:e.flush_interval_ms)||Uo,250,5e3,Tr.createLogger("flush interval"),Uo),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ei():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ti(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var e=this.ei(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&ie(i.data)&&Or(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ti(i)};for(var r in e)i()}}),this.Qr))}ti(t){try{this.Jr(t)}catch(t){Tr.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var t={};return Or(this.Gr,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;oe(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Gr=[],t}}var jo=["retriesPerformedSoFar"];class Bo{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!oe(mt)&&"onLine"in mt.navigator&&(this.ni=mt.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},Ur(mt,"online",this.si),Ur(mt,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,jo);ve(e)&&(s.url=Ro(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.kt(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Tr.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)}}))}kt(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.Gr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Tr.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),0===this.Gr.length)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),e=[],i=this.Gr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Gr=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,oe(mt)||(this.si&&(mt.removeEventListener("online",this.si),this.si=void 0),this.ai&&(mt.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Tr.error(t)}}this.Gr=[]}}class zo{constructor(t){this.hi=()=>{var t,e,i,r;this.di||(this.di={});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.di.lastScrollY=Math.ceil(n),this.di.maxScrollY=Math.max(n,null!==(t=this.di.maxScrollY)&&void 0!==t?t:0),this.di.maxScrollHeight=Math.max(o,null!==(e=this.di.maxScrollHeight)&&void 0!==e?e:0),this.di.lastContentY=a,this.di.maxContentY=Math.max(a,null!==(i=this.di.maxContentY)&&void 0!==i?i:0),this.di.maxContentHeight=Math.max(l,null!==(r=this.di.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){Ur(mt,"scroll",this.hi,{capture:!0}),Ur(mt,"scrollend",this.hi,{capture:!0}),Ur(mt,"resize",this.hi)}scrollElement(){if(!this.ci)return null==mt?void 0:mt.document.documentElement;var t=ie(this.ci)?this.ci:[this.ci];for(var e of t){var i=null==mt?void 0:mt.document.querySelector(e);if(i)return i}}vi(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[e]||0}return mt?"y"===t?mt.scrollY||mt.pageYOffset||mt.document.documentElement.scrollTop||0:mt.scrollX||mt.pageXOffset||mt.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var Ho=t=>$n(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 qo{constructor(t,e,i,r){this.fi=t=>{var e=this.pi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.gi(this._instance)};this.mi.register({[K]:i})}},this._instance=t,this.yi=e,this.mi=i,this.gi=r||Ho,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[K]}getSetOnceProps(){var t,e=null==(t=this.pi())?void 0:t.props;return e?"r"in e?kn(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 Or(Fr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Qt(i)]=e})),t}}class Vo{on(t,e){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(e),()=>{this.bi[t]=this.bi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.bi[t]||[])i(e);for(var r of this.bi["*"]||[])r(t,e)}constructor(){this.bi={}}}var Go=Rr("[SessionId]");class Wo{on(t,e){return this.wi.on(t,e)}constructor(t,e,i){var r;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Vo,this.Ti=(t,e)=>!(!ve(t)||!ve(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===lt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=e||Gr,this.Ri=i||Gr;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ee(this.Te.session_idle_timeout_seconds||1800,60,36e3,Go.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var n=rs.F(this.Oi),o=rs.F(this.Fi);n&&!o?this.Ii=n:rs.P(this.Oi),rs.q(this.Fi,!0)}if(null!=(r=this.Te.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Te.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.$i(this.Te.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Go.error("Invalid sessionID in bootstrap",t)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return oe(this.ki)&&(this.ki=[]),this.ki.push(t),this.Mi&&t(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((e=>e!==t))}}Li(){return"memory"!==this.Te.persistence&&!this.mi.yr&&rs.N()}Ni(t){t!==this.Ii&&(this.Ii=t,this.Li()&&rs.q(this.Oi,t))}Di(){return this.Ii?this.Ii:this.Li()?rs.F(this.Oi):null}qi(t){var e=this.xi;return!ue(e)&&!ue(t)&&5e3>Math.abs(t-e)}$i(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Mi=t,s&&!r||s&&this.qi(e)||(this.xi=e,this.mi.register({[k]:[e,t,i]}))}ji(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return ve(e)&&e>0}Hi(){this.ji()?this.mi.refreshKey(k):(this.mi.flush(),this.mi.load())}Bi(){var t;if(!ue(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var e=this.Ui();e[1]===this.Mi&&e[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.Mi)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],e=ve(t)?t:0,i=ve(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Vi(t){return this.Hi(),this.Ti(t,this.zi())}Ui(){var t=this.mi.props[k];return ie(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&mt&&(mt.removeEventListener(ct,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&rs.P(this.Fi)},Ur(mt,ct,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Te.cookieless_mode===lt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Ui(),s=r[1],n=r[2],o=this.zi(),a=this.Di(),l=ve(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,d=!s,v=s,c=!d&&!t&&this.Ti(i,o);if(c){(c=this.Vi(i))||Go.info("cross-tab refresh kept the session alive",{sessionId:s});var f=this.Ui();s=f[1],n=f[2]}d||c||l?(s=this.Ei(),a=this.Ri(),Go.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.Ri(),u=!0),(h=s!==v)&&(Go.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=!0));var p=ve(o)&&t&&!l?o:i,_=ve(n)?n:(new Date).getTime();this.Ni(a),this.$i(s,p,_),t||this.Pi();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.ki.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:_,changeReason:u?g:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi((new Date).getTime())){var t=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var Jo=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Jt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Jt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Ko(){return(Ko=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 ae(i)&&i.length>0?i:void 0}catch(t){return void Tr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var Yo=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 Qo(t,e,i){return an({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Xo={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=>Yo(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Yo(e,t))))),icontains:(t,e)=>e.map(Zo).some((e=>t.map(Zo).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Zo).every((e=>t.map(Zo).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)))}))},Zo=t=>t.toLowerCase();function ta(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(oe(r)||ue(r))return!1;var s=[String(r)],n=Xo[i.operator];return!!n&&n(i.values,s)}))}var ea="custom",ia="i.posthog.com",ra=/^\/static\//;class sa{constructor(t){this.Zi={},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("."+ia,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ea),this.Zi[this.apiHost]}Gi(t){if(ra.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.Gi(e);if(i)return""+i+e}if(this.region===ea)return this.apiHost+e;var r=ia+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function na(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var oa=Rr("[Surveys]"),aa="seenSurvey_",la=t=>{try{var e=(t=>((t,e)=>""+aa+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){oa.error("Failed to persist survey seen state",t)}},ua=[Fn.Popover,Fn.Widget,Fn.API],ha={ignoreConditions:!1,ignoreDelay:!1,displayType:Un.Popover},da=Rr("[PostHog ExternalIntegrations]"),va={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ca{constructor(t){this._instance=t}er(t,e){var i;null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return da.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=Ot.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.er(va[n],(()=>{var e;null==(e=Ot.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=Ot.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Ot.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}var fa={},pa=0,_a=()=>{},ga='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ma="Surveys module not available",ba="sanitize_properties is deprecated. Use before_send instead",ya="Invalid value for property_denylist config: ",wa=["token","distinct_id",it],xa="posthog",Ea=!So&&-1===(null==Tt?void 0:Tt.indexOf("MSIE"))&&-1===(null==Tt?void 0:Tt.indexOf("Mozilla")),Sa=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:Nr(null==wt?void 0:wt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:_a,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:xt&&ae(null==xt?void 0:xt.search)&&-1!==xt.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==mt||null==(e=mt.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){Tr.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:dt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Uo},error_tracking:{},_onCapture:_a},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ts,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))},$a=[["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"]],ka=t=>{var e={};for(var i of $a){var r=i[0],s=i[1];oe(t[r])||(e[s]=t[r])}var n=Ir({},e,t),o=t.__preview_external_dependency_versioned_paths;return oe(o)||(oe(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ae(o)&&oe(t.asset_host)&&(n.asset_host=o)),ie(t.property_blacklist)&&(oe(t.property_denylist)?n.property_denylist=t.property_blacklist:ie(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Tr.error(ya+t.property_denylist)),n};class Ta{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(t){Tr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ra{Ji(t,e){if(t){var i=this.Ki.indexOf(t);-1!==i&&this.Ki.splice(i,1)}return this.Ki.push(e),null==e.initialize||e.initialize(),e}Yi(){return this.config.cookieless_mode===lt||this.config.cookieless_mode===at&&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 Ta,this.Xi=!1,this.version=s.LIB_VERSION,this.en=new Vo,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sa(),this.SentryIntegration=tn,this.sentryIntegration=t=>function(t,e){var i=Zs(t,e);return{name:Xs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new zo(this),this.pageViewManager=new en(this),this.rateLimiter=new zn(this),this.requestRouter=new sa(this),this.consent=new ss(this),this.externalIntegrations=new ca(this);var e=null!==(t=Ra.__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.metrics=e.metrics&&new e.metrics(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=ae(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=ae(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Tr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==xa){var r,s=null!==(r=fa[i])&&void 0!==r?r:new Ra;return s._init(t,e,i),fa[i]=s,fa[xa][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var l=ae(t)?t.trim():"";if(!l)return Tr.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=Sa(e.defaults),e.debug=this.an(e.debug),this.ln=e,this.un=[],e.person_profiles?this.nn=e.person_profiles:e.process_person&&(this.nn=e.process_person);var u=Sa(e.defaults),h=ka(e),d=Ir({},u,h,{name:r,token:l});se(u.rageclick)&&se(h.rageclick)&&(d.rageclick=Ir({},u.rageclick,h.rageclick)),se(u.session_recording)&&se(h.session_recording)&&(d.session_recording=Ir({},u.session_recording,h.session_recording)),this.set_config(d),this.config.on_xhr_error&&Tr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Mn.GZipJS;var v=this.hn();this.persistence=new Cn(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(i({},this.config,{persistence:"sessionStorage"}),v,!1);var c=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.dn=new Lo((t=>this.cn(t)),this.config.request_queue_config),this.vn=new Bo(this),this.__request_queue=[];var p=this.Yi();if(p||(this.sessionManager=new Wo(this),this.sessionPropsManager=new qo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Tr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(p)}),0)):(Tr.info("Initializing extensions synchronously"),this.fn(p)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Tr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:c,s:f}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.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(J);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ut)this.identify(_);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ht)Tr.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 b=this.config.get_device_id(Gr()),y=e.bootstrap.isIdentifiedID?b:_;this.persistence.set_property(J,e.bootstrap.isIdentifiedID?ht:ut),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:et,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Gr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(J,ut)}return Ur(mt,"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()||Gr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(J,ht)),e()},s=i.user();"then"in s&&re(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Qs.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()||(Qs.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Qs.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,ft),identify:t=>e(t,_t),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.pn())):this.pn(),re(this.config._onCapture)&&this.config._onCapture!==_a&&(Tr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Tr.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 Ko.apply(this,arguments)}().then((t=>{t&&this.register({[a]:t})})).catch(_a),this}fn(t){var e,r,s,n,o,a,l,u,h=performance.now(),d=i({},Ra.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.featureFlags&&this.Ki.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new d.featureFlags(this)),d.exceptions&&this.Ki.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.Ki.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ki.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ki.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.Ki.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Ki.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this)),d.logs&&this.Ki.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this)),d.metrics&&this.Ki.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ki.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ki.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ki.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ki.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Ks)),d.toolbar&&this.Ki.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Ki.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this.Ki.forEach((t=>{t.initialize&&v.push((()=>{null==t.initialize||t.initialize()}))})),v.push((()=>{if(this.gn){var t=this.gn;this.gn=void 0,this.Hr(t)}})),this.mn(v,h)}mn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Tr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[rt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[st]:r}),this.config.__preview_deferred_init_extensions&&Tr.info("PostHog extensions initialized ("+r+"ms)")}Hr(t){if(!wt||!wt.body)return Tr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var e,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Kt(i.supportedCompression,Mn.GZipJS)?Mn.GZipJS:Kt(i.supportedCompression,Mn.Base64)?Mn.Base64:void 0),null!=(e=i.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:dt}),this.Ki.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}pn(){try{this.config.loaded(this)}catch(t){Tr.critical("`loaded` function failed",t)}if(this.bn(),this.config.internal_or_test_user_hostname&&null!=xt&&xt.hostname){var t=xt.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.Yi())&&this._n()}),1),this.wn=new qn(this),this.wn.load()}bn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.dn)||t.enable())}_dom_loaded(){this.is_capturing()&&Pr(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(pt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.dn)||r.unload(),null==(s=this.vn)||s.unload()):this.xn()&&this.capture(pt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Ea?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,(oe(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;var o,a,l,u,h,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&oe(n.compression)&&n.data&&(n.compression=Mn.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(h=(u=ie(o=n.data)?o:[o])[0])||null==(l=h.properties)?void 0:l.token)&&void 0!==a?a:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),ie(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=Do(n.url,n.method,n.compression,n.timestampMode);var v=No.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");"sendBeacon"!==d&&n.data&&n.compression===Mn.GZipJS&&kt&&"undefined"!=typeof Promise&&!ko?Co(n).then((t=>{c(t)})).catch((e=>{if(Ht(e))return ko=!0,void c(i({},n,{compression:void 0,url:Do(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Ht(t)||e===jt})(e)&&(ko=!0),c(n)})):c(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}))}cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t)}_execute_array(t){pa++;try{var e,i=[],r=[],s=[];Pr(t,(t=>{if(t)if(ie(e=t[0]))s.push(t);else if(re(t))try{t.call(this)}catch(e){Tr.error("Error executing queued PostHog call",t,e)}else ie(t)&&"alias"===e?i.push(t):ie(t)&&-1!==e.indexOf("capture")&&re(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Pr(t,(function(t){try{if(ie(t[0])){var i=e;Or(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Tr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{pa--}}push(t){if(pa>0&&ie(t)&&ae(t[0])){var e=Ra.prototype[t[0]];re(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.dn){if(this.is_capturing())if(!oe(t)&&ae(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&&!ae(null==e?void 0:e.$current_url)&&(Tr.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.kn||Tr.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=Oi(null==r?void 0:r.uuid,Gr),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ft&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(A);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,m,b,y=p?void 0:this.Sn(null==r?void 0:r.$set_once,t!==gt,t===_t);if(y&&(f.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>ae(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),ie(e))r=[],Pr(e,(e=>{r.push(t(e))}));else{var s={};Or(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,oe(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Ft.forEach(r),e.forEach(r),i}(f.properties,wa)),t===Dn.DISMISSED||t===Dn.SENT){var w=null==e?void 0:e[Nn.SURVEY_ID],x=null==e?void 0:e[Nn.SURVEY_ITERATION];la({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===Dn.SENT?"responded":"dismissed",b="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(b="$survey_"+m+"/"+g.id+"/"+g.current_iteration),b)]:!0})}else t===Dn.SHOWN&&(f.$set=i({},f.$set,{[Nn.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Ln.SHOWN){var E=null==e?void 0:e[jn.TOUR_TYPE];E&&(f.$set=i({},f.$set,{[jn.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(ne(S)||this.setPersonPropertiesForFlags(S),!he(this.config.before_send)){var k=this.wt(f);if(!k)return;(f=k).uuid=Oi(f.uuid,Gr)}this.en.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",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.cn(R):this.dn.enqueue(R),f}Tr.critical("This capture call is ignored due to client rate limiting.")}}else Tr.error("No event name provided to posthog.capture")}else Tr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,n,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.Yi()&&(l[it]=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!ae(l.distinct_id)&&!de(l.distinct_id)||le(l.distinct_id))&&Tr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Tt)return{};var u,h=t?[...pn,...e||[]]:[],d=function(t){for(var e=0;Ti.length>e;e++){var i=Ti[e],r=i[1],s=i[0].exec(t),n=s&&(re(r)?r(s,t):r);if(n)return n}return["",""]}(Tt),v=d[0],c=d[1],f=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};oe(i)||(p.detectGoogleSearchApp=i);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,b=null==mt||null==(a=mt.screen)?void 0:a.width,y=null==mt||null==(l=mt.screen)?void 0:l.height,w=null==mt?void 0:mt.devicePixelRatio;oe(g)||(_.userAgentDataPlatform=g),oe(m)||(_.maxTouchPoints=m),oe(b)||(_.screenWidth=b),oe(y)||(_.screenHeight=y),oe(w)||(_.devicePixelRatio=w);var x,E,S,k,T,R,P,O,I=Ir(Fr({$os:v,$os_version:c,$browser:Si(Tt,navigator.vendor,f,p),$device:Ri(Tt),$device_type:(E=Tt,S=_,O=Ri(E),O===Oe||O===Pe||"Kobo"===O||"Kindle Fire"===O||O===oi?Re:O===Ke||O===Qe||O===Ye||O===ri?"Console":O===Ce?"Wearable":O?$e:"Android"===(null==S?void 0:S.userAgentDataPlatform)&&(null!==(k=null==S?void 0:S.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==S?void 0:S.screenWidth)&&void 0!==T?T:0,null!==(R=null==S?void 0:S.screenHeight)&&void 0!==R?R:0)/(null!==(P=null==S?void 0:S.devicePixelRatio)&&void 0!==P?P:1)?$e:Re:"Desktop"),$timezone:Tn(),$timezone_offset:Rn()}),{$current_url:hn(r?Ii(null==xt?void 0:xt.href):null==xt?void 0:xt.href,h,gn),$host:null==xt?void 0:xt.host,$pathname:null==xt?void 0:xt.pathname,$raw_user_agent:Tt.length>1e3?Tt.substring(0,997)+"...":Tt,$browser_version:ki(Tt,navigator.vendor,f,p),$browser_language:xn(),$browser_language_prefix:(x=xn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==mt?void 0:mt.screen.height,$screen_width:null==mt?void 0:mt.screen.width,$viewport_height:null==mt?void 0:mt.innerHeight,$viewport_width:null==mt?void 0:mt.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=s.SDK_DIST_CHANNEL),I}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime()),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&Ir(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ir(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.vn)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ea&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ft||o?t!==pt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Ir(l,h),t===ft&&wt&&(l.title=wt.title),!oe(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Tt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Or(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]})),(l=Ir({},d,_,g,l)).$is_identified=this._isIdentified(),ie(this.config.property_denylist)?Or(this.config.property_denylist,(function(t){delete l[t]})):Tr.error(ya+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(Tr.error(ba),l=m(l,t));var b=this.Cn();return l.$process_person_profile=b,b&&!o&&this.Tn("_calculate_event_properties"),l}Sn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Cn())return t;if(this.Xi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Ir({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Tr.error(ba),o=a(o,"$set_once")),e&&(this.Xi=!0),ne(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)}In(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,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}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.en.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:ma}),()=>{})}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:ma})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:ma})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=ha),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:ma}}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:ma})}Mn(t){return!t||le(t)?(Tr.critical("Unique user id has not been set in posthog.identify"),!1):t===et?(Tr.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())||(Tr.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 Tr.uninitializedWarning("posthog.identify");if(de(t)&&(t=t.toString(),Tr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.Tn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(J)||ut)===ut;t!==r&&n?(this.persistence.set_property(J,ht),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(_t,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.sn=Qo(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(q))}}setPersonProperties(t,e){if((t||e)&&this.Tn("posthog.setPersonProperties")){var i=Qo(this.get_distinct_id(),t,e);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.sn=i):Tr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(ie(t)?t:[t]).filter((t=>ae(t)&&t.length>0));0!==i.length&&this.Tn("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=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(gt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else Tr.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.Tn("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,l,u,h,d,v;if(Tr.info("reset"),!this.__loaded)return Tr.uninitializedWarning("posthog.reset");var c,f=this.get_property(o),p=this.get_property(a),_=this.get_property(b);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),oe(_)||null==(c=this.persistence)||c.register({[b]:_}),null==(r=this.surveys)||r.reset(),null==(s=this.wn)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(l=this.conversations)||l.reset(),null==(u=this.logs)||u.reset(),null==(h=this.metrics)||h.reset(),null==(d=this.persistence)||d.set_property(J,ut),null==(v=this.sessionManager)||v.resetSessionId(),this.sn=null,this.config.cookieless_mode===lt)this.register_once({distinct_id:et,$device_id:null},"");else{var g=this.config.get_device_id(Gr());this.register_once({distinct_id:g,$device_id:t?g:f},""),t||oe(p)||this.register({[a]: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,n;i.__loaded?(null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(e=i.metrics)||e.flush("sendBeacon"),null==(r=i.dn)||r.unload(),null==(s=i.vn)||s.unload(),null==(n=i.featureFlags)||n.destroy()):Tr.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.Rn()}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 e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);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(n)?(Tr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(oe(e)&&(e=this.get_distinct_id()),t!==e?(this.In(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Tr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(se(t)){var r,n,o,a,l,u,h,d,v,c,f;Ir(this.config,ka(t));var p=this.hn();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(i({},this.config,{persistence:"sessionStorage"}),p,!1);var _=this.an(this.config.debug);ce(_)&&(this.config.debug=_),ce(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Xr.N()&&Xr.q("ph_debug",!0),Tr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,Xr.N()&&Xr.P("ph_debug"))),null==(n=this.exceptionObserver)||n.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.Pn(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){s.LIB_NAME=t,s.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:Ra.On}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:xa;return e!==xa&&(e=xa+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(J))===ht||(null==(e=this.sessionPersistence)?void 0:e.get_property(J))===ht}Cn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===dt&&!this._isIdentified()&&ne(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[tt]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(t){return"never"===this.config.person_profiles?(Tr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(tt,!0),!0)}hn(){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!==at)}Pn(){var t,e,i,r,s=this.hn();return(null==(t=this.persistence)?void 0:t.yr)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.yr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==lt){if(this.Yi()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Wo(this),this.pageViewManager=new en(this),this.persistence&&(this.sessionPropsManager=new qo(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=Ra.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ji(this.sessionRecording,new l(this)),this.yn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.yn)))}var u,h;this.consent.optInOut(!0),this.Pn(),this.bn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==at&&(null==(u=this.surveys)||u.loadIfEnabled()),(oe(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._n()}else Tr.warn(ga)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==lt?(this.config.cookieless_mode===at&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===at&&(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._n(),this.bn())):Tr.warn(ga)}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===lt||(this.config.cookieless_mode===at?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return yt?Jo(yt,this.config.custom_blocked_useragents):void 0}_n(){wt&&("visible"===wt.visibilityState?this.tn||(this.tn=!0,this.capture(ft,{title:wt.title},{send_instantly:!0}),this.rn&&(wt.removeEventListener(vt,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),Ur(wt,vt,this.rn)))}debug(t){!1===t?(null==mt||mt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==mt||mt.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ur(){var t=this.ln||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Tr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!he(t[e]),o=i in t&&!he(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Tr)}wt(t){var e;if(he(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(_e),r=ie(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),he(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return pe(t.event)?Tr.warn(o+". This can cause unexpected behavior."):Tr.info(o),null}s.properties&&!ne(s.properties)||Tr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&he(s.properties[a]))return Tr.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.ir)?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)})}an(t){var e=ce(t)&&!t,i=Xr.N()&&"true"===Xr.A("ph_debug");return!e&&(!!i||t)}}Ra.__defaultExtensionClasses={},Ra.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Ar(t.prototype[e[i]])}(Ra,["identify"]);class Pa{constructor(t){this.disabled=!1===t;var e=se(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 Oa="$copy_autocapture",Ia=Rr("[AutoCapture]");function Ca(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ma(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!ds(e));return e}function Aa(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!ds(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!vs(c,"body")&&ps>d.length;)if(fs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!ds(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},b=!1,y=!1;if(Or(d,(t=>{var e=As(t);if(vs(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&zs(i))&&(h?Ii(i):i)}Kt(ms(t),"ph-no-capture")&&(y=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};xs.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ca(1024,Hs(t)):Ca(1024,ys(t)));var a=ms(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Or(t.attributes,(function(i){var n;if((!Fs(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&zs(i.value)&&(!ae(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=_s(a).join(" ")),o["attr__"+i.name]=Ca(1024,"href"===i.name&&s?Ii(a):a)}}));for(var l=1,u=1,h=t;h=Ma(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(!As(t))return{};var e={};return Or(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&&zs(r)&&(e[i]=r)}})),e}(t);Ir(m,r)})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=vs(t,"a")||vs(t,"button")?Hs(t):ys(t)),b){var w,x;g[0].attr__href=b;var E=null==(w=ln(b))?void 0:w.host,S=null==mt||null==(x=mt.location)?void 0:x.host;E&&S&&E!==S&&(p=b)}return{props:Ir({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,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 Cr(o).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[Vs(t[0].toString())]=Vs(e.toString())})),(s+=":")+Cr(a).map((t=>t[0]+'="'+t[1]+'"')).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:Gs(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Cr(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}var Fa=Rr("[ExceptionAutocapture]"),Da=()=>{},Na=Rr("[TracingHeaders]"),Ua=Rr("[Web Vitals]"),La=9e5,ja="disabled",Ba="lazy_loading",za="awaiting_config",Ha="missing_config";Rr("[SessionRecording]"),Rr("[SessionRecording]");var qa="[SessionRecording]",Va=Rr(qa),Ga=Rr("[Heatmaps]");function Wa(t){return se(t)&&"clientX"in t&&"clientY"in t&&de(t.clientX)&&de(t.clientY)}var Ja=Rr("[Product Tours]"),Ka=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(g))},Ya=["$set_once","$set"],Qa=Rr("[SiteApps]"),Xa="Error while initializing PostHog app with config id ";function Za(t,e,i){if(he(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 tl{constructor(t){this.Fn=new Vo,this.Ln=(t,e)=>this.$n(t,e)&&this.An(t,e)&&this.Nn(t,e)&&this.Dn(t,e),this.$n=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.qn=new Set,this.jn=new Set}init(){var t,e;oe(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(!oe(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.jn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.qn)||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.qn.has(t)||this.qn.has(e.event))&&this.jn&&(null==(i=this.jn)?void 0:i.size)>0&&this.jn.forEach((t=>{this.Hn(e,t)&&this.Fn.emit("actionCaptured",t.name)}))}Bn(t){this.onAction("actionCaptured",(e=>t(e)))}Hn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Ln(t,i))return!0;return!1}onAction(t,e){return this.Fn.on(t,e)}An(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(!Za(r,e.url,e.url_matching||"contains"))return!1}return!0}Nn(t,e){return!!this.Un(t,e)&&!!this.zn(t,e)&&!!this.Vn(t,e)}Un(t,e){var i;if(null==e||!e.href)return!0;var r=this.Wn(t);if(r.length>0)return r.some((t=>Za(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Za((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}zn(t,e){var i;if(null==e||!e.text)return!0;var r=this.Wn(t);if(r.length>0)return r.some((t=>Za(t.text,e.text,e.text_matching||"exact")||Za(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;!he(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=>Za(t,n,o))))}Vn(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}Wn(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||ta(e.properties.reduce(((t,e)=>{var i=ie(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 el{constructor(t){var e;this.Zn=[],this._instance=t,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,null==(e=this._instance)||null==e.onSessionId||e.onSessionId((t=>this.Kn(t)))}Yn(t,e){return!!t&&ta(t.propertyFilters,null==e?void 0:e.properties)}Xn(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}es(t,e,i){var r=(i===An.Activation?this.Gn:this.Qn).get(t),s=[];return this.ts((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.Yn(n,e)}))}register(t){var e;oe(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.rs(t),this.ns(t))}ns(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.ss&&(this.ss=new tl(this._instance),this.ss.init(),this.ss.Bn((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.ss)||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.Jn.get(e.name);i&&i.push(t.id),this.Jn.set(e.name,i||[t.id])}})))})))}rs(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.Gn=this.Xn(t,An.Activation),this.Qn=this.Xn(t,An.Cancellation))}onEvent(t,e){var i,r,s=this.os(),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.ls(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.us([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.hs(n)}if(this.Qn.has(t)){var a=this.es(t,e,An.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.us(a.map((t=>t.id))),a.forEach((t=>this.ds(t.id))))}if(this.Gn.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Gn.get(t)});var l=this.es(t,e,An.Activation);this.cs(l.map((t=>t.id)))}}onAction(t){this.Jn.has(t)&&this.cs(this.Jn.get(t)||[])}cs(t){0!==t.length&&(this.Zn=[...new Set([...this.Zn,...t])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(t){this.Zn=this.Zn.filter((e=>e!==t));var e=this.vs();e.includes(t)||(this.fs([...e,t]),this.ps())}us(t){var e=new Set(t);this.Zn=this.Zn.filter((t=>!e.has(t)));var i=this.gs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.fs(r),0===r.length&&this.ys())}gs(){var t,e=this.bs();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}vs(){var t,e,i=this.gs();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._s()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}ps(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.ws(e)}ys(){this.xs()}Kn(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._s()];i&&i!==t&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((t=>!this.ks(t)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class il extends el{constructor(t){super(t)}bs(){return B}_s(){return z}Cs(){return Dn.SHOWN}ts(t){var e;null==(e=this._instance)||e.getSurveys(t)}ds(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}os(){return oa}fs(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[B]:t})}ws(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[z]:t})}xs(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(z)}ks(){return!1}ls(t,e){var i;this.ts((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return na(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===Dn.SHOWN?"consume":"ignore":t===Dn.SHOWN?"persist":t===Dn.DISMISSED||t===Dn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var rl="SDK is not enabled or survey functionality is not yet loaded",sl="Disabled. Not loading surveys.",nl=null!=mt&&mt.location?dn(mt.location.hash,"__posthog")||dn(location.hash,"state"):null,ol="_postHogToolbarParams",al=Rr("[Toolbar]"),ll=Rr("[FeatureFlags]"),ul=Rr("[FeatureFlags]",{debugEnabled:!0}),hl="\" failed. Feature flags didn't load in time.",dl=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},vl=t=>{var e={};for(var i of Cr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},cl=Rr("[Error tracking]"),fl="Refusing to render web experiment since the viewer is a likely bot",pl={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Yo(e,t),not_regex:(t,e)=>!Yo(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class _l{get Te(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{_l.Ts("retrieved web experiments from the server"),e.Is=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Is&&(_l.Ts("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Is)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);ae(r)&&t.variants[r]&&e.Ms(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];_l.Es(n,e._instance)&&e.Ms(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())_l.Ts(fl);else if(!this.Te.disable_web_experiments){if(he(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_l.Ts("applying feature flags",t),t.forEach((t=>{var e;if(this.Is&&null!=(e=this.Is)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Is)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Ms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=_l.getWindowLocation();if(null!=t&&t.search){var e=un(null==t?void 0:t.search,"__experiment_id"),i=un(null==t?void 0:t.search,"__experiment_variant");e&&i&&(_l.Ts("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Rs(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Te.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.Te.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Rs(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(_l.Ts("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Ms(r[0].name,e,r[0].variants[e].transforms))}static Es(t,e){return!he(t.conditions)&&_l.Ps(t,e)&&_l.Os(t)}static Ps(t,e){var i;if(he(t.conditions)||he(null==(i=t.conditions)?void 0:i.url))return!0;var r=_l.getWindowLocation();if(r){var s,n,o,a=ns(e,r.href);return null==(s=t.conditions)||!s.url||pl[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==mt?void 0:mt.location}static Os(t){var e;if(he(t.conditions)||he(null==(e=t.conditions)?void 0:e.utm))return!0;var i=bn();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,f=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&&f&&v}return!1}static Ts(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Tr.info("[WebExperiments] "+t,i)}Ms(t,e,i){this._is_bot()?_l.Ts(fl):"control"!==e?i.forEach((i=>{if(i.selector){var r;_l.Ts("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)}))}})):_l.Ts("Control variants leave the page unmodified.")}_is_bot(){return yt&&this._instance?Jo(yt,this.Te.custom_blocked_useragents):void 0}}var gl=Rr("[Conversations]"),ml="Conversations not available yet.",bl="console",yl={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],mt&&Ur(mt,"online",this.Bs)}destroy(){null==mt||mt.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return null!==(t=null==(e=this.mi)?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,ll.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=null!==(t=this.Te.evaluation_contexts)&&void 0!==t?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(ll.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||ll.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!oe(t)){if(ie(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||ll.error("Invalid flag key found:",t,"Expected non-empty string"),e}));ll.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,i=this._instance.config,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.zs(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.zs(C))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var d of Object.entries(l)){var v=d[0],c=d[1];h[v]={key:v,enabled:Ct(c),variant:Mt(c),reason:void 0,metadata:oe(null==u?void 0:u[v])?void 0:{id:0,version:void 0,description:void 0,payload:u[v]}}}this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(I),e=this.zs(F),r=this.zs(D);if(!r&&!e)return t||{};var s=Ir({},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=oe(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=oe(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=f}return this.Fs||(ll.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Fs=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Ct(r),variant:Mt(r),payload:It(e[i])}}))}getFlagVariants(){var t=this.zs(R),e=this.zs(F);if(!e)return t||{};for(var i=Ir({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(ll.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Fs=!0),i}getFlagPayloads(){var t=this.zs(C),e=this.zs(D);if(!e)return t||{};for(var i=Ir({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(ll.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Fs=!0),i}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,n=this.zs(o),a={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.mi)?void 0:e.get_initial_props())||{},this.zs(N)||{},{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}),group_properties:this.zs(U),timezone:Tn()};ue(n)||oe(n)||(a.$device_id=n),(null!=t&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Gs()&&(a.evaluation_contexts=this.Zs());var l=this.Qs();oe(l)||(a.flag_keys=l);var u=!!this.Te.advanced_only_evaluate_survey_feature_flags,h=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:h,data:a,compression:this.Te.disable_compression?void 0:Mn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(this.Xs(t.statusCode),200===t.statusCode&&(this.Ns||(this.$anon_distinct_id=void 0),s=!1),this.$s=!1,!a.disable_flags||this.Ns){this.Ds=!s;var n=[];t.error?t.error instanceof Error?n.push("AbortError"===t.error.name?"timeout":"connection_error"):n.push("unknown_error"):200!==t.statusCode&&n.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&n.push("errors_while_computing_flags");var o,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&n.push("quota_limited"),null==(r=this.mi)||r.register({[G]:n}),l)ll.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 a.disable_flags||this.receivedFeatureFlags(null!==(o=t.json)&&void 0!==o?o:{},s,{partialResponse:u}),this.Ns&&(this.Ns=!1,this.Ks())}}})}}Us(){return vn(this.Hs,3)}Xs(t){this.Hs=cn(t,this.Hs,3,(()=>ll.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){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 ll.warn('getFeatureFlag for key "'+t+hl)}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.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.zs(M)||void 0,l=this.zs(W)||void 0,u=this.zs(q)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.zs(V);d&&d!==v&&(u={},null==(h=this.mi)||h.register({[q]:u,[V]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,_,g,m,b,y,w,x,E;ie(u[t])?u[t].push(o):u[t]=[o],null==(c=this.mi)||c.register({[q]:u});var S=this.getFeatureFlagDetails(t),k=[...null!==(f=this.zs(G))&&void 0!==f?f:[]];oe(s)&&k.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==(p=this.Te.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Te.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.Ds};oe(null==S||null==(g=S.metadata)?void 0:g.has_experiment)||(T.$feature_flag_has_experiment=S.metadata.has_experiment),oe(null==S||null==(m=S.metadata)?void 0:m.version)||(T.$feature_flag_version=S.metadata.version);var R,P=null!==(b=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==b?b:null==S||null==(w=S.reason)?void 0:w.code;P&&(T.$feature_flag_reason=P),null!=S&&null!=(x=S.metadata)&&x.id&&(T.$feature_flag_id=S.metadata.id),oe(null==S?void 0:S.original_variant)&&oe(null==S?void 0:S.original_enabled)||(T.$feature_flag_original_response=oe(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(E=S.metadata)&&E.original_payload&&(T.$feature_flag_original_payload=null==S||null==(R=S.metadata)?void 0:R.original_payload),k.length&&(T.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",T)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:It(n)}}}else ll.warn('getFeatureFlagResult for key "'+t+hl)}getRemoteConfigPayload(t,e){var i=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:i,person_properties:{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}};this.Gs()&&(r.evaluation_contexts=this.Zs());var n=this.Qs();oe(n)||(r.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:Mn.Base64,timestampMode:"body",timeout:this.Te.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.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return ll.warn('isFeatureEnabled for key "'+t+hl),e.defaultValue;var i=this.getFeatureFlag(t,e);return oe(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var 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&&ll.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(ie(u)){ll.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;e&&e.register({[P]:u,[R]:c,[A]:!1})}else{var p=u,_=h,g=l;if(null!=o&&o.partialResponse)p=i({},r,p),_=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)})));p=i({},r,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},r,p),_=i({},s,_),g=i({},n,g);e&&e.register(i({[P]:Object.keys(vl(p)),[R]:p||{},[C]:_||{},[I]:g||{},[A]:!0===t.minimalFlagCalledEvents},d?{[M]:d}:{},v?{[W]:v}:{}))}}}(t,this.mi,s,n,o,r),e||(this.js=!1),this.eo(e)}}override(t,e){void 0===e&&(e=!1),ll.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return ll.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.mi.unregister(F),this.mi.unregister(D),this.eo(),ul.info("All overrides cleared");if(ie(t)){var e=dl(t);return this.mi.register({[F]:e}),this.eo(),ul.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Fs=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.mi.unregister(F),ul.info("Flag overrides cleared");else if(r.flags){if(ie(r.flags)){var s=dl(r.flags);this.mi.register({[F]:s})}else this.mi.register({[F]:r.flags});ul.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.mi.unregister(D),ul.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[D]:r.payloads}),ul.info("Payload overrides set",{payloads:r.payloads}))),void this.eo()}if(t&&"object"==typeof t)return this.mi.register({[F]:t}),this.eo(),ul.info("Flag overrides set",{flags:t});ll.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){ll.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.zs(O)||[]).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.mi)||s.register({[P]:Object.keys(vl(l)),[R]:l}),this.eo()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.zs(O),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.Te.token+s),method:"GET",timestampMode:"query",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.mi)||i.unregister(O),null==(r=this.mi)||r.register({[O]:s}),t(s)}}})}ro(){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)),{})}}eo(t){var e=this.ro(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){ll.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.zs(N)||{},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({[N]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.zs(N)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[N]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(N),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.zs(U)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[U]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(U)||{};this._instance.register({[U]:i({},e,{[t]:{}})})}else this._instance.unregister(U)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},wl={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!(null==(t=this.io)||!t.isStarted)}get status(){var t,e;return this.no===za||this.no===Ha?this.no:null!==(t=null==(e=this.io)?void 0:e.status)&&void 0!==t?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=ja,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Va.error("started without valid sessionManager"),new Error(qa+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===lt)throw new Error(qa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return mt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.oo||null==(e=this.io)||!e.isStarted){var i=!oe(Object.assign)&&!oe(Array.from);this.oo&&i?(this.ao(t),Va.info("starting")):(this.no=ja,this.stopRecording())}}ao(t){var e,i,r;this.oo&&(this.no!==za&&this.no!==Ha&&(this.no=Ba),null!=Ot&&null!=(e=Ot.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=Ot.__PosthogExtensions__)&&i.initSessionRecording?this.lo(t):null==(r=Ot.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.uo,(e=>{if(e)return Va.error("could not load recorder",e);this.lo(t)})))}stopRecording(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.stop()}ho(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.discard()}do(){var t,e;null==(t=this.mi)||t.unregister(T),null==(e=this.mi)||e.unregister(y)}co(t,e){if(he(t))return null;var i,r=de(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Va.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}vo(t){if(this.mi){var e,r,s=this.mi,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.co(null==(e=this.Te.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.co(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;he(a)&&this.do();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:oe(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.so)||e.call(this),this.so=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===za&&(this.no=Ha,Va.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.io)&&i.log?this.io.log(t,e):Va.warn("log called before recorder was ready")}get uo(){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"}fo(){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 Va.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}lo(t){var e,i;if(null==(e=Ot.__PosthogExtensions__)||!e.initSessionRecording)return Va.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[nt]:!0});if(this.io||(this.io=null==(i=Ot.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo()){if(this.no===Ha||this.no===za)return;return this.no=za,Va.info("persisted remote config is stale, requesting fresh config before starting"),void new qn(this._instance).load()}this.no=Ba,this.io.start(t)}onRRwebEmit(t){var e;null==(e=this.io)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||null==(e=this.mi)||e.register({[x]:!0}),null==(t=this.io)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||null==(e=this.mi)||e.register({[w]:!0}),null==(t=this.io)||t.overrideSampling()}overrideTrigger(t){var e,i;this.io||null==(i=this.mi)||i.register({["url"===t?E:S]:!0}),null==(e=this.io)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.io)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.io)||!i.tryAddCustomEvent(t,e))}}},xl={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Pa(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,i=se(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}wo(){if(this.isBrowserSupported()){if(mt&&wt){var t=t=>{t=t||(null==mt?void 0:mt.event);try{this.xo(t)}catch(t){Ia.error("Failed to capture event",t)}};if(Ur(wt,"submit",t,{capture:!0}),Ur(wt,"change",t,{capture:!0}),Ur(wt,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=t=>{t=t||(null==mt?void 0:mt.event);try{this.xo(t,Oa)}catch(t){Ia.error("Failed to capture copy/cut event",t)}};Ur(wt,"copy",e,{capture:!0}),Ur(wt,"cut",e,{capture:!0})}}}else Ia.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var i=e.autocapture_opt_out;ce(i)&&(this.instance.persistence&&this.instance.persistence.register({[h]:i}),this.mo=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,i=[];return null==(e=this._o)||e.forEach((e=>{var r=null==wt?void 0:wt.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[h],r=this.mo,s=this.instance.Ur()&&!this.yo;if(ue(r)&&!ce(i)&&!s)return!1;var n=null!==(e=this.mo)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!n}xo(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ws(t);cs(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())&&Is(r,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var s=e===Oa;if(r&&function(t,e,i,r,s,n){var o;if(!mt||Cs(t))return!1;if(null!=i&&i.url_allowlist&&!gs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&gs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=Ms(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(oe(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}(h,i))return!1;if(!Es(h,null==i?void 0:i.css_selector_allowlist))return!1;if(Es(h,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:$s))return!1;try{var d=mt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){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 u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(xs.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Te,s,s?["copy","cut"]:void 0,this.instance)){var n=Aa(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=n.props;if(n.explicitNoCapture)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(o.$element_selectors=a),e===Oa){var l,u=bs(null==mt||null==(l=mt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return re(null==wt?void 0:wt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(null==mt||null==(e=mt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Tr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,Tr.info("History API monitoring stopped")}monitorHistoryChanges(){mt&&mt.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(mt&&(null==(e=mt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Da;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return re(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e];re(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next}else t[e]=r.next}}catch(t){return Da}}(mt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Io(t)}))}}Io(t){try{var e,i=null==mt||null==(e=mt.location)?void 0:e.pathname;if(!i)return;i!==this.ko&&this.isEnabled&&this._instance.capture(ft,{navigation_type:t}),this.ko=i}catch(e){Tr.error("Error capturing "+t+" pageview",e)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};Ur(mt,"popstate",t),this.So=()=>{mt&&mt.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new Pa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return se(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return he(this.Te.capture_heatmaps)?he(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:!1!==this.Te.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.po)return;Ga.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval(null!==(t=this.Eo)&&void 0!==t?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:i}),this.Mo=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){Wa(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo="visible"===(null==wt?void 0:wt.visibilityState)?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){mt&&wt&&(this.Fo=this.oi.bind(this),Ur(mt,ct,this.Fo),this.Lo=t=>this.pe(t||(null==mt?void 0:mt.event)),Ur(wt,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||(null==mt?void 0:mt.event)),Ur(wt,"mousemove",this.$o,{capture:!0}),this.No=new Ys(this.instance,Js,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),Ur(wt,vt,this.Do),this.po=!0)}Po(){var t;mt&&wt&&(this.Fo&&mt.removeEventListener(ct,this.Fo),this.Lo&&wt.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&wt.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&wt.removeEventListener(vt,this.Do),clearTimeout(this.qo),null==(t=this.No)||t.stop(),this.po=!1)}jo(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&&ds(r)&&!vs(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:mt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Kt(e,s))return!0;r=Ss(r)}return!1}(ws(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}pe(t,e){var r;if(void 0===e&&(e="click"),!hs(t.target)&&Wa(t)){var s=this.jo(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Is(ws(t),this.instance.config.rageclick)&&this.Nt(i({},s,{type:"rageclick"})),this.Nt(s)}}Ao(t){!hs(t.target)&&Wa(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(mt){var e=this.Te.disable_capture_url_hashes?Ii(mt.location.href):mt.location.href,i=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...pn,...i||[]]:[],s=hn(e,r,gn);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}oi(){this.R&&!ne(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ys,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),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.Uo=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zo();if(!oe(r))if(he(null==t?void 0:t.name)||he(null==t?void 0:t.value))Ua.error("Invalid metric received",t);else if(!this.Vo||this.Vo>t.value){this.R.url!==r&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),oe(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=oe(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()});oe(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else Ua.error("Ignoring metric with value >= "+this.Vo,t)},this.Wo=()=>{if(!this.po){var t,e,i,r,s=Ot.__PosthogExtensions__;if(!oe(s)&&!oe(s.postHogWebVitalsCallbacks)){var n=s.postHogWebVitalsCallbacks;t=n.onLCP,e=n.onCLS,i=n.onFCP,r=n.onINP}t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Uo.bind(this)),this.po=!0):Ua.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!(null==(e=this._instance.persistence)||!e.props[p]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=se(this.Zo)?null==(t=this.Zo)?void 0:t.web_vitals_allowed_metrics:void 0;return he(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(se(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=se(this.Zo)?this.Zo.web_vitals_attribution:void 0;return null!=t&&t}get Vo(){var t=se(this.Zo)&&de(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:La;return t>0&&6e4>=t?La:t}get isEnabled(){var t=null==xt?void 0:xt.protocol;if("http:"!==t&&"https:"!==t)return Ua.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=se(this.Zo)?this.Zo.web_vitals:ce(this.Zo)?this.Zo:void 0;return ce(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(Ua.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=se(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=se(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:i}),this._instance.persistence.register({[m]:r})),this.Mo=i,this.startIfEnabled()}}}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Ua.error("failed to load script",e):t()}))}zo(){var t=mt?this._instance.config.disable_capture_url_hashes?Ii(mt.location.href):mt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...pn,...e||[]]:[];return hn(t,i,gn)}Ua.error("Could not determine current URL")}}},El={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var t;if(mt&&this.isEnabled&&null!=(t=Ot.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=e(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=i(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=r(this.captureException.bind(this)))}catch(t){Fa.error("failed to start",t),this.Ko()}}},this._instance=t,this.Yo=!(null==(e=this._instance.persistence)||!e.props[v]),this.Xo=new Se(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,Ge:Fa})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return se(t)?e=i({},e,t):(oe(t)?this.Yo:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Fa.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Fa.error("failed to load script",e);t()}))}Ko(){var t,e,i;null==(t=this.Go)||t.call(this),this.Go=void 0,null==(e=this.Qo)||e.call(this),this.Qo=void 0,null==(i=this.Jo)||i.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}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.Xo.consumeRateLimit(s)?Fa.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.ta=[],this.ra=new Yi([new lr,new mr,new hr,new ur,new _r,new pr,new vr,new gr],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=ar.test(l)?l.replace(ar,"$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||Qi});var r}))}(n)}}("web:javascript",rr,or)),this._instance=t,this.ta=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.ia=Er(this.na()),this.sa=new Sr(this.ia)}onConfigChange(){this.ia=Er(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.ta=n,this._instance.persistence&&this._instance.persistence.register({[c]:this.ta,[f]:o})}}}get oa(){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.ra.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!ae(t)||0===t.trim().length)return void cl.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>wr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.aa(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&cl.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.sa.add(i({[br]:t,[yr]:(new Date).toISOString()},s))}catch(t){cl.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void cl.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void cl.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void cl.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ia.enabled&&he(t.$exception_steps)?this.va(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return r&&this.sa.clear(),r}catch(t){return cl.error("Failed to capture exception event. Dropping this exception.",t),void this.sa.clear()}}catch(t){return void cl.error("Failed to process exception event. Ignoring this exception.",t)}}va(t){try{var e=this.sa.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return cl.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}ha(t){this.ia.enabled&&this.sa.add({[br]:t,[yr]:(new Date).toISOString()})}aa(t){return se(t)?i({},t):{}}na(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}ua(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return ae(i)&&i.length>0&&t.$exception_types.push(i),ae(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ta.some((t=>{var i=t.values.map((t=>{var i,r=Xo[t.operator],s=ie(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)}))}da(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://")))}ca(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}la(t){return!he(t)&&ie(t)}}},Sl=i({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var i,r;if(this.mi&&this.mi.register({[g]:!!e.productTours}),!Ka(this._instance))return!this.fa&&he(null==(i=this.mi)?void 0:i.props[H])||Ja.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.fa)||r.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&Ka(this._instance)&&this.er((()=>this.ga()))}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ja.error("Could not load product tours script",e):t()}))}ga(){var t;!this.fa&&null!=(t=Ot.__PosthogExtensions__)&&t.generateProductTours&&(this.fa=Ot.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!ie(this.pa)||e){var i=this.mi;if(i){var r=i.props[H];if(ie(r)&&!e)return this.pa=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",timestampMode:"query",callback:e=>{if(Ka(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ja.error(s),void t([],{isLoaded:!1,error:s})}var n=ie(e.json.product_tours)?e.json.product_tours:[];this.pa=n,i&&i.register({[H]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){he(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.fa)||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),null==(e=this.fa)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.fa)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.fa)||t.nextStep()}previousStep(){var t;null==(t=this.fa)||t.previousStep()}clearCache(){var t;this.pa=null,null==(t=this.mi)||t.unregister(H)}resetTour(t){var e;null==(e=this.fa)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.fa)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.fa)||e.cancelPendingTour(t)}}},yl),$l={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var i=this.globalsForEvent(e);this.ya.push(i),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return null==(t=Ot._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,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 of Object.entries(v)){var f=c[0];h[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,Ya),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),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}}wa(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)||(Qa.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)||(Qa.error("prepare_external_dependency_script returned null"),null):t}xa(){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==wt?void 0:wt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.ma++,this.ka)return this.Sa();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}))}},f=t=>{if(v.has(t))return t;var e=d.wa(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ue(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(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,p(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,p(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,p(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,p(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=p(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=f(i);return r?t.call(this,e,r):null})),this.ka=()=>{h.forEach((t=>t())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,0===this.ma&&(null==(e=this.ka)||e.call(this)))}}Ca(t,e){void 0===e&&(e=!0);var i=this.xa();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.ya.length&&(Qa.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((t=>this.Ca((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this._a)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Qa.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.Ca((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Qa.error(Xa+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Qa.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Ia(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Ca((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Qa.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.Ta(),void this._instance.on("eventCaptured",(t=>this.Ia(t)))):void Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._a)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;Ot["__$$ph_site_app_"+e]=s._instance,null==(t=Ot.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Qa.error(Xa+e,t)}))};for(var a of n.siteApps)o()}else Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},kl={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,e,i=this.Pa();i?(oe(this.Ma)&&(this.Ma=null==(t=Ot.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),oe(this.Ea)&&(this.Ea=null==(e=Ot.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Na.error("failed to load script",e);t()}))}Oa(){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}Pa(){var t=this.Oa();return ie(t)?(ie(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(ie(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;null==(t=this.Ma)||t.call(this),null==(e=this.Ea)||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Tl=i({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return oa.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(he(e))return oa.warn("Flags not loaded yet. Not loading surveys.");var i=ie(e);this.Fa=i?e.length>0:e,oa.info("flags response received, isSurveysEnabled: "+this.Fa),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(aa)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.La)oa.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)oa.info(sl);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())oa.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t){if(!oe(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var i=t.generateSurveys;if(i)return void this.Da(i,e);var r=t.loadExternalDependency;if(!r)return void this.qa(ot);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.qa("Could not load surveys script",i):this.Da(t.generateSurveys,e)}))}catch(t){throw this.qa("Error initializing surveys",t),t}finally{this.La=!1}}}else oa.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new il(this._instance),oa.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){oa.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Te.disable_surveys)return oa.info(sl),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this.Aa?this.Aa.then((e=>t(e.surveys,e.context))):("undefined"!=typeof Promise&&(this.Aa=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:e=>{var r;this.Aa=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;oa.error(n),this.Na=Date.now();var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.Na=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(na(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({[L]:l,[j]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(j);return de(t)&&Date.now()-t>3e5}Ua(){return de(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};la(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){oa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!he(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);oa.warn("init was not called")}za(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}Va(t){if(he(this._surveyManager))return{eligible:!1,reason:rl};var e="string"==typeof t?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(he(this._surveyManager))return{eligible:!1,reason:rl};var e="string"==typeof t?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(he(this._surveyManager))return oa.warn("init was not called"),{visible:!1,disabledReason:rl};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return he(this._surveyManager)?(oa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rl})):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.Wa(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(he(this._surveyManager))oa.warn("init was not called");else{var s="string"==typeof t?this.za(t):t;if(null!=s&&s.id)if(ua.includes(s.type)){var n=null==wt?void 0:wt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(oa.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;oa.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),oa.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);oa.warn("Survey element not found")}else oa.warn("Surveys of type "+s.type+" cannot be rendered in the app");else oa.warn("Survey not found")}}displaySurvey(t,e){var r;if(he(this._surveyManager))oa.warn("init was not called");else{var s=this.za(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!==Un.Popover&&e.initialResponses&&oa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Va(s);if(!o.eligible)return void oa.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==Un.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else oa.warn("Survey not found")}}cancelPendingSurvey(t){he(this._surveyManager)?oa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}},yl),Rl={toolbar:class{constructor(t){this.instance=t}Za(t){Ot.ph_toolbar_state=t}Ga(){var t;return null!==(t=Ot.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),Lr(this.instance.config))return!1;if(!mt||!wt)return!1;t=null!=t?t:mt.location,i=null!=i?i:mt.history;try{if(!e){try{mt.localStorage.setItem("test","test"),mt.localStorage.removeItem("test")}catch(t){return!1}e=null==mt?void 0:mt.localStorage}var r,s=nl||dn(t.hash,"__posthog")||dn(t.hash,"state"),n=s?Mr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Mr((()=>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(ol)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Qa(t){var e=Ot.ph_load_toolbar||Ot.ph_load_editor;!he(e)&&re(e)?e(t,this.instance):al.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==wt||!wt.getElementById(os));if(!mt||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(mt.localStorage.setItem(ol,JSON.stringify(i({},s,{source:void 0}))),2===this.Ga())this.Qa(s);else if(0===this.Ga()){var n;this.Za(1),null==(n=Ot.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return al.error("[Toolbar] Failed to load",t),void this.Za(0);this.Za(2),this.Qa(s)})),Ur(mt,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(s)}))}return!0}Ja(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)}}},Pl=i({experiments:_l},yl),Ol={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;he(e)||(ce(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||Lr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t&&!oe(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var i=t.loadExternalDependency;if(!i)return void this.tl(ot);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.tl("Could not load conversations script",e):this.el(t.initConversations),this.Ya=!1}))}catch(t){this.tl("Error initializing conversations",t),this.Ya=!1}}else gl.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),gl.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else gl.error("Cannot complete initialization: remote config is null")}tl(t,e){gl.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():gl.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ka&&!ue(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):(gl.warn(ml),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(gl.warn(ml),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(gl.warn(ml),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(gl.warn(ml),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(gl.warn(ml),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(gl.warn(ml),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gl.warn(ml),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()}Rn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Il={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=Rr("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var t,e;this.Hs=0,null==(t=this.ol)||t.onReconnect(),null==(e=this.al)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.rl=!0),mt&&Ur(mt,"online",this.sl)}ll(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=oe(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 Bi(this.ul(t,e),n,this.Ge,(()=>this.hl()),(t=>t()),void 0,r),n]}dl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.ol||this.cl!==e){var i;null==(i=this.ol)||i.reset(),this.cl=e;var r=this.ll((()=>this.Gr),(t=>{this.Gr=t}));this.ol=r[0],this.vl=r[1]}return this.ol}fl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.al||this.pl!==e){var i;null==(i=this.al)||i.reset(),this.pl=e;var r=this.ll((()=>this.nl),(t=>{this.nl=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},bl);this.al=r[0],this.gl=r[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!he(i)&&i&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],null==(t=this.ol)||t.reset(),this.nl=[],null==(e=this.al)||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))),this.al&&this.al.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.rl&&!this.il){var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ge.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(ot)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Dt.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Dt.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Tt:t=>this.Tt(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Tt(t){return new Promise((e=>{if(vn(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{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.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this._l(e),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)})}}})}}))}_l(t){(0!==t||this._instance.__loaded)&&(this.Hs=cn(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,s.LIB_NAME,(t=>{this.Gr=t})),this.nl.length>0&&this.wl(t,this.nl,this.gl,bl,(t=>{this.nl=t}))}wl(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=ji(o,Li(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,he(s)||(e.sessionStartTimestamp=s),he(n)||(e.lastActivityTimestamp=n)}if(null!=Ot&&null!=(t=Ot.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ii(Ot.location.href):Ot.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Cl={metrics:class{constructor(t){this.Ge=Rr("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.ol&&this.cl===i||(null==(e=this.ol)||e.reset(),this.cl=i,this.ol=new Vi(this.ul(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.Ge)),this.ol}count(t,e,i){void 0===e&&(e=1),this.dl().count(t,e,i)}gauge(t,e,i){this.dl().gauge(t,e,i)}histogram(t,e,i){this.dl().histogram(t,e,i)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((t=>this.Ge.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.ol)||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:t=>e.Bt(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(i({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Ml=i({},yl,wl,xl,El,Sl,$l,Tl,kl,Rl,Pl,Ol,Il,Cl);Ra.__defaultExtensionClasses=i({},Ml);var Al=Rr("[ExternalScriptsLoader]"),Fl=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Al.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==wt?void 0:wt.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(!wt)return i("document not found");var r=wt.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)wt.head.appendChild(r);else{var s,n=wt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):wt.body.appendChild(r)}};null!=wt&&wt.body?a():null==wt||wt.addEventListener("DOMContentLoaded",a)};Ot.__PosthogExtensions__=Ot.__PosthogExtensions__||{},Ot.__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)}},Ot.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Fl(t,r,i)};var Dl=function(){s.SDK_DIST_CHANNEL="npm";var t=fa[xa]=new Ra;return function(){function t(){t.done||(t.done=!0,Ea=!1,Or(fa,(function(t){t._dom_loaded()})))}null!=wt&&wt.addEventListener?"complete"===wt.readyState?t():Ur(wt,"DOMContentLoaded",t,{capture:!1}):mt&&Tr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Mn,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=Un,exports.PostHog=Ra,exports.ProductTourEventName=Ln,exports.ProductTourEventProperties=jn,exports.SurveyEventName=Dn,exports.SurveyEventProperties=Nn,exports.SurveyEventType=An,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={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Fn,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Dl,exports.posthog=Dl,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={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.407.8",s.LIB_NAME="web";var n="$people_distinct_id",o="$device_id",a="$device_model",l="__alias",u="__timers",h="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",g="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",E="$replay_override_url_trigger",S="$replay_override_event_trigger",k="$sesid",T="$session_is_sampled",R="$enabled_feature_flags",P="$active_feature_flags",O="$early_access_features",I="$feature_flag_details",C="$feature_flag_payloads",M="$feature_flag_request_id",A="$minimal_flag_called_events",F="$override_feature_flags",D="$override_feature_flag_payloads",N="$stored_person_properties",U="$stored_group_properties",L="$surveys",j="$surveys_loaded_at",B="$surveys_activated",z="$surveys_activated_session",H="ph_product_tours",q="$flag_call_reported",V="$flag_call_reported_session_id",G="$feature_flag_errors",W="$feature_flag_evaluated_at",J="$user_state",K="$client_session_props",Y="$capture_rate_limit",Q="$initial_campaign_params",X="$initial_referrer_info",Z="$initial_person_info",tt="$epp",et="$posthog_cookieless",it="$cookieless_mode",rt="$sdk_debug_extensions_init_method",st="$sdk_debug_extensions_init_time_ms",nt="$sdk_debug_recording_script_not_loaded",ot="PostHog loadExternalDependency extension not found.",at="on_reject",lt="always",ut="anonymous",ht="identified",dt="identified_only",vt="visibilitychange",ct="beforeunload",ft="$pageview",pt="$pageleave",_t="$identify",gt="$groupidentify",mt="undefined"!=typeof window?window:void 0,bt="undefined"!=typeof globalThis?globalThis:mt,yt=null==bt?void 0:bt.navigator,wt=null==bt?void 0:bt.document,xt=null==bt?void 0:bt.location,Et=null==bt?void 0:bt.fetch,St=null!=bt&&bt.XMLHttpRequest&&"withCredentials"in new bt.XMLHttpRequest?bt.XMLHttpRequest:void 0,$t=null==bt?void 0:bt.AbortController,kt=null==bt?void 0:bt.CompressionStream,Tt=null==yt?void 0:yt.userAgent;function Rt(){return!(!mt||!1===mt.navigator.onLine)}var Pt="undefined"!=typeof globalThis?globalThis:mt;Pt&&"undefined"==typeof self&&(Pt.self=Pt),Pt&&"undefined"==typeof File&&(Pt.File=function(){});var Ot=null!=mt?mt:{},It=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Ct(t){return"string"==typeof t||t}function Mt(t){return"string"==typeof t?t:void 0}var At,Ft=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Dt=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Nt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Ut=["$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"],Lt=["token"],jt="NativeGzipValidationError",Bt=t=>t.length>=2&&31===t[0]&&139===t[1],zt=(t,e)=>t===Nt.GZipJS||e===Nt.GZipJS||"gzip"===e,Ht=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),qt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=jt,e},Vt=function(){var t=e((function*(t,e){18>t.size&&qt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Bt(i)&&8===i[2]||qt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(At)return At;At=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;At[t]=e>>>0}return At})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&qt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&qt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Gt(){return Gt=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.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]))[0];return yield Vt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Gt.apply(this,arguments)}var Wt=["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"],Jt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Wt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Kt(t,e){return-1!==t.indexOf(e)}var Yt=function(t){return t.trim()},Qt=function(t){return t.replace(/^\$/,"")};function Xt(t){var e,i=[];return null!==(e=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(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var Zt=Object.prototype,te=Zt.hasOwnProperty,ee=Zt.toString,ie=Array.isArray||function(t){return"[object Array]"===ee.call(t)},re=t=>"function"==typeof t,se=t=>t===Object(t)&&!ie(t),ne=t=>{if(se(t)){for(var e in t)if(te.call(t,e))return!1;return!0}return!1},oe=t=>void 0===t,ae=t=>"[object String]"==ee.call(t),le=t=>ae(t)&&0===t.trim().length,ue=t=>null===t,he=t=>oe(t)||ue(t),de=t=>"[object Number]"==ee.call(t)&&t==t,ve=t=>de(t)&&t>0,ce=t=>"[object Boolean]"===ee.call(t),fe=t=>t instanceof FormData,pe=t=>Kt(Ut,t),_e=t=>Kt(Lt,t);function ge(t){return null===t||"object"!=typeof t}function me(t,e){return{}.toString.call(t)==="[object "+e+"]"}function be(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var ye=[!0,"true",1,"1","yes"],we=t=>Kt(ye,t),xe=[!1,"false",0,"0","no"];function Ee(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),de(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),Ee(s||i,e,i,r))}class Se{constructor(t){this.$e={},this.ze=t.ze,this.Ze=Ee(t.bucketSize,0,100,t.Ge),this.Qe=Ee(t.refillRate,0,this.Ze,t.Ge),this.Je=Ee(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var i=Math.floor((e-t.lastAccess)/this.Je);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qe,this.Ze),t.lastAccess=t.lastAccess+i*this.Je)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$e[r];return s?this.Ke(s,i):this.$e[r]=s={tokens:this.Ze,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.ze)||e.call(this,t)),0===s.tokens)}stop(){this.$e={}}}var $e="Mobile",ke="iOS",Te="Android",Re="Tablet",Pe=Te+" "+Re,Oe="iPad",Ie="Apple",Ce=Ie+" Watch",Me="Safari",Ae="BlackBerry",Fe="Samsung",De=Fe+"Browser",Ne=Fe+" Internet",Ue="Chrome",Le=Ue+" OS",je=Ue+" "+ke,Be="Internet Explorer",ze=Be+" "+$e,He="Opera",qe=He+" Mini",Ve="Edge",Ge="Microsoft "+Ve,We="Firefox",Je=We+" "+ke,Ke="Nintendo",Ye="PlayStation",Qe="Xbox",Xe=Te+" "+$e,Ze=$e+" "+Me,ti="Windows",ei=ti+" Phone",ii="Nokia",ri="Ouya",si="Generic",ni=si+" "+$e.toLowerCase(),oi=si+" "+Re.toLowerCase(),ai="Konqueror",li="Oculus Browser",ui="Vivaldi",hi="Yandex",di="Whale",vi="DuckDuckGo",ci="Pale Moon",fi="Waterfox",pi="Brave",_i="Google Search App",gi="(\\d+(\\.\\d+)?)",mi=new RegExp("Version/"+gi),bi=new RegExp(Qe,"i"),yi=new RegExp(Ye+" \\w+","i"),wi=new RegExp(Ke+" \\w+","i"),xi=new RegExp(Ae+"|PlayBook|BB10","i"),Ei={"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"},Si=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?pi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Kt(t,"GSA/")?_i:Kt(t," OPR/")&&Kt(t,"Mini")?qe:Kt(t," OPR/")?He:xi.test(t)?Ae:Kt(t,"IE"+$e)||Kt(t,"WPDesktop")?ze:Kt(t,"OculusBrowser")?li:Kt(t,De)?Ne:Kt(t,Ve)||Kt(t,"Edg/")?Ge:Kt(t,ui+"/")?ui:Kt(t,"YaBrowser/")?hi:Kt(t,di+"/")?di:Kt(t,vi+"/")||Kt(t,"Ddg/")?vi:Kt(t,"FBIOS")?"Facebook "+$e:Kt(t,"UCWEB")||Kt(t,"UCBrowser")?"UC Browser":Kt(t,"CriOS")?je:Kt(t,"CrMo")||Kt(t,Ue)?Ue:Kt(t,Te)&&Kt(t,Me)?Xe:Kt(t,"FxiOS")?Je:Kt(t.toLowerCase(),ai.toLowerCase())?ai:Kt(t,pi+"/")?pi:((t,e)=>e&&Kt(e,Ie)||function(t){return Kt(t,Me)&&!Kt(t,Ue)&&!Kt(t,Te)}(t))(t,e)?Kt(t,$e)?Ze:Me:Kt(t,"PaleMoon/")?ci:Kt(t,fi+"/")?fi:Kt(t,We)?We:Kt(t,"MSIE")||Kt(t,"Trident/")?Be:Kt(t,"Gecko")?We:"")},$i={[ze]:[new RegExp("rv:"+gi)],[Ge]:[new RegExp(Ve+"?\\/"+gi)],[Ue]:[new RegExp("("+Ue+"|CrMo)\\/"+gi)],[je]:[new RegExp("CriOS\\/"+gi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+gi)],[Me]:[mi],[Ze]:[mi],[He]:[new RegExp("(Opera|OPR)\\/"+gi)],[We]:[new RegExp(We+"\\/"+gi)],[Je]:[new RegExp("FxiOS\\/"+gi)],[ai]:[new RegExp("Konqueror[:/]?"+gi,"i")],[Ae]:[new RegExp(Ae+" "+gi),mi],[Xe]:[new RegExp("android\\s"+gi,"i")],[Ne]:[new RegExp(De+"\\/"+gi)],[li]:[new RegExp("OculusBrowser\\/"+gi)],[ui]:[new RegExp(ui+"\\/"+gi)],[hi]:[new RegExp("YaBrowser\\/"+gi)],[di]:[new RegExp(di+"\\/"+gi)],[pi]:[new RegExp(pi+"\\/"+gi)],[vi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+gi)],[ci]:[new RegExp("PaleMoon\\/"+gi)],[fi]:[new RegExp(fi+"\\/"+gi)],[_i]:[new RegExp("GSA\\/"+gi)],[Be]:[new RegExp("(rv:|MSIE )"+gi)],Mozilla:[new RegExp("rv:"+gi)]},ki=function(t,e,i,r){var s=Si(t,e,i,r),n=$i[s];if(oe(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},Ti=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),t=>[Qe,t&&t[1]||""]],[new RegExp(Ke,"i"),[Ke,""]],[new RegExp(Ye,"i"),[Ye,""]],[xi,[Ae,""]],[new RegExp(ti,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ei,""];if(new RegExp($e).test(e)&&!/IEMobile\b/.test(e))return[ti+" "+$e,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ei[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ti,r]}return[ti,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ke,[t[3],t[4],t[5]||"0"].join(".")]:[ke,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=oe(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Te+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Te+")","i"),t=>t&&t[2]?[Te,[t[2],t[3],t[4]||"0"].join(".")]:[Te,""]],[/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/,[Le,""]],[/Linux|debian/i,["Linux",""]]],Ri=function(t){return wi.test(t)?Ke:yi.test(t)?Ye:bi.test(t)?Qe:new RegExp(ri,"i").test(t)?ri:new RegExp("("+ei+"|WPDesktop)","i").test(t)?ei:/iPad/.test(t)?Oe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ce:xi.test(t)?Ae:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ii,"i").test(t)?ii:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp($e).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Te:Pe:new RegExp("(pda|"+$e+")","i").test(t)?ni:new RegExp(Re,"i").test(t)&&!new RegExp(Re+" pc","i").test(t)?oi:""},Pi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Oi(t,e){return"string"==typeof(i=t)&&Pi.test(i)?t:e();var i}function Ii(t){return t?t.split("#")[0]:t}function Ci(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var Mi=t=>t instanceof Error,Ai={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}},Fi=Ai.info;function Di(t){if(ce(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(ie(t))return{arrayValue:{values:t.map((t=>Di(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ni(t){var e=[];for(var i in t){var r=t[i];ue(r)||oe(r)||e.push({key:i,value:Di(r)})}return e}function Ui(t,e){var r=Ai[t.level||"info"]||Fi,s=r.text,n=r.number,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),he(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),he(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:Ni(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),oe(t.trace_flags)||(u.flags=t.trace_flags),u}function Li(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 ji(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ni(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Bi=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=i,this.Ye=r,this.Xe=s,this.et=n,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.wt(t);if(null!==e)if(e.body){if(this.xt()){var i={record:Ui(e,this.Ye())};this.Xe((()=>this.kt(i)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var i=ie(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ge.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ge.error("Error in beforeSend function for log:",t),null}return r}xt(){if(void 0===this.yt)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return e((function*(){var e;t.bt();var i=null!==(e=t._instance.getPersistedProperty(Dt.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.it=0;var a=Math.min(i.length,t.vt),l=i.slice(0,a),u=ji(l.map((t=>t.record)),t.Ct(),null!==(n=t.tt)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.Tt(u);if("too-large"===h.kind&&l.length>1)t.vt=Math.max(1,Math.floor(l.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.vt);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ge.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.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(l.length),i=null!==(o=t._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}It(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.it),s=null!==(e=i._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Dt.LogsQueue,s.slice(r)),yield i.et()}))()}Ct(){return Li(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Dt.LogsQueue))&&void 0!==e?e:[];this.dt>i.length||(i.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Dt.LogsQueue,i),this.ht>i.length?this.Mt():this._t()}}Mt(t){void 0===t&&(t=this.ct),this.Et||(this.Et=Ci((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(Dt.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.bt();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ci(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ci((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}};var zi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Hi(t){return String(t)+"000000"}function qi(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let Vi=class{constructor(t,e,i){this._instance=t,this.Te=e,this.Ge=i,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,i){void 0===e&&(e=1),this.Nt({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Nt({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Nt({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.rt,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.Dt()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.rt===s&&(this.rt=null)}));return this.rt=s,s}drainWindow(){if(0===this.Ot.size)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=qi(e.type,e.name,e.unit,r)}catch(t){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Ot.get(s);if(!n){if(!this.jt())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(s,n)}var o=this.Lt.get(e.name);void 0===o?this.Lt.set(e.name,e.type):o===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(n,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(zi.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,zi)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var i=ie(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ge.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.Ge.error("Error in beforeSend function for metric:",t),null}return r}Mt(){this.Et||(this.Et=Ci((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return e((function*(){if(0!==t.Ot.size){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var i=t.At,r=yield t._instance.Bt(t.qt(e));if(i===t.At)switch(r.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",r.error)}}}))()}qt(t){return e=this.zt(t),r=function(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})}(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ni(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}zt(t){var e=Hi(Date.now()),r=new Map;for(var s of t.values()){var n,o=qi(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=Ni(null!==(n=s.attributes)&&void 0!==n?n:{}),u=Hi(s.windowStartMs);if("count"===s.type){var h,d={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(h=s.total)&&void 0!==h?h:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:zi})}return Array.from(r.values())}Ut(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.Ot.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.jt()&&this.Ot.set(s,n)}}};var Gi,Wi,Ji;function Ki(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Ji&&i.length===Wi||(Wi=i.length,Ji=i.reduce(((i,r)=>{Gi||(Gi={});var s=Gi[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,Gi[r]=[l,u];break}}return i}),{})),Ji}}class Yi{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&&ie(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:Ki(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 Qi="?";function Xi(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Qi:i,in_app:!0};return oe(r)||(n.lineno=r),oe(s)||(n.colno=s),n}var Zi=(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]:Qi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},tr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,er=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ir=/\((\S*)(?::(\d+))(?::(\d+))\)/,rr=(t,e)=>{var i=tr.exec(t);if(i)return Xi(e,i[1],Qi,+i[2],+i[3]);var r=er.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ir.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Zi(r[1]||Qi,r[2]);return Xi(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},sr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,or=(t,e)=>{var i=sr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=nr.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]||Qi,o=Zi(n,s);return Xi(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ar=/\(error: (.*)\)/;class lr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=ae(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 me(t,"DOMException")}isDOMError(t){return me(t,"DOMError")}}class ur{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 hr{constructor(){}match(t){return me(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 dr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class vr{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(dr);return r&&(e=r[1],i=r[2]),[e,i]}}var cr=["fatal","error","warning","log","info","debug"];function fr(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 pr{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 be(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: "+fr(t)}isSeverityLevel(t){return ae(t)&&!le(t)&&cr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Mi(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class _r{match(t){return be(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+fr(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class gr{match(t){return ge(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 mr{match(t){return me(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!be(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 ge(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 br="$message",yr="$timestamp",wr=new Set([br,yr]),xr={enabled:!0,max_bytes:32768};function Er(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:xr.enabled,max_bytes:$r(t.max_bytes,xr.max_bytes)}:i({},xr)}class Sr{constructor(t){this.Vt=[],this.Wt=0,this.Te=Er(t)}setConfig(t){this.Te=Er(t),this.Zt()}add(t){var e=function(t){var e;try{e=Xt(t)}catch(t){return}try{var i=JSON.parse(e);if(!se(i))return;var r=i,s=r[br],n=r[yr];if(!ae(s)||0===s.trim().length)return;if(!ae(n)&&!de(n))return;return{step:r,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.Te.max_bytes||(this.Vt.push({step:e.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((t=>t.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var t=this.Vt.shift();t&&(this.Wt-=t.bytes)}}}function $r(t,e){if(!de(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var kr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={k(e){if(mt&&(s.DEBUG||mt.POSTHOG_DEBUG||i)&&!oe(mt.console)&&mt.console){for(var r=("__rrweb_original__"in mt.console[e]?mt.console[e].__rrweb_original__:mt.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>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)=>kr(t+" "+e,i)};return r},Tr=kr("[PostHog.js]"),Rr=Tr.createLogger;function Pr(t,e){ie(t)&&t.forEach(e)}function Or(t,e){if(!he(t))if(ie(t))t.forEach(e);else if(fe(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)te.call(t,i)&&e(t[i],i)}var Ir=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 Cr(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 Mr=function(t){try{return t()}catch(t){return}},Ar=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){Tr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Tr.critical(t)}}},Fr=function(t){var e={};return Or(t,(function(t,i){(ae(t)&&t.length>0||de(t))&&(e[i]=t)})),e};var Dr=["herokuapp.com","vercel.app","netlify.app"];function Nr(t){var e=null==t?void 0:t.hostname;if(!ae(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Dr)if(i===r)return!1;return!0}function Ur(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function Lr(t){return"ph_toolbar_internal"===t.name}var jr=t=>{if(wt){try{for(var e=t+"=",i=wt.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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return de(t)&&isFinite(t)&&Math.floor(t)===t});class Br{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/256,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 Br(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 Br(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 zr{generate(){var t=this.generateOrAbort();if(!oe(t))return t;this.S=0;var e=this.generateOrAbort();if(oe(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Br.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new Vr}}var Hr,qr=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};mt&&!oe(mt.crypto)&&crypto.getRandomValues&&(qr=t=>crypto.getRandomValues(t));class Vr{nextUint32(){return this.R.length>this.O||(qr(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Gr=()=>Wr().toString(),Wr=()=>(Hr||(Hr=new zr)).generate(),Jr="",Kr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Yr={N:()=>!!wt,D(t){Tr.error("cookieStore error: "+t)},A:jr,F(t){var e;try{e=JSON.parse(Yr.A(t))||{}}catch(t){}return e},q(t,e,i,r,s){if(!wt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=wt),Jr)return Jr;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_"+Gr();!Jr&&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",Jr=n)}return Jr}(t);if(!i){var r=(t=>{var e=t.match(Kr);return e?e[0]:""})(t);r!==i&&Tr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(wt.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&&Tr.warn("cookieStore warning: large cookie, len="+u.length),wt.cookie=u,!0}catch(t){return!1}},P(t,e){if(null!=wt&&wt.cookie)try{Yr.q(t,"",-1,e)}catch(t){return}}},Qr=null,Xr={N(){if(!ue(Qr))return Qr;var t=!0;if(oe(mt))t=!1;else try{var e="__mplssupport__";Xr.q(e,"xyz"),'"xyz"'!==Xr.A(e)&&(t=!1),Xr.P(e)}catch(e){t=!1}return t||Tr.error("localStorage unsupported; falling back to cookie store"),Qr=t,t},D(t){Tr.error("localStorage error: "+t)},A(t){try{return null==mt?void 0:mt.localStorage.getItem(t)}catch(t){Xr.D(t)}return null},F(t){try{return JSON.parse(Xr.A(t))||{}}catch(t){}return null},q(t,e){try{return null==mt||mt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Xr.D(t)}return!1},P(t){try{null==mt||mt.localStorage.removeItem(t)}catch(t){Xr.D(t)}}},Zr=[o,"distinct_id",k,T,tt,Z,J],ts={},es={N:()=>!0,D(t){Tr.error("memoryStorage error: "+t)},A:t=>ts[t]||null,F:t=>ts[t]||null,q:(t,e)=>(ts[t]=e,!0),P(t){delete ts[t]}},is=null,rs={N(){if(!ue(is))return is;if(is=!0,oe(mt))is=!1;else try{var t="__support__";rs.q(t,"xyz"),'"xyz"'!==rs.A(t)&&(is=!1),rs.P(t)}catch(t){is=!1}return is},D(t){Tr.error("sessionStorage error: ",t)},A(t){try{return null==mt?void 0:mt.sessionStorage.getItem(t)}catch(t){rs.D(t)}return null},F(t){try{return JSON.parse(rs.A(t))||null}catch(t){}return null},q(t,e){try{return null==mt||mt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){rs.D(t)}return!1},P(t){try{null==mt||mt.sessionStorage.removeItem(t)}catch(t){rs.D(t)}}};class ss{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===lt||this.isRejected()||-1===this.consent&&this.Te.cookieless_mode===at}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Jt.q(this.Kt,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Qt(){var t=this.Jt.A(this.Kt);return we(t)?1:Kt(xe,t)?0:-1}get Jt(){var t=this.Te.opt_out_capturing_persistence_type,e="localStorage"===t?Xr:Yr;if(!this.Yt||this.Yt!==e){this.Yt=e;var i="localStorage"===t?Yr:Xr;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(we(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[null==yt?void 0:yt.doNotTrack,null==yt?void 0:yt.msDoNotTrack,Ot.doNotTrack].some((t=>we(t)))}}function ns(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!re(r))return e;try{var s=r(e);return ae(s)&&s?s:e}catch(t){return Tr.error("Error in get_current_url, falling back to window.location.href",t),e}}var os="__POSTHOG_TOOLBAR__",as=1,ls=3,us=11;function hs(t){return t instanceof Element&&(t.id===os||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ds(t){return!!t&&t.nodeType===as}function vs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function cs(t){return!!t&&t.nodeType===ls}function fs(t){return!!t&&t.nodeType===us&&ds(t.host)}var ps=1e3;function _s(t){return t?Yt(t).split(/\s+/):[]}function gs(t,e){var i=function(t){var e,i=null==mt||null==(e=mt.location)?void 0:e.href;return oe(i)?void 0:ns(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function ms(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 _s(e)}function bs(t){return he(t)?null:Yt(t).split(/(\s+)/).filter((t=>zs(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ys(t){var e="";return As(t)&&!Fs(t)&&t.childNodes&&t.childNodes.length&&Or(t.childNodes,(function(t){var i;cs(t)&&t.textContent&&(e+=null!==(i=bs(t.textContent))&&void 0!==i?i:"")})),Yt(e)}function ws(t){var e;return oe(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var xs=["a","button","form","input","select","textarea","label"];function Es(t,e){if(oe(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 Ss(t){var e=t.parentNode;return!(!e||!ds(e))&&e}var $s=[".ph-no-autocapture","[data-ph-no-autocapture]"],ks=["next","previous","prev",">","<"],Ts=[...ks,"+","-","−","–"],Rs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Ps=[".ph-no-rageclick",".ph-no-capture"],Os=["","text","search","email","password","url","tel","number"];function Is(t,e){if(!mt||Cs(t))return!1;var i,r,s,n,o;if(ce(e)?(i=!!e&&Ps,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ps,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||!ds(t))&&(!!vs(t,"textarea")||(vs(t,"input")?Kt(Os,(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 a=Ms(t,!1).targetElementList;return!function(t,e){if(!1===t||oe(t))return!1;var i;if(!0===t)i=ks;else{if(!ie(t))return!1;if(t.length>10)return Tr.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 e=t.safeText,r=t.ariaLabel;return i.some((t=>Rs(e,t)||Rs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:ys(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Es(a,i)}var Cs=t=>!t||vs(t,"html")||!ds(t),Ms=(t,e)=>{if(!mt||Cs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!vs(s,"body");)if(fs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Ss(s);if(!n)break;if(e||xs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=mt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function As(t){for(var e=new Set,i=0,r=t;r.parentNode&&!vs(r,"body");r=r.parentNode){if(i++>=ps||e.has(r))return!1;e.add(r);var s=ms(r);if(Kt(s,"ph-sensitive")||Kt(s,"ph-no-capture"))return!1}if(Kt(ms(t),"ph-include"))return!0;var n=t.type||"";if(ae(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ae(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Fs(t){return!!(vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||vs(t,"select")||vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ds="(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})",Ns=new RegExp("^(?:"+Ds+")$"),Us=new RegExp(Ds),Ls="\\d{3}-?\\d{2}-?\\d{4}",js=new RegExp("^("+Ls+")$"),Bs=new RegExp("("+Ls+")");function zs(t,e){if(void 0===e&&(e=!0),he(t))return!1;if(ae(t)){if(t=Yt(t),(e?Ns:Us).test((t||"").replace(/[- ]/g,"")))return!1;if((e?js:Bs).test(t))return!1}return!0}function Hs(t){var e=ys(t);return zs(e=(e+" "+qs(t)).trim())?e:""}function qs(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Or(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ys(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+qs(t)).trim())}catch(t){Tr.error("[AutoCapture]",t)}})),e}function Vs(t){return t.replace(/"|\\"/g,'\\"')}function Gs(t){var e=t.attr__class;if(e)return ie(e)?e:_s(e)}var Ws=Rr("[Dead Clicks]"),Js=()=>!0,Ks=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(_)),r=t.instance.config.capture_dead_clicks;return ce(r)?r:!!se(r)||i};class Ys{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[_]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Ws.error("failed to load script",e):t()}))}tr(){var t;if(wt){if(!this.Xt&&null!=(t=Ot.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=se(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Xt=Ot.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Xt.start(wt),Ws.info("starting...")}}else Ws.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,Ws.info("stopping..."))}}var Qs=Rr("[SegmentIntegration]");var Xs="posthog-js";function Zs(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,h=void 0===u||u;return e=>{var r,a,u,d,v;if("*"!==l&&!l.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 f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.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==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),h&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class tn{constructor(t,e,i,r,s,n){this.name=Xs,this.setupOnce=function(o){o(Zs(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class en{constructor(t){this.rr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Tr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.rr)}destroy(){var t;null==(t=this.sr)||t.call(this),this.sr=void 0}doPageView(t,e){var i,r=this.ar(t,e);return this.ir={pathname:null!==(i=null==mt?void 0:mt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.ar(t,null==(e=this.ir)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ir)?void 0:t.pageViewId}}ar(t,e){var i=this.ir;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 n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,h=s.maxContentY;if(!(oe(n)||oe(o)||oe(a)||oe(l)||oe(u)||oe(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?Ee(o/n,0,1,Tr):1,v=n>1?Ee(a/n,0,1,Tr):1,c=l>1?Ee(u/l,0,1,Tr):1,f=l>1?Ee(h/l,0,1,Tr):1;r=Ir(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:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var rn=["flags","surveys"],sn={[n]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[T]:{exposure:"event"},[y]:{exposure:"event",shouldSkipFromEventProperties:t=>ue(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"},[R]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!se(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[P]:{exposure:"event",storageGroup:"flags"},[O]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"event",storageGroup:"flags"},[M]:{exposure:"event",storageGroup:"flags",volatile:!0},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"event"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[U]:{exposure:"hidden"},[L]:{exposure:"hidden",storageGroup:"surveys"},[j]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[B]:{exposure:"event"},[z]:{exposure:"hidden"},[H]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[rt]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{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"}},nn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],on=t=>{var e=sn[t];if(e)return e;for(var i of nn){var r=i[1];if(0===t.indexOf(i[0]))return r}},an=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return Xt(t)}},ln=t=>{var e=null==wt?void 0:wt.createElement("a");return oe(e)?null:(e.href=t,e)},un=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(!ie(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Tr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},hn=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("=");ie(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},dn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},vn=(t,e)=>t>=e&&Rt(),cn=(t,e,i,r)=>{if(0===t){if(Rt()){var s=e+1;return s===i&&r(),s}return e}return 0},fn="https?://(.*)",pn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...pn],gn="<masked>",mn=["li_fat_id"];function bn(t,e,i){if(!wt)return{};var r,s=e?[...pn,...i||[]]:[],n=yn(hn(wt.URL,s,gn),t),o=(r={},Or(mn,(function(t){var e=jr(t);r[t]=e||null})),r);return Ir(o,n)}function yn(t,e){var i=_n.concat(e||[]),r={};return Or(i,(function(e){var i=un(t,e);r[e]=i||null})),r}function wn(t){var e=function(t){return t?0===t.search(fn+"google.([^/?]*)")?"google":0===t.search(fn+"bing.com")?"bing":0===t.search(fn+"yahoo.com")?"yahoo":0===t.search(fn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ue(e)){r.$search_engine=e;var s=wt?un(wt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function xn(){return navigator.language||navigator.userLanguage}var En="$direct";function Sn(){return(null==wt?void 0:wt.referrer)||En}function $n(t,e,i){void 0===i&&(i=!1);var r=t?[...pn,...e||[]]:[],s=i?Ii(null==xt?void 0:xt.href):null==xt?void 0:xt.href,n=null==s?void 0:s.substring(0,1e3);return{r:Sn().substring(0,1e3),u:n?hn(n,r,gn):void 0}}function kn(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Ii(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==En?En:null==(i=ln(r))?void 0:i.host};if(n){o.$current_url=n;var a=ln(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=yn(n);Ir(o,l)}if(r){var u=wn(r);Ir(o,u)}return o}function Tn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Rn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Pn={flags:W,surveys:j},On=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],In="main";class Cn{constructor(t,e,r){if(void 0===r&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=!1,this.vr=(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.Jt=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Tr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),mt){var s=()=>this.flush();Ur(mt,"beforeunload",s,{capture:!1}),Ur(mt,"pagehide",s,{capture:!1})}}mr(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return de(e)&&e>0?e:0}isDisabled(){return!!this.yr}pr(t){-1===On.indexOf(t.persistence.toLowerCase())&&(Tr.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=[...Zr,...t];return i({},Xr,{F(t){try{var i={};try{i=Yr.F(t)||{}}catch(t){}var r,s=JSON.parse(Xr.A(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ue(a)||""===a||(n[o]=a)}r=Ir(s,n)}else r=Ir(i,s);return Xr.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Xr.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Yr.q(t,l,i,s,n,o)}catch(t){Xr.D(t)}return a},P(t,e){try{null==mt||mt.localStorage.removeItem(t),Yr.P(t,e)}catch(t){Xr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Xr.N()?(e=Xr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&rs.N()?e=rs:"memory"===n?e=es:"cookie"===n?e=Yr:r.N()?(e=r,s=!0):e=Yr,this.ur=s,e}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var e=null!=t?t:this.Te.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[W];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Or(this.props,((e,i)=>{var r=on(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===R?()=>this._r():()=>!1))return;r.transformToEventProperties&&Ir(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.yr){var t=this.Jt.F(this.vr);t&&(this.props=Ir({},t)),this.hr&&this.wr()}}wr(){for(var t of rn){var e=Xr.F(this.br(t));if(e&&!ne(e)){var i=this.kr(t);i.persisted=!0,this.Sr(t)||(i.fingerprint=this.Cr(e,t)),this.Tr(t,e)||Ir(this.props,e)}}}Sr(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=on(e))?void 0:i.storageGroup)===t}))}Tr(t,e){var i=Pn[t];if(!i)return!1;var r=e[i],s=this.props[i];return de(r)&&de(s)&&s>r}refreshKey(t){var e;if(!this.yr){var i=this.hr?null==(e=on(t))?void 0:e.storageGroup:void 0,r=i?Xr.F(this.br(i)):this.Jt.F(this.vr);if(r&&t in r)this.Ir(t,r[t]);else{if(i){var s=this.Jt.F(this.vr);if(s&&t in s)return void this.Ir(t,s[t])}this.Mr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?oe(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){oe(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,In))}Pr(){var t=this.Fr(),e=t.main,i=t.groups;for(var r of(this.Or(this.Jt,this.vr,e,In),rn)){var s,n=i[r];(!ne(n)||null!=(s=this.lr[r])&&s.persisted)&&this.Or(Xr,this.br(r),n,r)}}Fr(){var t={},e={flags:{},surveys:{}};return Or(this.props,((i,r)=>{var s,n=null==(s=on(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Cr(t,e){if(e===In)return JSON.stringify(t)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return Or(t,((t,e)=>{var r;i[e]=null!=(r=on(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Or(t,e,i,r){var s=this.kr(r);if(r===In||s.dirty||oe(s.fingerprint)){var n;try{if((n=this.Cr(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,r!==In&&(s.persisted=!0),oe(n)||(s.fingerprint=n)):this.Te.debug&&Tr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(oe(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var r of rn)Xr.P(this.br(r));i?delete this.lr[In]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(se(t)){oe(e)&&(e="None"),this.Lr=oe(i)?this.Nr:i;var r=!1;if(Or(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ir(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(se(t)){this.Lr=oe(e)?this.Nr:e;var i=!1;if(Or(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Ir(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Mr(t),this.save())}update_campaign_params(){if(!this.cr){var t=bn(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);ne(Fr(t))||this.register(t),this.cr=!0}}update_search_keyword(){var t;this.register((t=null==wt?void 0:wt.referrer)?wn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Sn(),$referring_domain:null!=wt&&wt.referrer&&(null==(t=ln(wt.referrer))?void 0:t.host)||En},void 0)}set_initial_person_info(){this.props[Q]||this.props[X]||this.register_once({[Z]:$n(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Or([X,Q],(e=>{var i=this.props[e];i&&Or(i,(function(e,i){t["$initial_"+Qt(i)]=e}))}));var e=this.props[Z];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=kn(t,e),r={};return Or(i,(function(t,e){r["$initial_"+Qt(e)]=t})),r}(e,this.Te.disable_capture_url_hashes);Ir(t,i)}return t}safe_merge(t){return Or(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.Nr=this.Lr=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.pr(t):this.Jt,n=this.gr(t);if(r||n!==this.hr){var o=this.props;this.clear(),this.Jt=s,this.hr=n,this.props=o,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ar&&(this.Ar=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.Ir(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return oe(i)||(delete e[t],this.Ir(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ir(t,e),this.save()}Ir(t,e){var i;this.props[t]=e,null!=(i=on(t))&&i.volatile||this.Dr(t)}Mr(t){delete this.props[t],this.Dr(t)}Dr(t){var e,i=null==(e=on(t))?void 0:e.storageGroup;i&&(this.kr(i).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}var Mn={GZipJS:"gzip-js",Base64:"base64"},An={Activation:"events",Cancellation:"cancelEvents"},Fn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Dn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Nn={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"},Un={Popover:"popover",Inline:"inline"},Ln={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"},jn={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"},Bn=Rr("[RateLimiter]");class zn{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=>{Bn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Bn.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 s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Y))&&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(Y,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Hn=Rr("[RemoteConfig]");class qn{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Ot._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}qr(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(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 Hn.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void Hn.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Hn.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Hr(t),this.Br()}));this.Hr(t),this.Br()}))}catch(t){Hn.error("Error loading remote config",t)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&wt&&"hidden"!==wt.visibilityState&&this._instance.reloadFeatureFlags()}Br(){var t;if(!this.zr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.zr=setInterval((()=>{this.refresh()}),e))}}Hr(t){var e;t||Hn.error("Failed to fetch remote config from PostHog."),this._instance.Hr(t?{ok:!0,config:t}:{ok:!1}),!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 Vn=Uint8Array,Gn=Uint16Array,Wn=Uint32Array,Jn=new Vn([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]),Kn=new Vn([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]),Yn=new Vn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qn=function(t,e){for(var i=new Gn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Wn(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]},Xn=Qn(Jn,2),Zn=Xn[1];Xn[0][28]=258,Zn[258]=28;for(var to=Qn(Kn,0)[1],eo=new Gn(32768),io=0;32768>io;++io){var ro=(43690&io)>>>1|(21845&io)<<1;eo[io]=((65280&(ro=(61680&(ro=(52428&ro)>>>2|(13107&ro)<<2))>>>4|(3855&ro)<<4))>>>8|(255&ro)<<8)>>>1}var so=function(t,e,i){for(var r=t.length,s=0,n=new Gn(e);r>s;++s)++n[t[s]-1];var o,a=new Gn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Gn(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[eo[d]>>>l]=u}else for(o=new Gn(r),s=0;r>s;++s)o[s]=eo[a[t[s]-1]++]>>>15-t[s];return o},no=new Vn(288);for(io=0;144>io;++io)no[io]=8;for(io=144;256>io;++io)no[io]=9;for(io=256;280>io;++io)no[io]=7;for(io=280;288>io;++io)no[io]=8;var oo=new Vn(32);for(io=0;32>io;++io)oo[io]=5;var ao=so(no,9,0),lo=so(oo,5,0),uo=function(t){return(t/8>>0)+(7&t&&1)},ho=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Gn?Gn:t instanceof Wn?Wn:Vn)(i-e);return r.set(t.subarray(e,i)),r},vo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},co=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},fo=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 Vn(0),0];if(1==s){var o=new Vn(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 Gn(v+1),f=po(i[h-1],c,0);if(f>e){r=0;var p=0,_=f-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;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}f=e}return[new Vn(c),f]},po=function(t,e,i){return-1==t.s?Math.max(po(t.l,e,i+1),po(t.r,e,i+1)):e[t.s]=i},_o=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Gn(++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]},go=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mo=function(t,e,i){var r=i.length,s=uo(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)},bo=function(t,e,i,r,s,n,o,a,l,u,h){vo(e,h++,i),++s[256];for(var d=fo(s,15),v=d[0],c=d[1],f=fo(n,15),p=f[0],_=f[1],g=_o(v),m=g[0],b=g[1],y=_o(p),w=y[0],x=y[1],E=new Gn(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=fo(E,7),T=k[0],R=k[1],P=19;P>4&&!T[Yn[P-1]];--P);var O,I,C,M,A=u+5<<3,F=go(s,no)+go(n,oo)+o,D=go(s,v)+go(n,p)+o+14+3*P+go(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(F>=A&&D>=A)return mo(e,h,t.subarray(l,l+u));if(vo(e,h,1+(F>D)),h+=2,F>D){O=so(v,c,0),I=v,C=so(p,_,0),M=p;var N=so(T,R,0);for(vo(e,h,b-257),vo(e,h+5,x-1),vo(e,h+10,P-4),h+=14,S=0;P>S;++S)vo(e,h+3*S,T[Yn[S]]);h+=3*P;for(var U=[m,w],L=0;2>L;++L){var j=U[L];for(S=0;j.length>S;++S)vo(e,h,N[B=31&j[S]]),h+=T[B],B>15&&(vo(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=ao,I=no,C=lo,M=oo;for(S=0;a>S;++S)if(r[S]>255){var B;co(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(vo(e,h,r[S]>>>23&31),h+=Jn[B]);var z=31&r[S];co(e,h,C[z]),h+=M[z],z>3&&(co(e,h,r[S]>>>5&8191),h+=Kn[z])}else co(e,h,O[r[S]]),h+=I[r[S]];return co(e,h,O[256]),h+I[256]},yo=new Wn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wo=function(){for(var t=new Wn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xo=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Eo(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=wo[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 Vn(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=mo(l,u,t.subarray(h,d)):(l[h]=!0,u=mo(l,u,t.subarray(h,o)))}else{for(var v=yo[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new Gn(32768),g=new Gn(p+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},w=new Wn(25e3),x=new Gn(288),E=new Gn(32),S=0,k=0,T=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var M=o-h;if((S>7e3||T>24576)&&M>423){u=bo(t,l,0,w,x,E,k,T,P,h-P,u),T=S=k=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var F=2,D=0,N=f,U=I-C&32767;if(M>2&&O==y(h-U))for(var L=Math.min(c,M)-1,j=Math.min(32767,h),B=Math.min(258,M);j>=U&&--N&&I!=C;){if(t[h+F]==t[h+F-U]){for(var z=0;B>z&&t[h+z]==t[h+z-U];++z);if(z>F){if(F=z,D=U,z>L)break;var H=Math.min(U,z-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,G=V-_[V]+32768&32767;G>q&&(q=G,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[T++]=268435456|Zn[F]<<18|to[D];var W=31&Zn[F],J=31&to[D];k+=Jn[W]+Kn[J],++x[257+W],++E[J],R=h+F,++S}else w[T++]=t[h],++x[t[h]]}}u=bo(t,l,!0,w,x,E,k,T,P,h-P,u)}return ho(a,0,r+uo(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&&xo(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),xo(u,h-8,i.d()),xo(u,h-4,r),u}var So=!!St||!!Et,$o="text/plain",ko=!1,To=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Ro=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),u=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Or(t,(function(t,e){oe(t)||oe(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)}(l);return h&&u.push(h),u.length>0?o+"?"+u.join("&"):o},Po=t=>{if(t.Vr)return t.Vr;var e=t.data,i=t.compression;if(e){if(i===Mn.GZipJS){var r=Eo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Vn(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 Vn(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 ho(r,0,s)}(an(e)),{mtime:0});return{contentType:$o,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Mn.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(an(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:an(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=an(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Oo=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Ro(t.url,{compression:Mn.Base64}),encodedBody:Po(i({},t,{compression:Mn.Base64,Vr:void 0}))}:{url:To(t.url,"compression"),encodedBody:Po(i({},t,{compression:void 0,Vr:void 0}))};try{e=Po(t)}catch(e){if(zt(t.compression,un(t.url,"compression")))return Tr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&zt(t.compression,un(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Bt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Bt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(ko=!0,s()):{url:t.url,encodedBody:e}},Io=t=>{try{return Oo(t)}catch(e){return Tr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Co=function(){var t=e((function*(t){var e=an(t.data),r=yield function(t,e,i){return Gt.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{Vr:{contentType:$o,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Mo=/Failed to fetch|NetworkError|Load failed/i,Ao=t=>{var e=Io(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Or(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if($t){var v=new $t;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)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||(t=>"TypeError"===(null==t?void 0:t.name)&&Mo.test((null==t?void 0:t.message)||""))(e)?Tr.warn(e):Tr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;Et(r,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Wr&&52428.8>(l||0),body:a,signal:null==(f=h)?void 0:f.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){Tr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>h?clearTimeout(h.timeout):null))}catch(t){h&&clearTimeout(h.timeout),c(t)}}},Fo=t=>{try{var e,r=Oo(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(yt.sendBeacon(s,u))return;var h=ie(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(ie(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>ie(t.data)?e:i({},t.data,{batch:e});return Fo(i({},t,{data:v(h.slice(0,d))})),void Fo(i({},t,{data:v(h.slice(d))}))}Tr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ao(i({},t,{Wr:!0}))}catch(t){Tr.warn("Beacon send failed",t)}},Do=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Ro(r===Mn.GZipJS?To(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Mn.GZipJS?{}:{compression:r}))},No=[];Et&&No.push({transport:"fetch",method:Ao}),St&&No.push({transport:"XHR",method(t){var e=Io(t);if(e){var i=new St,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Or(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&&No.push({transport:"sendBeacon",method:Fo});var Uo=3e3;class Lo{constructor(t,e){this.Zr=!0,this.Gr=[],this.Qr=Ee((null==e?void 0:e.flush_interval_ms)||Uo,250,5e3,Tr.createLogger("flush interval"),Uo),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ei():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ti(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var e=this.ei(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&ie(i.data)&&Or(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ti(i)};for(var r in e)i()}}),this.Qr))}ti(t){try{this.Jr(t)}catch(t){Tr.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var t={};return Or(this.Gr,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;oe(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Gr=[],t}}var jo=["retriesPerformedSoFar"];class Bo{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!oe(mt)&&"onLine"in mt.navigator&&(this.ni=mt.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},Ur(mt,"online",this.si),Ur(mt,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,jo);ve(e)&&(s.url=Ro(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.kt(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Tr.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)}}))}kt(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.Gr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Tr.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),0===this.Gr.length)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),e=[],i=this.Gr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Gr=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,oe(mt)||(this.si&&(mt.removeEventListener("online",this.si),this.si=void 0),this.ai&&(mt.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Tr.error(t)}}this.Gr=[]}}class zo{constructor(t){this.hi=()=>{var t,e,i,r;this.di||(this.di={});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.di.lastScrollY=Math.ceil(n),this.di.maxScrollY=Math.max(n,null!==(t=this.di.maxScrollY)&&void 0!==t?t:0),this.di.maxScrollHeight=Math.max(o,null!==(e=this.di.maxScrollHeight)&&void 0!==e?e:0),this.di.lastContentY=a,this.di.maxContentY=Math.max(a,null!==(i=this.di.maxContentY)&&void 0!==i?i:0),this.di.maxContentHeight=Math.max(l,null!==(r=this.di.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){Ur(mt,"scroll",this.hi,{capture:!0}),Ur(mt,"scrollend",this.hi,{capture:!0}),Ur(mt,"resize",this.hi)}scrollElement(){if(!this.ci)return null==mt?void 0:mt.document.documentElement;var t=ie(this.ci)?this.ci:[this.ci];for(var e of t){var i=null==mt?void 0:mt.document.querySelector(e);if(i)return i}}vi(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[e]||0}return mt?"y"===t?mt.scrollY||mt.pageYOffset||mt.document.documentElement.scrollTop||0:mt.scrollX||mt.pageXOffset||mt.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var Ho=t=>$n(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 qo{constructor(t,e,i,r){this.fi=t=>{var e=this.pi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.gi(this._instance)};this.mi.register({[K]:i})}},this._instance=t,this.yi=e,this.mi=i,this.gi=r||Ho,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[K]}getSetOnceProps(){var t,e=null==(t=this.pi())?void 0:t.props;return e?"r"in e?kn(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 Or(Fr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Qt(i)]=e})),t}}class Vo{on(t,e){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(e),()=>{this.bi[t]=this.bi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.bi[t]||[])i(e);for(var r of this.bi["*"]||[])r(t,e)}constructor(){this.bi={}}}var Go=Rr("[SessionId]");class Wo{on(t,e){return this.wi.on(t,e)}constructor(t,e,i){var r;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Vo,this.Ti=(t,e)=>!(!ve(t)||!ve(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===lt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=e||Gr,this.Ri=i||Gr;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ee(this.Te.session_idle_timeout_seconds||1800,60,36e3,Go.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var n=rs.F(this.Oi),o=rs.F(this.Fi);n&&!o?this.Ii=n:rs.P(this.Oi),rs.q(this.Fi,!0)}if(null!=(r=this.Te.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Te.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.$i(this.Te.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Go.error("Invalid sessionID in bootstrap",t)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return oe(this.ki)&&(this.ki=[]),this.ki.push(t),this.Mi&&t(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((e=>e!==t))}}Li(){return"memory"!==this.Te.persistence&&!this.mi.yr&&rs.N()}Ni(t){t!==this.Ii&&(this.Ii=t,this.Li()&&rs.q(this.Oi,t))}Di(){return this.Ii?this.Ii:this.Li()?rs.F(this.Oi):null}qi(t){var e=this.xi;return!ue(e)&&!ue(t)&&5e3>Math.abs(t-e)}$i(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Mi=t,s&&!r||s&&this.qi(e)||(this.xi=e,this.mi.register({[k]:[e,t,i]}))}ji(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return ve(e)&&e>0}Hi(){this.ji()?this.mi.refreshKey(k):(this.mi.flush(),this.mi.load())}Bi(){var t;if(!ue(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var e=this.Ui();e[1]===this.Mi&&e[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.Mi)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],e=ve(t)?t:0,i=ve(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Vi(t){return this.Hi(),this.Ti(t,this.zi())}Ui(){var t=this.mi.props[k];return ie(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&mt&&(mt.removeEventListener(ct,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&rs.P(this.Fi)},Ur(mt,ct,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Te.cookieless_mode===lt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Ui(),s=r[1],n=r[2],o=this.zi(),a=this.Di(),l=ve(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,d=!s,v=s,c=!d&&!t&&this.Ti(i,o);if(c){(c=this.Vi(i))||Go.info("cross-tab refresh kept the session alive",{sessionId:s});var f=this.Ui();s=f[1],n=f[2]}d||c||l?(s=this.Ei(),a=this.Ri(),Go.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.Ri(),u=!0),(h=s!==v)&&(Go.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=!0));var p=ve(o)&&t&&!l?o:i,_=ve(n)?n:(new Date).getTime();this.Ni(a),this.$i(s,p,_),t||this.Pi();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.ki.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:_,changeReason:u?g:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi((new Date).getTime())){var t=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var Jo=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Jt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Jt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Ko(){return(Ko=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 ae(i)&&i.length>0?i:void 0}catch(t){return void Tr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var Yo=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 Qo(t,e,i){return an({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Xo={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=>Yo(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Yo(e,t))))),icontains:(t,e)=>e.map(Zo).some((e=>t.map(Zo).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Zo).every((e=>t.map(Zo).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)))}))},Zo=t=>t.toLowerCase();function ta(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(oe(r)||ue(r))return!1;var s=[String(r)],n=Xo[i.operator];return!!n&&n(i.values,s)}))}var ea="custom",ia="i.posthog.com",ra=/^\/static\//;class sa{constructor(t){this.Zi={},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("."+ia,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ea),this.Zi[this.apiHost]}Gi(t){if(ra.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.Gi(e);if(i)return""+i+e}if(this.region===ea)return this.apiHost+e;var r=ia+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function na(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var oa=Rr("[Surveys]"),aa="seenSurvey_",la=t=>{try{var e=(t=>((t,e)=>""+aa+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){oa.error("Failed to persist survey seen state",t)}},ua=[Fn.Popover,Fn.Widget,Fn.API],ha={ignoreConditions:!1,ignoreDelay:!1,displayType:Un.Popover},da=Rr("[PostHog ExternalIntegrations]"),va={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ca{constructor(t){this._instance=t}er(t,e){var i;null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return da.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=Ot.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.er(va[n],(()=>{var e;null==(e=Ot.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=Ot.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Ot.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}var fa={},pa=0,_a=()=>{},ga='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ma="Surveys module not available",ba="sanitize_properties is deprecated. Use before_send instead",ya="Invalid value for property_denylist config: ",wa=["token","distinct_id",it],xa="posthog",Ea=!So&&-1===(null==Tt?void 0:Tt.indexOf("MSIE"))&&-1===(null==Tt?void 0:Tt.indexOf("Mozilla")),Sa=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:Nr(null==wt?void 0:wt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:_a,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:xt&&ae(null==xt?void 0:xt.search)&&-1!==xt.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==mt||null==(e=mt.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){Tr.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:dt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Uo},error_tracking:{},_onCapture:_a},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ts,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))},$a=[["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"]],ka=t=>{var e={};for(var i of $a){var r=i[0],s=i[1];oe(t[r])||(e[s]=t[r])}var n=Ir({},e,t),o=t.__preview_external_dependency_versioned_paths;return oe(o)||(oe(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ae(o)&&oe(t.asset_host)&&(n.asset_host=o)),ie(t.property_blacklist)&&(oe(t.property_denylist)?n.property_denylist=t.property_blacklist:ie(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Tr.error(ya+t.property_denylist)),n};class Ta{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(t){Tr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ra{Ji(t,e){if(t){var i=this.Ki.indexOf(t);-1!==i&&this.Ki.splice(i,1)}return this.Ki.push(e),null==e.initialize||e.initialize(),e}Yi(){return this.config.cookieless_mode===lt||this.config.cookieless_mode===at&&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 Ta,this.Xi=!1,this.version=s.LIB_VERSION,this.en=new Vo,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sa(),this.SentryIntegration=tn,this.sentryIntegration=t=>function(t,e){var i=Zs(t,e);return{name:Xs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new zo(this),this.pageViewManager=new en(this),this.rateLimiter=new zn(this),this.requestRouter=new sa(this),this.consent=new ss(this),this.externalIntegrations=new ca(this);var e=null!==(t=Ra.__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.metrics=e.metrics&&new e.metrics(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=ae(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=ae(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Tr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==xa){var r,s=null!==(r=fa[i])&&void 0!==r?r:new Ra;return s._init(t,e,i),fa[i]=s,fa[xa][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var l=ae(t)?t.trim():"";if(!l)return Tr.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=Sa(e.defaults),e.debug=this.an(e.debug),this.ln=e,this.un=[],e.person_profiles?this.nn=e.person_profiles:e.process_person&&(this.nn=e.process_person);var u=Sa(e.defaults),h=ka(e),d=Ir({},u,h,{name:r,token:l});se(u.rageclick)&&se(h.rageclick)&&(d.rageclick=Ir({},u.rageclick,h.rageclick)),se(u.session_recording)&&se(h.session_recording)&&(d.session_recording=Ir({},u.session_recording,h.session_recording)),this.set_config(d),this.config.on_xhr_error&&Tr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Mn.GZipJS;var v=this.hn();this.persistence=new Cn(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(i({},this.config,{persistence:"sessionStorage"}),v,!1);var c=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.dn=new Lo((t=>this.cn(t)),this.config.request_queue_config),this.vn=new Bo(this),this.__request_queue=[];var p=this.Yi();if(p||(this.sessionManager=new Wo(this),this.sessionPropsManager=new qo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Tr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(p)}),0)):(Tr.info("Initializing extensions synchronously"),this.fn(p)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Tr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:c,s:f}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.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(J);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ut)this.identify(_);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==_&&m===ht)Tr.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 b=this.config.get_device_id(Gr()),y=e.bootstrap.isIdentifiedID?b:_;this.persistence.set_property(J,e.bootstrap.isIdentifiedID?ht:ut),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:et,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Gr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(J,ut)}return Ur(mt,"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()||Gr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(J,ht)),e()},s=i.user();"then"in s&&re(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Qs.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()||(Qs.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Qs.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,ft),identify:t=>e(t,_t),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.pn())):this.pn(),re(this.config._onCapture)&&this.config._onCapture!==_a&&(Tr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Tr.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 Ko.apply(this,arguments)}().then((t=>{t&&this.register({[a]:t})})).catch(_a),this}fn(t){var e,r,s,n,o,a,l,u,h=performance.now(),d=i({},Ra.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.featureFlags&&this.Ki.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new d.featureFlags(this)),d.exceptions&&this.Ki.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.Ki.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ki.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ki.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.Ki.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Ki.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this)),d.logs&&this.Ki.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this)),d.metrics&&this.Ki.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ki.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ki.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ki.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ki.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Ks)),d.toolbar&&this.Ki.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Ki.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this.Ki.forEach((t=>{t.initialize&&v.push((()=>{null==t.initialize||t.initialize()}))})),v.push((()=>{if(this.gn){var t=this.gn;this.gn=void 0,this.Hr(t)}})),this.mn(v,h)}mn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Tr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[rt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[st]:r}),this.config.__preview_deferred_init_extensions&&Tr.info("PostHog extensions initialized ("+r+"ms)")}Hr(t){if(!wt||!wt.body)return Tr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var e,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Kt(i.supportedCompression,Mn.GZipJS)?Mn.GZipJS:Kt(i.supportedCompression,Mn.Base64)?Mn.Base64:void 0),null!=(e=i.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:dt}),this.Ki.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}pn(){try{this.config.loaded(this)}catch(t){Tr.critical("`loaded` function failed",t)}if(this.bn(),this.config.internal_or_test_user_hostname&&null!=xt&&xt.hostname){var t=xt.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.Yi())&&this._n()}),1),this.wn=new qn(this),this.wn.load()}bn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.dn)||t.enable())}_dom_loaded(){this.is_capturing()&&Pr(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(pt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.dn)||r.unload(),null==(s=this.vn)||s.unload()):this.xn()&&this.capture(pt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Ea?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,(oe(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;var o,a,l,u,h,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&oe(n.compression)&&n.data&&(n.compression=Mn.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(h=(u=ie(o=n.data)?o:[o])[0])||null==(l=h.properties)?void 0:l.token)&&void 0!==a?a:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),ie(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=Do(n.url,n.method,n.compression,n.timestampMode);var v=No.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");"sendBeacon"!==d&&n.data&&n.compression===Mn.GZipJS&&kt&&"undefined"!=typeof Promise&&!ko?Co(n).then((t=>{c(t)})).catch((e=>{if(Ht(e))return ko=!0,void c(i({},n,{compression:void 0,url:Do(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Ht(t)||e===jt})(e)&&(ko=!0),c(n)})):c(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}))}cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t)}_execute_array(t){pa++;try{var e,i=[],r=[],s=[];Pr(t,(t=>{if(t)if(ie(e=t[0]))s.push(t);else if(re(t))try{t.call(this)}catch(e){Tr.error("Error executing queued PostHog call",t,e)}else ie(t)&&"alias"===e?i.push(t):ie(t)&&-1!==e.indexOf("capture")&&re(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Pr(t,(function(t){try{if(ie(t[0])){var i=e;Or(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Tr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{pa--}}push(t){if(pa>0&&ie(t)&&ae(t[0])){var e=Ra.prototype[t[0]];re(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.dn){if(this.is_capturing())if(!oe(t)&&ae(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&&!ae(null==e?void 0:e.$current_url)&&(Tr.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.kn||Tr.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=Oi(null==r?void 0:r.uuid,Gr),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ft&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(A);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,m,b,y=p?void 0:this.Sn(null==r?void 0:r.$set_once,t!==gt,t===_t);if(y&&(f.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>ae(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),ie(e))r=[],Pr(e,(e=>{r.push(t(e))}));else{var s={};Or(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,oe(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Ft.forEach(r),e.forEach(r),i}(f.properties,wa)),t===Dn.DISMISSED||t===Dn.SENT){var w=null==e?void 0:e[Nn.SURVEY_ID],x=null==e?void 0:e[Nn.SURVEY_ITERATION];la({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===Dn.SENT?"responded":"dismissed",b="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(b="$survey_"+m+"/"+g.id+"/"+g.current_iteration),b)]:!0})}else t===Dn.SHOWN&&(f.$set=i({},f.$set,{[Nn.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Ln.SHOWN){var E=null==e?void 0:e[jn.TOUR_TYPE];E&&(f.$set=i({},f.$set,{[jn.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(ne(S)||this.setPersonPropertiesForFlags(S),!he(this.config.before_send)){var k=this.wt(f);if(!k)return;(f=k).uuid=Oi(f.uuid,Gr)}this.en.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",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.cn(R):this.dn.enqueue(R),f}Tr.critical("This capture call is ignored due to client rate limiting.")}}else Tr.error("No event name provided to posthog.capture")}else Tr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,n,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.Yi()&&(l[it]=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!ae(l.distinct_id)&&!de(l.distinct_id)||le(l.distinct_id))&&Tr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Tt)return{};var u,h=t?[...pn,...e||[]]:[],d=function(t){for(var e=0;Ti.length>e;e++){var i=Ti[e],r=i[1],s=i[0].exec(t),n=s&&(re(r)?r(s,t):r);if(n)return n}return["",""]}(Tt),v=d[0],c=d[1],f=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};oe(i)||(p.detectGoogleSearchApp=i);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,b=null==mt||null==(a=mt.screen)?void 0:a.width,y=null==mt||null==(l=mt.screen)?void 0:l.height,w=null==mt?void 0:mt.devicePixelRatio;oe(g)||(_.userAgentDataPlatform=g),oe(m)||(_.maxTouchPoints=m),oe(b)||(_.screenWidth=b),oe(y)||(_.screenHeight=y),oe(w)||(_.devicePixelRatio=w);var x,E,S,k,T,R,P,O,I=Ir(Fr({$os:v,$os_version:c,$browser:Si(Tt,navigator.vendor,f,p),$device:Ri(Tt),$device_type:(E=Tt,S=_,O=Ri(E),O===Oe||O===Pe||"Kobo"===O||"Kindle Fire"===O||O===oi?Re:O===Ke||O===Qe||O===Ye||O===ri?"Console":O===Ce?"Wearable":O?$e:"Android"===(null==S?void 0:S.userAgentDataPlatform)&&(null!==(k=null==S?void 0:S.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==S?void 0:S.screenWidth)&&void 0!==T?T:0,null!==(R=null==S?void 0:S.screenHeight)&&void 0!==R?R:0)/(null!==(P=null==S?void 0:S.devicePixelRatio)&&void 0!==P?P:1)?$e:Re:"Desktop"),$timezone:Tn(),$timezone_offset:Rn()}),{$current_url:hn(r?Ii(null==xt?void 0:xt.href):null==xt?void 0:xt.href,h,gn),$host:null==xt?void 0:xt.host,$pathname:null==xt?void 0:xt.pathname,$raw_user_agent:Tt.length>1e3?Tt.substring(0,997)+"...":Tt,$browser_version:ki(Tt,navigator.vendor,f,p),$browser_language:xn(),$browser_language_prefix:(x=xn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==mt?void 0:mt.screen.height,$screen_width:null==mt?void 0:mt.screen.width,$viewport_height:null==mt?void 0:mt.innerHeight,$viewport_width:null==mt?void 0:mt.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=s.SDK_DIST_CHANNEL),I}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime()),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&Ir(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ir(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.vn)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ea&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ft||o?t!==pt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Ir(l,h),t===ft&&wt&&(l.title=wt.title),!oe(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Tt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Or(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]})),(l=Ir({},d,_,g,l)).$is_identified=this._isIdentified(),ie(this.config.property_denylist)?Or(this.config.property_denylist,(function(t){delete l[t]})):Tr.error(ya+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(Tr.error(ba),l=m(l,t));var b=this.Cn();return l.$process_person_profile=b,b&&!o&&this.Tn("_calculate_event_properties"),l}Sn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Cn())return t;if(this.Xi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Ir({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Tr.error(ba),o=a(o,"$set_once")),e&&(this.Xi=!0),ne(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)}In(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,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}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.en.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:ma}),()=>{})}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:ma})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:ma})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=ha),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:ma}}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:ma})}Mn(t){return!t||le(t)?(Tr.critical("Unique user id has not been set in posthog.identify"),!1):t===et?(Tr.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())||(Tr.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 Tr.uninitializedWarning("posthog.identify");if(de(t)&&(t=t.toString(),Tr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.Tn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(J)||ut)===ut;t!==r&&n?(this.persistence.set_property(J,ht),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(_t,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.sn=Qo(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(q))}}setPersonProperties(t,e){if((t||e)&&this.Tn("posthog.setPersonProperties")){var i=Qo(this.get_distinct_id(),t,e);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.sn=i):Tr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(ie(t)?t:[t]).filter((t=>ae(t)&&t.length>0));0!==i.length&&this.Tn("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=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(gt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else Tr.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.Tn("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,l,u,h,d,v;if(Tr.info("reset"),!this.__loaded)return Tr.uninitializedWarning("posthog.reset");var c,f=this.get_property(o),p=this.get_property(a),_=this.get_property(b);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),oe(_)||null==(c=this.persistence)||c.register({[b]:_}),null==(r=this.surveys)||r.reset(),null==(s=this.wn)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(l=this.conversations)||l.reset(),null==(u=this.logs)||u.reset(),null==(h=this.metrics)||h.reset(),null==(d=this.persistence)||d.set_property(J,ut),null==(v=this.sessionManager)||v.resetSessionId(),this.sn=null,this.config.cookieless_mode===lt)this.register_once({distinct_id:et,$device_id:null},"");else{var g=this.config.get_device_id(Gr());this.register_once({distinct_id:g,$device_id:t?g:f},""),t||oe(p)||this.register({[a]: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,n;i.__loaded?(null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(e=i.metrics)||e.flush("sendBeacon"),null==(r=i.dn)||r.unload(),null==(s=i.vn)||s.unload(),null==(n=i.featureFlags)||n.destroy()):Tr.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.Rn()}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 e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);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(n)?(Tr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(oe(e)&&(e=this.get_distinct_id()),t!==e?(this.In(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Tr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(se(t)){var r,n,o,a,l,u,h,d,v,c,f;Ir(this.config,ka(t));var p=this.hn();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(i({},this.config,{persistence:"sessionStorage"}),p,!1);var _=this.an(this.config.debug);ce(_)&&(this.config.debug=_),ce(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Xr.N()&&Xr.q("ph_debug",!0),Tr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,Xr.N()&&Xr.P("ph_debug"))),null==(n=this.exceptionObserver)||n.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.Pn(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){s.LIB_NAME=t,s.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:Ra.On}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:xa;return e!==xa&&(e=xa+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(J))===ht||(null==(e=this.sessionPersistence)?void 0:e.get_property(J))===ht}Cn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===dt&&!this._isIdentified()&&ne(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[tt]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(t){return"never"===this.config.person_profiles?(Tr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(tt,!0),!0)}hn(){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!==at)}Pn(){var t,e,i,r,s=this.hn();return(null==(t=this.persistence)?void 0:t.yr)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.yr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==lt){if(this.Yi()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Wo(this),this.pageViewManager=new en(this),this.persistence&&(this.sessionPropsManager=new qo(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=Ra.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ji(this.sessionRecording,new l(this)),this.yn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.yn)))}var u,h;this.consent.optInOut(!0),this.Pn(),this.bn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==at&&(null==(u=this.surveys)||u.loadIfEnabled()),(oe(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._n()}else Tr.warn(ga)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==lt?(this.config.cookieless_mode===at&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===at&&(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._n(),this.bn())):Tr.warn(ga)}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===lt||(this.config.cookieless_mode===at?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return yt?Jo(yt,this.config.custom_blocked_useragents):void 0}_n(){wt&&("visible"===wt.visibilityState?this.tn||(this.tn=!0,this.capture(ft,{title:wt.title},{send_instantly:!0}),this.rn&&(wt.removeEventListener(vt,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),Ur(wt,vt,this.rn)))}debug(t){!1===t?(null==mt||mt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==mt||mt.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ur(){var t=this.ln||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Tr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!he(t[e]),o=i in t&&!he(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Tr)}wt(t){var e;if(he(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(_e),r=ie(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),he(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return pe(t.event)?Tr.warn(o+". This can cause unexpected behavior."):Tr.info(o),null}s.properties&&!ne(s.properties)||Tr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&he(s.properties[a]))return Tr.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.ir)?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)})}an(t){var e=ce(t)&&!t,i=Xr.N()&&"true"===Xr.A("ph_debug");return!e&&(!!i||t)}}Ra.__defaultExtensionClasses={},Ra.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Ar(t.prototype[e[i]])}(Ra,["identify"]);class Pa{constructor(t){this.disabled=!1===t;var e=se(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 Oa="$copy_autocapture",Ia=Rr("[AutoCapture]");function Ca(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ma(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!ds(e));return e}function Aa(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!ds(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!vs(c,"body")&&ps>d.length;)if(fs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!ds(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},b=!1,y=!1;if(Or(d,(t=>{var e=As(t);if(vs(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&zs(i))&&(h?Ii(i):i)}Kt(ms(t),"ph-no-capture")&&(y=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};xs.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ca(1024,Hs(t)):Ca(1024,ys(t)));var a=ms(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Or(t.attributes,(function(i){var n;if((!Fs(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&zs(i.value)&&(!ae(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=_s(a).join(" ")),o["attr__"+i.name]=Ca(1024,"href"===i.name&&s?Ii(a):a)}}));for(var l=1,u=1,h=t;h=Ma(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(!As(t))return{};var e={};return Or(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&&zs(r)&&(e[i]=r)}})),e}(t);Ir(m,r)})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=vs(t,"a")||vs(t,"button")?Hs(t):ys(t)),b){var w,x;g[0].attr__href=b;var E=null==(w=ln(b))?void 0:w.host,S=null==mt||null==(x=mt.location)?void 0:x.host;E&&S&&E!==S&&(p=b)}return{props:Ir({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,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 Cr(o).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[Vs(t[0].toString())]=Vs(e.toString())})),(s+=":")+Cr(a).map((t=>t[0]+'="'+t[1]+'"')).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:Gs(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Cr(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}var Fa=Rr("[ExceptionAutocapture]"),Da=()=>{},Na=Rr("[TracingHeaders]"),Ua=Rr("[Web Vitals]"),La=9e5,ja="disabled",Ba="lazy_loading",za="awaiting_config",Ha="missing_config";Rr("[SessionRecording]"),Rr("[SessionRecording]");var qa="[SessionRecording]",Va=Rr(qa),Ga=Rr("[Heatmaps]");function Wa(t){return se(t)&&"clientX"in t&&"clientY"in t&&de(t.clientX)&&de(t.clientY)}var Ja=Rr("[Product Tours]"),Ka=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(g))},Ya=["$set_once","$set"],Qa=Rr("[SiteApps]"),Xa="Error while initializing PostHog app with config id ";function Za(t,e,i){if(he(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 tl{constructor(t){this.Fn=new Vo,this.Ln=(t,e)=>this.$n(t,e)&&this.An(t,e)&&this.Nn(t,e)&&this.Dn(t,e),this.$n=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.qn=new Set,this.jn=new Set}init(){var t,e;oe(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(!oe(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.jn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.qn)||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.qn.has(t)||this.qn.has(e.event))&&this.jn&&(null==(i=this.jn)?void 0:i.size)>0&&this.jn.forEach((t=>{this.Hn(e,t)&&this.Fn.emit("actionCaptured",t.name)}))}Bn(t){this.onAction("actionCaptured",(e=>t(e)))}Hn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Ln(t,i))return!0;return!1}onAction(t,e){return this.Fn.on(t,e)}An(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(!Za(r,e.url,e.url_matching||"contains"))return!1}return!0}Nn(t,e){return!!this.Un(t,e)&&!!this.zn(t,e)&&!!this.Vn(t,e)}Un(t,e){var i;if(null==e||!e.href)return!0;var r=this.Wn(t);if(r.length>0)return r.some((t=>Za(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Za((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}zn(t,e){var i;if(null==e||!e.text)return!0;var r=this.Wn(t);if(r.length>0)return r.some((t=>Za(t.text,e.text,e.text_matching||"exact")||Za(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;!he(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=>Za(t,n,o))))}Vn(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}Wn(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||ta(e.properties.reduce(((t,e)=>{var i=ie(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 el{constructor(t){var e;this.Zn=[],this._instance=t,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,null==(e=this._instance)||null==e.onSessionId||e.onSessionId((t=>this.Kn(t)))}Yn(t,e){return!!t&&ta(t.propertyFilters,null==e?void 0:e.properties)}Xn(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}es(t,e,i){var r=(i===An.Activation?this.Gn:this.Qn).get(t),s=[];return this.ts((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.Yn(n,e)}))}register(t){var e;oe(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.rs(t),this.ns(t))}ns(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.ss&&(this.ss=new tl(this._instance),this.ss.init(),this.ss.Bn((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.ss)||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.Jn.get(e.name);i&&i.push(t.id),this.Jn.set(e.name,i||[t.id])}})))})))}rs(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.Gn=this.Xn(t,An.Activation),this.Qn=this.Xn(t,An.Cancellation))}onEvent(t,e){var i,r,s=this.os(),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.ls(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.us([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.hs(n)}if(this.Qn.has(t)){var a=this.es(t,e,An.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.us(a.map((t=>t.id))),a.forEach((t=>this.ds(t.id))))}if(this.Gn.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Gn.get(t)});var l=this.es(t,e,An.Activation);this.cs(l.map((t=>t.id)))}}onAction(t){this.Jn.has(t)&&this.cs(this.Jn.get(t)||[])}cs(t){0!==t.length&&(this.Zn=[...new Set([...this.Zn,...t])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(t){this.Zn=this.Zn.filter((e=>e!==t));var e=this.vs();e.includes(t)||(this.fs([...e,t]),this.ps())}us(t){var e=new Set(t);this.Zn=this.Zn.filter((t=>!e.has(t)));var i=this.gs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.fs(r),0===r.length&&this.ys())}gs(){var t,e=this.bs();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}vs(){var t,e,i=this.gs();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._s()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}ps(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.ws(e)}ys(){this.xs()}Kn(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._s()];i&&i!==t&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((t=>!this.ks(t)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class il extends el{constructor(t){super(t)}bs(){return B}_s(){return z}Cs(){return Dn.SHOWN}ts(t){var e;null==(e=this._instance)||e.getSurveys(t)}ds(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}os(){return oa}fs(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[B]:t})}ws(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[z]:t})}xs(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(z)}ks(){return!1}ls(t,e){var i;this.ts((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return na(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===Dn.SHOWN?"consume":"ignore":t===Dn.SHOWN?"persist":t===Dn.DISMISSED||t===Dn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var rl="SDK is not enabled or survey functionality is not yet loaded",sl="Disabled. Not loading surveys.",nl=null!=mt&&mt.location?dn(mt.location.hash,"__posthog")||dn(location.hash,"state"):null,ol="_postHogToolbarParams",al=Rr("[Toolbar]"),ll=Rr("[FeatureFlags]"),ul=Rr("[FeatureFlags]",{debugEnabled:!0}),hl="\" failed. Feature flags didn't load in time.",dl=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},vl=t=>{var e={};for(var i of Cr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},cl=Rr("[Error tracking]"),fl="Refusing to render web experiment since the viewer is a likely bot",pl={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Yo(e,t),not_regex:(t,e)=>!Yo(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class _l{get Te(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{_l.Ts("retrieved web experiments from the server"),e.Is=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Is&&(_l.Ts("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Is)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);ae(r)&&t.variants[r]&&e.Ms(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];_l.Es(n,e._instance)&&e.Ms(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())_l.Ts(fl);else if(!this.Te.disable_web_experiments){if(he(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_l.Ts("applying feature flags",t),t.forEach((t=>{var e;if(this.Is&&null!=(e=this.Is)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Is)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Ms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=_l.getWindowLocation();if(null!=t&&t.search){var e=un(null==t?void 0:t.search,"__experiment_id"),i=un(null==t?void 0:t.search,"__experiment_variant");e&&i&&(_l.Ts("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Rs(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Te.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.Te.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Rs(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(_l.Ts("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Ms(r[0].name,e,r[0].variants[e].transforms))}static Es(t,e){return!he(t.conditions)&&_l.Ps(t,e)&&_l.Os(t)}static Ps(t,e){var i;if(he(t.conditions)||he(null==(i=t.conditions)?void 0:i.url))return!0;var r=_l.getWindowLocation();if(r){var s,n,o,a=ns(e,r.href);return null==(s=t.conditions)||!s.url||pl[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==mt?void 0:mt.location}static Os(t){var e;if(he(t.conditions)||he(null==(e=t.conditions)?void 0:e.utm))return!0;var i=bn();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,f=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&&f&&v}return!1}static Ts(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Tr.info("[WebExperiments] "+t,i)}Ms(t,e,i){this._is_bot()?_l.Ts(fl):"control"!==e?i.forEach((i=>{if(i.selector){var r;_l.Ts("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)}))}})):_l.Ts("Control variants leave the page unmodified.")}_is_bot(){return yt&&this._instance?Jo(yt,this.Te.custom_blocked_useragents):void 0}}var gl=Rr("[Conversations]"),ml="Conversations not available yet.",bl="console",yl={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],mt&&Ur(mt,"online",this.Bs)}destroy(){null==mt||mt.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return null!==(t=null==(e=this.mi)?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,ll.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=null!==(t=this.Te.evaluation_contexts)&&void 0!==t?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(ll.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||ll.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!oe(t)){if(ie(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||ll.error("Invalid flag key found:",t,"Expected non-empty string"),e}));ll.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,i=this._instance.config,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.zs(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.zs(C))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var d of Object.entries(l)){var v=d[0],c=d[1];h[v]={key:v,enabled:Ct(c),variant:Mt(c),reason:void 0,metadata:oe(null==u?void 0:u[v])?void 0:{id:0,version:void 0,description:void 0,payload:u[v]}}}this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(I),e=this.zs(F),r=this.zs(D);if(!r&&!e)return t||{};var s=Ir({},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=oe(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=oe(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=f}return this.Fs||(ll.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Fs=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Ct(r),variant:Mt(r),payload:It(e[i])}}))}getFlagVariants(){var t=this.zs(R),e=this.zs(F);if(!e)return t||{};for(var i=Ir({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(ll.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Fs=!0),i}getFlagPayloads(){var t=this.zs(C),e=this.zs(D);if(!e)return t||{};for(var i=Ir({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(ll.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Fs=!0),i}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,n=this.zs(o),a={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.mi)?void 0:e.get_initial_props())||{},this.zs(N)||{},{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}),group_properties:this.zs(U),timezone:Tn()};ue(n)||oe(n)||(a.$device_id=n),(null!=t&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Gs()&&(a.evaluation_contexts=this.Zs());var l=this.Qs();oe(l)||(a.flag_keys=l);var u=!!this.Te.advanced_only_evaluate_survey_feature_flags,h=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:h,data:a,compression:this.Te.disable_compression?void 0:Mn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(this.Xs(t.statusCode),200===t.statusCode&&(this.Ns||(this.$anon_distinct_id=void 0),s=!1),this.$s=!1,!a.disable_flags||this.Ns){this.Ds=!s;var n=[];t.error?t.error instanceof Error?n.push("AbortError"===t.error.name?"timeout":"connection_error"):n.push("unknown_error"):200!==t.statusCode&&n.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&n.push("errors_while_computing_flags");var o,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&n.push("quota_limited"),null==(r=this.mi)||r.register({[G]:n}),l)ll.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 a.disable_flags||this.receivedFeatureFlags(null!==(o=t.json)&&void 0!==o?o:{},s,{partialResponse:u}),this.Ns&&(this.Ns=!1,this.Ks())}}})}}Us(){return vn(this.Hs,3)}Xs(t){this.Hs=cn(t,this.Hs,3,(()=>ll.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){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 ll.warn('getFeatureFlag for key "'+t+hl)}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.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.zs(M)||void 0,l=this.zs(W)||void 0,u=this.zs(q)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.zs(V);d&&d!==v&&(u={},null==(h=this.mi)||h.register({[q]:u,[V]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,_,g,m,b,y,w,x,E;ie(u[t])?u[t].push(o):u[t]=[o],null==(c=this.mi)||c.register({[q]:u});var S=this.getFeatureFlagDetails(t),k=[...null!==(f=this.zs(G))&&void 0!==f?f:[]];oe(s)&&k.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==(p=this.Te.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Te.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.Ds};oe(null==S||null==(g=S.metadata)?void 0:g.has_experiment)||(T.$feature_flag_has_experiment=S.metadata.has_experiment),oe(null==S||null==(m=S.metadata)?void 0:m.version)||(T.$feature_flag_version=S.metadata.version);var R,P=null!==(b=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==b?b:null==S||null==(w=S.reason)?void 0:w.code;P&&(T.$feature_flag_reason=P),null!=S&&null!=(x=S.metadata)&&x.id&&(T.$feature_flag_id=S.metadata.id),oe(null==S?void 0:S.original_variant)&&oe(null==S?void 0:S.original_enabled)||(T.$feature_flag_original_response=oe(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(E=S.metadata)&&E.original_payload&&(T.$feature_flag_original_payload=null==S||null==(R=S.metadata)?void 0:R.original_payload),k.length&&(T.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",T)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:It(n)}}}else ll.warn('getFeatureFlagResult for key "'+t+hl)}getRemoteConfigPayload(t,e){var i=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:i,person_properties:{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}};this.Gs()&&(r.evaluation_contexts=this.Zs());var n=this.Qs();oe(n)||(r.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:Mn.Base64,timestampMode:"body",timeout:this.Te.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.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return ll.warn('isFeatureEnabled for key "'+t+hl),e.defaultValue;var i=this.getFeatureFlag(t,e);return oe(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var 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&&ll.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(ie(u)){ll.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;e&&e.register({[P]:u,[R]:c,[A]:!1})}else{var p=u,_=h,g=l;if(null!=o&&o.partialResponse)p=i({},r,p),_=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)})));p=i({},r,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},r,p),_=i({},s,_),g=i({},n,g);e&&e.register(i({[P]:Object.keys(vl(p)),[R]:p||{},[C]:_||{},[I]:g||{},[A]:!0===t.minimalFlagCalledEvents},d?{[M]:d}:{},v?{[W]:v}:{}))}}}(t,this.mi,s,n,o,r),e||(this.js=!1),this.eo(e)}}override(t,e){void 0===e&&(e=!1),ll.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return ll.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.mi.unregister(F),this.mi.unregister(D),this.eo(),ul.info("All overrides cleared");if(ie(t)){var e=dl(t);return this.mi.register({[F]:e}),this.eo(),ul.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Fs=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.mi.unregister(F),ul.info("Flag overrides cleared");else if(r.flags){if(ie(r.flags)){var s=dl(r.flags);this.mi.register({[F]:s})}else this.mi.register({[F]:r.flags});ul.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.mi.unregister(D),ul.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[D]:r.payloads}),ul.info("Payload overrides set",{payloads:r.payloads}))),void this.eo()}if(t&&"object"==typeof t)return this.mi.register({[F]:t}),this.eo(),ul.info("Flag overrides set",{flags:t});ll.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){ll.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.zs(O)||[]).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.mi)||s.register({[P]:Object.keys(vl(l)),[R]:l}),this.eo()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.zs(O),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.Te.token+s),method:"GET",timestampMode:"query",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.mi)||i.unregister(O),null==(r=this.mi)||r.register({[O]:s}),t(s)}}})}ro(){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)),{})}}eo(t){var e=this.ro(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){ll.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.zs(N)||{},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({[N]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.zs(N)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[N]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(N),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.zs(U)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[U]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(U)||{};this._instance.register({[U]:i({},e,{[t]:{}})})}else this._instance.unregister(U)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},wl={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!(null==(t=this.io)||!t.isStarted)}get status(){var t,e;return this.no===za||this.no===Ha?this.no:null!==(t=null==(e=this.io)?void 0:e.status)&&void 0!==t?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=ja,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Va.error("started without valid sessionManager"),new Error(qa+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===lt)throw new Error(qa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return mt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.oo||null==(e=this.io)||!e.isStarted){var i=!oe(Object.assign)&&!oe(Array.from);this.oo&&i?(this.ao(t),Va.info("starting")):(this.no=ja,this.stopRecording())}}ao(t){var e,i,r;this.oo&&(this.no!==za&&this.no!==Ha&&(this.no=Ba),null!=Ot&&null!=(e=Ot.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=Ot.__PosthogExtensions__)&&i.initSessionRecording?this.lo(t):null==(r=Ot.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.uo,(e=>{if(e)return Va.error("could not load recorder",e);this.lo(t)})))}stopRecording(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.stop()}ho(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.discard()}do(){var t,e;null==(t=this.mi)||t.unregister(T),null==(e=this.mi)||e.unregister(y)}co(t,e){if(he(t))return null;var i,r=de(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Va.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}vo(t){if(this.mi){var e,r,s=this.mi,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.co(null==(e=this.Te.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.co(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;he(a)&&this.do();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:oe(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.so)||e.call(this),this.so=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===za&&(this.no=Ha,Va.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.io)&&i.log?this.io.log(t,e):Va.warn("log called before recorder was ready")}get uo(){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"}fo(){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 Va.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}lo(t){var e,i;if(null==(e=Ot.__PosthogExtensions__)||!e.initSessionRecording)return Va.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[nt]:!0});if(this.io||(this.io=null==(i=Ot.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo()){if(this.no===Ha||this.no===za)return;return this.no=za,Va.info("persisted remote config is stale, requesting fresh config before starting"),void new qn(this._instance).load()}this.no=Ba,this.io.start(t)}onRRwebEmit(t){var e;null==(e=this.io)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||null==(e=this.mi)||e.register({[x]:!0}),null==(t=this.io)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||null==(e=this.mi)||e.register({[w]:!0}),null==(t=this.io)||t.overrideSampling()}overrideTrigger(t){var e,i;this.io||null==(i=this.mi)||i.register({["url"===t?E:S]:!0}),null==(e=this.io)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.io)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.io)||!i.tryAddCustomEvent(t,e))}}},xl={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Pa(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,i=se(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}wo(){if(this.isBrowserSupported()){if(mt&&wt){var t=t=>{t=t||(null==mt?void 0:mt.event);try{this.xo(t)}catch(t){Ia.error("Failed to capture event",t)}};if(Ur(wt,"submit",t,{capture:!0}),Ur(wt,"change",t,{capture:!0}),Ur(wt,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=t=>{t=t||(null==mt?void 0:mt.event);try{this.xo(t,Oa)}catch(t){Ia.error("Failed to capture copy/cut event",t)}};Ur(wt,"copy",e,{capture:!0}),Ur(wt,"cut",e,{capture:!0})}}}else Ia.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var i=e.autocapture_opt_out;ce(i)&&(this.instance.persistence&&this.instance.persistence.register({[h]:i}),this.mo=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,i=[];return null==(e=this._o)||e.forEach((e=>{var r=null==wt?void 0:wt.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[h],r=this.mo,s=this.instance.Ur()&&!this.yo;if(ue(r)&&!ce(i)&&!s)return!1;var n=null!==(e=this.mo)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!n}xo(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ws(t);cs(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())&&Is(r,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var s=e===Oa;if(r&&function(t,e,i,r,s,n){var o;if(!mt||Cs(t))return!1;if(null!=i&&i.url_allowlist&&!gs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&gs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=Ms(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(oe(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}(h,i))return!1;if(!Es(h,null==i?void 0:i.css_selector_allowlist))return!1;if(Es(h,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:$s))return!1;try{var d=mt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){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 u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(xs.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Te,s,s?["copy","cut"]:void 0,this.instance)){var n=Aa(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=n.props;if(n.explicitNoCapture)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(o.$element_selectors=a),e===Oa){var l,u=bs(null==mt||null==(l=mt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return re(null==wt?void 0:wt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(null==mt||null==(e=mt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Tr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,Tr.info("History API monitoring stopped")}monitorHistoryChanges(){mt&&mt.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(mt&&(null==(e=mt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Da;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return re(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e];re(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next}else t[e]=r.next}}catch(t){return Da}}(mt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Io(t)}))}}Io(t){try{var e,i=null==mt||null==(e=mt.location)?void 0:e.pathname;if(!i)return;i!==this.ko&&this.isEnabled&&this._instance.capture(ft,{navigation_type:t}),this.ko=i}catch(e){Tr.error("Error capturing "+t+" pageview",e)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};Ur(mt,"popstate",t),this.So=()=>{mt&&mt.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new Pa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return se(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return he(this.Te.capture_heatmaps)?he(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:!1!==this.Te.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.po)return;Ga.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval(null!==(t=this.Eo)&&void 0!==t?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:i}),this.Mo=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){Wa(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo="visible"===(null==wt?void 0:wt.visibilityState)?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){mt&&wt&&(this.Fo=this.oi.bind(this),Ur(mt,ct,this.Fo),this.Lo=t=>this.pe(t||(null==mt?void 0:mt.event)),Ur(wt,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||(null==mt?void 0:mt.event)),Ur(wt,"mousemove",this.$o,{capture:!0}),this.No=new Ys(this.instance,Js,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),Ur(wt,vt,this.Do),this.po=!0)}Po(){var t;mt&&wt&&(this.Fo&&mt.removeEventListener(ct,this.Fo),this.Lo&&wt.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&wt.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&wt.removeEventListener(vt,this.Do),clearTimeout(this.qo),null==(t=this.No)||t.stop(),this.po=!1)}jo(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&&ds(r)&&!vs(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:mt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Kt(e,s))return!0;r=Ss(r)}return!1}(ws(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}pe(t,e){var r;if(void 0===e&&(e="click"),!hs(t.target)&&Wa(t)){var s=this.jo(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Is(ws(t),this.instance.config.rageclick)&&this.Nt(i({},s,{type:"rageclick"})),this.Nt(s)}}Ao(t){!hs(t.target)&&Wa(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(mt){var e=this.Te.disable_capture_url_hashes?Ii(mt.location.href):mt.location.href,i=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...pn,...i||[]]:[],s=hn(e,r,gn);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}oi(){this.R&&!ne(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ys,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),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.Uo=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zo();if(!oe(r))if(he(null==t?void 0:t.name)||he(null==t?void 0:t.value))Ua.error("Invalid metric received",t);else if(!this.Vo||this.Vo>t.value){this.R.url!==r&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),oe(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=oe(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()});oe(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else Ua.error("Ignoring metric with value >= "+this.Vo,t)},this.Wo=()=>{if(!this.po){var t,e,i,r,s=Ot.__PosthogExtensions__;if(!oe(s)&&!oe(s.postHogWebVitalsCallbacks)){var n=s.postHogWebVitalsCallbacks;t=n.onLCP,e=n.onCLS,i=n.onFCP,r=n.onINP}t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Uo.bind(this)),this.po=!0):Ua.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!(null==(e=this._instance.persistence)||!e.props[p]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=se(this.Zo)?null==(t=this.Zo)?void 0:t.web_vitals_allowed_metrics:void 0;return he(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(se(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=se(this.Zo)?this.Zo.web_vitals_attribution:void 0;return null!=t&&t}get Vo(){var t=se(this.Zo)&&de(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:La;return t>0&&6e4>=t?La:t}get isEnabled(){var t=null==xt?void 0:xt.protocol;if("http:"!==t&&"https:"!==t)return Ua.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=se(this.Zo)?this.Zo.web_vitals:ce(this.Zo)?this.Zo:void 0;return ce(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(Ua.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=se(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=se(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:i}),this._instance.persistence.register({[m]:r})),this.Mo=i,this.startIfEnabled()}}}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Ua.error("failed to load script",e):t()}))}zo(){var t=mt?this._instance.config.disable_capture_url_hashes?Ii(mt.location.href):mt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...pn,...e||[]]:[];return hn(t,i,gn)}Ua.error("Could not determine current URL")}}},El={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var t;if(mt&&this.isEnabled&&null!=(t=Ot.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=e(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=i(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=r(this.captureException.bind(this)))}catch(t){Fa.error("failed to start",t),this.Ko()}}},this._instance=t,this.Yo=!(null==(e=this._instance.persistence)||!e.props[v]),this.Xo=new Se(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,Ge:Fa})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return se(t)?e=i({},e,t):(oe(t)?this.Yo:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Fa.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Fa.error("failed to load script",e);t()}))}Ko(){var t,e,i;null==(t=this.Go)||t.call(this),this.Go=void 0,null==(e=this.Qo)||e.call(this),this.Qo=void 0,null==(i=this.Jo)||i.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}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.Xo.consumeRateLimit(s)?Fa.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.ta=[],this.ra=new Yi([new lr,new mr,new hr,new ur,new _r,new pr,new vr,new gr],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=ar.test(l)?l.replace(ar,"$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||Qi});var r}))}(n)}}("web:javascript",rr,or)),this._instance=t,this.ta=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.ia=Er(this.na()),this.sa=new Sr(this.ia)}onConfigChange(){this.ia=Er(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.ta=n,this._instance.persistence&&this._instance.persistence.register({[c]:this.ta,[f]:o})}}}get oa(){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.ra.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!ae(t)||0===t.trim().length)return void cl.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>wr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.aa(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&cl.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.sa.add(i({[br]:t,[yr]:(new Date).toISOString()},s))}catch(t){cl.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void cl.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void cl.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void cl.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ia.enabled&&he(t.$exception_steps)?this.va(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return r&&this.sa.clear(),r}catch(t){return cl.error("Failed to capture exception event. Dropping this exception.",t),void this.sa.clear()}}catch(t){return void cl.error("Failed to process exception event. Ignoring this exception.",t)}}va(t){try{var e=this.sa.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return cl.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}ha(t){this.ia.enabled&&this.sa.add({[br]:t,[yr]:(new Date).toISOString()})}aa(t){return se(t)?i({},t):{}}na(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}ua(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return ae(i)&&i.length>0&&t.$exception_types.push(i),ae(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ta.some((t=>{var i=t.values.map((t=>{var i,r=Xo[t.operator],s=ie(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)}))}da(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://")))}ca(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}la(t){return!he(t)&&ie(t)}}},Sl=i({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var i,r;if(this.mi&&this.mi.register({[g]:!!e.productTours}),!Ka(this._instance))return!this.fa&&he(null==(i=this.mi)?void 0:i.props[H])||Ja.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.fa)||r.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&Ka(this._instance)&&this.er((()=>this.ga()))}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ja.error("Could not load product tours script",e):t()}))}ga(){var t;!this.fa&&null!=(t=Ot.__PosthogExtensions__)&&t.generateProductTours&&(this.fa=Ot.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!ie(this.pa)||e){var i=this.mi;if(i){var r=i.props[H];if(ie(r)&&!e)return this.pa=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",timestampMode:"query",callback:e=>{if(Ka(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ja.error(s),void t([],{isLoaded:!1,error:s})}var n=ie(e.json.product_tours)?e.json.product_tours:[];this.pa=n,i&&i.register({[H]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){he(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.fa)||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),null==(e=this.fa)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.fa)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.fa)||t.nextStep()}previousStep(){var t;null==(t=this.fa)||t.previousStep()}clearCache(){var t;this.pa=null,null==(t=this.mi)||t.unregister(H)}resetTour(t){var e;null==(e=this.fa)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.fa)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.fa)||e.cancelPendingTour(t)}}},yl),$l={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var i=this.globalsForEvent(e);this.ya.push(i),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return null==(t=Ot._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,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 of Object.entries(v)){var f=c[0];h[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,Ya),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),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}}wa(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)||(Qa.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)||(Qa.error("prepare_external_dependency_script returned null"),null):t}xa(){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==wt?void 0:wt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.ma++,this.ka)return this.Sa();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}))}},f=t=>{if(v.has(t))return t;var e=d.wa(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ue(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(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,p(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,p(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,p(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,p(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=p(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=f(i);return r?t.call(this,e,r):null})),this.ka=()=>{h.forEach((t=>t())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,0===this.ma&&(null==(e=this.ka)||e.call(this)))}}Ca(t,e){void 0===e&&(e=!0);var i=this.xa();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.ya.length&&(Qa.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((t=>this.Ca((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this._a)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Qa.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.Ca((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Qa.error(Xa+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Qa.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Ia(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Ca((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Qa.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.Ta(),void this._instance.on("eventCaptured",(t=>this.Ia(t)))):void Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._a)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;Ot["__$$ph_site_app_"+e]=s._instance,null==(t=Ot.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Qa.error(Xa+e,t)}))};for(var a of n.siteApps)o()}else Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},kl={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,e,i=this.Pa();i?(oe(this.Ma)&&(this.Ma=null==(t=Ot.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),oe(this.Ea)&&(this.Ea=null==(e=Ot.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,i;null!=(e=Ot.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=Ot.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Na.error("failed to load script",e);t()}))}Oa(){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}Pa(){var t=this.Oa();return ie(t)?(ie(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(ie(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;null==(t=this.Ma)||t.call(this),null==(e=this.Ea)||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Tl=i({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return oa.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(he(e))return oa.warn("Flags not loaded yet. Not loading surveys.");var i=ie(e);this.Fa=i?e.length>0:e,oa.info("flags response received, isSurveysEnabled: "+this.Fa),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(aa)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.La)oa.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)oa.info(sl);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())oa.info("Not loading surveys in cookieless mode without consent.");else{var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t){if(!oe(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var i=t.generateSurveys;if(i)return void this.Da(i,e);var r=t.loadExternalDependency;if(!r)return void this.qa(ot);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.qa("Could not load surveys script",i):this.Da(t.generateSurveys,e)}))}catch(t){throw this.qa("Error initializing surveys",t),t}finally{this.La=!1}}}else oa.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new il(this._instance),oa.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){oa.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Te.disable_surveys)return oa.info(sl),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this.Aa?this.Aa.then((e=>t(e.surveys,e.context))):("undefined"!=typeof Promise&&(this.Aa=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:e=>{var r;this.Aa=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;oa.error(n),this.Na=Date.now();var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.Na=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(na(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({[L]:l,[j]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(j);return de(t)&&Date.now()-t>3e5}Ua(){return de(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};la(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){oa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!he(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);oa.warn("init was not called")}za(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}Va(t){if(he(this._surveyManager))return{eligible:!1,reason:rl};var e="string"==typeof t?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(he(this._surveyManager))return{eligible:!1,reason:rl};var e="string"==typeof t?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(he(this._surveyManager))return oa.warn("init was not called"),{visible:!1,disabledReason:rl};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return he(this._surveyManager)?(oa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rl})):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.Wa(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(he(this._surveyManager))oa.warn("init was not called");else{var s="string"==typeof t?this.za(t):t;if(null!=s&&s.id)if(ua.includes(s.type)){var n=null==wt?void 0:wt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(oa.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;oa.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),oa.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);oa.warn("Survey element not found")}else oa.warn("Surveys of type "+s.type+" cannot be rendered in the app");else oa.warn("Survey not found")}}displaySurvey(t,e){var r;if(he(this._surveyManager))oa.warn("init was not called");else{var s=this.za(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!==Un.Popover&&e.initialResponses&&oa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Va(s);if(!o.eligible)return void oa.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==Un.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else oa.warn("Survey not found")}}cancelPendingSurvey(t){he(this._surveyManager)?oa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}},yl),Rl={toolbar:class{constructor(t){this.instance=t}Za(t){Ot.ph_toolbar_state=t}Ga(){var t;return null!==(t=Ot.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),Lr(this.instance.config))return!1;if(!mt||!wt)return!1;t=null!=t?t:mt.location,i=null!=i?i:mt.history;try{if(!e){try{mt.localStorage.setItem("test","test"),mt.localStorage.removeItem("test")}catch(t){return!1}e=null==mt?void 0:mt.localStorage}var r,s=nl||dn(t.hash,"__posthog")||dn(t.hash,"state"),n=s?Mr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Mr((()=>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(ol)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Qa(t){var e=Ot.ph_load_toolbar||Ot.ph_load_editor;!he(e)&&re(e)?e(t,this.instance):al.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==wt||!wt.getElementById(os));if(!mt||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(mt.localStorage.setItem(ol,JSON.stringify(i({},s,{source:void 0}))),2===this.Ga())this.Qa(s);else if(0===this.Ga()){var n;this.Za(1),null==(n=Ot.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return al.error("[Toolbar] Failed to load",t),void this.Za(0);this.Za(2),this.Qa(s)})),Ur(mt,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(s)}))}return!0}Ja(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)}}},Pl=i({experiments:_l},yl),Ol={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;he(e)||(ce(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||Lr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t&&!oe(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var i=t.loadExternalDependency;if(!i)return void this.tl(ot);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.tl("Could not load conversations script",e):this.el(t.initConversations),this.Ya=!1}))}catch(t){this.tl("Error initializing conversations",t),this.Ya=!1}}else gl.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),gl.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else gl.error("Cannot complete initialization: remote config is null")}tl(t,e){gl.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():gl.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ka&&!ue(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):(gl.warn(ml),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(gl.warn(ml),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(gl.warn(ml),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(gl.warn(ml),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(gl.warn(ml),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(gl.warn(ml),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gl.warn(ml),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()}Rn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Il={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=Rr("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var t,e;this.Hs=0,null==(t=this.ol)||t.onReconnect(),null==(e=this.al)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.rl=!0),mt&&Ur(mt,"online",this.sl)}ll(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=oe(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 Bi(this.ul(t,e),n,this.Ge,(()=>this.hl()),(t=>t()),void 0,r),n]}dl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.ol||this.cl!==e){var i;null==(i=this.ol)||i.reset(),this.cl=e;var r=this.ll((()=>this.Gr),(t=>{this.Gr=t}));this.ol=r[0],this.vl=r[1]}return this.ol}fl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.al||this.pl!==e){var i;null==(i=this.al)||i.reset(),this.pl=e;var r=this.ll((()=>this.nl),(t=>{this.nl=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},bl);this.al=r[0],this.gl=r[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!he(i)&&i&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],null==(t=this.ol)||t.reset(),this.nl=[],null==(e=this.al)||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))),this.al&&this.al.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.rl&&!this.il){var t=null==Ot?void 0:Ot.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ge.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(ot)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Dt.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Dt.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Tt:t=>this.Tt(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Tt(t){return new Promise((e=>{if(vn(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{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.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this._l(e),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)})}}})}}))}_l(t){(0!==t||this._instance.__loaded)&&(this.Hs=cn(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,s.LIB_NAME,(t=>{this.Gr=t})),this.nl.length>0&&this.wl(t,this.nl,this.gl,bl,(t=>{this.nl=t}))}wl(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=ji(o,Li(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,he(s)||(e.sessionStartTimestamp=s),he(n)||(e.lastActivityTimestamp=n)}if(null!=Ot&&null!=(t=Ot.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ii(Ot.location.href):Ot.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Cl={metrics:class{constructor(t){this.Ge=Rr("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.ol&&this.cl===i||(null==(e=this.ol)||e.reset(),this.cl=i,this.ol=new Vi(this.ul(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.Ge)),this.ol}count(t,e,i){void 0===e&&(e=1),this.dl().count(t,e,i)}gauge(t,e,i){this.dl().gauge(t,e,i)}histogram(t,e,i){this.dl().histogram(t,e,i)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((t=>this.Ge.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.ol)||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:t=>e.Bt(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(i({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Ml=i({},yl,wl,xl,El,Sl,$l,Tl,kl,Rl,Pl,Ol,Il,Cl);Ra.__defaultExtensionClasses=i({},Ml);var Al=Rr("[ExternalScriptsLoader]"),Fl=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Al.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==wt?void 0:wt.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(!wt)return i("document not found");var r=wt.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)wt.head.appendChild(r);else{var s,n=wt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):wt.body.appendChild(r)}};null!=wt&&wt.body?a():null==wt||wt.addEventListener("DOMContentLoaded",a)};Ot.__PosthogExtensions__=Ot.__PosthogExtensions__||{},Ot.__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)}},Ot.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Fl(t,r,i)};var Dl=function(){s.SDK_DIST_CHANNEL="npm";var t=fa[xa]=new Ra;return function(){function t(){t.done||(t.done=!0,Ea=!1,Or(fa,(function(t){t._dom_loaded()})))}null!=wt&&wt.addEventListener?"complete"===wt.readyState?t():Ur(wt,"DOMContentLoaded",t,{capture:!1}):mt&&Tr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Mn,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=Un,exports.PostHog=Ra,exports.ProductTourEventName=Ln,exports.ProductTourEventProperties=jn,exports.SurveyEventName=Dn,exports.SurveyEventProperties=Nn,exports.SurveyEventType=An,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={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Fn,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Dl,exports.posthog=Dl,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map