/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/posthog-js@1.414.0/dist/main.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"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.4.0",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.414.0",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",A="$feature_flag_request_id",M="$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="$surveys_activated_timestamps",q="ph_product_tours",V="$flag_call_reported",W="$flag_call_reported_session_id",G="$feature_flag_errors",K="$feature_flag_evaluated_at",J="$user_state",Y="$client_session_props",Q="$capture_rate_limit",X="$initial_campaign_params",Z="$initial_referrer_info",tt="$initial_person_info",et="$epp",it="$posthog_cookieless",rt="$cookieless_mode",st="$sdk_debug_extensions_init_method",nt="$sdk_debug_extensions_init_time_ms",ot="$sdk_debug_recording_script_not_loaded",at="PostHog loadExternalDependency extension not found.",lt="on_reject",ut="always",ht="anonymous",dt="identified",vt="identified_only",ct="visibilitychange",ft="beforeunload",pt="$pageview",_t="$pageleave",gt="$identify",mt="$groupidentify",bt="undefined"!=typeof window?window:void 0,yt="undefined"!=typeof globalThis?globalThis:bt,wt=null==yt?void 0:yt.navigator,xt=null==yt?void 0:yt.document,Et=null==yt?void 0:yt.location,St=null==yt?void 0:yt.fetch,$t=null!=yt&&yt.XMLHttpRequest&&"withCredentials"in new yt.XMLHttpRequest?yt.XMLHttpRequest:void 0,kt=null==yt?void 0:yt.AbortController,Tt=null==yt?void 0:yt.CompressionStream,Rt=null==wt?void 0:wt.userAgent;function Pt(){return!(!bt||!1===bt.navigator.onLine)}var Ot="undefined"!=typeof globalThis?globalThis:bt;Ot&&"undefined"==typeof self&&(Ot.self=Ot),Ot&&"undefined"==typeof File&&(Ot.File=function(){});var It=null!=bt?bt:{},Ct=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function At(t){return"string"==typeof t||t}function Mt(t){return"string"==typeof t?t:void 0}var Ft,Dt=["$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","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Nt=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.PushRegistered="push_registered",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}({}),Ut=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Lt=["$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"],jt=["token"],Bt="NativeGzipValidationError",zt=t=>t.length>=2&&31===t[0]&&139===t[1],Ht=(t,e)=>t===Ut.GZipJS||e===Ut.GZipJS||"gzip"===e,qt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Vt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Bt,e},Wt=function(){var t=e((function*(t,e){18>t.size&&Vt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());zt(i)&&8===i[2]||Vt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Ft)return Ft;Ft=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Ft[t]=e>>>0}return Ft})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Vt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Vt("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 Wt(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 Kt=["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 Kt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Yt(t,e){return-1!==t.indexOf(e)}var Qt=function(t){return t.trim()},Xt=function(t){return t.replace(/^\$/,"")};function Zt(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 te=Object.prototype,ee=te.hasOwnProperty,ie=te.toString,re=Array.isArray||function(t){return"[object Array]"===ie.call(t)},se=t=>"function"==typeof t,ne=t=>t===Object(t)&&!re(t),oe=t=>{if(ne(t)){for(var e in t)if(ee.call(t,e))return!1;return!0}return!1},ae=t=>void 0===t,le=t=>"[object String]"==ie.call(t),ue=t=>le(t)&&0===t.trim().length,he=t=>null===t,de=t=>ae(t)||he(t),ve=t=>"[object Number]"==ie.call(t)&&t==t,ce=t=>ve(t)&&t>0,fe=t=>"[object Boolean]"===ie.call(t),pe=t=>t instanceof FormData,_e=t=>Yt(Lt,t),ge=t=>Yt(jt,t);function me(t){return null===t||"object"!=typeof t}function be(t,e){return{}.toString.call(t)==="[object "+e+"]"}function ye(t){return"undefined"!=typeof Event&&we(t,Event)}function we(t,e){try{return t instanceof e}catch(t){return!1}}var xe=[!0,"true",1,"1","yes"],Ee=t=>Yt(xe,t),Se=[!1,"false",0,"0","no"];function $e(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),ve(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),$e(s||i,e,i,r))}class ke{constructor(t){this.tt={},this.et=t.et,this.it=$e(t.bucketSize,0,100,t.rt),this.nt=$e(t.refillRate,0,this.it,t.rt),this.st=$e(t.refillInterval,0,864e5,t.rt)}ot(t,e){var i=Math.floor((e-t.lastAccess)/this.st);i>0&&(t.tokens=Math.min(t.tokens+i*this.nt,this.it),t.lastAccess=t.lastAccess+i*this.st)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.tt[r];return s?this.ot(s,i):this.tt[r]=s={tokens:this.it,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.et)||e.call(this,t)),0===s.tokens)}stop(){this.tt={}}}var Te="Mobile",Re="iOS",Pe="Android",Oe="Tablet",Ie=Pe+" "+Oe,Ce="iPad",Ae="Apple",Me=Ae+" Watch",Fe="Safari",De="BlackBerry",Ne="Samsung",Ue=Ne+"Browser",Le=Ne+" Internet",je="Chrome",Be=je+" OS",ze=je+" "+Re,He="Internet Explorer",qe=He+" "+Te,Ve="Opera",We=Ve+" Mini",Ge="Edge",Ke="Microsoft "+Ge,Je="Firefox",Ye=Je+" "+Re,Qe="Nintendo",Xe="PlayStation",Ze="Xbox",ti=Pe+" "+Te,ei=Te+" "+Fe,ii="Windows",ri=ii+" Phone",si="Nokia",ni="Ouya",oi="Generic",ai=oi+" "+Te.toLowerCase(),li=oi+" "+Oe.toLowerCase(),ui="Konqueror",hi="Oculus Browser",di="Vivaldi",vi="Yandex",ci="Whale",fi="DuckDuckGo",pi="Pale Moon",_i="Waterfox",gi="Brave",mi="Google Search App",bi="(\\d+(\\.\\d+)?)",yi=new RegExp("Version/"+bi),wi=new RegExp(Ze,"i"),xi=new RegExp(Xe+" \\w+","i"),Ei=new RegExp(Qe+" \\w+","i"),Si=new RegExp(De+"|PlayBook|BB10","i"),$i={"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"},ki=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?gi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Yt(t,"GSA/")?mi:Yt(t," OPR/")&&Yt(t,"Mini")?We:Yt(t," OPR/")?Ve:Si.test(t)?De:Yt(t,"IE"+Te)||Yt(t,"WPDesktop")?qe:Yt(t,"OculusBrowser")?hi:Yt(t,Ue)?Le:Yt(t,Ge)||Yt(t,"Edg/")?Ke:Yt(t,di+"/")?di:Yt(t,"YaBrowser/")?vi:Yt(t,ci+"/")?ci:Yt(t,fi+"/")||Yt(t,"Ddg/")?fi:Yt(t,"FBIOS")?"Facebook "+Te:Yt(t,"UCWEB")||Yt(t,"UCBrowser")?"UC Browser":Yt(t,"CriOS")?ze:Yt(t,"CrMo")||Yt(t,je)?je:Yt(t,Pe)&&Yt(t,Fe)?ti:Yt(t,"FxiOS")?Ye:Yt(t.toLowerCase(),ui.toLowerCase())?ui:Yt(t,gi+"/")?gi:((t,e)=>e&&Yt(e,Ae)||function(t){return Yt(t,Fe)&&!Yt(t,je)&&!Yt(t,Pe)}(t))(t,e)?Yt(t,Te)?ei:Fe:Yt(t,"PaleMoon/")?pi:Yt(t,_i+"/")?_i:Yt(t,Je)?Je:Yt(t,"MSIE")||Yt(t,"Trident/")?He:Yt(t,"Gecko")?Je:"")},Ti={[qe]:[new RegExp("rv:"+bi)],[Ke]:[new RegExp(Ge+"?\\/"+bi)],[je]:[new RegExp("("+je+"|CrMo)\\/"+bi)],[ze]:[new RegExp("CriOS\\/"+bi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+bi)],[Fe]:[yi],[ei]:[yi],[Ve]:[new RegExp("(Opera|OPR)\\/"+bi)],[Je]:[new RegExp(Je+"\\/"+bi)],[Ye]:[new RegExp("FxiOS\\/"+bi)],[ui]:[new RegExp("Konqueror[:/]?"+bi,"i")],[De]:[new RegExp(De+" "+bi),yi],[ti]:[new RegExp("android\\s"+bi,"i")],[Le]:[new RegExp(Ue+"\\/"+bi)],[hi]:[new RegExp("OculusBrowser\\/"+bi)],[di]:[new RegExp(di+"\\/"+bi)],[vi]:[new RegExp("YaBrowser\\/"+bi)],[ci]:[new RegExp(ci+"\\/"+bi)],[gi]:[new RegExp(gi+"\\/"+bi)],[fi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+bi)],[pi]:[new RegExp("PaleMoon\\/"+bi)],[_i]:[new RegExp(_i+"\\/"+bi)],[mi]:[new RegExp("GSA\\/"+bi)],[He]:[new RegExp("(rv:|MSIE )"+bi)],Mozilla:[new RegExp("rv:"+bi)]},Ri=function(t,e,i,r){var s=ki(t,e,i,r),n=Ti[s];if(ae(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},Pi=[[new RegExp(Ze+"; "+Ze+" (.*?)[);]","i"),t=>[Ze,t&&t[1]||""]],[new RegExp(Qe,"i"),[Qe,""]],[new RegExp(Xe,"i"),[Xe,""]],[Si,[De,""]],[new RegExp(ii,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ri,""];if(new RegExp(Te).test(e)&&!/IEMobile\b/.test(e))return[ii+" "+Te,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=$i[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ii,r]}return[ii,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Re,[t[3],t[4],t[5]||"0"].join(".")]:[Re,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ae(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Pe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Pe+")","i"),t=>t&&t[2]?[Pe,[t[2],t[3],t[4]||"0"].join(".")]:[Pe,""]],[/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/,[Be,""]],[/Linux|debian/i,["Linux",""]]],Oi=function(t){return Ei.test(t)?Qe:xi.test(t)?Xe:wi.test(t)?Ze:new RegExp(ni,"i").test(t)?ni:new RegExp("("+ri+"|WPDesktop)","i").test(t)?ri:/iPad/.test(t)?Ce:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Me:Si.test(t)?De:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(si,"i").test(t)?si:/(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(Te).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)?Pe:Ie:new RegExp("(pda|"+Te+")","i").test(t)?ai:new RegExp(Oe,"i").test(t)&&!new RegExp(Oe+" pc","i").test(t)?li:""},Ii=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ci(t,e){return"string"==typeof(i=t)&&Ii.test(i)?t:e();var i}function Ai(t){return t?t.split("#")[0]:t}function Mi(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Fi(t,e,i){return Di.apply(this,arguments)}function Di(){return(Di=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Mi((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ni=t=>t instanceof Error,Ui={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}},Li=Ui.info;function ji(t){if(fe(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(re(t))return{arrayValue:{values:t.map((t=>ji(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Bi(t){var e=[];for(var i in t){var r=t[i];he(r)||ae(r)||e.push({key:i,value:ji(r)})}return e}function zi(t,e){var r=Ui[t.level||"info"]||Li,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),de(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),de(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:Bi(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ae(t.trace_flags)||(u.flags=t.trace_flags),u}function Hi(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 qi(t,e,i,r){return{resourceLogs:[{resource:{attributes:Bi(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Vi=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Ne=e,this.rt=i,this.ut=r,this.ht=s,this.dt=n,this.vt=o,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=e.maxBufferSize,this.xt=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.St=e.flushIntervalMs,this.Ct=e.maxBatchRecordsPerPost,this.Mt=e.rateCapWindowMs,this.Tt=e.maxLogsPerInterval}reset(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.It()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.Pt(t);if(null!==e)if(e.body){if(this.Rt()){var i={record:zi(e,this.ut())};this.ht((()=>this.At(i)))}}else this.rt.info("Log was rejected in beforeSend function")}}Pt(t){var e=this.Ne.beforeSend;if(!e)return t;var i=re(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.rt.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.rt.error("Error in beforeSend function for log:",t),null}return r}Rt(){if(void 0===this.Tt)return!0;var t=Date.now(),e=t-this.bt;return this.Mt>e&&e>=0||(this.bt=t,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.ct||(t.ct=t.Ft().finally((()=>{t.ct=null}))),t.ct}))()}Ft(){var t=this;return e((function*(){var e;t.Et();var i=null!==(e=t._instance.getPersistedProperty(Nt.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.ft=0;var a=Math.min(i.length,t.Ct),l=i.slice(0,a),u=qi(l.map((t=>t.record)),t.Lt(),null!==(n=t.vt)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.Ot(u);if("too-large"===h.kind&&l.length>1)t.Ct=Math.max(1,Math.floor(l.length/2)),t.rt.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ct);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.rt.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.Ne.maxBatchRecordsPerPost>t.Ct&&(t.Ct=Math.min(t.Ne.maxBatchRecordsPerPost,t.Ct+1)),yield t.Dt(l.length),i=null!==(o=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}Dt(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.ft),s=null!==(e=i._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Nt.LogsQueue,s.slice(r)),yield i.dt()}))()}Lt(){return Hi(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}At(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==e?e:[];this.xt>i.length||(i.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Nt.LogsQueue,i),this.kt>i.length?this.$t():this.It()}}$t(t){void 0===t&&(t=this.St),this.Nt||(this.Nt=Mi((()=>{this.Nt=void 0,this.It()}),t))}qt(){var t=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,t)}jt(){var t=this._instance.getPersistedProperty(Nt.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.Et();var e=i.flush().catch((()=>{}));void 0!==t?yield Fi(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield Fi(e,t,(()=>{e.catch((()=>{}))}))}))()}It(){this.flush().then((()=>{this.yt=0}),(t=>{this.yt++,this.rt.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.$t(this.qt())}))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Wi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Gi(t){return String(t)+"000000"}function Ki(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 Ji=class{constructor(t,e,i){this._instance=t,this.Ne=e,this.rt=i,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}count(t,e,i){void 0===e&&(e=1),this.Vt({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.Vt({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.Vt({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.ct,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.Zt()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.ct===s&&(this.ct=null)}));return this.ct=s,s}drainWindow(){if(0===this.Bt.size)return null;var t=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(t)}reset(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Vt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Pt(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.rt.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=Ki(e.type,e.name,e.unit,r)}catch(t){return void this.rt.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Bt.get(s);if(!n){if(!this.Qt())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Bt.set(s,n)}var o=this.Ut.get(e.name);void 0===o?this.Ut.set(e.name,e.type):o===e.type||this.zt.has(e.name)||(this.zt.add(e.name),this.rt.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.Kt(n,e.value),this.$t()}else this.rt.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}Qt(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Kt(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(Wi.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,Wi)]+=1}}Pt(t){var e=this.Ne.beforeSend;if(!e)return t;var i=re(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.rt.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.rt.error("Error in beforeSend function for metric:",t),null}return r}$t(){this.Nt||(this.Nt=Mi((()=>{this.Nt=void 0,this.flush().catch((t=>{this.rt.error("Metrics flush failed:",t)}))}),this.Ne.flushIntervalMs))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var t=this;return e((function*(){if(0!==t.Bt.size){var e=t.Bt;t.Bt=new Map,t.Ht=!1,t.Ut=new Map,t.zt=new Set;var i=t.Wt,r=yield t._instance.Jt(t.Gt(e));if(i===t.Wt)switch(r.kind){case"ok":return;case"retry-later":return t.Yt(e),void t.$t();case"too-large":return void t.rt.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.rt.error("Failed to send metrics batch:",r.error)}}}))()}Gt(t){return e=this.Xt(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.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Bi(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}Xt(t){var e=Gi(Date.now()),r=new Map;for(var s of t.values()){var n,o=Ki(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=Bi(null!==(n=s.attributes)&&void 0!==n?n:{}),u=Gi(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:Wi})}return Array.from(r.values())}Yt(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.Bt.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.Qt()&&this.Bt.set(s,n)}}};var Yi,Qi,Xi;function Zi(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Xi&&i.length===Qi||(Qi=i.length,Xi=i.reduce(((i,r)=>{Yi||(Yi={});var s=Yi[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,Yi[r]=[l,u];break}}return i}),{})),Xi}}class tr{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&&re(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:Zi(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 er="?";function ir(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?er:i,in_app:!0};return ae(r)||(n.lineno=r),ae(s)||(n.colno=s),n}var rr=(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]:er,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},sr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,nr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,or=/\((\S*)(?::(\d+))(?::(\d+))\)/,ar=(t,e)=>{var i=sr.exec(t);if(i)return ir(e,i[1],er,+i[2],+i[3]);var r=nr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=or.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=rr(r[1]||er,r[2]);return ir(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},lr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ur=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hr=(t,e)=>{var i=lr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ur.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]||er,o=rr(n,s);return ir(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},dr=/\(error: (.*)\)/;class vr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=le(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 be(t,"DOMException")}isDOMError(t){return be(t,"DOMError")}}class cr{match(t){return function(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return we(t,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 fr{constructor(){}match(t){return!!be(t,"ErrorEvent")&&(null!=t.error||this.fe(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.pe(t))&&void 0!==r?r:s.stack,synthetic:!0})}fe(t){return le(t.message)&&t.message.length>0}pe(t){var e=t;if(le(e.filename)&&e.filename.length>0){var i,r,s=null!==(i=e.lineno)&&void 0!==i?i:0,n=null!==(r=e.colno)&&void 0!==r?r:0;return"Error\n    at "+e.filename+":"+s+":"+n}}}var pr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _r{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(pr);return r&&(e=r[1],i=r[2]),[e,i]}}var gr=["fatal","error","warning","log","info","debug"];function mr(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 br{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r,s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null==(r=e.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return ye(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: "+mr(t)}isSeverityLevel(t){return le(t)&&!ue(t)&&gr.indexOf(t)>=0}getStack(t){try{return le(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:le(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ni(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class yr{match(t){return ye(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+mr(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class wr{match(t){return me(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 xr{match(t){return be(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!ye(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 me(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 Er="$message",Sr="$timestamp",$r=new Set([Er,Sr]),kr={enabled:!0,max_bytes:32768};function Tr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:kr.enabled,max_bytes:Pr(t.max_bytes,kr.max_bytes)}:i({},kr)}class Rr{constructor(t){this.Ke=[],this.Je=0,this.Ne=Tr(t)}setConfig(t){this.Ne=Tr(t),this.Xe()}add(t){var e=function(t){var e;try{e=Zt(t)}catch(t){return}try{var i=JSON.parse(e);if(!ne(i))return;var r=i,s=r[Er],n=r[Sr];if(!le(s)||0===s.trim().length)return;if(!le(n)&&!ve(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.Ne.max_bytes||(this.Ke.push({step:e.step,bytes:i}),this.Je+=i,this.Xe())}}getAttachable(){return this.Ke.map((t=>t.step))}clear(){this.Ke=[],this.Je=0}size(){return this.Ke.length}Xe(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var t=this.Ke.shift();t&&(this.Je-=t.bytes)}}}function Pr(t,e){if(!ve(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Or=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={k(e){if(bt&&(s.DEBUG||bt.POSTHOG_DEBUG||i)&&!ae(bt.console)&&bt.console){for(var r=("__rrweb_original__"in bt.console[e]?bt.console[e].__rrweb_original__:bt.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)=>Or(t+" "+e,i)};return r},Ir=Or("[PostHog.js]"),Cr=Ir.createLogger;function Ar(t,e){re(t)&&t.forEach(e)}function Mr(t,e){if(!de(t))if(re(t))t.forEach(e);else if(pe(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)ee.call(t,i)&&e(t[i],i)}var Fr=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 Dr(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 Nr=function(t){try{return t()}catch(t){return}},Ur=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){Ir.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ir.critical(t)}}},Lr=function(t){var e={};return Mr(t,(function(t,i){(le(t)&&t.length>0||ve(t))&&(e[i]=t)})),e};var jr=["herokuapp.com","vercel.app","netlify.app"];function Br(t){var e=null==t?void 0:t.hostname;if(!le(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of jr)if(i===r)return!1;return!0}function zr(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 Hr(t){return"ph_toolbar_internal"===t.name}var qr=t=>{if(xt){try{for(var e=t+"=",i=xt.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 ve(t)&&isFinite(t)&&Math.floor(t)===t});class Vr{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 Vr(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 Vr(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 Wr{generate(){var t=this.generateOrAbort();if(!ae(t))return t;this.S=0;var e=this.generateOrAbort();if(ae(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 Vr.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new Jr}}var Gr,Kr=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};bt&&!ae(bt.crypto)&&crypto.getRandomValues&&(Kr=t=>crypto.getRandomValues(t));class Jr{nextUint32(){return this.R.length>this.O||(Kr(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Yr=()=>Qr().toString(),Qr=()=>(Gr||(Gr=new Wr)).generate(),Xr="",Zr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ts={N:()=>!!xt,j(t){Ir.error("cookieStore error: "+t)},P:qr,H(t){var e;try{e=JSON.parse(ts.P(t))||{}}catch(t){}return e},F(t,e,i,r,s){if(!xt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=xt),Xr)return Xr;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_"+Yr();!Xr&&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",Xr=n)}return Xr}(t);if(!i){var r=(t=>{var e=t.match(Zr);return e?e[0]:""})(t);r!==i&&Ir.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(xt.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&&Ir.warn("cookieStore warning: large cookie, len="+u.length),xt.cookie=u,!0}catch(t){return!1}},q(t,e){if(null!=xt&&xt.cookie)try{ts.F(t,"",-1,e)}catch(t){return}}},es=null,is={N(){if(!he(es))return es;var t=!0;if(ae(bt))t=!1;else try{var e="__mplssupport__";is.F(e,"xyz"),'"xyz"'!==is.P(e)&&(t=!1),is.q(e)}catch(e){t=!1}return t||Ir.error("localStorage unsupported; falling back to cookie store"),es=t,t},j(t){Ir.error("localStorage error: "+t)},P(t){try{return null==bt?void 0:bt.localStorage.getItem(t)}catch(t){is.j(t)}return null},H(t){try{return JSON.parse(is.P(t))||{}}catch(t){}return null},F(t,e){try{return null==bt||bt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){is.j(t)}return!1},q(t){try{null==bt||bt.localStorage.removeItem(t)}catch(t){is.j(t)}}},rs=[o,"distinct_id",k,T,et,tt,J],ss={},ns={N:()=>!0,j(t){Ir.error("memoryStorage error: "+t)},P:t=>ss[t]||null,H:t=>ss[t]||null,F:(t,e)=>(ss[t]=e,!0),q(t){delete ss[t]}},os=null,as={N(){if(!he(os))return os;if(os=!0,ae(bt))os=!1;else try{var t="__support__";as.F(t,"xyz"),'"xyz"'!==as.P(t)&&(os=!1),as.q(t)}catch(t){os=!1}return os},j(t){Ir.error("sessionStorage error: ",t)},P(t){try{return null==bt?void 0:bt.sessionStorage.getItem(t)}catch(t){as.j(t)}return null},H(t){try{return JSON.parse(as.P(t))||null}catch(t){}return null},F(t,e){try{return null==bt||bt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){as.j(t)}return!1},q(t){try{null==bt||bt.sessionStorage.removeItem(t)}catch(t){as.j(t)}}};class ls{constructor(t){this._instance=t}get Ne(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Ne.cookieless_mode===ut||this.isRejected()||-1===this.consent&&this.Ne.cookieless_mode===lt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Ne.opt_out_capturing_by_default}optInOut(t){this.ii.F(this.ri,t?1:0,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}reset(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}get ri(){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 ei(){var t=this.ii.P(this.ri);return Ee(t)?1:Yt(Se,t)?0:-1}get ii(){var t=this.Ne.opt_out_capturing_persistence_type,e="localStorage"===t?is:ts;if(!this.ni||this.ni!==e){this.ni=e;var i="localStorage"===t?ts:is;i.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(Ee(i.P(this.ri))),i.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Ne.respect_dnt&&[null==wt?void 0:wt.doNotTrack,null==wt?void 0:wt.msDoNotTrack,It.doNotTrack].some((t=>Ee(t)))}}function us(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!se(r))return e;try{var s=r(e);return le(s)&&s?s:e}catch(t){return Ir.error("Error in get_current_url, falling back to window.location.href",t),e}}var hs="__POSTHOG_TOOLBAR__",ds=1,vs=3,cs=11;function fs(t){return t instanceof Element&&(t.id===hs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ps(t){return!!t&&t.nodeType===ds}function _s(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function gs(t){return!!t&&t.nodeType===vs}function ms(t){return!!t&&t.nodeType===cs&&ps(t.host)}var bs=1e3;function ys(t){return t?Qt(t).split(/\s+/):[]}function ws(t,e){var i=function(t){var e,i=null==bt||null==(e=bt.location)?void 0:e.href;return ae(i)?void 0:us(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function xs(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 ys(e)}function Es(t){return de(t)?null:Qt(t).split(/(\s+)/).filter((t=>Gs(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ss(t){var e="";return Us(t)&&!Ls(t)&&t.childNodes&&t.childNodes.length&&Mr(t.childNodes,(function(t){var i;gs(t)&&t.textContent&&(e+=null!==(i=Es(t.textContent))&&void 0!==i?i:"")})),Qt(e)}function $s(t){var e;return ae(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var ks=["a","button","form","input","select","textarea","label"];function Ts(t,e){if(ae(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 Rs(t){var e=t.parentNode;return!(!e||!ps(e))&&e}var Ps=[".ph-no-autocapture","[data-ph-no-autocapture]"],Os=["next","previous","prev",">","<"],Is=[...Os,"+","-","−","–"],Cs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,As=[".ph-no-rageclick",".ph-no-capture"],Ms=["","text","search","email","password","url","tel","number"];function Fs(t,e){if(!bt||Ds(t))return!1;var i,r,s,n,o;if(fe(e)?(i=!!e&&As,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:As,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||!ps(t))&&(!!_s(t,"textarea")||(_s(t,"input")?Yt(Ms,(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=Ns(t,!1).targetElementList;return!function(t,e){if(!1===t||ae(t))return!1;var i;if(!0===t)i=Os;else{if(!re(t))return!1;if(t.length>10)return Ir.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=>Cs(e,t)||Cs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ss(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Ts(a,i)}var Ds=t=>!t||_s(t,"html")||!ps(t),Ns=(t,e)=>{if(!bt||Ds(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!_s(s,"body");)if(ms(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Rs(s);if(!n)break;if(e||ks.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=bt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Us(t){for(var e=new Set,i=0,r=t;r.parentNode&&!_s(r,"body");r=r.parentNode){if(i++>=bs||e.has(r))return!1;e.add(r);var s=xs(r);if(Yt(s,"ph-sensitive")||Yt(s,"ph-no-capture"))return!1}if(Yt(xs(t),"ph-include"))return!0;var n=t.type||"";if(le(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!le(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 Ls(t){return!!(_s(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||_s(t,"select")||_s(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var js=new RegExp("^(?:(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}))$"),Bs=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zs=[16,15,14,13],Hs=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),qs=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Vs=/[0-9A-Za-z_]/;function Ws(t){for(var e=0,i=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;i&&(s*=2)>9&&(s-=9),e+=s,i=!i}return e%10==0}function Gs(t,e){if(void 0===e&&(e=!0),de(t))return!1;if(le(t)){t=Qt(t);var i=e?js.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(Bs.lastIndex=0;e=Bs.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of zs){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(js.test(a)&&Ws(a))return!0}}}return!1}(t);if(i)return!1;var r=e?Hs.test(t):function(t){var e;for(qs.lastIndex=0;e=qs.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&Vs.test(i)&&Vs.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function Ks(t){var e=Ss(t);return Gs(e=(e+" "+Js(t)).trim())?e:""}function Js(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Mr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ss(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Js(t)).trim())}catch(t){Ir.error("[AutoCapture]",t)}})),e}function Ys(t){return t.replace(/"|\\"/g,'\\"')}function Qs(t){var e=t.attr__class;if(e)return re(e)?e:ys(e)}var Xs=Cr("[Dead Clicks]"),Zs=()=>!0,tn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(_)),r=t.instance.config.capture_dead_clicks;return fe(r)?r:!!ne(r)||i};class en{get lazyLoadedDeadClicksAutocapture(){return this.si}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.ai((()=>{this.oi()})):this.stop()}ai(t){var e,i;null!=(e=It.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Xs.error("failed to load script",e):t()}))}oi(){var t;if(xt){if(!this.si&&null!=(t=It.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=ne(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.si=It.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.si.start(xt),Xs.info("starting...")}}else Xs.error("`document` not found. Cannot start.")}stop(){this.si&&(this.si.stop(),this.si=void 0,Xs.info("stopping..."))}}var rn=Cr("[SegmentIntegration]");var sn="posthog-js";function nn(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 on{constructor(t,e,i,r,s,n){this.name=sn,this.setupOnce=function(o){o(nn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class an{constructor(t){this.li=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ir.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hi()}hi(){var t;this.di=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.li)}destroy(){var t;null==(t=this.di)||t.call(this),this.di=void 0}doPageView(t,e){var i,r=this.vi(t,e);return this.ui={pathname:null!==(i=null==bt?void 0:bt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.vi(t,null==(e=this.ui)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ui)?void 0:t.pageViewId}}vi(t,e){var i=this.ui;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(!(ae(n)||ae(o)||ae(a)||ae(l)||ae(u)||ae(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?$e(o/n,0,1,Ir):1,v=n>1?$e(a/n,0,1,Ir):1,c=l>1?$e(u/l,0,1,Ir):1,f=l>1?$e(h/l,0,1,Ir):1;r=Fr(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 ln=["flags","surveys"],un={[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=>he(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(!ne(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"},[A]:{exposure:"event",storageGroup:"flags",volatile:!0},[M]:{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"},[q]:{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"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{exposure:"event"},[ot]:{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"}},hn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],dn=t=>{var e=un[t];if(e)return e;for(var i of hn){var r=i[1];if(0===t.indexOf(i[0]))return r}},vn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return Zt(t)}},cn=t=>{var e=null==xt?void 0:xt.createElement("a");return ae(e)?null:(e.href=t,e)},fn=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(!re(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Ir.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},pn=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("=");re(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},_n=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},gn=(t,e)=>t>=e&&Pt(),mn=(t,e,i,r)=>{if(0===t){if(Pt()){var s=e+1;return s===i&&r(),s}return e}return 0},bn="https?://(.*)",yn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],wn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...yn],xn="<masked>",En=["li_fat_id"];function Sn(t,e,i){if(!xt)return{};var r,s=e?[...yn,...i||[]]:[],n=$n(pn(xt.URL,s,xn),t),o=(r={},Mr(En,(function(t){var e=qr(t);r[t]=e||null})),r);return Fr(o,n)}function $n(t,e){var i=wn.concat(e||[]),r={};return Mr(i,(function(e){var i=fn(t,e);r[e]=i||null})),r}function kn(t){var e=function(t){return t?0===t.search(bn+"google.([^/?]*)")?"google":0===t.search(bn+"bing.com")?"bing":0===t.search(bn+"yahoo.com")?"yahoo":0===t.search(bn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!he(e)){r.$search_engine=e;var s=xt?fn(xt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Tn(){return navigator.language||navigator.userLanguage}var Rn="$direct";function Pn(){return(null==xt?void 0:xt.referrer)||Rn}function On(t,e,i){void 0===i&&(i=!1);var r=t?[...yn,...e||[]]:[],s=i?Ai(null==Et?void 0:Et.href):null==Et?void 0:Et.href,n=null==s?void 0:s.substring(0,1e3);return{r:Pn().substring(0,1e3),u:n?pn(n,r,xn):void 0}}function In(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Ai(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Rn?Rn:null==(i=cn(r))?void 0:i.host};if(n){o.$current_url=n;var a=cn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=$n(n);Fr(o,l)}if(r){var u=kn(r);Fr(o,u)}return o}function Cn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function An(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Mn={flags:K,surveys:j},Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Dn="main";class Nn{constructor(t,e,r){if(void 0===r&&(r=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=t,this.gi=r,this.props={},this.mi=void 0,this.yi=(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.ii=this.bi(t),this.pi=this.wi(t),this.load(),t.debug&&Ir.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),bt){var s=()=>this.flush();zr(bt,"beforeunload",s,{capture:!1}),zr(bt,"pagehide",s,{capture:!1})}}ki(){var t,e=null==(t=this.Ne)?void 0:t.persistence_save_debounce_ms;return ve(e)&&e>0?e:0}isDisabled(){return!!this.xi}bi(t){-1===Fn.indexOf(t.persistence.toLowerCase())&&(Ir.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=[...rs,...t];return i({},is,{H(t){try{var i={};try{i=ts.H(t)||{}}catch(t){}var r,s=JSON.parse(is.P(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];he(a)||""===a||(n[o]=a)}r=Fr(s,n)}else r=Fr(i,s);return is.F(t,r),r}catch(t){}return null},F(t,e,i,s,n,o){var a=is.F(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&ts.F(t,l,i,s,n,o)}catch(t){is.j(t)}return a},q(t,e){try{null==bt||bt.localStorage.removeItem(t),ts.q(t,e)}catch(t){is.j(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&is.N()?(e=is,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&as.N()?e=as:"memory"===n?e=ns:"cookie"===n?e=ts:r.N()?(e=r,s=!0):e=ts,this.fi=s,e}Si(t){return this.yi+"__"+t}wi(t){return this.fi&&!!t.split_storage}Ci(t){var e=null!=t?t:this.Ne.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[K];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Mr(this.props,((e,i)=>{var r=dn(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===R?()=>this.Ci():()=>!1))return;r.transformToEventProperties&&Fr(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.xi){var t=this.ii.H(this.yi);t&&(this.props=Fr({},t)),this.pi&&this.Mi()}}Mi(){for(var t of ln){var e=is.H(this.Si(t));if(e&&!oe(e)){var i=this.Ti(t);i.persisted=!0,this.Ei(t)||(i.fingerprint=this.Ii(e,t)),this.Pi(t,e)||Fr(this.props,e)}}}Ei(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=dn(e))?void 0:i.storageGroup)===t}))}Pi(t,e){var i=Mn[t];if(!i)return!1;var r=e[i],s=this.props[i];return ve(r)&&ve(s)&&s>r}refreshKey(t){var e;if(!this.xi){var i=this.pi?null==(e=dn(t))?void 0:e.storageGroup:void 0,r=i?is.H(this.Si(i)):this.ii.H(this.yi);if(r&&t in r)this.Ri(t,r[t]);else{if(i){var s=this.ii.H(this.yi);if(s&&t in s)return void this.Ri(t,s[t])}this.Ai(t)}}}save(){if(!this.xi){var t=this.ki();t>0?ae(this.Fi)&&(this.Fi=setTimeout((()=>{this.Fi=void 0,this.Li()}),t)):this.Li()}}flush(){ae(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0,this.Li())}Li(){this.xi||(this.pi?this.Oi():this.Di(this.ii,this.yi,this.props,Dn))}Oi(){var t=this.$i(),e=t.main,i=t.groups;for(var r of(this.Di(this.ii,this.yi,e,Dn),ln)){var s,n=i[r];(!oe(n)||null!=(s=this.ci[r])&&s.persisted)&&this.Di(is,this.Si(r),n,r)}}$i(){var t={},e={flags:{},surveys:{}};return Mr(this.props,((i,r)=>{var s,n=null==(s=dn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ii(t,e){if(e===Dn)return JSON.stringify(t)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var i={};return Mr(t,((t,e)=>{var r;i[e]=null!=(r=dn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Di(t,e,i,r){var s=this.Ti(r);if(r===Dn||s.dirty||ae(s.fingerprint)){var n;try{if((n=this.Ii(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.F(e,i,this.Ni,this.qi,this.ji,this.Ne.debug)?(s.dirty=!1,r!==Dn&&(s.persisted=!0),ae(n)||(s.fingerprint=n)):this.Ne.debug&&Ir.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(ae(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!i&&this.gi)for(var r of ln)is.q(this.Si(r));i?delete this.ci[Dn]:this.ci={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(ne(t)){ae(e)&&(e="None"),this.Ni=ae(i)?this.Bi:i;var r=!1;if(Mr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ri(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(ne(t)){this.Ni=ae(e)?this.Bi:e;var i=!1;if(Mr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||ne(e)||re(e))&&(this.Ri(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Ai(t),this.save())}update_campaign_params(){var t=null==xt?void 0:xt.URL;if(t!==this.mi){var e=Sn(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);oe(Lr(e))||this.register(e),this.mi=t}}update_search_keyword(){var t;this.register((t=null==xt?void 0:xt.referrer)?kn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Pn(),$referring_domain:null!=xt&&xt.referrer&&(null==(t=cn(xt.referrer))?void 0:t.host)||Rn},void 0)}set_initial_person_info(){this.props[X]||this.props[Z]||this.register_once({[tt]:On(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Mr([Z,X],(e=>{var i=this.props[e];i&&Mr(i,(function(e,i){t["$initial_"+Xt(i)]=e}))}));var e=this.props[tt];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=In(t,e),r={};return Mr(i,(function(t,e){r["$initial_"+Xt(e)]=t})),r}(e,this.Ne.disable_capture_url_hashes);Fr(t,i)}return t}safe_merge(t){return Mr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.Bi=this.Ni=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.bi(t):this.ii,n=this.wi(t);if(r||n!==this.pi){var o=this.props;this.clear(),this.ii=s,this.pi=n,this.props=o,this.save()}}set_disabled(t){this.xi=t,this.xi?this.remove():this.save()}set_cross_subdomain(t){t!==this.qi&&(this.qi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ji&&(this.ji=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.Ri(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return ae(i)||(delete e[t],this.Ri(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ri(t,e),this.save()}Ri(t,e){var i;this.props[t]=e,null!=(i=dn(t))&&i.volatile||this.Hi(t)}Ai(t){delete this.props[t],this.Hi(t)}Hi(t){var e,i=null==(e=dn(t))?void 0:e.storageGroup;i&&(this.Ti(i).dirty=!0)}Ti(t){return this.ci[t]||(this.ci[t]={})}}function Un(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&se(i.then)&&i.then(void 0,(()=>{}))}}}}var Ln={GZipJS:"gzip-js",Base64:"base64"},jn={Activation:"events",Cancellation:"cancelEvents"},Bn={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},zn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Hn={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},qn={Popover:"popover",Inline:"inline"},Vn={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"},Wn={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"},Gn=Cr("[RateLimiter]");class Kn{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=>{Gn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Gn.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(Q))&&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;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var u=(ve(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ui(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Q,a),{isRateLimited:l,remainingTokens:a.tokens}}zi(t){var e=this.instance.config.property_denylist;return!re(e)||!e.includes(t)}Wi(){var t;if(this.zi("$current_url")&&this.zi("$pathname")&&null!=Et&&Et.pathname)return""+(null!==(t=Et.origin)&&void 0!==t?t:"")+Et.pathname}Ui(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Wi(),o=this.zi("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Jn=Cr("[RemoteConfig]");class Yn{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=It._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Vi(t){var e,i;null!=(e=It.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Zi(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Jn.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance.Ki())return void Jn.warn("Remote config is disabled. Falling back to local config.");this.Vi((t=>{if(!t)return Jn.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((t=>{this.Gi(t.json,t),this.Qi()}));this.Gi(t),this.Qi()}))}catch(t){Jn.error("Error loading remote config",t),this.Gi()}}stop(){this.Ji&&(clearInterval(this.Ji),this.Ji=void 0)}refresh(){!this._instance.Ki()&&xt&&"hidden"!==xt.visibilityState&&this._instance.reloadFeatureFlags()}Qi(){var t;if(!this.Ji){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Ji=setInterval((()=>{this.refresh()}),e))}}Gi(t,e){!t&&e&&(0===e.statusCode?e.error||Jn.warn("Failed to fetch remote config from PostHog."):Jn.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(t?{ok:!0,config:t}:{ok:!1})}catch(t){Jn.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){Jn.error("Error loading feature flags",t)}}}var Qn=Uint8Array,Xn=Uint16Array,Zn=Uint32Array,to=new Qn([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]),eo=new Qn([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]),io=new Qn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ro=function(t,e){for(var i=new Xn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Zn(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]},so=ro(to,2),no=so[1];so[0][28]=258,no[258]=28;for(var oo=ro(eo,0)[1],ao=new Xn(32768),lo=0;32768>lo;++lo){var uo=(43690&lo)>>>1|(21845&lo)<<1;ao[lo]=((65280&(uo=(61680&(uo=(52428&uo)>>>2|(13107&uo)<<2))>>>4|(3855&uo)<<4))>>>8|(255&uo)<<8)>>>1}var ho=function(t,e,i){for(var r=t.length,s=0,n=new Xn(e);r>s;++s)++n[t[s]-1];var o,a=new Xn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Xn(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[ao[d]>>>l]=u}else for(o=new Xn(r),s=0;r>s;++s)o[s]=ao[a[t[s]-1]++]>>>15-t[s];return o},vo=new Qn(288);for(lo=0;144>lo;++lo)vo[lo]=8;for(lo=144;256>lo;++lo)vo[lo]=9;for(lo=256;280>lo;++lo)vo[lo]=7;for(lo=280;288>lo;++lo)vo[lo]=8;var co=new Qn(32);for(lo=0;32>lo;++lo)co[lo]=5;var fo=ho(vo,9,0),po=ho(co,5,0),_o=function(t){return(t/8>>0)+(7&t&&1)},go=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Xn?Xn:t instanceof Zn?Zn:Qn)(i-e);return r.set(t.subarray(e,i)),r},mo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},bo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},yo=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 Qn(0),0];if(1==s){var o=new Qn(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 Xn(v+1),f=wo(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 Qn(c),f]},wo=function(t,e,i){return-1==t.s?Math.max(wo(t.l,e,i+1),wo(t.r,e,i+1)):e[t.s]=i},xo=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Xn(++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]},Eo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},So=function(t,e,i){var r=i.length,s=_o(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)},$o=function(t,e,i,r,s,n,o,a,l,u,h){mo(e,h++,i),++s[256];for(var d=yo(s,15),v=d[0],c=d[1],f=yo(n,15),p=f[0],_=f[1],g=xo(v),m=g[0],b=g[1],y=xo(p),w=y[0],x=y[1],E=new Xn(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=yo(E,7),T=k[0],R=k[1],P=19;P>4&&!T[io[P-1]];--P);var O,I,C,A,M=u+5<<3,F=Eo(s,vo)+Eo(n,co)+o,D=Eo(s,v)+Eo(n,p)+o+14+3*P+Eo(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(F>=M&&D>=M)return So(e,h,t.subarray(l,l+u));if(mo(e,h,1+(F>D)),h+=2,F>D){O=ho(v,c,0),I=v,C=ho(p,_,0),A=p;var N=ho(T,R,0);for(mo(e,h,b-257),mo(e,h+5,x-1),mo(e,h+10,P-4),h+=14,S=0;P>S;++S)mo(e,h+3*S,T[io[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)mo(e,h,N[B=31&j[S]]),h+=T[B],B>15&&(mo(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=fo,I=vo,C=po,A=co;for(S=0;a>S;++S)if(r[S]>255){var B;bo(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(mo(e,h,r[S]>>>23&31),h+=to[B]);var z=31&r[S];bo(e,h,C[z]),h+=A[z],z>3&&(bo(e,h,r[S]>>>5&8191),h+=eo[z])}else bo(e,h,O[r[S]]),h+=I[r[S]];return bo(e,h,O[256]),h+I[256]},ko=new Zn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),To=function(){for(var t=new Zn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Ro=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Po(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=To[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 Qn(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=So(l,u,t.subarray(h,d)):(l[h]=!0,u=So(l,u,t.subarray(h,o)))}else{for(var v=ko[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new Xn(32768),g=new Xn(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 Zn(25e3),x=new Xn(288),E=new Xn(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 A=o-h;if((S>7e3||T>24576)&&A>423){u=$o(t,l,0,w,x,E,k,T,P,h-P,u),T=S=k=0,P=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var F=2,D=0,N=f,U=I-C&32767;if(A>2&&O==y(h-U))for(var L=Math.min(c,A)-1,j=Math.min(32767,h),B=Math.min(258,A);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(M=0;H>M;++M){var V=h-U+M+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[T++]=268435456|no[F]<<18|oo[D];var G=31&no[F],K=31&oo[D];k+=to[G]+eo[K],++x[257+G],++E[K],R=h+F,++S}else w[T++]=t[h],++x[t[h]]}}u=$o(t,l,!0,w,x,E,k,T,P,h-P,u)}return go(a,0,r+_o(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&&Ro(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),Ro(u,h-8,i.d()),Ro(u,h-4,r),u}var Oo=!!$t||!!St,Io="text/plain",Co=!1,Ao=(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:"")},Mo=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 Mr(t,(function(t,e){ae(t)||ae(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},Fo=t=>{if(t.Yi)return t.Yi;var e=t.data,i=t.compression;if(e){if(i===Ln.GZipJS){var r=Po(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Qn(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 Qn(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 go(r,0,s)}(vn(e)),{mtime:0});return{contentType:Io,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ln.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(vn(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:vn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=vn(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Do=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Mo(t.url,{compression:Ln.Base64}),encodedBody:Fo(i({},t,{compression:Ln.Base64,Yi:void 0}))}:{url:Ao(t.url,"compression"),encodedBody:Fo(i({},t,{compression:void 0,Yi:void 0}))};try{e=Fo(t)}catch(e){if(Ht(t.compression,fn(t.url,"compression")))return Ir.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Ht(t.compression,fn(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?zt(new Uint8Array(r)):ArrayBuffer.isView(r)&&zt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Co=!0,s()):{url:t.url,encodedBody:e}},No=t=>{try{return Do(t)}catch(e){return Ir.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Uo=function(){var t=e((function*(t){var e=vn(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,{Yi:{contentType:Io,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Lo=/Failed to fetch|NetworkError|Load failed/i,jo=t=>"TypeError"===(null==t?void 0:t.name)&&Lo.test((null==t?void 0:t.message)||""),Bo=t=>{var e=No(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;Mr(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if(kt){var v=new kt;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)||jo(e)?Ir.warn(e):Ir.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;St(r,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Xi&&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){Ir.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>h?clearTimeout(h.timeout):null))}catch(t){h&&clearTimeout(h.timeout),c(t)}}},zo=t=>{try{var e,r=Do(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(wt.sendBeacon(s,u))return;var h=re(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(re(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>re(t.data)?e:i({},t.data,{batch:e});return zo(i({},t,{data:v(h.slice(0,d))})),void zo(i({},t,{data:v(h.slice(d))}))}Ir.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Bo(i({},t,{Xi:!0}))}catch(t){Ir.warn("Beacon send failed",t)}},Ho=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Mo(r===Ln.GZipJS?Ao(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ln.GZipJS?{}:{compression:r}))},qo=[];St&&qo.push({transport:"fetch",method:Bo}),$t&&qo.push({transport:"XHR",method(t){var e=No(t);if(e){var i=new $t,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Mr(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!=wt&&wt.sendBeacon&&qo.push({transport:"sendBeacon",method:zo});var Vo=3e3;class Wo{constructor(t,e){this.tr=!0,this.er=[],this.ir=$e((null==e?void 0:e.flush_interval_ms)||Vo,250,5e3,Ir.createLogger("flush interval"),Vo),this.rr=t}enqueue(t){this.er.push(t),this.nr||this.sr()}unload(){this.ar();var t=this.er.length>0?this.lr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ur(i({},t,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var t=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var e=this.lr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&re(i.data)&&Mr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ur(i)};for(var r in e)i()}}),this.ir))}ur(t){try{this.rr(t)}catch(t){Ir.error(t)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var t={};return Mr(this.er,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ae(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.er=[],t}}var Go=["retriesPerformedSoFar"];class Ko{constructor(t){this.hr=!1,this.dr=3e3,this.er=[],this._instance=t,this.er=[],this.vr=!0,!ae(bt)&&"onLine"in bt.navigator&&(this.vr=bt.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},zr(bt,"online",this.cr),zr(bt,"offline",this.gr))}get length(){return this.er.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,Go);ce(e)&&(s.url=Mo(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.At(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Ir.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)}}))}At(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.er.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ir.warn(s),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),0===this.er.length)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var t=Date.now(),e=[],i=this.er.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.er=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,ae(bt)||(this.cr&&(bt.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(bt.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Ir.error(t)}}this.er=[]}}class Jo{constructor(t){this.br=()=>{var t,e,i,r;this._r||(this._r={});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._r.lastScrollY=Math.ceil(n),this._r.maxScrollY=Math.max(n,null!==(t=this._r.maxScrollY)&&void 0!==t?t:0),this._r.maxScrollHeight=Math.max(o,null!==(e=this._r.maxScrollHeight)&&void 0!==e?e:0),this._r.lastContentY=a,this._r.maxContentY=Math.max(a,null!==(i=this._r.maxContentY)&&void 0!==i?i:0),this._r.maxContentHeight=Math.max(l,null!==(r=this._r.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var t=this._r;return setTimeout(this.br,0),t}startMeasuringScrollPosition(){zr(bt,"scroll",this.br,{capture:!0}),zr(bt,"scrollend",this.br,{capture:!0}),zr(bt,"resize",this.br)}scrollElement(){if(!this.wr)return null==bt?void 0:bt.document.documentElement;var t=re(this.wr)?this.wr:[this.wr];for(var e of t){var i=null==bt?void 0:bt.document.querySelector(e);if(i)return i}}kr(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.wr){var i=this.scrollElement();return i&&i[e]||0}return bt?"y"===t?bt.scrollY||bt.pageYOffset||bt.document.documentElement.scrollTop||0:bt.scrollX||bt.pageXOffset||bt.document.documentElement.scrollLeft||0:0}scrollY(){return this.kr("y")}scrollX(){return this.kr("x")}}var Yo=t=>On(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.Sr=t=>{var e=this.Cr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Mr(this._instance)};this.Tr.register({[Y]:i})}},this._instance=t,this.Er=e,this.Tr=i,this.Mr=r||Yo,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[Y]}getSetOnceProps(){var t,e=null==(t=this.Cr())?void 0:t.props;return e?"r"in e?In(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 Mr(Lr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Xt(i)]=e})),t}}class Xo{on(t,e){return this.Ir[t]||(this.Ir[t]=[]),this.Ir[t].push(e),()=>{this.Ir[t]=this.Ir[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ir[t]||[])i(e);for(var r of this.Ir["*"]||[])r(t,e)}constructor(){this.Ir={}}}var Zo=Cr("[SessionId]");class ta{on(t,e){return this.Pr.on(t,e)}constructor(t,e,i){var r;if(this.Rr=null,this.Ar=[],this.Fr=void 0,this.Lr=!1,this.Pr=new Xo,this.Or=(t,e)=>!(!ce(t)||!ce(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ut)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=t.config,this.Tr=t.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=e||Yr,this.qr=i||Yr;var s=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*$e(this.Ne.session_idle_timeout_seconds||1800,60,36e3,Zo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+s+"_window_id",this.Hr="ph_"+s+"_primary_window_exists",this.Ur()){var n=as.H(this.Br),o=as.H(this.Hr);n&&!o?this.Dr=n:as.q(this.Br),as.F(this.Hr,!0)}if(null!=(r=this.Ne.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Ne.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.zr(this.Ne.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Zo.error("Invalid sessionID in bootstrap",t)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ae(this.Ar)&&(this.Ar=[]),this.Ar.push(t),this.$r&&t(this.$r,this.Dr),()=>{this.Ar=this.Ar.filter((e=>e!==t))}}Ur(){return"memory"!==this.Ne.persistence&&!this.Tr.xi&&as.N()}Vr(t){t!==this.Dr&&(this.Dr=t,this.Ur()&&as.F(this.Br,t))}Zr(){return this.Dr?this.Dr:this.Ur()?as.H(this.Br):null}Gr(t){var e=this.Rr;return!he(e)&&!he(t)&&5e3>Math.abs(t-e)}zr(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.$r||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.$r=t,s&&!r||s&&this.Gr(e)||(this.Rr=e,this.Tr.register({[k]:[e,t,i]}))}Qr(){var t,e=null==(t=this.Ne)?void 0:t.persistence_save_debounce_ms;return ce(e)&&e>0}Kr(){this.Qr()?this.Tr.refreshKey(k):(this.Tr.flush(),this.Tr.load())}Jr(){var t;if(!he(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Kr();var e=this.Yr();e[1]===this.$r&&e[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.$r)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var t=this.Yr()[0],e=ce(t)?t:0,i=ce(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}tn(t){return this.Kr(),this.Or(t,this.Xr())}Yr(){var t=this.Tr.props[k];return re(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Lr=!0,this.Jr(),clearTimeout(this.en),this.en=void 0,this.Fr&&bt&&(bt.removeEventListener(ft,this.Fr,{capture:!1}),this.Fr=void 0),this.Ar=[]}Wr(){this.Fr=()=>{this.Jr(),this.Ur()&&as.q(this.Hr)},zr(bt,ft,this.Fr,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Ne.cookieless_mode===ut)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Yr(),s=r[1],n=r[2],o=this.Xr(),a=this.Zr(),l=ce(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,d=!s,v=s,c=!d&&!t&&this.Or(i,o);if(c){(c=this.tn(i))||Zo.info("cross-tab refresh kept the session alive",{sessionId:s});var f=this.Yr();s=f[1],n=f[2]}d||c||l?(s=this.Nr(),a=this.qr(),Zo.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.qr(),u=!0),(h=s!==v)&&(Zo.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=!0));var p=ce(o)&&t&&!l?o:i,_=ce(n)?n:(new Date).getTime();this.Vr(a),this.zr(s,p,_),t||this.jr();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.Ar.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:_,changeReason:u?g:void 0,lastActivityTimestamp:o}}jr(){this.Lr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Lr)if(this.tn((new Date).getTime())){var t=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:t})}else this.jr()}),1.1*this.sessionTimeoutMs))}}var ea=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 ia(){return(ia=e((function*(){var t=null==wt?void 0:wt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return le(i)&&i.length>0?i:void 0}catch(t){return void Ir.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var ra=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 sa(t,e,i){return vn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var na={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=>ra(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!ra(e,t))))),icontains:(t,e)=>e.map(oa).some((e=>t.map(oa).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(oa).every((e=>t.map(oa).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)))}))},oa=t=>t.toLowerCase();function aa(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(ae(r)||he(r))return!1;var s=[String(r)],n=na[i.operator];return!!n&&n(i.values,s)}))}var la="custom",ua="i.posthog.com",ha=/^\/static\//;class da{constructor(t){this.rn={},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("."+ua,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.rn[this.apiHost]||(this.rn[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":la),this.rn[this.apiHost]}nn(t){if(ha.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.nn(e);if(i)return""+i+e}if(this.region===la)return this.apiHost+e;var r=ua+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function va(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var ca=Cr("[Surveys]"),fa="seenSurvey_",pa=t=>{try{var e=(t=>((t,e)=>""+fa+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){ca.error("Failed to persist survey seen state",t)}},_a=[Bn.Popover,Bn.Widget,Bn.API],ga={ignoreConditions:!1,ignoreDelay:!1,displayType:qn.Popover},ma=Cr("[PostHog ExternalIntegrations]"),ba={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ya{constructor(t){this._instance=t}ai(t,e){var i;null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return ma.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=It.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.ai(ba[n],(()=>{var e;null==(e=It.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=It.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=It.__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()}}}class wa{constructor(t,e){this.rt=t,this.sn=e,this.an=new Map,this.ln=!1}add(t){var i=this;return e((function*(){if(i.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.an.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.an.set(t.name,t);try{var e=t.setup(i.sn);e&&(yield e)}catch(e){var r=i.an.get(t.name)===t;r&&i.an.delete(t.name),i.rt.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.un(t)}}))()}dispose(){if(!this.ln){this.ln=!0;var t=Array.from(this.an.values()).reverse();for(var e of(this.an.clear(),t))this.un(e)}}un(t){try{var e=null==t.dispose?void 0:t.dispose();e&&se(e.then)&&e.then(void 0,(e=>{this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class xa{constructor(t){this._instance=t}get(t){var e;return null==(e=this._instance.persistence)?void 0:e.get_property(t)}set(t,e){var i;null==(i=this._instance.persistence)||i.set_property(t,e)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var Ea="extensionsRemoteConfig";class Sa{constructor(t){this.ln=!1,this.instance=t,this.rt=Ir.createLogger("[BrowserExtensions]"),this.hn=t.dn,this.kv=new xa(t),this.onEvent=t=>Un(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.rt.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.ln)return Un((()=>{}));var e=e=>{try{t(e)}catch(t){this.rt.error("Browser extension remote config listener failed",t)}},i=this.instance.vn.on(Ea,e);return this.hn&&e(this.hn),Un(i)},this.cn=new wa(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(o))&&void 0!==t?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.cn.add(t)}capture(t,i,r){var s=this;return e((function*(){r?s.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return Un(this.instance.fn(t))}handleRemoteConfig(t){this.ln||(this.hn=t,this.instance.vn.emit(Ea,t))}sendRequest(t,i){var r=this;return e((function*(){var e;void 0===i&&(i={});var s=r.instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",t),n={method:i.method,url:i.query?Mo(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport};return"sendBeacon"===i.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var $a={},ka=0,Ta=()=>{},Ra='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Pa="Surveys module not available",Oa="sanitize_properties is deprecated. Use before_send instead",Ia="Invalid value for property_denylist config: ",Ca=["token","distinct_id",rt],Aa="posthog",Ma=!Oo&&-1===(null==Rt?void 0:Rt.indexOf("MSIE"))&&-1===(null==Rt?void 0:Rt.indexOf("Mozilla")),Fa=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:Br(null==xt?void 0:xt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ta,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:Et&&le(null==Et?void 0:Et.search)&&-1!==Et.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==bt||null==(e=bt.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){Ir.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:vt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Vo},error_tracking:{},_onCapture:Ta},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Is,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))},Da=[["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"]],Na=t=>{var e={};for(var i of Da){var r=i[0],s=i[1];ae(t[r])||(e[s]=t[r])}var n=Fr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ae(o)||(ae(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),le(o)&&ae(t.asset_host)&&(n.asset_host=o)),re(t.property_blacklist)&&(ae(t.property_denylist)?n.property_denylist=t.property_blacklist:re(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ir.error(Ia+t.property_denylist)),n};class Ua{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(t){Ir.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class La{gn(t,e){if(t){var i=this.an.indexOf(t);-1!==i&&this.an.splice(i,1)}return this.an.push(e),null==e.initialize||e.initialize(),e}mn(){return this.config.cookieless_mode===ut||this.config.cookieless_mode===lt&&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 Ua,this.yn=!1,this.version=s.LIB_VERSION,this.bn=new Set,this._n="",this.vn=new Xo,this.an=[],this.wn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Fa(),this.SentryIntegration=on,this.sentryIntegration=t=>function(t,e){var i=nn(t,e);return{name:sn,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kn=!1,this.xn=null,this.Sn=null,this.Cn=null,this.scrollManager=new Jo(this),this.pageViewManager=new an(this),this.rateLimiter=new Kn(this),this.requestRouter=new da(this),this.consent=new ls(this),this.externalIntegrations=new ya(this);var e=null!==(t=La.__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=le(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=le(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Ir.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Aa){var r,s=null!==(r=$a[i])&&void 0!==r?r:new La;return s._init(t,e,i),$a[i]=s,$a[Aa][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var l,u=le(t)?t.trim():"";if(!u)return Ir.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 u!==(null==(l=this.config)?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Fa(e.defaults),e.debug=this.Mn(e.debug),this.Tn=e,this.En=[],e.person_profiles?this.Sn=e.person_profiles:e.process_person&&(this.Sn=e.process_person);var h=Fa(e.defaults),d=Na(e),v=Fr({},h,d,{name:r,token:u});ne(h.rageclick)&&ne(d.rageclick)&&(v.rageclick=Fr({},h.rageclick,d.rageclick)),ne(h.session_recording)&&ne(d.session_recording)&&(v.session_recording=Fr({},h.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Ir.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ln.GZipJS;var c=this.In();if(this.persistence=new Nn(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Nn(i({},this.config,{persistence:"sessionStorage"}),c,!1),this._n="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&as.N()){var f=as.H(this._n);re(f)&&f.forEach((t=>{le(t)&&this.bn.add(t)}))}else as.q(this._n);var p=i({},this.persistence.props),_=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Pn=new Wo((t=>this.Rn(t)),this.config.request_queue_config),this.An=new Ko(this),this.__request_queue=[];var g=this.mn();if(g||(this.sessionManager=new ta(this),this.sessionPropsManager=new Qo(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Fn()}))),this.config.__preview_deferred_init_extensions?(Ir.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ln(g)}),0)):(Ir.info("Initializing extensions synchronously"),this.Ln(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Ir.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:_}),!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 m=e.bootstrap.distinctID,b=this.get_distinct_id(),y=this.persistence.get_property(J);if(e.bootstrap.isIdentifiedID&&null!=b&&b!==m&&y===ht)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=b&&b!==m&&y===dt)Ir.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 w=this.config.get_device_id(Yr()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(J,e.bootstrap.isIdentifiedID?dt:ht),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:it,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Yr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(J,ht)}return zr(bt,"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()||Yr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(J,dt)),e()},s=i.user();"then"in s&&se(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||rn.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()||(rn.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(rn.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,pt),identify:t=>e(t,gt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.On())):this.On(),se(this.config._onCapture)&&this.config._onCapture!==Ta&&(Ir.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ir.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 ia.apply(this,arguments)}().then((t=>{t&&this.register({[a]:t})})).catch(Ta),this}Ln(t){var e,r,s,n,o,a,l,u,h=performance.now(),d=i({},La.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.featureFlags&&this.an.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new d.featureFlags(this)),d.exceptions&&this.an.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.an.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.an.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.an.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.an.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.an.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.an.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this)),d.logs&&this.an.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this)),d.metrics&&this.an.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.an.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.an.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.an.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.an.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,tn)),d.toolbar&&this.an.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.an.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this.an.forEach((t=>{t.initialize&&v.push((()=>{null==t.initialize||t.initialize()}))})),v.push((()=>{if(this.Dn){var t=this.Dn;this.Dn=void 0,this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.$n(v,h)}$n(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.$n(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Ir.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[st]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[nt]:r}),this.config.__preview_deferred_init_extensions&&Ir.info("PostHog extensions initialized ("+r+"ms)")}Gi(t){var e;if(!xt||!xt.body)return Ir.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Dn=t),this.dn=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=Yt(r.supportedCompression,Ln.GZipJS)?Ln.GZipJS:Yt(r.supportedCompression,Ln.Base64)?Ln.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Sn?this.Sn:vt}),null==(e=this.Nn)||e.handleRemoteConfig(t),this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}On(){try{this.config.loaded(this)}catch(t){Ir.critical("`loaded` function failed",t)}if(this.qn(),this.config.internal_or_test_user_hostname&&null!=Et&&Et.hostname){var t=Et.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.mn())&&this.jn()}),1),this.Bn=new Yn(this),this.Bn.load()}qn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Pn)||t.enable())}_dom_loaded(){this.is_capturing()&&Ar(this.__request_queue,(t=>this.Rn(t))),this.__request_queue=[],this.qn()}_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.Hn()&&this.capture(_t),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Pn)||r.unload(),null==(s=this.An)||s.unload()):this.Hn()&&this.capture(_t,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Ma?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,(ae(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&&ae(n.compression)&&n.data&&(n.compression=Ln.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(h=(u=re(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()),re(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=Ho(n.url,n.method,n.compression,n.timestampMode);var v=qo.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");var f=t=>{try{c(t)}catch(t){jo(t)?Ir.warn(t):Ir.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ln.GZipJS&&Tt&&"undefined"!=typeof Promise&&!Co?Uo(n).then((t=>{f(t)})).catch((e=>{if(qt(e))return Co=!0,void f(i({},n,{compression:void 0,url:Ho(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 qt(t)||e===Bt})(e)&&(Co=!0),f(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}))}Rn(t){this.An?this.An.retriableRequest(t):this._send_request(t)}_execute_array(t){ka++;try{var e,i=[],r=[],s=[];Ar(t,(t=>{if(t)if(re(e=t[0]))s.push(t);else if(se(t))try{t.call(this)}catch(e){Ir.error("Error executing queued PostHog call",t,e)}else re(t)&&"alias"===e?i.push(t):re(t)&&-1!==e.indexOf("capture")&&se(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Ar(t,(function(t){try{if(re(t[0])){var i=e;Mr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Ir.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{ka--}}push(t){if(ka>0&&re(t)&&le(t[0])){var e=La.prototype[t[0]];se(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l,u,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pn){if(this.is_capturing())if(!ae(t)&&le(t)){var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var v=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){if(this.wn.length>0){var c={};for(var f of this.wn.slice())try{Fr(c,f())}catch(t){Ir.error("Failed to produce browser extension event properties",t)}e=i({},c,null!=e?e:{})}var p;null!=(s=e)&&s.$current_url&&!le(null==(n=e)?void 0:n.$current_url)&&(Ir.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(p=e)||delete p.$current_url),"$exception"!==t||null!=r&&r.Un||Ir.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 _=new Date,g=(null==r?void 0:r.timestamp)||_,m=Ci(null==r?void 0:r.uuid,Yr),b={uuid:m,event:t,properties:this.calculateEventProperties(t,e||{},g,m)};t===pt&&this.config.__preview_capture_bot_pageviews&&d&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),v&&(b.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var y="$feature_flag_called"===t&&!1===b.properties.$feature_flag_has_experiment&&!0===this.get_property(M);(null==r?void 0:r.$set)&&!y&&(b.$set=null==r?void 0:r.$set);var w=null==r?void 0:r.$unset;w&&(b.$unset=w);var x,E,S,k=y?void 0:this.zn(null==r?void 0:r.$set_once,t!==mt,t===gt);if(k&&(b.$set_once=k),null!=r&&r._noTruncate||(a=this.config.properties_string_max_length,l=b,u=t=>le(t)?t.slice(0,a):t,h=new Set,b=function t(e,i){if(e!==Object(e))return u?u(e):e;if(!h.has(e)){var r;if(h.add(e),re(e))r=[],Ar(e,(e=>{r.push(t(e))}));else{var s={};Mr(e,((e,i)=>{h.has(e)||(s[i]=t(e,i))})),r=s}return r}}(l)),b.timestamp=g,ae(null==r?void 0:r.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=_),y&&(b.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Dt.forEach(r),e.forEach(r),i}(b.properties,Ca)),t===zn.DISMISSED||t===zn.SENT){var T,R,P=null==(T=e)?void 0:T[Hn.SURVEY_ID],O=null==(R=e)?void 0:R[Hn.SURVEY_ITERATION];pa({id:P,current_iteration:O}),b.$set=i({},b.$set,{[(x={id:P,current_iteration:O},E=t===zn.SENT?"responded":"dismissed",S="$survey_"+E+"/"+x.id,x.current_iteration&&x.current_iteration>0&&(S="$survey_"+E+"/"+x.id+"/"+x.current_iteration),S)]:!0})}else t===zn.SHOWN&&(b.$set=i({},b.$set,{[Hn.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Vn.SHOWN){var I,C=null==(I=e)?void 0:I[Wn.TOUR_TYPE];C&&(b.$set=i({},b.$set,{[Wn.TOUR_LAST_SEEN_DATE+"/"+C]:(new Date).toISOString()}))}var A=i({},b.properties.$set,b.$set);if(oe(A)||this.setPersonPropertiesForFlags(A),!de(this.config.before_send)){var F=this.Pt(b);if(!F)return;(b=F).uuid=Ci(b.uuid,Yr)}this.vn.emit("eventCaptured",b);var D=null!==(o=null==r?void 0:r._url)&&void 0!==o?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),N={method:"POST",url:D,data:b,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(D)?"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.Rn(N):this.Pn.enqueue(N),b}Ir.critical("This capture call is ignored due to client rate limiting.")}}else Ir.error("No event name provided to posthog.capture")}else Ir.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}Wn(){var t;return null!==(t=this.Nn)&&void 0!==t?t:this.Nn=new Sa(this)}fn(t){this.wn.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.wn.indexOf(t);-1!==i&&this.wn.splice(i,1)}}}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.mn()&&(l[rt]=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!le(l.distinct_id)&&!ve(l.distinct_id)||ue(l.distinct_id))&&Ir.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),!Rt)return{};var u,h=t?[...yn,...e||[]]:[],d=function(t){for(var e=0;Pi.length>e;e++){var i=Pi[e],r=i[1],s=i[0].exec(t),n=s&&(se(r)?r(s,t):r);if(n)return n}return["",""]}(Rt),v=d[0],c=d[1],f=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};ae(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==bt||null==(a=bt.screen)?void 0:a.width,y=null==bt||null==(l=bt.screen)?void 0:l.height,w=null==bt?void 0:bt.devicePixelRatio;ae(g)||(_.userAgentDataPlatform=g),ae(m)||(_.maxTouchPoints=m),ae(b)||(_.screenWidth=b),ae(y)||(_.screenHeight=y),ae(w)||(_.devicePixelRatio=w);var x,E,S,k,T,R,P,O,I=Fr(Lr({$os:v,$os_version:c,$browser:ki(Rt,navigator.vendor,f,p),$device:Oi(Rt),$device_type:(E=Rt,S=_,O=Oi(E),O===Ce||O===Ie||"Kobo"===O||"Kindle Fire"===O||O===li?Oe:O===Qe||O===Ze||O===Xe||O===ni?"Console":O===Me?"Wearable":O?Te:"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)?Te:Oe:"Desktop"),$timezone:Cn(),$timezone_offset:An()}),{$current_url:pn(r?Ai(null==Et?void 0:Et.href):null==Et?void 0:Et.href,h,xn),$host:null==Et?void 0:Et.host,$pathname:null==Et?void 0:Et.pathname,$raw_user_agent:Rt.length>1e3?Rt.substring(0,997)+"...":Rt,$browser_version:Ri(Rt,navigator.vendor,f,p),$browser_language:Tn(),$browser_language_prefix:(x=Tn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==bt?void 0:bt.screen.height,$screen_width:null==bt?void 0:bt.screen.width,$viewport_height:null==bt?void 0:bt.innerHeight,$viewport_width:null==bt?void 0:bt.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&&Fr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Fr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.An)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===la&&(l.$lib_custom_api_host=this.config.api_host),h=t!==pt||o?t!==_t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Fr(l,h),t===pt&&xt&&(l.title=xt.title),!ae(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Rt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Mr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]})),(l=Fr({},d,_,g,l)).$is_identified=this._isIdentified(),re(this.config.property_denylist)?Mr(this.config.property_denylist,(function(t){delete l[t]})):Ir.error(Ia+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(Ir.error(Oa),l=m(l,t));var b=this.Vn();return l.$process_person_profile=b,b&&!o&&this.Zn("_calculate_event_properties"),l}zn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Vn())return t;if(this.yn&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Fr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ir.error(Oa),o=a(o,"$set_once")),e&&(this.yn=!0),oe(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),Object.keys(t).forEach((t=>this.bn.add(t))),this.Gn()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.bn.delete(t),this.Gn()}Qn(t,e){this.register({[t]:e})}Fn(){this.bn.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.bn.clear(),this.Gn()}Gn(){var t;if(this._n)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.xi||!as.N())as.q(this._n);else{var e=[];this.bn.forEach((t=>e.push(t))),e.length>0?as.F(this._n,e):as.q(this._n)}}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.vn.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:Pa}),()=>{})}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:Pa})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Pa})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=ga),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:Pa}}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:Pa})}Kn(t){return!t||ue(t)?(Ir.critical("Unique user id has not been set in posthog.identify"),!1):t===it?(Ir.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())||(Ir.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 Ir.uninitializedWarning("posthog.identify");if(ve(t)&&(t=t.toString(),Ir.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Kn(t)&&this.Zn("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)||ht)===ht,a=t!==r,u=!a&&n;if(a&&n)this.persistence.set_property(J,dt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(gt,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Cn=sa(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r);else if(u){this.persistence.set_property(J,dt);var h=e||{},d=i||{};this.setPersonPropertiesForFlags({$set:h,$set_once:d},!1),this.capture("$set",{$set:h,$set_once:d}),this.Cn=sa(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);a?(this.reloadFeatureFlags(),this.unregister(V)):u&&(e||i)&&this.reloadFeatureFlags()}}setPersonProperties(t,e){if((t||e)&&this.Zn("posthog.setPersonProperties")){var i=sa(this.get_distinct_id(),t,e);this.Cn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Cn=i):Ir.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(re(t)?t:[t]).filter((t=>le(t)&&t.length>0));0!==i.length&&this.Zn("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Cn=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(mt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else Ir.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.Zn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){this.Jn(t)}Jn(t,e){var i,r,s,n,l,u,h,d,v,c;if(void 0===e&&(e=!1),Ir.info("reset"),!this.__loaded)return Ir.uninitializedWarning("posthog.reset");var f,p=this.get_property(o),_=this.get_property(a),g=this.get_property(b),m=this.is_capturing();if(this.consent.reset(),e||!m||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after."),null==(i=this.persistence)||i.clear(),null==(r=this.sessionPersistence)||r.clear(),this.bn.clear(),this.Gn(),ae(g)||null==(f=this.persistence)||f.register({[b]:g}),null==(s=this.surveys)||s.reset(),null==(n=this.Bn)||n.stop(),null==(l=this.featureFlags)||l.reset(),null==(u=this.conversations)||u.reset(),null==(h=this.logs)||h.reset(),null==(d=this.metrics)||d.reset(),null==(v=this.persistence)||v.set_property(J,ht),null==(c=this.sessionManager)||c.resetSessionId(),this.Cn=null,this.config.cookieless_mode===ut)this.register_once({distinct_id:it,$device_id:null},"");else{var y=this.config.get_device_id(Yr());this.register_once({distinct_id:y,$device_id:t?y:p},""),t||ae(_)||this.register({[a]:_})}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,o,a,l;i.__loaded?(null==(t=i.Bn)||t.stop(),null==(e=i.Nn)||e.dispose(),null==(r=i.sessionRecording)||r.dispose(),null==(s=i.logs)||s.flushLogs("sendBeacon"),null==(n=i.metrics)||n.flush("sendBeacon"),null==(o=i.Pn)||o.unload(),null==(a=i.An)||a.unload(),null==(l=i.featureFlags)||l.destroy()):Ir.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.Yn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Xn()}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)?(Ir.critical("Attempting to create alias for existing People user - aborting."),-2):this.Zn("posthog.alias")?(ae(e)&&(e=this.get_distinct_id()),t!==e?(this.Qn(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ir.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(ne(t)){var r,n,o,a,l,u,h,d,v,c,f;Fr(this.config,Na(t));var p=this.In();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Nn(i({},this.config,{persistence:"sessionStorage"}),p,!1);var _=this.Mn(this.config.debug);fe(_)&&(this.config.debug=_),fe(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,is.N()&&is.F("ph_debug",!0),Ir.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,is.N()&&is.q("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.ts(),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:La.es}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:Aa;return e!==Aa&&(e=Aa+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(J))===dt||(null==(e=this.sessionPersistence)?void 0:e.get_property(J))===dt}Vn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===vt&&!this._isIdentified()&&oe(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[et]))}Hn(){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.Vn()||this.Zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Zn(t){return"never"===this.config.person_profiles?(Ir.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Qn(et,!0),!0)}In(){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!==lt)}ts(){var t,e,i,r,s=this.In();return(null==(t=this.persistence)?void 0:t.xi)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.xi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.bn.clear(),this.Gn()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==ut){if(this.mn()){var i,r,s,n,o;this.Jn(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new ta(this),this.pageViewManager=new an(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=La.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.gn(this.sessionRecording,new l(this)),this.dn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.dn)))}var u,h;this.consent.optInOut(!0),this.ts(),this.qn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==lt&&(null==(u=this.surveys)||u.loadIfEnabled()),(ae(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.jn()}else Ir.warn(Ra)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==ut?(this.config.cookieless_mode===lt&&this.consent.isOptedIn()&&this.Jn(!0,!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode===lt&&(this.register({distinct_id:it,$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.jn(),this.qn())):Ir.warn(Ra)}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===ut||(this.config.cookieless_mode===lt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return wt?ea(wt,this.config.custom_blocked_useragents):void 0}jn(){xt&&("visible"===xt.visibilityState?this.kn||(this.kn=!0,this.capture(pt,{title:xt.title},{send_instantly:!0}),this.xn&&(xt.removeEventListener(ct,this.xn),this.xn=null)):this.xn||(this.xn=this.jn.bind(this),zr(xt,ct,this.xn)))}debug(t){!1===t?(null==bt||bt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==bt||bt.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}))}Ki(){var t=this.Tn||{};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?(Ir.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&&!de(t[e]),o=i in t&&!de(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,Ir)}Pt(t){var e;if(de(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(ge),r=re(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),de(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return _e(t.event)?Ir.warn(o+". This can cause unexpected behavior."):Ir.info(o),null}s.properties&&!oe(s.properties)||Ir.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&de(s.properties[a]))return Ir.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.ui)?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)})}Mn(t){var e=fe(t)&&!t,i=is.N()&&"true"===is.P("ph_debug");return!e&&(!!i||t)}}La.__defaultExtensionClasses={},La.es=(()=>{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]]=Ur(t.prototype[e[i]])}(La,["identify"]);class ja{constructor(t){this.disabled=!1===t;var e=ne(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 Ba="$copy_autocapture",za=Cr("[AutoCapture]");function Ha(t,e){return e.length>t?e.slice(0,t)+"...":e}function qa(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!ps(e));return e}function Va(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!ps(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!_s(c,"body")&&bs>d.length;)if(ms(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!ps(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(Mr(d,(t=>{var e=Us(t);if(_s(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&Gs(i))&&(h?Ai(i):i)}Yt(xs(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};ks.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ha(1024,Ks(t)):Ha(1024,Ss(t)));var a=xs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Mr(t.attributes,(function(i){var n;if((!Ls(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Gs(i.value)&&(!le(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=ys(a).join(" ")),o["attr__"+i.name]=Ha(1024,"href"===i.name&&s?Ai(a):a)}}));for(var l=1,u=1,h=t;h=qa(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(!Us(t))return{};var e={};return Mr(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&&Gs(r)&&(e[i]=r)}})),e}(t);Fr(m,r)})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=_s(t,"a")||_s(t,"button")?Ks(t):Ss(t)),b){var w,x;g[0].attr__href=b;var E=null==(w=cn(b))?void 0:w.host,S=null==bt||null==(x=bt.location)?void 0:x.host;E&&S&&E!==S&&(p=b)}return{props:Fr({$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 Dr(o).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[Ys(t[0].toString())]=Ys(e.toString())})),(s+=":")+Dr(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:Qs(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dr(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 Wa=Cr("[ExceptionAutocapture]"),Ga=()=>{},Ka=Cr("[TracingHeaders]"),Ja=Cr("[Web Vitals]"),Ya=9e5,Qa="disabled",Xa="lazy_loading",Za="awaiting_config",tl="missing_config";Cr("[SessionRecording]"),Cr("[SessionRecording]");var el="[SessionRecording]",il=Cr(el),rl=Cr("[Heatmaps]");function sl(t){return ne(t)&&"clientX"in t&&"clientY"in t&&ve(t.clientX)&&ve(t.clientY)}var nl=Cr("[Product Tours]"),ol=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(g))},al=["$set_once","$set"],ll=Cr("[SiteApps]"),ul="Error while initializing PostHog app with config id ";function hl(t,e,i){if(de(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 dl{constructor(t){this.rs=new Xo,this.ns=(t,e)=>this.ss(t,e)&&this.os(t,e)&&this.ls(t,e)&&this.us(t,e),this.ss=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.hs=new Set,this.ds=new Set}init(){var t,e;ae(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(!ae(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.ds)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.hs)||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.hs.has(t)||this.hs.has(e.event))&&this.ds&&(null==(i=this.ds)?void 0:i.size)>0&&this.ds.forEach((t=>{this.vs(e,t)&&this.rs.emit("actionCaptured",t.name)}))}cs(t){this.onAction("actionCaptured",(e=>t(e)))}vs(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.ns(t,i))return!0;return!1}onAction(t,e){return this.rs.on(t,e)}os(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(!hl(r,e.url,e.url_matching||"contains"))return!1}return!0}ls(t,e){return!!this.fs(t,e)&&!!this.ps(t,e)&&!!this.gs(t,e)}fs(t,e){var i;if(null==e||!e.href)return!0;var r=this.ys(t);if(r.length>0)return r.some((t=>hl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&hl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}ps(t,e){var i;if(null==e||!e.text)return!0;var r=this.ys(t);if(r.length>0)return r.some((t=>hl(t.text,e.text,e.text_matching||"exact")||hl(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;!de(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=>hl(t,n,o))))}gs(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}ys(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}us(t,e){return null==e||!e.properties||0===e.properties.length||aa(e.properties.reduce(((t,e)=>{var i=re(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 vl{constructor(t){var e;this.bs=[],this._instance=t,this._s=new Map,this.ws=new Map,this.ks=new Map,null==(e=this._instance)||null==e.onSessionId||e.onSessionId((t=>this.xs(t)))}Ss(t){return!1}Cs(){return null}Ms(t){}Ts(){}Es(t,e){return!!t&&aa(t.propertyFilters,null==e?void 0:e.properties)}Is(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}Ps(t,e,i){var r=(i===jn.Activation?this._s:this.ws).get(t),s=[];return this.Rs((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.Es(n,e)}))}register(t){var e;ae(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.As(t),this.Fs(t))}Fs(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.Ls&&(this.Ls=new dl(this._instance),this.Ls.init(),this.Ls.cs((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.Ls)||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.ks.get(e.name);i&&i.push(t.id),this.ks.set(e.name,i||[t.id])}})))})))}As(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._s=this.Is(t,jn.Activation),this.ws=this.Is(t,jn.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.Ds(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.$s([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Ns(n),void this.qs([n])}if(this.ws.has(t)){var a=this.Ps(t,e,jn.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.$s(a.map((t=>t.id))),a.forEach((t=>this.js(t.id))))}if(this._s.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this._s.get(t)});var l=this.Ps(t,e,jn.Activation);this.Bs(l.map((t=>t.id)))}}onAction(t){this.ks.has(t)&&this.Bs(this.ks.get(t)||[])}Bs(t){var e;if(0!==t.length){var i=!(null==(e=this._instance)||null==e.get_session_id||!e.get_session_id()),r=[];for(var s of t)i&&this.Ss(s)?this.Ns(s)&&this.Hs(s):r.push(s);r.length>0&&(this.bs=[...new Set([...this.bs,...r])]),this.Os().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ns(t){this.bs=this.bs.filter((e=>e!==t));var e=this.Us();return!e.includes(t)&&(this.zs([...e,t]),this.Ws(),!0)}$s(t){var e=new Set(t);this.bs=this.bs.filter((t=>!e.has(t)));var i=this.Vs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.zs(r),0===r.length&&this.Zs()),this.qs(t)}Gs(){var t,e=this.Cs();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Hs(t){if(this.Cs()){var e=this.Gs();this.Ms(i({},e,{[t]:Date.now()}))}}qs(t){if(this.Cs()){var e=this.Gs(),i={},r=!1;for(var s of Object.entries(e)){var n=s[0],o=s[1];t.includes(n)?r=!0:i[n]=o}r&&(oe(i)?this.Ts():this.Ms(i))}}Qs(){this.Cs()&&this.Ts()}getActivationTimestamp(t){if(this.Us().includes(t)){var e=this.Gs()[t];return ve(e)?e:void 0}}Vs(){var t,e=this.Ks();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}Us(){var t,e,i=this.Vs();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Js()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}Ws(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.Ys(e)}Zs(){this.Xs()}xs(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Js()];if(i&&i!==t){var r=this.Vs(),s=this.Gs();r.length>0&&(this.zs([]),r.filter((t=>ve(s[t]))).forEach((t=>this.js(t)))),this.Zs(),this.Qs()}}getActivatedIds(){return[...new Set([...this.Us(),...this.bs])].filter((t=>!this.ta(t)))}reset(){this.bs=[],this.Vs().length>0&&this.zs([]),this.Zs(),this.Qs()}getEventToItemsMap(){return this._s}ea(){return this.Ls}}class cl extends vl{constructor(t){super(t)}Ks(){return B}Js(){return z}Cs(){return H}Ms(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}Ts(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}Ss(t){var e,i;this.Rs((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return ve(r)&&r>0}ia(){return zn.SHOWN}Rs(t){var e;null==(e=this._instance)||e.getSurveys(t)}js(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Os(){return ca}zs(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[B]:t})}Ys(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)}ta(){return!1}Ds(t,e){var i;this.Rs((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return va(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===zn.SHOWN?"consume":"ignore":t===zn.SHOWN?"persist":t===zn.DISMISSED||t===zn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var fl="SDK is not enabled or survey functionality is not yet loaded",pl="Disabled. Not loading surveys.",_l=null!=bt&&bt.location?_n(bt.location.hash,"__posthog")||_n(location.hash,"state"):null,gl="_postHogToolbarParams",ml=Cr("[Toolbar]"),bl=Cr("[FeatureFlags]"),yl=Cr("[FeatureFlags]",{debugEnabled:!0}),wl="\" failed. Feature flags didn't load in time.",xl=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},El=t=>{var e={};for(var i of Dr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},Sl=Cr("[Error tracking]"),$l="Refusing to render web experiment since the viewer is a likely bot",kl={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ra(e,t),not_regex:(t,e)=>!ra(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Tl{get Ne(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Tl.ra("retrieved web experiments from the server"),e.na=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.na&&(Tl.ra("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.na)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);le(r)&&t.variants[r]&&e.sa(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Tl.aa(n,e._instance)&&e.sa(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Tl.ra($l);else if(!this.Ne.disable_web_experiments){if(de(this.na))return this.na=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Tl.ra("applying feature flags",t),t.forEach((t=>{var e;if(this.na&&null!=(e=this.na)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.na)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.sa(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Tl.getWindowLocation();if(null!=t&&t.search){var e=fn(null==t?void 0:t.search,"__experiment_id"),i=fn(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Tl.ra("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.oa(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Ne.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.Ne.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}oa(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Tl.ra("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.sa(r[0].name,e,r[0].variants[e].transforms))}static aa(t,e){return!de(t.conditions)&&Tl.la(t,e)&&Tl.ua(t)}static la(t,e){var i;if(de(t.conditions)||de(null==(i=t.conditions)?void 0:i.url))return!0;var r=Tl.getWindowLocation();if(r){var s,n,o,a=us(e,r.href);return null==(s=t.conditions)||!s.url||kl[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==bt?void 0:bt.location}static ua(t){var e;if(de(t.conditions)||de(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Sn();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 ra(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Ir.info("[WebExperiments] "+t,i)}sa(t,e,i){this._is_bot()?Tl.ra($l):"control"!==e?i.forEach((i=>{if(i.selector){var r;Tl.ra("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)}))}})):Tl.ra("Control variants leave the page unmodified.")}_is_bot(){return wt&&this._instance?ea(wt,this.Ne.custom_blocked_useragents):void 0}}var Rl=Cr("[Conversations]"),Pl="Conversations not available yet.",Ol="console",Il="__posthogHandledLogsRequestError",Cl=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[Il]=!0,i},Al=t=>!!t&&"object"==typeof t&&!0===t[Il],Ml={featureFlags:class{constructor(t){this.ha=!1,this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=!1,this.ma=!1,this.ya=0,this.ba=()=>{var t=this._a();this.ya=0,t&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],bt&&zr(bt,"online",this.ba)}destroy(){null==bt||bt.removeEventListener("online",this.ba)}get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}wa(t){return this._instance.get_property(t)}ka(){var t,e;return null!==(t=null==(e=this.Tr)?void 0:e.Ci(this.Ne.feature_flag_cache_ttl_ms))&&void 0!==t&&t}xa(){return!!this.ka()&&(this.ma||this.va||(this.ma=!0,bl.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Sa(){var t,e=null!==(t=this.Ne.evaluation_contexts)&&void 0!==t?t:this.Ne.evaluation_environments;return!this.Ne.evaluation_environments||this.Ne.evaluation_contexts||this.ga||(bl.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ga=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||bl.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Ca(){return this.Sa().length>0}Ma(){var t=this.Ne.flag_keys;if(!ae(t)){if(re(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||bl.error("Invalid flag key found:",t,"Expected non-empty string"),e}));bl.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.wa(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.wa(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:At(c),variant:Mt(c),reason:void 0,metadata:ae(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.da}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.wa(I),e=this.wa(F),r=this.wa(D);if(!r&&!e)return t||{};var s=Fr({},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=ae(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=ae(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.ha||(bl.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ha=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:At(r),variant:Mt(r),payload:Ct(e[i])}}))}getFlagVariants(){var t=this.wa(R),e=this.wa(F);if(!e)return t||{};for(var i=Fr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ha||(bl.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.ha=!0),i}getFlagPayloads(){var t=this.wa(C),e=this.wa(D);if(!e)return t||{};for(var i=Fr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ha||(bl.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.ha=!0),i}reloadFeatureFlags(){this.ca||this.Ne.advanced_disable_feature_flags||this._a()||this.Ta||(this._instance.vn.emit("featureFlagsReloading",!0),this.Ta=setTimeout((()=>{this.Ea()}),5))}Ia(){clearTimeout(this.Ta),this.Ta=void 0}ensureFlagsLoaded(){this.da||this.va||this.Ta||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ca=t}Ea(t){var e;if(this.Ia(),!this._instance.Ki()&&!this._a())if(this.va)this.fa=!0;else{var r=this.Ne.token,n=this.wa(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.Tr)?void 0:e.get_initial_props())||{},this.wa(N)||{},{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}),group_properties:this.wa(U),timezone:Cn()};he(n)||ae(n)||(a.$device_id=n),(null!=t&&t.disableFlags||this.Ne.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Ca()&&(a.evaluation_contexts=this.Sa());var l=this.Ma();ae(l)||(a.flag_keys=l);var u=!!this.Ne.advanced_only_evaluate_survey_feature_flags,h=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Ne.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.va=!0,this._instance._send_request({method:"POST",url:h,data:a,compression:this.Ne.disable_compression?void 0:Ln.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(this.Pa(t.statusCode),200===t.statusCode&&(this.fa||(this.$anon_distinct_id=void 0),s=!1),this.va=!1,!a.disable_flags||this.fa){this.pa=!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.Tr)||r.register({[G]:n}),l)bl.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.fa&&(this.fa=!1,this.Ea())}}})}}_a(){return gn(this.ya,3)}Pa(t){this.ya=mn(t,this.ya,3,(()=>bl.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.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){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 bl.warn('getFeatureFlag for key "'+t+wl)}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.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.wa(A)||void 0,l=this.wa(K)||void 0,u=this.wa(V)||{};if(this.Ne.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.wa(W);d&&d!==v&&(u={},null==(h=this.Tr)||h.register({[V]:u,[W]: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;re(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Tr)||c.register({[V]:u});var S=this.getFeatureFlagDetails(t),k=[...null!==(f=this.wa(G))&&void 0!==f?f:[]];ae(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.Ne.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Ne.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.pa};ae(null==S||null==(g=S.metadata)?void 0:g.has_experiment)||(T.$feature_flag_has_experiment=S.metadata.has_experiment),ae(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),ae(null==S?void 0:S.original_variant)&&ae(null==S?void 0:S.original_enabled)||(T.$feature_flag_original_response=ae(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:Ct(n)}}}else bl.warn('getFeatureFlagResult for key "'+t+wl)}getRemoteConfigPayload(t,e){var i=this.Ne.token,r={distinct_id:this._instance.get_distinct_id(),token:i,person_properties:{$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION}};this.Ca()&&(r.evaluation_contexts=this.Sa());var n=this.Ma();ae(n)||(r.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Ne.disable_compression?void 0:Ln.Base64,timestampMode:"body",timeout:this.Ne.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.pa)return e.defaultValue;if(!(this.da||this.getFlags()&&this.getFlags().length>0))return bl.warn('isFeatureEnabled for key "'+t+wl),e.defaultValue;var i=this.getFeatureFlag(t,e);return ae(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.Tr){this.da=!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&&bl.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(re(u)){bl.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,[M]:!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(El(p)),[R]:p||{},[C]:_||{},[I]:g||{},[M]:!0===t.minimalFlagCalledEvents},d?{[A]:d}:{},v?{[K]:v}:{}))}}}(t,this.Tr,s,n,o,r),e||(this.ma=!1),this.Ra(e)}}override(t,e){void 0===e&&(e=!1),bl.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Tr)return bl.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Tr.unregister(F),this.Tr.unregister(D),this.Ra(),yl.info("All overrides cleared");if(re(t)){var e=xl(t);return this.Tr.register({[F]:e}),this.Ra(),yl.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.ha=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.Tr.unregister(F),yl.info("Flag overrides cleared");else if(r.flags){if(re(r.flags)){var s=xl(r.flags);this.Tr.register({[F]:s})}else this.Tr.register({[F]:r.flags});yl.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Tr.unregister(D),yl.info("Payload overrides cleared")):r.payloads&&(this.Tr.register({[D]:r.payloads}),yl.info("Payload overrides set",{payloads:r.payloads}))),void this.Ra()}if(t&&"object"==typeof t)return this.Tr.register({[F]:t}),this.Ra(),yl.info("Flag overrides set",{flags:t});bl.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.da){var e=this.Aa(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){bl.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.wa(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.Tr)||s.register({[P]:Object.keys(El(l)),[R]:l}),this.Ra()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.wa(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.Ne.token+s),method:"GET",timestampMode:"query",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.Tr)||i.unregister(O),null==(r=this.Tr)||r.register({[O]:s}),t(s)}}})}Aa(){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)),{})}}Ra(t){var e=this.Aa(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){bl.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.wa(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.wa(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.wa(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.wa(U)||{};this._instance.register({[U]:i({},e,{[t]:{}})})}else this._instance.unregister(U)}reset(){this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.$anon_distinct_id=void 0,this.Ia(),this.ha=!1,this.ya=0}}},Fl={sessionRecording:class{get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Fa)||!t.isStarted)}get status(){var t,e;return this.La===Za||this.La===tl?this.La:null!==(t=null==(e=this.Fa)?void 0:e.status)&&void 0!==t?t:this.La}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.La=Qa,this.Oa=void 0,this.Da=!1,this.$a=(()=>{var t;if(null==xt||!xt.visibilityState||"visible"===xt.visibilityState)return!0;var e=null==bt||null==(t=bt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.Ie=()=>{var t;"visible"===(null==xt?void 0:xt.visibilityState)&&(this.$a=!0,null==(t=this.Fa)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw il.error("started without valid sessionManager"),new Error(el+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===ut)throw new Error(el+' cannot be used with cookieless_mode="always"');null!=xt&&xt.addEventListener&&zr(xt,"visibilitychange",this.Ie)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Da=!0,null==xt||null==xt.removeEventListener||xt.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}get Na(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Ne.disable_session_recording,r=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return bt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.Da||this.Na&&null!=(e=this.Fa)&&e.isStarted)){var i=!ae(Object.assign)&&!ae(Array.from);this.Na&&i?(this.qa(t),il.info("starting")):(this.La=Qa,this.stopRecording())}}qa(t){var e,i,r;this.Na&&(this.La!==Za&&this.La!==tl&&(this.La=Xa),null!=It&&null!=(e=It.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=It.__PosthogExtensions__)&&i.initSessionRecording?this.ja(t):null==(r=It.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ba,(e=>{if(e)return il.error("could not load recorder",e);this.ja(t)})))}stopRecording(){var t,e;null==(t=this.Oa)||t.call(this),this.Oa=void 0,null==(e=this.Fa)||e.stop()}Ha(){var t,e;null==(t=this.Oa)||t.call(this),this.Oa=void 0,null==(e=this.Fa)||e.discard()}Ua(){var t,e;null==(t=this.Tr)||t.unregister(T),null==(e=this.Tr)||e.unregister(y)}za(t,e){if(de(t))return null;var i,r=ve(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(il.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Wa(t){if(this.Tr){var e,r,s=this.Tr,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.za(null==(e=this.Ne.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.za(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;de(a)&&this.Ua();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:ae(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.Oa)||e.call(this),this.Oa=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.Wa(e),void this.Ha()):(this.Wa(e),void this.startIfEnabledOrStop()):(this.La===Za&&(this.La=tl,il.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.Fa)&&i.log?this.Fa.log(t,e):il.warn("log called before recorder was ready")}get Ba(){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"}Va(){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 il.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}ja(t){var e,i,r;if(!this.Da){if(null==(e=It.__PosthogExtensions__)||!e.initSessionRecording)return il.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ot]:!0});var s;if(this.Fa||(this.Fa=null==(s=It.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.$a),this.Fa._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Va()){if(this.La===tl||this.La===Za)return;return this.La=Za,il.info("persisted remote config is stale, requesting fresh config before starting"),void new Yn(this._instance).load()}this.La=Xa,null==(i=(r=this.Fa).setDocumentWasEverVisible)||i.call(r,this.$a),this.Fa.start(t)}}onRRwebEmit(t){var e;null==(e=this.Fa)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Fa||null==(e=this.Tr)||e.register({[x]:!0}),null==(t=this.Fa)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Fa||null==(e=this.Tr)||e.register({[w]:!0}),null==(t=this.Fa)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Fa||null==(i=this.Tr)||i.register({["url"===t?E:S]:!0}),null==(e=this.Fa)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Fa)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Fa)||!i.tryAddCustomEvent(t,e))}}},Dl={autocapture:class{constructor(t){this.Za=!1,this.Ga=null,this.Qa=!1,this.Ka=!1,this.instance=t,this.rageclicks=new ja(t.config.rageclick),this.Ja=null}initialize(){this.startIfEnabled()}get Ne(){var t,e,i=ne(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}Ya(){if(this.isBrowserSupported()){if(bt&&xt){var t=t=>{t=t||(null==bt?void 0:bt.event);try{this.Xa(t)}catch(t){za.error("Failed to capture event",t)}};if(zr(xt,"submit",t,{capture:!0}),zr(xt,"change",t,{capture:!0}),zr(xt,"click",t,{capture:!0}),this.Ne.capture_copied_text){var e=t=>{t=t||(null==bt?void 0:bt.event);try{this.Xa(t,Ba)}catch(t){za.error("Failed to capture copy/cut event",t)}};zr(xt,"copy",e,{capture:!0}),zr(xt,"cut",e,{capture:!0})}}}else za.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Za&&(this.Ya(),this.Za=!0)}onRemoteConfig(t){if(this.Qa=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.Ka=e.elementsChainAsString);var i=e.autocapture_opt_out;fe(i)&&(this.instance.persistence&&this.instance.persistence.register({[h]:i}),this.Ga=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ja=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ja)||e.forEach((e=>{var r=null==xt?void 0:xt.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.Ga,s=this.instance.Ki()&&!this.Qa;if(he(r)&&!fe(i)&&!s)return!1;var n=null!==(e=this.Ga)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!n}Xa(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=$s(t);gs(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())&&Fs(r,this.instance.config.rageclick)&&this.Xa(t,"$rageclick");var s=e===Ba;if(r&&function(t,e,i,r,s,n){var o;if(!bt||Ds(t))return!1;if(null!=i&&i.url_allowlist&&!ws(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&ws(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=Ns(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ae(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(!Ts(h,null==i?void 0:i.css_selector_allowlist))return!1;if(Ts(h,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Ps))return!1;try{var d=bt.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&&(ks.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Ne,s,s?["copy","cut"]:void 0,this.instance)){var n=Va(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsChainAsString:this.Ka,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===Ba){var l,u=Es(null==bt||null==(l=bt.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 se(null==xt?void 0:xt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.eo=(null==bt||null==(e=bt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ir.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.io&&this.io(),this.io=void 0,Ir.info("History API monitoring stopped")}monitorHistoryChanges(){bt&&bt.history&&(this.ro("pushState"),this.ro("replaceState"),this.no())}ro(t){var e;if(bt&&(null==(e=bt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Ga;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 se(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];se(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 Ga}}(bt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.so(t)}))}}so(t){try{var e,i=null==bt||null==(e=bt.location)?void 0:e.pathname;if(!i)return;i!==this.eo&&this.isEnabled&&this._instance.capture(pt,{navigation_type:t}),this.eo=i}catch(e){Ir.error("Error capturing "+t+" pageview",e)}}no(){if(!this.io){var t=()=>{this.so("popstate")};zr(bt,"popstate",t),this.io=()=>{bt&&bt.removeEventListener("popstate",t)}}}},heatmaps:class{get Ne(){return this.instance.config}constructor(t){var e;this.ao=!1,this.Za=!1,this.oo=null,this.instance=t,this.ao=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new ja(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return ne(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ne.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return de(this.Ne.capture_heatmaps)?de(this.Ne.enable_heatmaps)?this.ao:this.Ne.enable_heatmaps:!1!==this.Ne.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Za)return;rl.info("starting..."),this.lo(),this.Ie()}else{var t;clearInterval(null!==(t=this.oo)&&void 0!==t?t:void 0),this.uo(),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.ao=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}ho(t){sl(t.originalEvent)&&this.ke(t.originalEvent,"deadclick")}Ie(){this.oo&&clearInterval(this.oo),this.oo="visible"===(null==xt?void 0:xt.visibilityState)?setInterval(this.pr.bind(this),this.flushIntervalMilliseconds):null}lo(){bt&&xt&&(this.do=this.pr.bind(this),zr(bt,ft,this.do),this.vo=t=>this.ke(t||(null==bt?void 0:bt.event)),zr(xt,"click",this.vo,{capture:!0}),this.co=t=>this.fo(t||(null==bt?void 0:bt.event)),zr(xt,"mousemove",this.co,{capture:!0}),this.po=new en(this.instance,Zs,this.ho.bind(this)),this.po.startIfEnabledOrStop(),this.mo=this.Ie.bind(this),zr(xt,ct,this.mo),this.Za=!0)}uo(){var t;bt&&xt&&(this.do&&bt.removeEventListener(ft,this.do),this.vo&&xt.removeEventListener("click",this.vo,{capture:!0}),this.co&&xt.removeEventListener("mousemove",this.co,{capture:!0}),this.mo&&xt.removeEventListener(ct,this.mo),clearTimeout(this.yo),null==(t=this.po)||t.stop(),this.Za=!1)}bo(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&&ps(r)&&!_s(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:bt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Yt(e,s))return!0;r=Rs(r)}return!1}($s(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}ke(t,e){var r;if(void 0===e&&(e="click"),!fs(t.target)&&sl(t)){var s=this.bo(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Fs($s(t),this.instance.config.rageclick)&&this.Vt(i({},s,{type:"rageclick"})),this.Vt(s)}}fo(t){!fs(t.target)&&sl(t)&&(clearTimeout(this.yo),this.yo=setTimeout((()=>{this.Vt(this.bo(t,"mousemove"))}),500))}Vt(t){if(bt){var e=this.Ne.disable_capture_url_hashes?Ai(bt.location.href):bt.location.href,i=this.Ne.custom_personal_data_properties,r=this.Ne.mask_personal_data_properties?[...yn,...i||[]]:[],s=pn(e,r,xn);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}pr(){this.R&&!oe(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:en,webVitalsAutocapture:class{constructor(t){var e;this.ao=!1,this.Za=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._o=()=>{clearTimeout(this.wo),this.wo=void 0,0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",i({$current_url:this.R.url},this.R.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ko=t=>{var e;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},de(null==t?void 0:t.name)||de(null==t?void 0:t.value))Ja.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.xo(r);if(!ae(s)){var n=ve(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.So||this.So>t.value){this.R.navigationKey!==n&&(this._o(),this.wo=setTimeout(this._o,this.flushToCaptureTimeoutMs)),ae(this.R.navigationKey)&&(this.R.navigationKey=n,this.R.url=s),this.R.firstMetricTimestamp=ae(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var o=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),a=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});ae(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this._o()}else Ja.error("Ignoring metric with value >= "+this.So,t)}}},this.Co=()=>{if(!this.Za){var t,e,i,r,s=It.__PosthogExtensions__,n=null==s?void 0:s.postHogWebVitalsCallbacksByFlavor,o=(null==n?void 0:n[this.Mo])||("web-vitals"===this.Mo&&ae(n)?null==s?void 0:s.postHogWebVitalsCallbacks:void 0);if(ae(o)||(t=o.onLCP,e=o.onCLS,i=o.onFCP,r=o.onINP),t&&e&&i&&r){var a={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&t(this.ko.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ko.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ko.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&r(this.ko.bind(this),a),this.Za=!0}else Ja.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.ao=!(null==(e=this._instance.persistence)||!e.props[p]),this.startIfEnabled()}get To(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=ne(this.To)?null==(t=this.To)?void 0:t.web_vitals_allowed_metrics:void 0;return de(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ne(this.To)?this.To.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=ne(this.To)?this.To.web_vitals_attribution:void 0;return null!=t&&t}get useSoftNavs(){var t=ne(this.To)?this.To.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get So(){var t=ne(this.To)&&ve(this.To.__web_vitals_max_value)?this.To.__web_vitals_max_value:Ya;return t>0&&6e4>=t?Ya:t}get isEnabled(){var t=null==Et?void 0:Et.protocol;if("http:"!==t&&"https:"!==t)return Ja.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=ne(this.To)?this.To.web_vitals:fe(this.To)?this.To:void 0;return fe(e)?e:this.ao}startIfEnabled(){this.isEnabled&&!this.Za&&(Ja.info("enabled, starting..."),this.ai(this.Co))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=ne(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=ne(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.ao=i,this.startIfEnabled()}}}get Mo(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ai(t){var e=It.__PosthogExtensions__,i=this.Mo,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ae(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Ja.error("failed to load script",e):t()}))}xo(t){var e=t||(null==bt?void 0:bt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Ai(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...yn,...r||[]]:[];return pn(i,s,xn)}Ja.error("Could not determine current URL")}}},Nl={exceptionObserver:class{constructor(t){var e;this.Co=()=>{var t;if(bt&&this.isEnabled&&null!=(t=It.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=It.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=It.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=It.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Eo&&this.Ne.capture_unhandled_errors&&(this.Eo=e(this.captureException.bind(this))),!this.Io&&this.Ne.capture_unhandled_rejections&&(this.Io=i(this.captureException.bind(this))),!this.Po&&this.Ne.capture_console_errors&&(this.Po=r(this.captureException.bind(this)))}catch(t){Wa.error("failed to start",t),this.Ro()}}},this._instance=t,this.Ao=!(null==(e=this._instance.persistence)||!e.props[v]),this.Fo=new ke(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,rt:Wa})),this.Ne=this.Lo(),this.startIfEnabledOrStop()}Lo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ne(t)?e=i({},e,t):(ae(t)?this.Ao:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wa.info("enabled"),this.Ro(),this.ai(this.Co)):this.Ro()}ai(t){var e,i;null!=(e=It.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Wa.error("failed to load script",e);t()}))}Ro(){var t,e,i;null==(t=this.Eo)||t.call(this),this.Eo=void 0,null==(e=this.Io)||e.call(this),this.Io=void 0,null==(i=this.Po)||i.call(this),this.Po=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Ao=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.Ao}),this.Ne=this.Lo(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ne=this.Lo()}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.Fo.consumeRateLimit(s)?Wa.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.Oo=[],this.Do=new tr([new vr,new xr,new fr,new cr,new yr,new br,new _r,new wr],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=dr.test(l)?l.replace(dr,"$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||er});var r}))}(n)}}("web:javascript",ar,hr)),this._instance=t,this.Oo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.$o=Tr(this.No()),this.qo=new Rr(this.$o)}onConfigChange(){this.$o=Tr(this.No()),this.qo.setConfig(this.$o)}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.Oo=n,this._instance.persistence&&this._instance.persistence.register({[c]:this.Oo,[f]:o})}}}get jo(){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.Do.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.$o.enabled)try{if(!le(t)||0===t.trim().length)return void Sl.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)=>$r.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.Bo(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Sl.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.qo.add(i({[Er]:t,[Sr]:(new Date).toISOString()},s))}catch(t){Sl.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Ho(e)){if(this.Uo(e))return this.zo("Exception dropped: matched a suppression rule"),void Sl.info("Skipping exception capture because a suppression rule matched");if(!this.jo&&this.Wo(e))return this.zo("Exception dropped: thrown by a browser extension"),void Sl.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Vo(e))return this.zo("Exception dropped: thrown by the PostHog SDK"),void Sl.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.$o.enabled&&de(t.$exception_steps)?this.Zo(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Un:!0});return s&&this.qo.clear(),s}catch(t){return Sl.error("Failed to capture exception event. Dropping this exception.",t),void this.qo.clear()}}catch(t){return void Sl.error("Failed to process exception event. Ignoring this exception.",t)}var n}Zo(t){try{var e=this.qo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Sl.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}zo(t){this.$o.enabled&&this.qo.add({[Er]:t,[Sr]:(new Date).toISOString()})}Bo(t){return ne(t)?i({},t):{}}No(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Uo(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return le(i)&&i.length>0&&t.$exception_types.push(i),le(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Oo.some((t=>{var i=t.values.map((t=>{var i=na[t.operator],r=e[t.key];if(!i||!r)return!1;var s=re(t.value)?t.value:[t.value];return s.length>0&&i(s,r)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}catch(t){return Sl.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Wo(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://")))}Vo(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}Ho(t){return!de(t)&&re(t)}}},Ul=i({productTours:class{get Tr(){return this._instance.persistence}constructor(t){this.Go=null,this.Qo=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.Tr&&this.Tr.register({[g]:!!e.productTours}),!ol(this._instance))return!this.Go&&de(null==(i=this.Tr)?void 0:i.props[q])||nl.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Go)||r.stop(),this.Go=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Go&&ol(this._instance)&&this.ai((()=>this.Ko()))}ai(t){var e,i;null!=(e=It.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?nl.error("Could not load product tours script",e):t()}))}Ko(){var t;!this.Go&&null!=(t=It.__PosthogExtensions__)&&t.generateProductTours&&(this.Go=It.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!re(this.Qo)||e){var i=this.Tr;if(i){var r=i.props[q];if(re(r)&&!e)return this.Qo=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(ol(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?e.error||nl.warn(s):nl.error(s),void t([],{isLoaded:!1,error:s})}var n=re(e.json.product_tours)?e.json.product_tours:[];this.Qo=n,i&&i.register({[q]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Qo,{isLoaded:!0})}getActiveProductTours(t){de(this.Go)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Go.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Go)||e.showTourById(t)}previewTour(t){this.Go?this.Go.previewTour(t):this.ai((()=>{var e;this.Ko(),null==(e=this.Go)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Go)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Go)||t.nextStep()}previousStep(){var t;null==(t=this.Go)||t.previousStep()}clearCache(){var t;this.Qo=null,null==(t=this.Tr)||t.unregister(q)}resetTour(t){var e;null==(e=this.Go)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Go)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Go)||e.cancelPendingTour(t)}}},Ml),Ll={siteApps:class{constructor(t){this.Jo=0,this._instance=t,this.Yo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Xo(t,e){if(e){var i=this.globalsForEvent(e);this.Yo.push(i),this.Yo.length>1e3&&(this.Yo=this.Yo.slice(10))}}get siteAppLoaders(){var t;return null==(t=It._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Xo.bind(this));this.tl=()=>{t(),this.Yo=[],this.tl=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,al),{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}}el(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)||(ll.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)||(ll.error("prepare_external_dependency_script returned null"),null):t}il(){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==xt?void 0:xt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Jo++,this.rl)return this.nl();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.el(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!he(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.rl=()=>{h.forEach((t=>t())),this.rl=void 0},this.nl()}nl(){var t=!1;return()=>{var e;t||(t=!0,this.Jo--,0===this.Jo&&(null==(e=this.rl)||e.call(this)))}}sl(t,e){void 0===e&&(e=!0);var i=this.il();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.Yo.length&&(ll.info("Processing "+this.Yo.length+" events for site app with id "+t.id),this.Yo.forEach((t=>this.sl((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.tl)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ll.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.sl((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){ll.error(ul+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ll.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}al(){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)}ol(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.sl((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){ll.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.al(),void this._instance.on("eventCaptured",(t=>this.ol(t)))):void ll.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.tl)||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;It["__$$ph_site_app_"+e]=s._instance,null==(t=It.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return ll.error(ul+e,t)}))};for(var a of n.siteApps)o()}else ll.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},jl={tracingHeaders:class{constructor(t){this.ll=void 0,this.ul=void 0,this.hl=void 0,this.Co=()=>{var t,e,i=this.dl();i?(ae(this.ll)&&(this.ll=null==(t=It.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ae(this.ul)&&(this.ul=null==(e=It.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ro()},this._instance=t}initialize(){this.startIfEnabledOrStop()}ai(t){var e,i;null!=(e=It.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=It.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ka.error("failed to load script",e);t()}))}vl(){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}dl(){var t=this.vl();return re(t)?(re(this.hl)?this.hl.splice(0,this.hl.length,...t):this.hl=[...t],t.length>0?this.hl:void 0):(re(this.hl)&&this.hl.splice(0),this.hl=t||void 0,this.hl)}Ro(){var t,e;null==(t=this.ll)||t.call(this),null==(e=this.ul)||e.call(this),this.ll=void 0,this.ul=void 0}startIfEnabledOrStop(){this.dl()?this.ai(this.Co):this.Ro()}}},Bl=i({surveys:class{get Ne(){return this._instance.config}constructor(t){this.cl=void 0,this._surveyManager=null,this.fl=!1,this.pl=[],this.gl=null,this.ml=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Ne.disable_surveys){if(!t.ok)return ca.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(de(e))return ca.warn("Flags not loaded yet. Not loading surveys.");var i=re(e);this.cl=i?e.length>0:e,ca.info("flags response received, isSurveysEnabled: "+this.cl),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(fa)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.fl)ca.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)ca.info(pl);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())ca.info("Not loading surveys in cookieless mode without consent.");else{var t=null==It?void 0:It.__PosthogExtensions__;if(t){if(!ae(this.cl)||this.Ne.advanced_enable_surveys){var e=this.cl||this.Ne.advanced_enable_surveys;this.fl=!0;try{var i=t.generateSurveys;if(i)return void this.yl(i,e);var r=t.loadExternalDependency;if(!r)return void this.bl(at);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.bl("Could not load surveys script",i):this.yl(t.generateSurveys,e)}))}catch(t){throw this.bl("Error initializing surveys",t),t}finally{this.fl=!1}}}else ca.error("PostHog Extensions not found.")}}yl(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new cl(this._instance),ca.info("Surveys loaded successfully"),this._l({isLoaded:!0})}bl(t,e){ca.error(t,e),this._l({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.pl.push(t),this._surveyManager&&this._l({isLoaded:!0}),()=>{this.pl=this.pl.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Ne.disable_surveys)return ca.info(pl),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0}),void(this.wl()&&this.getSurveys((()=>{}),!0));"undefined"!=typeof Promise&&this.gl?this.gl.then((e=>t(e.surveys,e.context))):("undefined"!=typeof Promise&&(this.gl=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:e=>{var r;this.gl=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;0!==s?ca.error(n):e.error||ca.warn(n),this.ml=Date.now();var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.ml=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(va(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})}}))}wl(){return this.kl()&&!this.gl&&!this.xl()}kl(){var t=this._instance.get_property(j);return ve(t)&&Date.now()-t>3e5}xl(){return ve(this.ml)&&3e5>Date.now()-this.ml}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};pa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}_l(t){for(var e of this.pl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){ca.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!de(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);ca.warn("init was not called")}Sl(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}Cl(t){if(de(this._surveyManager))return{eligible:!1,reason:fl};var e="string"==typeof t?this.Sl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Ml(t){if(de(this._surveyManager))return{eligible:!1,reason:fl};var e="string"==typeof t?this.Sl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(de(this._surveyManager))return ca.warn("init was not called"),{visible:!1,disabledReason:fl};var e=this.Ml(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return de(this._surveyManager)?(ca.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fl})):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.Ml(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(de(this._surveyManager))ca.warn("init was not called");else{var s="string"==typeof t?this.Sl(t):t;if(null!=s&&s.id)if(_a.includes(s.type)){var n=null==xt?void 0:xt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(ca.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;ca.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),ca.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);ca.warn("Survey element not found")}else ca.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ca.warn("Survey not found")}}displaySurvey(t,e){var r;if(de(this._surveyManager))ca.warn("init was not called");else{var s=this.Sl(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!==qn.Popover&&e.initialResponses&&ca.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Cl(s);if(!o.eligible)return void ca.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==qn.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else ca.warn("Survey not found")}}cancelPendingSurvey(t){de(this._surveyManager)?ca.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}},Ml),zl={toolbar:class{constructor(t){this.instance=t}Tl(t){It.ph_toolbar_state=t}El(){var t;return null!==(t=It.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),Hr(this.instance.config))return!1;if(!bt||!xt)return!1;t=null!=t?t:bt.location,i=null!=i?i:bt.history;try{if(!e){try{bt.localStorage.setItem("test","test"),bt.localStorage.removeItem("test")}catch(t){return!1}e=null==bt?void 0:bt.localStorage}var r,s=_l||_n(t.hash,"__posthog")||_n(t.hash,"state"),n=s?Nr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Nr((()=>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(gl)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Il(t){var e=It.ph_load_toolbar||It.ph_load_editor;!de(e)&&se(e)?e(t,this.instance):ml.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==xt||!xt.getElementById(hs));if(!bt||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(bt.localStorage.setItem(gl,JSON.stringify(i({},s,{source:void 0}))),2===this.El())this.Il(s);else if(0===this.El()){var n;this.Tl(1),null==(n=It.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ml.error("[Toolbar] Failed to load",t),void this.Tl(0);this.Tl(2),this.Il(s)})),zr(bt,"turbolinks:load",(()=>{this.Tl(0),this.loadToolbar(s)}))}return!0}Pl(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)}}},Hl=i({experiments:Tl},Ml),ql={conversations:class{constructor(t){this.Rl=void 0,this._conversationsManager=null,this.Al=!1,this.Fl=null,this.Ll=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Ol=t.ok,t.ok)){var e=t.config.conversations;de(e)||(fe(e)?this.Rl=e:(this.Rl=e.enabled,this.Fl=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Rl=void 0,this.Fl=null,this.Ol=void 0,this.Ll=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Al||this._instance.config.disable_conversations||Hr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==It?void 0:It.__PosthogExtensions__;if(t&&!ae(this.Rl)&&this.Rl)if(this.Fl&&this.Fl.token){this.Al=!0;try{var e=t.initConversations;if(e)return this.Dl(e),void(this.Al=!1);var i=t.loadExternalDependency;if(!i)return void this.$l(at);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.$l("Could not load conversations script",e):this.Dl(t.initConversations),this.Al=!1}))}catch(t){this.$l("Error initializing conversations",t),this.Al=!1}}else Rl.error("Conversations enabled but missing token in remote config.")}}Dl(t){if(this.Fl)try{this._conversationsManager=t(this.Fl,this._instance),this.Ll=!1,Rl.info("Conversations loaded successfully")}catch(t){this.$l("Error completing conversations initialization",t)}else Rl.error("Cannot complete initialization: remote config is null")}$l(t,e){Rl.error(t,e),this._conversationsManager=null,this.Al=!1,this.Ll=!0}show(){this._conversationsManager?this._conversationsManager.show():Rl.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rl&&!he(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Hr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Ol?"remote_config_failed":ae(this.Rl)?this.Ol?"disabled_in_project":"remote_config_pending":this.Rl?de(this.Fl)||!this.Fl.token?"missing_token":null!=It&&It.__PosthogExtensions__?this.Al?"initializing":this.Ll?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}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):(Rl.warn(Pl),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(Rl.warn(Pl),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Rl.warn(Pl),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Rl.warn(Pl),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Rl.warn(Pl),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Rl.warn(Pl),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Rl.warn(Pl),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}Yn(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Xn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Vl={logs:class{constructor(t){var e,r=this;this.Nl=!1,this.ql=!1,this.rt=Cr("[logs]"),this.jl=i({},this.rt,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(Al)||r.rt.error(...e)}}),this.er=[],this.Bl=[],this.ya=0,this.Hl=()=>{var t,e;this.ya=0,null==(t=this.Ul)||t.onReconnect(),null==(e=this.zl)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Nl=!0),bt&&zr(bt,"online",this.Hl)}Wl(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=ae(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 Vi(this.Vl(t,e),n,this.jl,(()=>this.Zl()),(t=>t()),void 0,r),n]}Gl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ul||this.Ql!==e){var i;null==(i=this.Ul)||i.reset(),this.Ql=e;var r=this.Wl((()=>this.er),(t=>{this.er=t}));this.Ul=r[0],this.Kl=r[1]}return this.Ul}Jl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.zl||this.Yl!==e){var i;null==(i=this.zl)||i.reset(),this.Yl=e;var r=this.Wl((()=>this.Bl),(t=>{this.Bl=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ol);this.zl=r[0],this.Xl=r[1]}return this.zl}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!de(i)&&i&&(this.Nl=!0,this.loadIfEnabled())}}reset(){var t,e;this.er=[],null==(t=this.Ul)||t.reset(),this.Bl=[],null==(e=this.zl)||e.reset(),this.ya=0}captureLog(t){this.Gl().captureLog(t)}he(t){this.Jl().captureLog(t)}get logger(){return this.tu||(this.tu={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.tu}flushLogs(t){t?this.eu(t):(this.Ul&&this.Ul.flush().catch((t=>this.iu(t))),this.zl&&this.zl.flush().catch((t=>this.iu(t))))}iu(t){Al(t)||this.rt.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Nl&&!this.ql){var t=null==It?void 0:It.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.rt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ql=!0)})):this.rt.error(at)}else this.rt.error("PostHog Extensions not found.")}}Vl(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Nt.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Nt.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Ot:t=>this.Ot(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Ot(t){return new Promise((e=>{if(gn(this.ya,3))e({kind:"fatal",error:Cl(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>{this.rt.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Cl(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.ru(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this.nu(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;0===e?(t.error||this.rt.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Cl(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}}))}nu(t){(0!==t||this._instance.__loaded)&&(this.ya=mn(t,this.ya,3,(()=>this.rt.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."))))}eu(t){this.er.length>0&&this.su(t,this.er,this.Kl,s.LIB_NAME,(t=>{this.er=t})),this.Bl.length>0&&this.su(t,this.Bl,this.Xl,Ol,(t=>{this.Bl=t}))}su(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=qi(o,Hi(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ru(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}ru(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Zl(){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,de(s)||(e.sessionStartTimestamp=s),de(n)||(e.lastActivityTimestamp=n)}if(null!=It&&null!=(t=It.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ai(It.location.href):It.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Wl={metrics:class{constructor(t){this.rt=Cr("[metrics]"),this._instance=t}initialize(){}Gl(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Ul&&this.Ql===i||(null==(e=this.Ul)||e.reset(),this.Ql=i,this.Ul=new Ji(this.Vl(),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.rt)),this.Ul}count(t,e,i){void 0===e&&(e=1),this.Gl().count(t,e,i)}gauge(t,e,i){this.Gl().gauge(t,e,i)}histogram(t,e,i){this.Gl().histogram(t,e,i)}flush(t){if(!this.Ul)return Promise.resolve();if(t){var e=this.Ul.drainWindow();return e&&this.Jt(e,t),Promise.resolve()}return this.Ul.flush().catch((t=>this.rt.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Ul)||t.reset()}Vl(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Jt:t=>e.Jt(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Jt(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.au(),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)})}}}))}))}au(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gl=i({},Ml,Fl,Dl,Nl,Ul,Ll,Bl,jl,zl,Hl,ql,Vl,Wl);La.__defaultExtensionClasses=i({},Gl);var Kl=Cr("[ExternalScriptsLoader]"),Jl=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Kl.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==xt?void 0:xt.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(!xt)return i("document not found");var r=xt.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)xt.head.appendChild(r);else{var s,n=xt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):xt.body.appendChild(r)}};null!=xt&&xt.body?a():null==xt||xt.addEventListener("DOMContentLoaded",a)};It.__PosthogExtensions__=It.__PosthogExtensions__||{},It.__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)}Jl(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Jl(t,o,i)}},It.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Jl(t,r,i)};var Yl=function(){s.SDK_DIST_CHANNEL="npm";var t=$a[Aa]=new La;return function(){function t(){t.done||(t.done=!0,Ma=!1,Mr($a,(function(t){t._dom_loaded()})))}null!=xt&&xt.addEventListener?"complete"===xt.readyState?t():zr(xt,"DOMContentLoaded",t,{capture:!1}):bt&&Ir.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Ln,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=qn,exports.PostHog=La,exports.ProductTourEventName=Vn,exports.ProductTourEventProperties=Wn,exports.SurveyEventName=zn,exports.SurveyEventProperties=Hn,exports.SurveyEventType=jn,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=Bn,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Yl,exports.posthog=Yl,exports.severityLevels=["fatal","error","warning","log","info","debug"];
//# sourceMappingURL=main.js.map
