1var v=typeof window<"u"?window:void 0,ae=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(ae.self=ae),typeof File>"u"&&(ae.File=function(){});var pe=ae?.navigator,E=ae?.document,se=ae?.location,fs=ae?.fetch,_s=ae!=null&&ae.XMLHttpRequest&&"withCredentials"in new ae.XMLHttpRequest?ae.XMLHttpRequest:void 0,Sr=ae?.AbortController,po=ae?.CompressionStream,_e=pe?.userAgent,$=v??{};function Tn(){return!(!v||v.navigator.onLine===!1)}var Er="1.399.5",ee={DEBUG:!1,LIB_VERSION:Er,LIB_NAME:"web",JS_SDK_VERSION:Er};function kr(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(s,r)}function ie(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function a(l){kr(n,s,r,a,o,"next",l)}function o(l){kr(n,s,r,a,o,"throw",l)}a(void 0)}))}}function _(){return _=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},_.apply(null,arguments)}function Rn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var Pr=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}};function Fr(i){return typeof i=="string"||i}function Ar(i){return typeof i=="string"?i:void 0}var Pt,Ne=(function(i){return i.AnonymousId="anonymous_id",i.DistinctId="distinct_id",i.Props="props",i.EnablePersonProcessing="enable_person_processing",i.PersonMode="person_mode",i.FeatureFlagDetails="feature_flag_details",i.FeatureFlags="feature_flags",i.FeatureFlagPayloads="feature_flag_payloads",i.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",i.BootstrapFeatureFlags="bootstrap_feature_flags",i.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",i.OverrideFeatureFlags="override_feature_flags",i.Queue="queue",i.AiQueue="ai_queue",i.LogsQueue="logs_queue",i.OptedOut="opted_out",i.SessionId="session_id",i.SessionStartTimestamp="session_start_timestamp",i.SessionLastTimestamp="session_timestamp",i.PersonProperties="person_properties",i.GroupProperties="group_properties",i.InstalledAppBuild="installed_app_build",i.InstalledAppVersion="installed_app_version",i.SessionReplay="session_replay",i.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",i.SurveyLastSeenDate="survey_last_seen_date",i.SurveysSeen="surveys_seen",i.Surveys="surveys",i.RemoteConfig="remote_config",i.FlagsEndpointWasHit="flags_endpoint_was_hit",i.DeviceId="device_id",i})({}),Ir=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),vo=["$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"],go=["token"],Mn="NativeGzipValidationError",ms=i=>i.length>=2&&i[0]===31&&i[1]===139,$r=(i,e)=>i===Ir.GZipJS||e===Ir.GZipJS||e==="gzip",Tr=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",ti=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=Mn,e},fo=(function(){var i=ie((function*(e,t){18>e.size&&ti("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());ms(s)&&s[2]===8||ti("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Pt)return Pt;Pt=[];for(var h=0;256>h;h++){for(var c=h,d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;Pt[h]=c>>>0}return Pt})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(t)&&ti("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&ti("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function ys(){return ys=ie((function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(s).then((()=>n.close())).catch((function(){var u=ie((function*(h){try{yield n.abort(h)}catch{}throw h}));return function(h){return u.apply(this,arguments)}})()),o=new Response(r.readable).blob(),[l]=yield Promise.all([o,a]);return yield fo(l,s),l}catch(u){if(t!=null&&t.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}})),ys.apply(this,arguments)}var _o=["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","hub
1spot","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"],Rr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return _o.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function O(i,e){return i.indexOf(e)!==-1}var ji=function(i){return i.trim()},bs=function(i){return i.replace(/^\$/,"")};function On(i){var e,t=[];return(e=JSON.stringify(i,(function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(r))return"[Circular]";t.push(r)}return r}})))!==null&&e!==void 0?e:"null"}var Cn=Object.prototype,Ln=Cn.hasOwnProperty,qi=Cn.toString,L=Array.isArray||function(i){return qi.call(i)==="[object Array]"},Fe=i=>typeof i=="function",J=i=>i===Object(i)&&!L(i),We=i=>{if(J(i)){for(var e in i)if(Ln.call(i,e))return!1;return!0}return!1},x=i=>i===void 0,U=i=>qi.call(i)=="[object String]",ws=i=>U(i)&&i.trim().length===0,ve=i=>i===null,C=i=>x(i)||ve(i),ue=i=>qi.call(i)=="[object Number]"&&i==i,Le=i=>ue(i)&&i>0,Re=i=>qi.call(i)==="[object Boolean]",mo=i=>i instanceof FormData,yo=i=>O(vo,i),bo=i=>O(go,i);function Dn(i){return i===null||typeof i!="object"}function _i(i,e){return{}.toString.call(i)==="[object "+e+"]"}function ir(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var wo=[!0,"true",1,"1","yes"],zi=i=>O(wo,i),xo=[!1,"false",0,"0","no"];function Te(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),ue(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Te(r||t,e,t,s))}class So{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=Te(e.bucketSize,0,100,e.Ae),this.De=Te(e.refillRate,0,this.Fe,e.Ae),this.$e=Te(e.refillInterval,0,864e5,e.Ae)}Ne(e,t){var s=Math.floor((t-e.lastAccess)/this.$e);s>0&&(e.tokens=Math.min(e.tokens+s*this.De,this.Fe),e.lastAccess=e.lastAccess+s*this.$e)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.Ee[r];return n?this.Ne(n,s):this.Ee[r]=n={tokens:this.Fe,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.Pe)==null||t.call(this,e)),n.tokens===0)}stop(){this.Ee={}}}var we="Mobile",mi="iOS",He="Android",bt="Tablet",Nn=He+" "+bt,jn="iPad",qn="Apple",Bn=qn+" Watch",Bt="Safari",wt="BlackBerry",Hn="Samsung",Un=Hn+"Browser",zn=Hn+" Internet",at="Chrome",Eo=at+" OS",Vn=at+" "+mi,sr="Internet Explorer",Gn=sr+" "+we,rr="Opera",ko=rr+" Mini",nr="Edge",Wn="Microsoft "+nr,mt="Firefox",Yn=mt+" "+mi,Wt="Nintendo",Yt="PlayStation",yt="Xbox",Jn=He+" "+we,Qn=we+" "+Bt,Lt="Windows",xs=Lt+" Phone",Mr="Nokia",Ss="Ouya",Kn="Generic",Po=Kn+" "+we.toLowerCase(),Zn=Kn+" "+bt.toLowerCase(),Es="Konqueror",Xn="Oculus Browser",yi="Vivaldi",ea="Yandex",bi="Whale",ks="DuckDuckGo",ta="Pale Moon",wi="Waterfox",Ht="Brave",ia="Google Search App",X="(\\d+(\\.\\d+)?)",Vi=new RegExp("Version/"+X),Fo=new RegExp(yt,"i"),Ao=new RegExp(Yt+" \\w+","i"),Io=new RegExp(Wt+" \\w+","i"),ar=new RegExp(wt+"|PlayBook|BB10","i"),$o={"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"},sa=function(i,e,t,s){e=e||"";var r=(function(n){return n!=null&&n.brave?Ht:null})(t);return r||(s!=null&&s.detectGoogleSearchApp&&O(i,"GSA/")?ia:O(i," OPR/")&&O(i,"Mini")?ko:O(i," OPR/")?rr:ar.test(i)?wt:O(i,"IE"+we)||O(i,"WPDesktop")?Gn:O(i,"OculusBrowser")?Xn:O(i,Un)?zn:O(i,nr)||O(i,"Edg/")?Wn:O(i,yi+"/")?yi:O(i,"YaBrowser/")?ea:O(i,bi+"/")?bi:O(i,ks+"/")||O(i,"Ddg/")?ks:O(i,"FBIOS")?"Facebook "+we:O(i,"UCWEB")||O(i,"UCBrowser")?"UC Browser":O(i,"CriOS")?Vn:O(i,"CrMo")||O(i,at)?at:O(i,He)&&O(i,Bt)?Jn:O(i,"FxiOS")?Yn:O(i.toLowerCase(),Es.toLowerCase())?Es:O(i,Ht+"/")?Ht:((n,a)=>a&&O(a,qn)||(function(o){return O(o,Bt)&&!O(o,at)&&!O(o,He)})(n))(i,e)?O(i,we)?Qn:Bt:O(i,"PaleMoon/")?ta:O(i,wi+"/")?wi:O(i,mt)?mt:O(i,"MSIE")||O(i,"Trident/")?sr:O(i,"Gecko")?mt:"")},To={[Gn]:[new RegExp("rv:"+X)],[Wn]:[new RegExp(nr+"?\\/"+X)],[at]:[new RegExp("("+at+"|CrMo)\\/"+X)],[Vn]:[new RegExp("CriOS\\/"+X)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+X)],[Bt]:[Vi],[Qn]:[Vi],[rr]:[new RegExp("(Opera|OPR)\\/"+X)],[mt]:[new RegExp(mt+"\\/"+X)],[Yn]:[new RegExp("FxiOS\\/"+X)],[Es]:[new RegExp("Konqueror[:/]?"+X,"i")],[wt]:[new RegExp(wt+" "+X),Vi],[Jn]:[new RegExp("android\\s"+X,"i")],[zn]:[new RegExp(Un+"\\/"+X)],[Xn]:[new RegExp("OculusBrowser\\/"+X)],[yi]:[new RegExp(yi+"\\/"+X)],[ea]:[new RegExp("YaBrowser\\/"+X)],[bi]:[new RegExp(bi+"\\/"+X)],[Ht]:[new RegExp(Ht+"\\/"+X)],[ks]:[new RegExp("(DuckDuckGo|Ddg)\\/"+X)],[ta]:[new RegExp("PaleMoon\\/"+X)],[wi]:[new RegExp(wi+"\\/"+X)],[ia]:[new RegExp("GSA\\/"+X)],[sr]:[new RegExp("(rv:|MSIE )"+X)],Mozilla:[new RegExp("rv:"+X)]},Ro=function(i,e,t,s){var r=sa(i,e,t,s),n=To[r];if(x(n))return null;for(var a=0;n.length>a;a++){var o=i.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},Or=[[new RegExp(yt+"; "+yt+" (.*?)[);]","i"),i=>[yt,i&&i[1]||""]],[new RegExp(Wt,"i"),[Wt,""]],[new RegExp(Yt,"i"),[Yt,""]],[ar,[wt,""]],[new RegExp(Lt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[xs,""];if(new RegExp(we).test(e)&&!/IEMobile\b/.test(e))return[Lt+" "+we,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=$o[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Lt,s]}return[Lt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[mi,[i[3],i[4],i[5]||"0"].join(".")]:[mi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=x(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+He+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+He+")","i"),i=>i&&i[2]?[He,[i[2],i[3],i[4]||"0"].join(".")]:[He,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Eo,""]],[/Linux|debian/i,["Linux",""]]],Cr=function(i){return Io.test(i)?Wt:Ao.test(i)?Yt:Fo.test(i)?yt:new RegExp(Ss,"i").test(i)?Ss:new RegExp("("+xs+"|WPDesktop)","i").test(i)?xs:/iPad/.test(i)?jn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Bn:ar.test(i)?wt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Mr,"i").test(i)?Mr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(we).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?He:Nn:new RegExp("(pda|"+we+")","i").test(i)?Po:new RegExp(bt,"i").test(i)&&!new RegExp(bt+" pc","i").test(i)?Zn:""},Mo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Lr(i,e){return typeof(t=i)=="string"&&Mo.test(t)?i:e();var t}function Ye(i){return i&&i.split("#")[0]}function ci(i,e){var t=setTimeout(i,e);return t?.unref&&t?.unref(),t}var Oo=i=>i instanceof Error,ra={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}},Co=ra.info;function na(i){if(Re(i))return{boolValue:i};if(typeof i=="number")return Number.isFinite(i)?Number.isInteger(i)?{intValue:i}:{doubleValue:i}:{stringValue:String(i)};if(typeof i=="string")return{stringValue:i};if(L(i))return{arrayValue:{values:i.map((e=>na(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function xi(i){var e=[];
1for(var t in i){var s=i[t];ve(s)||x(s)||e.push({key:t,value:na(s)})}return e}function Lo(i,e){var t=i.level||"info",{text:s,number:r}=ra[t]||Co,n=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),C(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),C(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 o=_({},a,i.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:r,severityText:s,body:{stringValue:i.body},attributes:xi(o)};return i.trace_id&&(l.traceId=i.trace_id),i.span_id&&(l.spanId=i.span_id),x(i.trace_flags)||(l.flags=i.trace_flags),l}function aa(i,e,t){return _({},i.resourceAttributes,{"service.name":i.serviceName||"unknown_service"},i.environment&&{"deployment.environment":i.environment},i.serviceVersion&&{"service.version":i.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}function oa(i,e,t,s){return{resourceLogs:[{resource:{attributes:xi(e)},scopeLogs:[{scope:{name:t,version:s},logRecords:i}]}]}}let Do=class{constructor(i,e,t,s,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.Se=e,this.Ae=t,this.qe=s,this.Be=r,this.je=n,this.He=a,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.Ke=e.flushIntervalMs,this.Ye=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(i){if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var e=this.it(i);if(e!==null)if(e.body){if(this.nt()){var t={record:Lo(e,this.qe())};this.Be((()=>this.st(t)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(i){var e=this.Se.beforeSend;if(!e)return i;var t=L(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;s=n}catch(a){return this.Ae.error("Error in beforeSend function for log:",a),null}return s}nt(){if(this.et===void 0)return!0;var i=Date.now(),e=i-this.We;return this.Xe>e&&e>=0||(this.We=i,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var i=this;return ie((function*(){if(!i._instance.isDisabled)return i.Ue||(i.Ue=i.ot().finally((()=>{i.Ue=null}))),i.Ue}))()}ot(){var i=this;return ie((function*(){var e;i.tt();var t=(e=i._instance.getPersistedProperty(Ne.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var s=t.length,r=0;t.length>0&&s>r;){var n,a;i.ze=0;var o=Math.min(t.length,i.Ye),l=t.slice(0,o),u=oa(l.map((c=>c.record)),i.ut(),(n=i.He)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),h=yield i._instance.ht(u);if(h.kind==="too-large"&&l.length>1)i.Ye=Math.max(1,Math.floor(l.length/2)),i.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+i.Ye);else if(h.kind==="retry-later"||(h.kind==="too-large"?i.Ae.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&i.Se.maxBatchRecordsPerPost>i.Ye&&(i.Ye=Math.min(i.Se.maxBatchRecordsPerPost,i.Ye+1)),yield i.dt(l.length),t=(a=i._instance.getPersistedProperty(Ne.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,h.kind==="fatal"))throw h.error}}))()}dt(i){var e=this;return ie((function*(){var t,s=Math.max(0,i-e.ze),r=(t=e._instance.getPersistedProperty(Ne.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Ne.LogsQueue,r.slice(s)),yield e.je()}))()}ut(){return aa(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Ne.LogsQueue))!==null&&e!==void 0?e:[];this.Je>t.length||(t.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(Ne.LogsQueue,t),this.Qe>t.length?this.ct():this.rt()}}ct(i){i===void 0&&(i=this.Ke),this.vt||(this.vt=ci((()=>{this.vt=void 0,this.rt()}),i))}ft(){var i=Math.min(Math.max(0,this.Ve-1),6);return this.Ke*Math.pow(2,i)}yt(){var i=this._instance.getPersistedProperty(Ne.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return ie((function*(){e.tt();var t=e.flush().catch((()=>{}));i!==void 0?yield Promise.race([t,new Promise((s=>ci(s,i)))]):yield t}))()}flushWithTimeout(i){var e=this;return ie((function*(){var t=!1,s=e.flush(),r=new Promise((n=>ci((()=>{t=!0,n()}
1),i)));try{yield Promise.race([s,r])}finally{t&&s.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(i=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",i)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var Gi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Dr(i){return String(i)+"000000"}function Nr(i,e,t,s){var r="";return s&&(r=Object.keys(s).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(s[n]))).join(",")),i+"\0"+e+"\0"+(t??"")+"\0"+r}let No=class{constructor(i,e,t){this._instance=i,this.Se=e,this.Ae=t,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(i,e,t){e===void 0&&(e=1),this.kt({name:i,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(i,e,t){this.kt({name:i,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(i,e,t){this.kt({name:i,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var i=this,e=this.Ue,t=(function(){var r=ie((function*(){e&&(yield e.catch((()=>{}))),yield i.St()}));return function(){return r.apply(this,arguments)}})(),s=t().finally((()=>{this.Ue===s&&(this.Ue=null)}));return this.Ue=s,s}drainWindow(){if(this.bt.size===0)return null;var i=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(i)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.it(i);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ae.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t=this.wt.get(e.name);t===void 0?this.wt.set(e.name,e.type):t===e.type||this.xt.has(e.name)||(this.xt.add(e.name),this.Ae.warn("Metric name '"+e.name+"' is already used as a "+t+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name."));var s=Nr(e.type,e.name,e.unit,e.attributes),r=this.bt.get(s);if(!r){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));r={name:e.name,type:e.type,unit:e.unit,attributes:e.attributes?_({},e.attributes):void 0,windowStartMs:Date.now()},this.bt.set(s,r)}this.It(r,e.value),this.ct()}else this.Ae.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}It(i,e){var t;switch(i.type){case"count":i.total=((t=i.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":i.last=e;break;case"histogram":i.hist||(i.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Gi.length+1).fill(0)});var s=i.hist;s.count+=1,s.sum+=e,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e),s.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(e,Gi)]+=1}}it(i){var e=this.Se.beforeSend;if(!e)return i;var t=L(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.Ae.info("Metric was rejected in beforeSend function"),null;s=n}catch(a){return this.Ae.error("Error in beforeSend function for metric:",a),null}return s}ct(){this.vt||(this.vt=ci((()=>{this.vt=void 0,this.flush().catch((()=>{}))}),this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var i=this;return ie((function*(){if(i.bt.size!==0){var e=i.bt;i.bt=new Map,i._t=!1,i.wt=new Map,i.xt=new Set;var t=yield i._instance.Tt(i.Ct(e));switch(t.kind){case"ok":return;case"retry-later":return i.Mt(e),void i.ct();case"too-large":return void i.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.Ae.error("Failed to send metrics batch:",t.error)}}}))()}Ct(i){return(function(r,n,a,o){return{resourceMetrics:[{resource:{attributes:xi(n)},scopeMetrics:[{scope:{name:a,version:o},metrics:r}]}]}})(this.Et(i),(e=this.Se,t=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),_({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":s})),this._instance.getLibraryId(),this._instance.getLibraryVersion());var e,t,s}Et(i){var e=Dr(Date.now()),t=new Map;for(var s of i.values()){var r,n=Nr(s.type,s.name,s.unit,void 0),a=t.get(n);a||(a=_({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=xi((r=s.attributes)!==null&&r!==void 0?r:{}),l=Dr(s.windowStartMs);if(s.type==="count"){var u,h={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=s.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(h)}else if(s.type==="gauge"){var c,d={attributes:o,timeUnixNano:e,asDouble:(c=s.last)!==null&&c!==void 0?c:0};a.gauge.dataPoints.push(d)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Gi})}return Array.from(t.values())}Mt(i){var e,t;for(var[s,r]of i){var n=this.bt.get(s);if(n)switch(n.windowStartMs=Math.min(n.windowStartMs,r.windowStartMs),n.type){case"count":n.total=((e=n.total)!==null&&e!==void 0?e:0)+((t=r.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(r.hist)if(n.hist){n.hist.count+=r.hist.count,n.hist.sum+=r.hist.sum,n.hist.min=Math.min(n.hist.min,r.hist.min),n.hist.max=Math.max(n.hist.max,r.hist.max);for(var a=0;n.hist.bucketCounts.length>a;a++)n.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else n.hist=r.hist}else this.bt.set(s,r)}}};var ii,jr,Wi;function jo(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Wi&&t.length===jr||(jr=t.length,Wi=t.reduce(((s,r)=>{ii||(ii={});var n=ii[r];if(n)s[n[0]]=n[1];else for(var a=i(r),o=a.length-1;o>=0;o--){var l=a[o],u=l?.filename,h=e[r];if(u&&h){s[u]=h,ii[r]=[u,h];break}}return s}),{})),Wi}}class qo{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var t=this;return ie((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&L(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),_({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ie((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,a={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:jo(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return _({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}}var xt="?";function Ps(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?xt:t,in_app:!0};return x(s)||(n.lineno=s),x(r)||(n.colno=r),n}var la=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:xt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Bo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ho=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Uo=/\((\S*)(?::(\d+))(?::(\d+))\)/,zo=(i,e)=>{var t=Bo.exec(i);if(t){var[,s,r,n]=t;return Ps(e,s,xt,+r,+n)}var a=Ho.exec(i);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=Uo.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=la(a[1]||xt,a[2]);return Ps(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},Vo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Go=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Wo=(i,e)=>{var t=Vo.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=Go.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||xt;return[n,r]=la(n,r),Ps(e,r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},qr=/\(error: (.*)\)/;class Yo{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return _i(e,"DOMException")}isDOMError(e){return _i(e,"DOMError")}}class Jo{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class Qo{constructor(){}match(e){return _i(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var Ko=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Zo{match(e){return typeof e=="string"}coerce(e,t){var s,[r,n]=this.getInfos(e);return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(Ko);return r&&(t=r[1],s=r[2]),[t,s]}}var Xo=["fatal","error","warning","log","info","debug"];function ua(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");
1if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class el{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ir(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+ua(e)}isSeverityLevel(e){return U(e)&&!ws(e)&&Xo.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(Oo(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class tl{match(e){return ir(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ua(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class il{match(e){return Dn(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class sl{match(e){return _i(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ir(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return Dn(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Si="$message",Ei="$timestamp",rl=new Set([Si,Ei]),Yi={enabled:!0,max_bytes:32768};function ki(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:Yi.enabled,max_bytes:al(i.max_bytes,Yi.max_bytes)}:_({},Yi)}class nl{constructor(e){this.Pt=[],this.Rt=0,this.Se=ki(e)}setConfig(e){this.Se=ki(e),this.Ot()}add(e){var t=(function(r){var n;try{n=On(r)}catch{return}try{var a=JSON.parse(n);if(!J(a))return;var o=a,l=o[Si],u=o[Ei];return!U(l)||l.trim().length===0||!U(u)&&!ue(u)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var s=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a})(t.json);s>this.Se.max_bytes||(this.Pt.push({step:t.step,bytes:s}),this.Rt+=s,this.Ot())}}getAttachable(){return this.Pt.map((e=>e.step))}clear(){this.Pt=[],this.Rt=0}size(){return this.Pt.length}Ot(){for(;this.Rt>this.Se.max_bytes&&this.Pt.length>0;){var e=this.Pt.shift();e&&(this.Rt-=e.bytes)}}}function al(i,e){if(!ue(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var ha=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,s={k(r){if(v&&(ee.DEBUG||$.POSTHOG_DEBUG||t)&&!x(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[r])?v.console[r].__rrweb_original__:v.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(i,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>ha(i+" "+r,n)};return s}
1,w=ha("[PostHog.js]"),K=w.createLogger,ol=K("[ExternalScriptsLoader]"),Ji=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return ol.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=E?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[a].src===e){var l=s[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},a=0;s.length>a;a++)if(r=n())return r.v}var o=()=>{if(!E)return t("document not found");var l=E.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)},l.onerror=c=>t(c),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")E.head.appendChild(l);else{var u,h=E.querySelectorAll("body > script");h.length>0?(u=h[0].parentNode)==null||u.insertBefore(l,h[0]):E.body.appendChild(l)}};E!=null&&E.body?o():E?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.strict_script_versioning)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}Ji(i,s,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");Ji(i,a,t)}},$.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);Ji(i,s,t)};var ca="$people_distinct_id",Pi="$device_id",Qi="$device_model",Dt="__alias",Nt="__timers",Fs="$autocapture_disabled_server_side",As="$heatmaps_enabled_server_side",Is="$exception_capture_enabled_server_side",$s="$error_tracking_suppression_rules",Ts="$error_tracking_capture_extension_exceptions",Rs="$web_vitals_enabled_server_side",or="$dead_clicks_enabled_server_side",lr="$product_tours_enabled_server_side",Ms="$web_vitals_allowed_metrics",nt="$session_recording_remote_config",da="$replay_sample_rate",pa="$replay_override_sampling",va="$replay_override_linked_flag",ga="$replay_override_url_trigger",fa="$replay_override_event_trigger",ft="$sesid",ur="$session_is_sampled",rt="$enabled_feature_flags",di="$active_feature_flags",jt="$early_access_features",Os="$feature_flag_details",pi="$feature_flag_payloads",Cs="$feature_flag_request_id",De="$override_feature_flags",pt="$override_feature_flag_payloads",tt="$stored_person_properties",it="$stored_group_properties",Ls="$surveys",Fi="$surveys_loaded_at",Ds="$surveys_activated",qt="ph_product_tours",Ut="$flag_call_reported",Ns="$flag_call_reported_session_id",js="$feature_flag_errors",Jt="$feature_flag_evaluated_at",Pe="$user_state",qs="$client_session_props",Bs="$capture_rate_limit",Hs="$initial_campaign_params",Us="$initial_referrer_info",Ai="$initial_person_info",Ii="$epp",_a="__POSTHOG_TOOLBAR__",si="$posthog_cookieless",ma="$sdk_debug_extensions_init_method",ya="$sdk_debug_extensions_init_time_ms",ba="$sdk_debug_recording_script_not_loaded",hr="PostHog loadExternalDependency extension not found.",st="on_reject",qe="always",lt="anonymous",ut="identified",zs="identified_only",$i="visibilitychange",Ti="beforeunload",vt="$pageview",Ki="$pageleave",Zi="$identify",Br="$groupidentify";function ri(i,e){L(i)&&i.forEach(e)}function V(i,e){if(!C(i))if(L(i))i.forEach(e);else if(mo(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)Ln.call(i,t)&&e(i[t],t)}var W=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function vi(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Hr=function(i){try{return i()}catch{return}},ll=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(r)}}},cr=function(i){var e={};return V(i,(function(t,s){(U(t)&&t.length>0||ue(t))&&(e[s]=t)})),e},ul=["herokuapp.com","vercel.app","netlify.app"];function hl(i){var e=i?.hostname;if(!U(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of ul)if(t===s)return!1;return!0}function te(i,e,t,s){var{capture:r=!1,passive:n=!0}=s??{};i?.addEventListener(e,t,{capture:r,passive:n})}
1function wa(i){return i.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return ue(i)&&isFinite(i)&&Math.floor(i)===i});class Ri{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new Ri(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ri(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}}class cl{constructor(){this.S=0,this.C=0,this.I=new dl}generate(){var e=this.generateOrAbort();if(x(e)){this.S=0;var t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Ri.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ur,xa=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!x(v.crypto)&&crypto.getRandomValues&&(xa=i=>crypto.getRandomValues(i));class dl{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(xa(this.R),this.O=0),this.R[this.O++]}}var je=()=>pl().toString(),pl=()=>(Ur||(Ur=new cl)).generate(),Ft="",vl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,$e={N:()=>!!E,D(i){w.error("cookieStore error: "+i)},A(i){if(E){try{for(var e=i+"=",t=E.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(i){var e;try{e=JSON.parse($e.A(i))||{}}catch{}return e},q(i,e,t,s,r){if(!E)return!1;try{var n="",a="",o=(function(h,c){if(c){var d=(function(g,f){if(f===void 0&&(f=E),Ft)return Ft;if(!f||["localhost","127.0.0.1"].includes(g))return"";for(var m=g.split("."),y=Math.min(m.length,8),P="dmn_chk_"+je();!Ft&&y--;){var k=m.slice(y).join("."),S=P+"=1;domain=."+k+";path=/";f.cookie=S+";max-age=3",f.cookie.includes(P)&&(f.cookie=S+";max-age=0",Ft=k)}return Ft})(h);if(!d){var p=(g=>{var f=g.match(vl);return f?f[0]:""})(h);p!==d&&w.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(E.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+u.length),E.cookie=u,!0}catch{return!1}},P(i,e){if(E!=null&&E.cookie)try{$e.q(i,"",-1,e)}catch{return}}},Xi=null,z={N(){if(!ve(Xi))return Xi;var i=!0;if(x(v))i=!1;else try{var e="__mplssupport__";z.q(e,"xyz"),z.A(e)!=='"xyz"'&&(i=!1),z.P(e)}catch{i=!1}return i||w.error("localStorage unsupported; falling back to cookie store"),Xi=i,i},D(i){w.error("localStorage error: "+i)},A(i){try{return v?.localStorage.getItem(i)}catch(e){z.D(e)}return null},F(i){try{return JSON.parse(z.A(i))||{}}catch{}return null},q(i,e){try{return v?.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){z.D(t)}return!1},P(i){try{v?.localStorage.removeItem(i)}catch(e){z.D(e)}}},gl=[Pi,"distinct_id",ft,ur,Ii,Ai,Pe],ni={},fl={N:()=>!0,D(i){w.error("memoryStorage error: "+i)},A:i=>ni[i]||null,F:i=>ni[i]||null,q:(i,e)=>(ni[i]=e,!0),P(i){delete ni[i]}},Qe=null,le={N(){if(!ve(Qe))return Qe;if(Qe=!0,x(v))Qe=!1;else try{var i="__support__";le.q(i,"xyz"),le.A(i)!=='"xyz"'&&(Qe=!1),le.P(i)}catch{Qe=!1}return Qe},D(i){w.error("sessionStorage error: ",i)},A(i){try{return v?.sessionStorage.getItem(i)}catch(e){le.D(e)}return null},F(i){try{return JSON.parse(le.A(i))||null}catch{}return null},q(i,e){try{return v?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){le.D(t)}return!1},P(i){try{v?.sessionStorage.removeItem(i)}catch(e){le.D(e)}}};class _l{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.Ft()?0:this.At}
1isOptedOut(){return this.Se.cookieless_mode===qe||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===st}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Dt.q(this.$t,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Dt.P(this.$t,this.Se.cross_subdomain_cookie)}get $t(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get At(){var e=this.Dt.A(this.$t);return zi(e)?1:O(xo,e)?0:-1}get Dt(){var e=this.Se.opt_out_capturing_persistence_type,t=e==="localStorage"?z:$e;if(!this.Nt||this.Nt!==t){this.Nt=t;var s=e==="localStorage"?$e:z;s.A(this.$t)&&(this.Nt.A(this.$t)||this.optInOut(zi(s.A(this.$t))),s.P(this.$t,this.Se.cross_subdomain_cookie))}return this.Nt}Ft(){return!!this.Se.respect_dnt&&[pe?.doNotTrack,pe?.msDoNotTrack,$.doNotTrack].some((e=>zi(e)))}}function Sa(i,e){var t,s=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!Fe(s))return e;try{var r=s(e);return U(r)&&r?r:e}catch(n){return w.error("Error in get_current_url, falling back to window.location.href",n),e}}var ml=1,yl=3,bl=11;function zr(i){return i instanceof Element&&(i.id===_a||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Je(i){return!!i&&i.nodeType===ml}function be(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Ea(i){return!!i&&i.nodeType===yl}function ka(i){return!!i&&i.nodeType===bl&&Je(i.host)}var Pa=1e3;function dr(i){return i?ji(i).split(/\s+/):[]}function Vr(i,e){var t=(function(s){var r,n=v==null||(r=v.location)==null?void 0:r.href;return x(n)?void 0:Sa(s,n)})(e);return!!(t&&i&&i.some((s=>t.match(s))))}function Mi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return dr(e)}function Fa(i){return C(i)?null:ji(i).split(/(\s+)/).filter((e=>zt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Qt(i){var e="";return Gs(i)&&!Ta(i)&&i.childNodes&&i.childNodes.length&&V(i.childNodes,(function(t){var s;Ea(t)&&t.textContent&&(e+=(s=Fa(t.textContent))!==null&&s!==void 0?s:"")})),ji(e)}function es(i){return x(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var pr=["a","button","form","input","select","textarea","label"];function Vs(i,e){if(x(e))return!0;var t,s=function(n){if(e.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function Aa(i){var e=i.parentNode;return!(!e||!Je(e))&&e}var wl=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ia=["next","previous","prev",">","<"],xl=[...Ia,"+","-","â","â"],Gr=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,Wr=[".ph-no-rageclick",".ph-no-capture"],Sl=["","text","search","email","password","url","tel","number"];function Yr(i,e){if(!v||vr(i))return!1;var t,s,r,n,a;if(Re(e)?(t=!!e&&Wr,s=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:Wr,s=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!Je(l))&&(!!be(l,"textarea")||(be(l,"input")?O(Sl,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var h=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return h==="true"||h===""})(l)))})(i))return!1;var{targetElementList:o}=$a(i,!1);return!(function(l,u){if(l===!1||x(l))return!1;var h;if(l===!0)h=Ia;else{if(!L(l))return!1;if(l.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;h=l.map((c=>c.toLowerCase()))}return u.some((c=>{var{safeText:d,ariaLabel:p}=c;return h.some((g=>Gr(d,g)||Gr(p,g)))}))})(s,o.map((l=>{var u;return{safeText:Qt(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!Vs(o,t)}var vr=i=>!i||be(i,"html")||!Je(i),$a=(i,e)=>{if(!v||vr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!be(r,"body");)if(ka(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Aa(r);if(!n)break;if(e||pr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function Gs(i){for(var e=new Set,t=0,s=i;s.parentNode&&!be(s,"body");s=s.parentNode){if(t++>=Pa||e.has(s))return!1;e.add(s);var r=Mi(s);if(O(r,"ph-sensitive")||O(r,"ph-no-capture"))return!1}if(O(Mi(i),"ph-include"))return!0;var n=i.type||"";if(U(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=i.name||i.id||"";return!U(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function Ta(i){return!!(be(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||be(i,"select")||be(i,"textarea")||i.getAttribute("contenteditable")==="true")}var Ra="(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}
1)|((?:2131|1800|35[0-9]{3})[0-9]{11})",El=new RegExp("^(?:"+Ra+")$"),kl=new RegExp(Ra),Ma="\\d{3}-?\\d{2}-?\\d{4}",Pl=new RegExp("^("+Ma+")$"),Fl=new RegExp("("+Ma+")");function zt(i,e){return e===void 0&&(e=!0),!(C(i)||U(i)&&(i=ji(i),(e?El:kl).test((i||"").replace(/[- ]/g,""))||(e?Pl:Fl).test(i)))}function Jr(i){var e=Qt(i);return zt(e=(e+" "+Oa(i)).trim())?e:""}function Oa(i){var e="";return i&&i.childNodes&&i.childNodes.length&&V(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=Qt(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Oa(t)).trim())}catch(n){w.error("[AutoCapture]",n)}})),e}function Qr(i){return i.replace(/"|\\"/g,'\\"')}function Al(i){var e=i.attr__class;return e?L(e)?e:dr(e):void 0}var ai=K("[Dead Clicks]"),Il=()=>!0,$l=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(or)),s=i.instance.config.capture_dead_clicks;return Re(s)?s:!!J(s)||t};class Kr{get lazyLoadedDeadClicksAutocapture(){return this.qt}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[or]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt((()=>{this.jt()})):this.stop()}Bt(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?ai.error("failed to load script",r):e()}))}jt(){var e;if(E){if(!this.qt&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=J(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.qt=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.qt.start(E),ai.info("starting...")}}else ai.error("`document` not found. Cannot start.")}stop(){this.qt&&(this.qt.stop(),this.qt=void 0,ai.info("stopping..."))}}var ts=K("[SegmentIntegration]"),Ca="posthog-js";function La(i,e){var{organization:t,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,u,h,c,d;if(n!=="*"&&!n.includes(o.level)||!i.__loaded)return o;o.tags||(o.tags={});var p=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());o.tags["PostHog Person URL"]=p,i.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var g,f=((l=o.exception)==null?void 0:l.values)||[],m=f.map((P=>_({},P,{stacktrace:P.stacktrace?_({},P.stacktrace,{type:"raw",frames:(P.stacktrace.frames||[]).map((k=>_({},k,{platform:"web:javascript"})))}):void 0}))),y={$exception_message:((u=f[0])==null?void 0:u.value)||o.message,$exception_type:(h=f[0])==null?void 0:h.type,$exception_level:o.level,$exception_list:m,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((c=f[0])==null?void 0:c.value)||o.message,$sentry_exception_type:(d=f[0])==null?void 0:d.type,$sentry_tags:o.tags};return t&&s&&(y.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),a&&((g=i.exceptions)==null||g.sendExceptionEvent(y)),o}}class Tl{constructor(e,t,s,r,n,a){this.name=Ca,this.setupOnce=function(o){o(La(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class Zr{constructor(e){this.Ht=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.Ut=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zt()}zt(){var e;this.Vt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ht)}destroy(){var e;(e=this.Vt)==null||e.call(this),this.Vt=void 0}doPageView(e,t){var s,r=this.Wt(e,t);return this.Ut={pathname:(s=v?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Wt(e,(t=this.Ut)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ut)==null?void 0:e.pageViewId}}Wt(e,t){var s=this.Ut;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,last
1ContentY:h,maxContentY:c}=n;if(!(x(a)||x(o)||x(l)||x(u)||x(h)||x(c))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h),c=Math.ceil(c);var d=a>1?Te(o/a,0,1,w):1,p=a>1?Te(l/a,0,1,w):1,g=u>1?Te(h/u,0,1,w):1,f=u>1?Te(c/u,0,1,w):1;r=W(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var oi=["flags","surveys"],Rl={[ca]:{exposure:"hidden"},[Dt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Nt]:{exposure:"hidden"},[Fs]:{exposure:"event"},[As]:{exposure:"hidden"},[Is]:{exposure:"event"},[$s]:{exposure:"hidden"},[Ts]:{exposure:"event"},[Rs]:{exposure:"event"},[or]:{exposure:"event"},[lr]:{exposure:"hidden"},[Ms]:{exposure:"event"},[nt]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ft]:{exposure:"hidden"},[ur]:{exposure:"event"},[da]:{exposure:"event",shouldSkipFromEventProperties:i=>ve(i)},$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"},[rt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!J(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[di]:{exposure:"event",storageGroup:"flags"},[jt]:{exposure:"hidden"},[Os]:{exposure:"hidden",storageGroup:"flags"},[pi]:{exposure:"event",storageGroup:"flags"},[Cs]:{exposure:"event",storageGroup:"flags",volatile:!0},[De]:{exposure:"event"},[pt]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[Ls]:{exposure:"hidden",storageGroup:"surveys"},[Fi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ds]:{exposure:"event"},[qt]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ut]:{exposure:"hidden"},[Ns]:{exposure:"hidden"},[js]:{exposure:"hidden"},[Jt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Pe]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[Bs]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[Us]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[pa]:{exposure:"event"},[va]:{exposure:"event"},[ga]:{exposure:"event"},[fa]:{exposure:"event"},[ma]:{exposure:"event"},[ya]:{exposure:"event"},[ba]:{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"}},Ml=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ke=i=>{var e=Rl[i];if(e)return e;for(var[t,s]of Ml)if(i.indexOf(t)===0)return s},Kt=i=>{var e=E?.createElement("a");return x(e)?null:(e.href=i,e)},St=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!L(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{w.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Zt=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");L(c)&&(e.includes(c[0])?u.push(c[0]+"="+t):u.push(l[h]))}var d=o;return a!=null&&(d+="?"+u.join("&")),r!=null&&(d+="#"+r),d},Oi=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Da=(i,e)=>i>=e&&Tn(),Na=(i,e,t,s)=>{if(i===0){if(Tn()){var r=e+1;return r===t&&s(),r}return e}return 0},li="https?://(.*)",Et=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ol=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Et],Xt="<masked>",Cl=["li_fat_id"];function ja(i,e,t){if(!E)return{};var s,r=e?[...Et,...t||[]]:[],n=qa(Zt(E.URL,r,Xt),i),a=(s={},V(Cl,(function(o){var l=$e.A(o);s[o]=l||null})),s);return W(a,n)}function qa(i,e){var t=Ol.concat(e||[]),s={};return V(t,(function(r){var n=St(i,r);s[r]=n||null})),s}function Ba(i){var e=(function(n){return n?n.search(li+"google.([^/?]*)")===0?"google":n.search(li+"bing.com")===0?"bing":n.search(li+"yahoo.com")===0?"yahoo":n.search(li+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!ve(e)){s.$search_engine=e;var r=E?St(E.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function Xr(){return navigator.language||navigator.userLanguage}var Ci="$direct";function Ha(){return E?.referrer||Ci}function Ua(i,e,t){t===void 0&&(t=!1);var s=i?[...Et,...e||[]]:[],r=t?Ye(se?.href):se?.href,n=r?.substring(0,1e3);return{r:Ha().substring(0,1e3),u:n?Zt(n,s,Xt):void 0}}function za(i,e){var t;e===void 0&&(e=!1);var{r:s,u:r}=i,n=e?Ye(r):r,a={$referrer:s,$referring_domain:s==null?void 0:s==Ci?Ci:(t=Kt(s))==null?void 0:t.host};
1if(n){a.$current_url=n;var o=Kt(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=qa(n);W(a,l)}if(s){var u=Ba(s);W(a,u)}return a}function Va(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ll(){try{return new Date().getTimezoneOffset()}catch{return}}var Dl={flags:Jt,surveys:Fi},Nl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ht="main";class is{constructor(e,t,s){if(s===void 0&&(s=!0),this.Gt={},this.Zt=!1,this.Qt=!1,this.Se=e,this.Jt=s,this.props={},this.Kt=!1,this.Yt=(n=>{var a="";return n.token&&(a=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+a+"_posthog"})(e),this.Dt=this.Xt(e),this.Qt=this.er(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,t),this.save(),v){var r=()=>this.flush();te(v,"beforeunload",r,{capture:!1}),te(v,"pagehide",r,{capture:!1})}}tr(){var e,t=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return ue(t)&&t>0?t:0}isDisabled(){return!!this.rr}Xt(e){Nl.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...gl,...a];return _({},z,{F(u){try{var h={};try{h=$e.F(u)||{}}catch{}var c,d=JSON.parse(z.A(u)||"{}");if(o){var p={};for(var g in h){var f=h[g];ve(f)||f===""||(p[g]=f)}c=W(d,p)}else c=W(h,d);return z.q(u,c),c}catch{}return null},q(u,h,c,d,p,g){var f=z.q(u,h,void 0,void 0,g);try{var m={};l.forEach((y=>{h[y]&&(m[y]=h[y])})),Object.keys(m).length&&$e.q(u,m,c,d,p,g)}catch(y){z.D(y)}return f},P(u,h){try{v?.localStorage.removeItem(u),$e.P(u,h)}catch(c){z.D(c)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&z.N()?(t=z,r=!0):n==="localstorage+cookie"&&s.N()?(t=s,r=!0):n==="sessionstorage"&&le.N()?t=le:n==="memory"?t=fl:n==="cookie"?t=$e:s.N()?(t=s,r=!0):t=$e,this.Zt=r,t}ir(e){return this.Yt+"__"+e}er(e){return this.Zt&&!!e.split_storage}nr(e){var t=e??this.Se.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[Jt];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return V(this.props,((t,s)=>{var r=Ke(s);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===rt?()=>this.nr():()=>!1))return;r.transformToEventProperties&&W(e,r.transformToEventProperties(t))}else if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,(()=>!1)))return;e[s]=t}})),e}load(){if(!this.rr){var e=this.Dt.F(this.Yt);e&&(this.props=W({},e)),this.Qt&&this.sr()}}sr(){for(var e of oi){var t=z.F(this.ir(e));if(t&&!We(t)){var s=this.ar(e);s.persisted=!0,this.lr(e)||(s.fingerprint=this.ur(t,e)),this.hr(e,t)||W(this.props,t)}}}lr(e){return Object.keys(this.props).some((t=>{var s;return((s=Ke(t))==null?void 0:s.storageGroup)===e}))}hr(e,t){var s=Dl[e];if(!s)return!1;var r=t[s],n=this.props[s];return ue(r)&&ue(n)&&n>r}refreshKey(e){var t;if(!this.rr){var s=this.Qt?(t=Ke(e))==null?void 0:t.storageGroup:void 0,r=s?z.F(this.ir(s)):this.Dt.F(this.Yt);if(r&&e in r)this.dr(e,r[e]);else{if(s){var n=this.Dt.F(this.Yt);if(n&&e in n)return void this.dr(e,n[e])}this.cr(e)}}}save(){if(!this.rr){var e=this.tr();e>0?x(this.vr)&&(this.vr=setTimeout((()=>{this.vr=void 0,this.pr()}),e)):this.pr()}}flush(){x(this.vr)||(clearTimeout(this.vr),this.vr=void 0,this.pr())}pr(){this.rr||(this.Qt?this.gr():this.mr(this.Dt,this.Yt,this.props,ht))}gr(){var{main:e,groups:t}=this.yr();for(var s of(this.mr(this.Dt,this.Yt,e,ht),oi)){var r,n=t[s];(!We(n)||(r=this.Gt[s])!=null&&r.persisted)&&this.mr(z,this.ir(s),n,s)}}yr(){var e={},t={};for(var s of oi)t[s]={};return V(this.props,((r,n)=>{var a,o=(a=Ke(n))==null?void 0:a.storageGroup;o?t[o][n]=r:e[n]=r})),{main:e,groups:t}}ur(e,t){if(t===ht)return JSON.stringify(e)+"|"+this.br+"|"+this._r+"|"+this.wr;var s={};return V(e,((r,n)=>{var a;s[n]=(a=Ke(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(s)}mr(e,t,s,r){var n=this.ar(r);if(r===ht||n.dirty||x(n.fingerprint)){var a;try{if((a=this.ur(s,r))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.q(t,s,this.br,this._r,this.wr,this.Se.debug)?(n.dirty=!1,r!==ht&&(n.persisted=!0),x(a)||
1(n.fingerprint=a)):this.Se.debug&&w.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=e===void 0?{}:e;if(x(this.vr)||(clearTimeout(this.vr),this.vr=void 0),this.Dt.P(this.Yt,!1),this.Dt.P(this.Yt,!0),!t&&this.Jt)for(var s of oi)z.P(this.ir(s));t?delete this.Gt[ht]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(J(e)){x(t)&&(t="None"),this.br=x(s)?this.kr:s;var r=!1;if(V(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.dr(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(J(e)){this.br=x(t)?this.kr:t;var s=!1;if(V(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.dr(n,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.cr(e),this.save())}update_campaign_params(){if(!this.Kt){var e=ja(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);We(cr(e))||this.register(e),this.Kt=!0}}update_search_keyword(){var e;this.register((e=E?.referrer)?Ba(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ha(),$referring_domain:E!=null&&E.referrer&&((e=Kt(E.referrer))==null?void 0:e.host)||Ci},void 0)}set_initial_person_info(){this.props[Hs]||this.props[Us]||this.register_once({[Ai]:Ua(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};V([Us,Hs],(r=>{var n=this.props[r];n&&V(n,(function(a,o){e["$initial_"+bs(o)]=a}))}));var t=this.props[Ai];if(t){var s=(function(r,n){n===void 0&&(n=!1);var a=za(r,n),o={};return V(a,(function(l,u){o["$initial_"+bs(u)]=l})),o})(t,this.Se.disable_capture_url_hashes);W(e,s)}return e}safe_merge(e){return V(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.kr=this.br=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==t.persistence||!((l,u)=>{if(l.length!==u.length)return!1;var h=[...l].sort(),c=[...u].sort();return h.every(((d,p)=>d===c[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=r?this.Xt(e):this.Dt,a=this.er(e);if(r||a!==this.Qt){var o=this.props;this.clear(),this.Dt=n,this.Qt=a,this.props=o,this.save()}}set_disabled(e){this.rr=e,this.rr?this.remove():this.save()}set_cross_subdomain(e){e!==this._r&&(this._r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[Nt]||{};s[e]=t,this.dr(Nt,s),this.save()}remove_event_timer(e){var t=this.props[Nt]||{},s=t[e];return x(s)||(delete t[e],this.dr(Nt,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.dr(e,t),this.save()}dr(e,t){var s;this.props[e]=t,(s=Ke(e))!=null&&s.volatile||this.Sr(e)}cr(e){delete this.props[e],this.Sr(e)}Sr(e){var t,s=(t=Ke(e))==null?void 0:t.storageGroup;s&&(this.ar(s).dirty=!0)}ar(e){return this.Gt[e]||(this.Gt[e]={})}}var At={Activation:"events",Cancellation:"cancelEvents"},ss={Popover:"popover",API:"api",Widget:"widget"},jl={Always:"always"},Be={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},rs={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ws={Popover:"popover",Inline:"inline"},ql={SHOWN:"product tour shown"},en={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},tn=K("[RateLimiter]");class Bl{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{tn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void tn.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:a}=this,o=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(Bs))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var u=1>l.tokens;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(Bs,l),{isRateLimited:u,remainingTokens:l.tokens}
1}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var It=K("[RemoteConfig]");class Ga{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Cr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ir(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return It.info("Using preloaded remote config",this.remoteConfig),this.Tr(this.remoteConfig),void this.Mr();if(this._instance.Er())return void It.warn("Remote config is disabled. Falling back to local config.");this.Cr((e=>{if(!e)return It.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ir((t=>{this.Tr(t),this.Mr()}));this.Tr(e),this.Mr()}))}catch(e){It.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}refresh(){!this._instance.Er()&&E&&E.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Mr(){var e;if(!this.Pr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Pr=setInterval((()=>{this.refresh()}),t))}}Tr(e){var t;e||It.error("Failed to fetch remote config from PostHog."),this._instance.Tr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}}var de={GZipJS:"gzip-js",Base64:"base64"},Ee=Uint8Array,me=Uint16Array,kt=Uint32Array,gr=new Ee([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]),fr=new Ee([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]),sn=new Ee([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wa=function(i,e){for(var t=new me(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new kt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},Ya=Wa(gr,2),Ys=Ya[1];Ya[0][28]=258,Ys[258]=28;for(var rn=Wa(fr,0)[1],Ja=new me(32768),Q=0;32768>Q;++Q){var ct=(43690&Q)>>>1|(21845&Q)<<1;Ja[Q]=((65280&(ct=(61680&(ct=(52428&ct)>>>2|(13107&ct)<<2))>>>4|(3855&ct)<<4))>>>8|(255&ct)<<8)>>>1}var Vt=function(i,e,t){for(var s=i.length,r=0,n=new me(e);s>r;++r)++n[i[r]-1];var a,o=new me(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new me(s),r=0;s>r;++r)a[r]=Ja[o[i[r]-1]++]>>>15-i[r];return a},ot=new Ee(288);for(Q=0;144>Q;++Q)ot[Q]=8;for(Q=144;256>Q;++Q)ot[Q]=9;for(Q=256;280>Q;++Q)ot[Q]=7;for(Q=280;288>Q;++Q)ot[Q]=8;var Li=new Ee(32);for(Q=0;32>Q;++Q)Li[Q]=5;var Hl=Vt(ot,9),Ul=Vt(Li,5),Qa=function(i){return(i/8>>0)+(7&i&&1)},Ka=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof me?me:i instanceof kt?kt:Ee)(t-e);return s.set(i.subarray(e,t)),s},Me=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8}
vendor: 4,291 bytes, line 1
1,$t=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},ns=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new Ee(0),0];if(r==1){var a=new Ee(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(A,D){return A.f-D.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,h=1,c=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=t[t[c].f>t[u].f?u++:c++],l=t[u!=h&&t[c].f>t[u].f?u++:c++],t[h++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new me(d+1),g=Js(t[h-1],p,0);if(g>e){s=0;var f=0,m=g-e,y=1<<m;for(n.sort((function(A,D){return p[D.s]-p[A.s]||A.f-D.f}));r>s;++s){var P=n[s].s;if(e>=p[P])break;f+=y-(1<<g-p[P]),p[P]=e}for(f>>>=m;f>0;){var k=n[s].s;e>p[k]?f-=1<<e-p[k]++-1:++s}for(;s>=0&&f;--s){var S=n[s].s;p[S]==e&&(--p[S],++f)}g=e}return[new Ee(p),g]},Js=function(i,e,t){return i.s==-1?Math.max(Js(i.l,e,t+1),Js(i.r,e,t+1)):e[i.s]=t},nn=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new me(++e),s=0,r=i[0],n=1,a=function(l){t[s++]=l},o=1;e>=o;++o)if(i[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=i[o]}return[t.subarray(0,s),e]},Tt=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},Qs=function(i,e,t){var s=t.length,r=Qa(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},an=function(i,e,t,s,r,n,a,o,l,u,h){Me(e,h++,t),++r[256];for(var c=ns(r,15),d=c[0],p=c[1],g=ns(n,15),f=g[0],m=g[1],y=nn(d),P=y[0],k=y[1],S=nn(f),A=S[0],D=S[1],I=new me(19),F=0;P.length>F;++F)I[31&P[F]]++;for(F=0;A.length>F;++F)I[31&A[F]]++;for(var b=ns(I,7),T=b[0],M=b[1],R=19;R>4&&!T[sn[R-1]];--R);var N,q,G,B,j=u+5<<3,Y=Tt(r,ot)+Tt(n,Li)+a,he=Tt(r,d)+Tt(n,f)+a+14+3*R+Tt(I,T)+(2*I[16]+3*I[17]+7*I[18]);if(Y>=j&&he>=j)return Qs(e,h,i.subarray(l,l+u));if(Me(e,h,1+(Y>he)),h+=2,Y>he){N=Vt(d,p),q=d,G=Vt(f,m),B=f;var ke=Vt(T,M);for(Me(e,h,k-257),Me(e,h+5,D-1),Me(e,h+10,R-4),h+=14,F=0;R>F;++F)Me(e,h+3*F,T[sn[F]]);h+=3*R;for(var ge=[P,A],ye=0;2>ye;++ye){var Z=ge[ye];for(F=0;Z.length>F;++F)Me(e,h,ke[oe=31&Z[F]]),h+=T[oe],oe>15&&(Me(e,h,Z[F]>>>5&127),h+=Z[F]>>>12)}}else N=Hl,q=ot,G=Ul,B=Li;for(F=0;o>F;++F)if(s[F]>255){var oe;$t(e,h,N[257+(oe=s[F]>>>18&31)]),h+=q[oe+257],oe>7&&(Me(e,h,s[F]>>>23&31),h+=gr[oe]);var re=31&s[F];$t(e,h,G[re]),h+=B[re],re>3&&($t(e,h,s[F]>>>5&8191),h+=fr[re])}else $t(e,h,N[s[F]]),h+=q[s[F]];return $t(e,h,N[256]),h+q[256]},zl=new kt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vl=(function(){for(var i=new kt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),as=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Gl(i,e){e===void 0&&(e={});var t=(function(){var c=4294967295;return{p(d){for(var p=c,g=0;d.length>g;++g)p=Vl[255&p^d[g]]^p>>>8;c=p},d(){return 4294967295^c}}})(),s=i.length;t.p(i);var r,n,a,o,l,u=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(c,d,p,g,f,m){var y=c.length,P=new Ee(g+y+5*(1+Math.floor(y/7e3))+f),k=P.subarray(g,P.length-f),S=0;if(!d||8>y)for(var A=0;y>=A;A+=65535){var D=A+65535;y>D?S=Qs(k,S,c.subarray(A,D)):(k[A]=!0,S=Qs(k,S,c.subarray(A,y)))}else{for(var I=zl[d-1],F=I>>>13,b=8191&I,T=(1<<p)-1,M=new me(32768),R=new me(T+1),N=Math.ceil(p/3),q=2*N,G=function(Ui){return(c[Ui]^c[Ui+1]<<N^c[Ui+2]<<q)&T},B=new kt(25e3),j=new me(288),Y=new me(32),he=0,ke=0,ge=(A=0,0),ye=0,Z=0;y>A;++A){var oe=G(A),re=32767&A,Ue=R[oe];if(M[re]=Ue,R[oe]=re,A>=ye){var ze=y-A;if((he>7e3||ge>24576)&&ze>423){S=an(c,k,0,B,j,Y,ke,ge,Z,A-Z,S),ge=he=ke=0,Z=A;for(var fe=0;286>fe;++fe)j[fe]=0;for(fe=0;30>fe;++fe)Y[fe]=0}var Ae=2,ei=0,oo=b,Ve=re-Ue&32767;if(ze>2&&oe==G(A-Ve))for(var lo=Math.min(F,ze)-1,uo=Math.min(32767,A),ho=Math.min(258,ze);uo>=Ve&&--oo&&re!=Ue;){if(c[A+Ae]==c[A+Ae-Ve]){for(var Ge=0;ho>Ge&&c[A+Ge]==c[A+Ge-Ve];++Ge);if(Ge>Ae){if(Ae=Ge,ei=Ve,Ge>lo)break;var co=Math.min(Ve,Ge-2),yr=0;for(fe=0;co>fe;++fe){var Hi=A-Ve+fe+32768&32767,br=Hi-M[Hi]+32768&32767;br>yr&&(yr=br,Ue=Hi)}}}Ve+=(re=Ue)-(Ue=M[re])+32768&32767}if(ei){B[ge++]=268435456|Ys[Ae]<<18|rn[ei];var wr=31&Ys[Ae],xr=31&rn[ei];ke+=gr[wr]+fr[xr],++j[257+wr],++Y[xr],ye=A+Ae,++he}
1else B[ge++]=c[A],++j[c[A]]}}S=an(c,k,!0,B,j,Y,ke,ge,Z,A-Z,S)}return Ka(P,0,g+Qa(S)+f)})(n=i,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),h=u.length;return(function(c,d){var p=d.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>d.level?4:d.level==9?2:0,c[9]=3,d.mtime!=0&&as(c,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){c[3]=8;for(var g=0;p.length>=g;++g)c[g+10]=p.charCodeAt(g)}})(u,e),as(u,h-8,t.d()),as(u,h-4,s),u}var Wl=!!_s||!!fs,Za="text/plain",gi=!1,Ks=(i,e)=>{var[t,s]=i.split("#"),[r,n]=t.split("?");if(!n)return i;var a=n.split("&").filter((o=>o.split("=")[0]!==e)).join("&");return r+(a?"?"+a:"")+(s?"#"+s:"")},_r=function(i,e,t){var s;t===void 0&&(t=!0);var[r,n]=i.split("?"),a=_({},e),o=(s=n?.split("&").map((u=>{var h,[c,d]=u.split("="),p=t&&(h=a[c])!==null&&h!==void 0?h:d;return delete a[c],c+"="+p})))!==null&&s!==void 0?s:[],l=(function(u,h){var c,d;h===void 0&&(h="&");var p=[];return V(u,(function(g,f){x(g)||x(f)||f==="undefined"||(c=encodeURIComponent((m=>m instanceof File)(g)?g.name:g.toString()),d=encodeURIComponent(f),p[p.length]=d+"="+c)})),p.join(h)})(a);return l&&o.push(l),r+"?"+o.join("&")},_t=(i,e)=>{try{return JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e)}catch{return On(i)}},os=i=>{if(i.Lt)return i.Lt;var{data:e,compression:t}=i;if(e){if(t===de.GZipJS){var s=Gl((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var h=new Ee(o.length+(o.length>>>1)),c=0,d=function(m){h[c++]=m},p=0;u>p;++p){if(c+5>h.length){var g=new Ee(c+8+(u-p<<1));g.set(h),h=g}var f=o.charCodeAt(p);128>f?d(f):2048>f?(d(192|f>>>6),d(128|63&f)):f>55295&&57344>f?(d(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++p))>>>18),d(128|f>>>12&63),d(128|f>>>6&63),d(128|63&f)):(d(224|f>>>12),d(128|f>>>6&63),d(128|63&f))}return Ka(h,0,c)})(_t(e)),{mtime:0});return{contentType:Za,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===de.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(_t(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:_t(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=_t(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Xa=i=>{var e,t,s=()=>i.transport==="sendBeacon"?{url:_r(i.url,{compression:de.Base64}),encodedBody:os(_({},i,{compression:de.Base64,Lt:void 0}))}:{url:Ks(i.url,"compression"),encodedBody:os(_({},i,{compression:void 0,Lt:void 0}))};try{e=os(i)}catch(r){if($r(i.compression,St(i.url,"compression")))return w.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&$r(i.compression,St(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?ms(new Uint8Array(t)):ArrayBuffer.isView(t)&&ms(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(gi=!0,s()):{url:i.url,encodedBody:e}},on=i=>{try{return Xa(i)}catch(e){return w.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},Yl=(function(){var i=ie((function*(e){var t=_t(e.data),s=yield(function(n,a,o){return ys.apply(this,arguments)})(t,ee.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return _({},e,{Lt:{contentType:Za,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),Jl=/Failed to fetch|NetworkError|Load failed/i,Ql=["/e/","/s/"],ln=(i,e)=>{var t=(r=>{var n=(a=>{var o=Kt(a),l=o?.pathname||a.split(/[?#]/)[0];return l?l[0]==="/"?l:"/"+l:"/"})(r);return Ql.some((a=>((o,l)=>o.slice(o.length-l.length)===l)(n,a)))})(i),s=t?Ks(i,"ver"):i;return _r(e===de.GZipJS?Ks(s,"compression"):s,_({_:new Date().getTime().toString()},t?{}:{ver:ee.JS_SDK_VERSION},e===de.GZipJS?{}:{compression:e}))},fi=[];fs&&fi.push({transport:"fetch",method(i){var e,t=on(i);if(t){var{url:s,encodedBody:r}=t,{contentType:n,body:a,estimatedSize:o}=r??{},l=new Headers;V(i.headers,(function(d,p){l.append(p,d)})),n&&l.append("Content-Type",n);var u=null,h=!1;if(Sr){var c=new Sr;u={signal:c.signal,timeout:setTimeout((()=>{var d,p;h=!0,c.abort((d=i.timeout,(p=new Error("PostHog request timed out"+(d?" after "+d+"ms":""))).name="AbortError",p))}),i.timeout)}}fs(s,_({method:i?.method||"GET",headers:l,keepalive:i.method==="POST"&&52428.8>(o||0),body:a,signal:(e=u)==null?void 0:e.signal},i.fetchOptions)).then((d=>d.text().then((p=>{var g={statusCode:d.status,text:p};if(d.status===200)try{g.json=JSON.parse(p)}catch(f){w.error(f)}i.callback==null||i.callback(g)})))).catch((d=>{h&&d?.name==="AbortError"||(p=>
1p?.name==="TypeError"&&Jl.test(p?.message||""))(d)?w.warn(d):w.error(d),i.callback==null||i.callback({statusCode:0,error:d})})).finally((()=>u?clearTimeout(u.timeout):null))}}}),_s&&fi.push({transport:"XHR",method(i){var e=on(i);if(e){var t=new _s,{url:s,encodedBody:r}=e;t.open(i.method||"GET",s,!0);var{contentType:n,body:a}=r??{};V(i.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(o)}},t.send(a)}}}),pe!=null&&pe.sendBeacon&&fi.push({transport:"sendBeacon",method(i){try{var{url:e,encodedBody:t}=Xa(i),{contentType:s,body:r}=t??{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});pe.sendBeacon(e,n)}catch{}}});var Zs=3e3;class Kl{constructor(e,t){this.Rr=!0,this.Or=[],this.Lr=Te(t?.flush_interval_ms||Zs,250,5e3,w.createLogger("flush interval"),Zs),this.Fr=e}enqueue(e){this.Or.push(e),this.Ar||this.Dr()}unload(){this.$r();var e=this.Or.length>0?this.Nr():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.qr(_({},s,{transport:"sendBeacon"}))}))}enable(){this.Rr=!1,this.Dr()}Dr(){var e=this;this.Rr||(this.Ar=setTimeout((()=>{if(this.$r(),this.Or.length>0){var t=this.Nr(),s=function(){var n=t[r],a=new Date().getTime();n.data&&L(n.data)&&V(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.qr(n)};for(var r in t)s()}}),this.Lr))}qr(e){try{this.Fr(e)}catch(t){w.error(t)}}$r(){clearTimeout(this.Ar),this.Ar=void 0}Nr(){var e={};return V(this.Or,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;x(e[n])&&(e[n]=_({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.Or=[],e}}var Zl=["retriesPerformedSoFar"];class Xl{constructor(e){this.Br=!1,this.jr=3e3,this.Or=[],this._instance=e,this.Or=[],this.Hr=!0,!x(v)&&"onLine"in v.navigator&&(this.Hr=v.navigator.onLine,this.Ur=()=>{this.Hr=!0,this.zr()},this.Vr=()=>{this.Hr=!1},te(v,"online",this.Ur),te(v,"offline",this.Vr))}get length(){return this.Or.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=Rn(e,Zl);Le(t)&&(s.url=_r(s.url,{retry_count:t})),this._instance._send_request(_({},s,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t??0))return void this.st(_({retriesPerformedSoFar:t},s));r.statusCode===0&&w.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(t??0)+" retries.")}s.callback==null||s.callback(r)}}))}st(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),h=Math.random()-.5;return Math.ceil(u+h*(u-l))})(t),r=Date.now()+s;this.Or.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),w.warn(n),this.Br||(this.Br=!0,this.Wr())}Wr(){if(this.Gr&&clearTimeout(this.Gr),this.Or.length===0)return this.Br=!1,void(this.Gr=void 0);this.Gr=setTimeout((()=>{this.Hr&&this.Or.length>0&&this.zr(),this.Wr()}),this.jr)}zr(){var e=Date.now(),t=[],s=this.Or.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Or=t,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,x(v)||(this.Ur&&(v.removeEventListener("online",this.Ur),this.Ur=void 0),this.Vr&&(v.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Or))try{this._instance._send_request(_({},e,{transport:"sendBeacon"}))}catch(t){w.error(t)}this.Or=[]}}class eu{constructor(e){this.Zr=()=>{var t,s,r,n;this.Qr||(this.Qr={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),h=a?.scrollHeight||0;this.Qr.lastScrollY=Math.ceil(o),this.Qr.maxScrollY=Math.max(o,(t=this.Qr.maxScrollY)!==null&&t!==void 0?t:0),this.Qr.maxScrollHeight=Math.max(l,(s=this.Qr.maxScrollHeight)!==null&&s!==void 0?s:0),this.Qr.lastContentY=u,this.Qr.maxContentY=Math.max(u,(r=this.Qr.maxContentY)!==null&&r!==void 0?r:0),this.Qr.maxContentHeight=Math.max(h,(n=this.Qr.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Jr(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Zr,0),e}startMeasuringScrollPosition(){te(v,"scroll",this.Zr,{capture:!0}),te(v,"scrollend",this.Zr,{capture:!0}),te(v,"resize",this.Zr)}scrollElement(){if(!this.Jr)return v?.document.documentElement;var e=L(this.Jr)?this.Jr:[this.Jr];for(var t of e){var s=v?.document.querySelector(t);if(s)return s}}Kr(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.Jr){var s=this.scrollElement();return s&&s[t]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.Kr("y")}scrollX(){return this.Kr("x")}}var tu=i=>Ua(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties,i?.config.disable_capture_url_hashes
1);class un{constructor(e,t,s,r){this.Yr=n=>{var a=this.Xr();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.ei(this._instance)};this.ti.register({[qs]:o})}},this._instance=e,this.ri=t,this.ti=s,this.ei=r||tu,this.ri.onSessionId(this.Yr)}Xr(){return this.ti.props[qs]}getSetOnceProps(){var e,t=(e=this.Xr())==null?void 0:e.props;return t?"r"in t?za(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return V(cr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+bs(s)]=t})),e}}class mr{constructor(){this.ii={}}on(e,t){return this.ii[e]||(this.ii[e]=[]),this.ii[e].push(t),()=>{this.ii[e]=this.ii[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.ii[e]||[])s(t);for(var r of this.ii["*"]||[])r(e,t)}}var Rt=K("[SessionId]");class hn{on(e,t){return this.ni.on(e,t)}constructor(e,t,s){var r;if(this.si=null,this.oi=[],this.ai=void 0,this.li=!1,this.ni=new mr,this.ui=(u,h)=>!(!Le(u)||!Le(h))&&Math.abs(u-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===qe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ti=e.persistence,this.hi=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ci=t||je,this.vi=s||je;var n=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*Te(this.Se.session_idle_timeout_seconds||1800,60,36e3,Rt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+n+"_window_id",this.gi="ph_"+n+"_primary_window_exists",this.mi()){var a=le.F(this.pi),o=le.F(this.gi);a&&!o?this.hi=a:le.P(this.pi),le.q(this.gi,!0)}if((r=this.Se.bootstrap)!=null&&r.sessionID)try{var l=(u=>{var h=this.Se.bootstrap.sessionID.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})();this.yi(this.Se.bootstrap.sessionID,new Date().getTime(),l)}catch(u){Rt.error("Invalid sessionID in bootstrap",u)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.oi)&&(this.oi=[]),this.oi.push(e),this.di&&e(this.di,this.hi),()=>{this.oi=this.oi.filter((t=>t!==e))}}mi(){return this.Se.persistence!=="memory"&&!this.ti.rr&&le.N()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&le.q(this.pi,e))}xi(){return this.hi?this.hi:this.mi()?le.F(this.pi):null}ki(e){var t=this.si;return!ve(t)&&!ve(e)&&5e3>Math.abs(e-t)}yi(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.di||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.di=e,n&&!r||n&&this.ki(t)||(this.si=t,this.ti.register({[ft]:[t,e,s]}))}Si(){var e,t=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Le(t)&&t>0}Ci(){this.Si()?this.ti.refreshKey(ft):(this.ti.flush(),this.ti.load())}Ii(){var e;if(!ve(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.si){this.Ci();var[,t,s]=this.Ti();t===this.di&&s===this._sessionStartTimestamp&&(this.si=this._sessionActivityTimestamp,this.ti.register({[ft]:[this._sessionActivityTimestamp,(e=this.di)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ti.flush())}}Mi(){var[e]=this.Ti(),t=Le(e)?e:0,s=Le(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Ei(e){return this.Ci(),this.ui(e,this.Mi())}Ti(){var e=this.ti.props[ft];return L(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.si=null,clearTimeout(this.Pi),this.Pi=void 0,this.yi(null,null,null)}destroy(){this.li=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.ai&&v&&(v.removeEventListener(Ti,this.ai,{capture:!1}),this.ai=void 0),this.oi=[]}bi(){this.ai=()=>{this.Ii(),this.mi()&&le.P(this.gi)},te(v,Ti,this.ai,{capture:!1})}
1checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Se.cookieless_mode===qe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),[,r,n]=this.Ti(),a=this.Mi(),o=this.xi(),l=Le(n)&&Math.abs(s-n)>864e5,u=!1,h=!1,c=!r,d=r,p=!c&&!e&&this.ui(s,a);p&&((p=this.Ei(s))||Rt.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,n]=this.Ti()),c||p||l?(r=this.ci(),o=this.vi(),Rt.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l}}),n=s,u=!0):(o||(o=this.vi(),u=!0),(h=r!==d)&&(Rt.info("adopted cross-tab session id",{sessionId:r,windowId:o}),u=!0));var g=Le(a)&&e&&!l?a:s,f=Le(n)?n:new Date().getTime();this.wi(o),this.yi(r,g,f),e||this.fi();var m={noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.oi.forEach((y=>y(r,o,m))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:u?m:void 0,lastActivityTimestamp:a}}fi(){this.li||(clearTimeout(this.Pi),this.Pi=setTimeout((()=>{if(!this.li)if(this.Ei(new Date().getTime())){var e=this.di;this.resetSessionId(),this.ni.emit("forcedIdleReset",{idleSessionId:e})}else this.fi()}),1.1*this.sessionTimeoutMs))}}var eo=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Rr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>Rr(r?.brand,e))))return!0}catch{}return!!i.webdriver};function to(){return(to=ie((function*(){var i=pe?.userAgentData;if(i!=null&&i.getHighEntropyValues)try{var e=yield i.getHighEntropyValues(["model"]),t=e?.model;return U(t)&&t.length>0?t:void 0}catch(s){return void w.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var Di=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function cn(i,e,t){return _t({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var io={exact:(i,e)=>e.some((t=>i.some((s=>t===s)))),is_not:(i,e)=>e.every((t=>i.every((s=>t!==s)))),regex:(i,e)=>e.some((t=>i.some((s=>Di(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!Di(t,s))))),icontains:(i,e)=>e.map(ui).some((t=>i.map(ui).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(ui).every((t=>i.map(ui).every((s=>!t.includes(s))))),gt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s>parseFloat(r)))})),lt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s<parseFloat(r)))}))},ui=i=>i.toLowerCase();function so(i,e){return!i||Object.entries(i).every((t=>{var[s,r]=t,n=e?.[s];if(x(n)||ve(n))return!1;var a=[String(n)],o=io[r.operator];return!!o&&o(r.values,a)}))}var Xs="custom",dn="i.posthog.com",iu=/^\/static\//;class su{constructor(e){this.Ri={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+dn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ri[this.apiHost]||(this.Ri[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":Xs),this.Ri[this.apiHost]}Oi(e){if(iu.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Oi(t);if(s)return""+s+t}if(this.region===Xs)return this.apiHost+t;var r=dn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var H=K("[Surveys]"),er="seenSurvey_",ro=i=>{try{var e=(t=>((s,r)=>{var n=""+er+r.id;return r.current_iteration&&r.current_iteration>0&&(n=""+er+r.id+"_"+r.current_iteration),n})(0,t))(i);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){H.error("Failed to persist survey seen state",t)}},ru=[ss.Popover,ss.Widget,ss.API],nu={ignoreConditions:!1,ignoreDelay:!1,displayType:Ws.Popover}
1,au=K("[PostHog ExternalIntegrations]"),ou={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class lu{constructor(e){this._instance=e}Bt(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return au.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,u;!r||(o=$.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.Bt(ou[a],(()=>{var h;(h=$.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[a])==null||h.start(e._instance)})),!r&&(l=$.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((u=$.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[s,r]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(s)}}}var Gt={},ls=0,Ni=()=>{},pn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Mt="Surveys module not available",vn="sanitize_properties is deprecated. Use before_send instead",no="Invalid value for property_denylist config: ",gt="posthog",ao=!Wl&&_e?.indexOf("MSIE")===-1&&_e?.indexOf("Mozilla")===-1,gn=i=>{var e;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:hl(E?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ni,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:se&&U(se?.search)&&se.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){w.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:zs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Zs},error_tracking:{},_onCapture:Ni},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:xl,ignore_text_selection:!0}
1:!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)}))(i))},uu=[["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"]],fn=i=>{var e={};for(var[t,s]of uu)x(i[t])||(e[s]=i[t]);var r=W({},e,i),n=i.__preview_external_dependency_versioned_paths;return x(n)||(x(i.strict_script_versioning)&&(r.strict_script_versioning=!!n),U(n)&&x(i.asset_host)&&(r.asset_host=n)),L(i.property_blacklist)&&(x(i.property_denylist)?r.property_denylist=i.property_blacklist:L(i.property_denylist)?r.property_denylist=[...i.property_blacklist,...i.property_denylist]:w.error(no+i.property_denylist)),r};class hu{constructor(){this.__forceAllowLocalhost=!1}get Li(){return this.__forceAllowLocalhost}set Li(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Se{Fi(e,t){if(e){var s=this.Ai.indexOf(e);s!==-1&&this.Ai.splice(s,1)}return this.Ai.push(t),t.initialize==null||t.initialize(),t}Di(){return this.config.cookieless_mode===qe||this.config.cookieless_mode===st&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new hu,this.$i=!1,this.version=ee.LIB_VERSION,this.Ni=new mr,this.Ai=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=gn(),this.SentryIntegration=Tl,this.sentryIntegration=s=>(function(r,n){var a=La(r,n);return{name:Ca,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.qi=!1,this.Bi=null,this.ji=null,this.Hi=null,this.scrollManager=new eu(this),this.pageViewManager=new Zr(this),this.rateLimiter=new Bl(this),this.requestRouter=new su(this),this.consent=new _l(this),this.externalIntegrations=new lu(this);var t=(e=Se.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(s,r,n)=>{var a=U(s)?{[s]:r}:s;this.setPersonProperties(a),n?.({})},set_once:(s,r,n)=>{var a=U(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(s=>w.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==gt){var r,n=(r=Gt[s])!==null&&r!==void 0?r:new Se;return n._init(e,t,s),Gt[s]=n,Gt[gt][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a=U(e)?e.trim():"";if(!a)return w.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Ui(t.debug),this.zi=t,this.Vi=[],t.person_profiles?this.ji=t.person_profiles:t.process_person&&(this.ji=t.process_person);var o=gn(t.defaults),l=fn(t),u=W({},o,l,{name:s,token:a});J(o.rageclick)&&J(l.rageclick)&&(u.rageclick=W({},o.rageclick,l.rageclick)),J(o.session_recording)&&J(l.session_recording)&&(u.session_recording=W({},o.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:de.GZipJS;var h=this.Wi();this.persistence=new is(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new is(_({},this.config,{persistence:"sessionStorage"}),h,!1);var c=_({},this.persistence.props),d=_({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gi=new Kl((S=>this.Zi(S)),this.config.request_queue_config),this.Qi=new Xl(this),this.__request_queue=[];var p=this.Di();if(p||(this.sessionManager=new hn(this),this.sessionPropsManager=new un(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ji(p)}),0)):(w.info("Initializing extensions synchronously"),this.Ji(p)),ee.DEBUG=ee.DEBUG||this.config.debug,ee.DEBUG&&w.info("Starting in debug mode",{this:this,config:t,thisC:_({},this.config),p:c,s:d}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=_({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var g=t.bootstrap.distinctID,f=this.get_distinct_id(),m=this.persistence.get_property(Pe);if(t.bootstrap.isIdentifiedID&&f!=null&&f!==g&&m===lt)this.identify(g);else if(t.bootstrap.isIdentifiedID&&f!=null&&f!==g&&m===ut)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(je()),P=t.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(Pe,t.bootstrap.isIdentifiedID?ut:lt),this.register({distinct_id:g,$device_id:P})}}if(p)this.register_once({distinct_id:si,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(je());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(Pe,lt)}return te(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(S,A){var D=S.config.segment;if(!D)return A();(function(I,F){var b=I.config.segment;if(!b)return F();var T=R=>{var N=()=>R.anonymousId()||je();I.config.get_device_id=N,R.id()&&(I.register({distinct_id:R.id(),$device_id:N()}),I.persistence.set_property(Pe,ut)),F()},M=b.user();"then"in M&&Fe(M.then)?M.then(T):T(M)}
1)(S,(()=>{D.register((I=>{typeof Promise<"u"&&Promise.resolve||ts.warn("This browser does not have Promise support, and can not use the segment integration");var F=(b,T)=>{if(!T)return b;b.event.userId||b.event.anonymousId===I.get_distinct_id()||(ts.info("No userId set, resetting PostHog"),I.reset()),b.event.userId&&b.event.userId!==I.get_distinct_id()&&(ts.info("UserId set, identifying with PostHog"),I.identify(b.event.userId));var M=I.calculateEventProperties(T,b.event.properties);return b.event.properties=Object.assign({},M,b.event.properties),b};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:b=>F(b,b.event.event),page:b=>F(b,vt),identify:b=>F(b,Zi),screen:b=>F(b,"$screen")}})(S)).then((()=>{A()}))}))})(this,(()=>this.Ki())):this.Ki(),Fe(this.config._onCapture)&&this.config._onCapture!==Ni&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(S=>this.config._onCapture(S.event,S)))),this.config.ip&&w.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return to.apply(this,arguments)})().then((S=>{S&&this.register({[Qi]:S})})).catch(Ni),this}Ji(e){var t,s,r,n,a,o,l,u,h=performance.now(),c=_({},Se.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this.Ai.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new c.featureFlags(this)),c.exceptions&&this.Ai.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new c.exceptions(this)),c.historyAutocapture&&this.Ai.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ai.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this.Ai.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ai.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this.Ai.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ai.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new c.surveys(this)),c.logs&&this.Ai.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new c.logs(this)),c.metrics&&this.Ai.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new c.metrics(this)),c.conversations&&this.Ai.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ai.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ai.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ai.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ai.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ai.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,$l)),c.toolbar&&this.Ai.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new c.toolbar(this)),c.experiments&&this.Ai.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new c.experiments(this)),this.Ai.forEach((p=>{p.initialize&&d.push((()=>{p.initialize==null||p.initialize()}))})),d.push((()=>{if(this.Yi){var p=this.Yi;this.Yi=void 0,this.Tr(p)}})),this.Xi(d,h)}Xi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Xi(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){w.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[ma]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ya]:r}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+r+"ms)")}Tr(e){var t;if(!E||!E.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Tr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.en=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=O(e.supportedCompression,de.GZipJS)?de.GZipJS:O(e.supportedCompression,de.Base64)?de.Base64:void 0),(t=e.anal
1ytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ji?this.ji:zs}),this.Ai.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(e)))}Ki(){try{this.config.loaded(this)}catch(s){w.critical("`loaded` function failed",s)}if(this.tn(),this.config.internal_or_test_user_hostname&&se!=null&&se.hostname){var e=se.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Di())&&this.rn()}),1),this.nn=new Ga(this),this.nn.load()}tn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Gi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&ri(this.__request_queue,(e=>this.Zi(e))),this.__request_queue=[],this.tn()}_handle_unload(){var e,t,s,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.sn()&&this.capture(Ki),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.Gi)==null||r.unload(),(n=this.Qi)==null||n.unload()):this.sn()&&this.capture(Ki,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?ao?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=_({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(x(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var s,r,n,a=_({},t);a.timeout=a.timeout||6e4;var o=(s=a.transport)!==null&&s!==void 0?s:"fetch";o==="sendBeacon"&&x(a.compression)&&a.data&&(a.compression=de.Base64),a.url=ln(a.url,a.compression);var l=fi.filter((h=>!a.disableTransport||!h.transport||!a.disableTransport.includes(h.transport))),u=(r=(n=(function(h,c){for(var d=0;h.length>d;d++)if(h[d].transport===o)return h[d]})(l))==null?void 0:n.method)!==null&&r!==void 0?r:l[0].method;if(!u)throw new Error("No available transport method");o!=="sendBeacon"&&a.data&&a.compression===de.GZipJS&&po&&typeof Promise<"u"&&!gi?Yl(a).then((h=>{u(h)})).catch((h=>{if(Tr(h))return gi=!0,void u(_({},a,{compression:void 0,url:ln(t.url,void 0)}));(c=>{if(!c||typeof c!="object")return!1;var d="name"in c?String(c.name):"";return Tr(c)||d===Mn})(h)&&(gi=!0),u(a)})):u(a)})(_({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Zi(e){this.Qi?this.Qi.retriableRequest(e):this._send_request(e)}_execute_array(e){ls++;try{var t,s=[],r=[],n=[];ri(e,(o=>{if(o)if(L(t=o[0]))n.push(o);else if(Fe(o))try{o.call(this)}catch(l){w.error("Error executing queued PostHog call",o,l)}else L(o)&&t==="alias"?s.push(o):L(o)&&t.indexOf("capture")!==-1&&Fe(this[t])?n.push(o):r.push(o)}));var a=function(o,l){ri(o,(function(u){try{if(L(u[0])){var h=l;V(u,(function(c){h=h[c[0]].apply(h,c.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(c){w.error("Error executing queued PostHog call",u,c)}}))};a(s,this),a(r,this),a(n,this)}finally{ls--}}push(e){if(ls>0&&L(e)&&U(e[0])){var t=Se.prototype[e[0]];Fe(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!x(e)&&U(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h==null||!h.isRateLimited){t!=null&&t.$current_url&&!U(t?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.an||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,d=s?.timestamp||c,p=Lr(s?.uuid,je),g={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},d,p)};e===vt&&this.config.__preview_capture_bot_pageviews&&u&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),h&&(g.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),s?.$set&&(g.$set=s?.$set);var f=s?.$unset;f&&(g.$unset=f);var m,y,P,k=this.ln(s?.$set_once,e!==Br,e===Zi);if(k&&(g.$set_once=k),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,a=g,o=T=>U(T)?T.slice(0,n):T,l=new Set,g=(function T(M,R){return M!==Object(M)?o?o(M):M:l.has(M)?void 0:(l.add(M),L(M)?(N=[],ri(M,(q=>{N.push(T(q))}))):(N={},V(M,((q,G)=>{l.has(q)||(N[G]=T(q))}))),N);var N})(a)),g.timestamp=d,x(s?.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=c),e===Be.DISMISSED||e===Be.SENT){var S=t?.[rs.SURVEY_ID],A=t?.[rs.SURVEY_ITERATION];ro({id:S,current_iteration:A}),g.$set=_({},g.$set,{[(m={id:S,current_iteration:A},y=e===Be.SENT?"responded":"dismissed",P="$survey_"+y+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(P="$survey_"+y+"/"+m.id+"/"+m.current_iteration),P)]:!0})}else e===Be.SHOWN&&(g.$set=_({},g.$set,{[rs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===ql.SHOWN){var D=t?.[en.TOUR_TYPE];D&&(g.$set=_({},g.$set,{[en.TOUR_LAST_SEEN_DATE+"/"+D]:new Date().toISOString()}))}var I=_({},g.properties.$set,g.$set);if(We(I)||this.setPersonPropertiesForFlags(I),!C(this.config.before_send)){var F=this.it(g);if(!F)return;(g=F).uuid=Lr(g.uuid,je)}this.Ni.emit("eventCaptured",g);var b={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:g,compression:"best-available",batchKey:s?._batchKey,transport:s?.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Zi(b):this.Gi.enqueue(b),g}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=_({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Di()&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=_({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!U(o.distinct_id)&&!ue(o.distinct_id)||ws(o.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,h=(function(y,P,k,S){var A,D,I,F;if(S===void 0&&(S=!1),!_e)return{};var b,T,M,R,N,q,G,B,j,Y=y?[...Et,...P||[]]:[],[he,ke]=(function(oe){for(var re=0;Or.length>re;re++){var[Ue,ze]=Or[re],fe=Ue.exec(oe),Ae=fe&&(Fe(ze)?ze(fe,oe):ze);if(Ae)return Ae}return["",""]})(_e),ge=(b=typeof navigator<"u"?navigator:void 0)!=null&&b.brave?{brave:!0}:{},ye={detectGoogleSearchApp:k},Z=W(cr({$os:he,$os_version:ke,$browser:sa(_e,navigator.vendor,ge,ye),$device:Cr(_e),$device_type:(M=_e,R={userAgentDataPlatform:(A=navigator)==null||(A=A.userAgentData)==null?void 0:A.platform,maxTouchPoints:(D=navigator)==null?void 0:D.maxTouchPoints,screenWidth:v==null||(I=v.screen)==null?void 0:I.width,screenHeight:v==null||(F=v.screen)==null?void 0:F.height,devicePixelRatio:v?.devicePixelRatio},j=Cr(M),j===jn||j===Nn||j==="Kobo"||j==="Kindle Fire"||j===Zn?bt:j===Wt||j===yt||j===Yt||j===Ss?"Console":j===Bn?"Wearable":j?we:R?.userAgentDataPlatform==="Android"&&((N=R?.maxTouchPoints)!==null&&N!==void 0?N:0)>0?600>Math.min((q=R?.screenWidth)!==null&&q!==void 0?q:0,(G=R?.screenHeight)!==null&&G!==void 0?G:0)/((B=R?.devicePixelRatio)!==null&&B!==void 0?B:1)?we:bt:"Desktop"),$timezone:Va(),$timezone_offset:Ll()}),{$current_url:Zt(S?Ye(se?.href):se?.href,Y,Xt),$host:se?.host,$pathname:se?.pathname,$raw_user_agent:_e.length>1e3?_e.substring(0,997)+"...":_e,$browser_version:Ro(_e,navigator.vendor,ge,ye),$browser_language:Xr(),$browser_language_prefix:(T=Xr(),typeof T=="string"?T.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHe
1ight,$viewport_width:v?.innerWidth,$lib:ee.LIB_NAME,$lib_version:ee.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ee.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=ee.SDK_DIST_CHANNEL),Z})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:c,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime());o.$session_id=c,o.$window_id=d}this.sessionPropsManager&&W(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&W(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.Qi)==null?void 0:p.length}catch(y){o.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===Xs&&(o.$lib_custom_api_host=this.config.api_host),u=e!==vt||n?e!==Ki||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=W(o,u),e===vt&&E&&(o.title=E.title),!x(a)){var g=s.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}_e&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=W({},h,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),L(this.config.property_denylist)?V(this.config.property_denylist,(function(y){delete o[y]})):w.error(no+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(w.error(vn),o=f(o,e));var m=this.un();return o.$process_person_profile=m,m&&!n&&this.hn("_calculate_event_properties"),o}ln(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.un()||this.$i&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=W({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(w.error(vn),o=l(o,"$set_once")),t&&(this.$i=!0),We(o)?void 0:o}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}dn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,t){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.Ni.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Mt}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Mt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Mt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;
1t===void 0&&(t=nu),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Mt}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Mt})}cn(e){return!e||ws(e)?(w.critical("Unique user id has not been set in posthog.identify"),!1):e===si?(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(ue(e)&&(e=e.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.cn(e)&&this.hn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Pi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Dt)&&(this.unregister(Dt),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(Pe)||lt)===lt;e!==r&&a?(this.persistence.set_property(Pe,ut),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(Zi,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.Hi=cn(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(t||s)&&this.setPersonProperties(t,s),e!==r&&(this.reloadFeatureFlags(),this.unregister(Ut))}}setPersonProperties(e,t){if((e||t)&&this.hn("posthog.setPersonProperties")){var s=cn(this.get_distinct_id(),e,t);this.Hi!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Hi=s):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,s=(L(e)?e:[e]).filter((r=>U(r)&&r.length>0));s.length!==0&&this.hn("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Hi=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},r,{[e]:t})}),n||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(Br,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.hn("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,a,o,l,u,h,c;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var d,p=this.get_property(Pi),g=this.get_property(Qi),f=this.get_property(nt);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),x(f)||(d=this.persistence)==null||d.register({[nt]:f}),(r=this.surveys)==null||r.reset(),(n=this.nn)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.logs)==null||l.reset(),(u=this.metrics)==null||u.reset(),(h=this.persistence)==null||h.set_property(Pe,lt),(c=this.sessionManager)==null||c.resetSessionId(),this.Hi=null,this.config.cookieless_mode===qe)this.register_once({distinct_id:si,$device_id:null},"");else{var m=this.config.get_device_id(je());this.register_once({distinct_id:m,$device_id:e?m:p},""),e||x(g)||this.register({[Qi]:g})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return ie((function*(){var s,r,n,a,o;t.__loaded?((s=t.logs)==null||s.flushLogs("sendBeacon"),(r=t.metrics)==null||r.flush("sendBeacon"),(n=t.Gi)==null||n.unload(),(a=t.Qi)==null||a.unload(),(o=t.featureFlags)==null||o.destroy()):w.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.vn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.fn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&s){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;
1r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(ca)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.hn("posthog.alias")?(x(t)&&(t=this.get_distinct_id()),e!==t?(this.dn(Dt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(J(e)){var s,r,n,a,o,l,u,h,c,d,p;W(this.config,fn(e));var g=this.Wi();(s=this.persistence)==null||s.update_config(this.config,t,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new is(_({},this.config,{persistence:"sessionStorage"}),g,!1);var f=this.Ui(this.config.debug);Re(f)&&(this.config.debug=f),Re(this.config.debug)&&(this.config.debug?(ee.DEBUG=!0,z.N()&&z.q("ph_debug",!0),w.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(ee.DEBUG=!1,z.N()&&z.P("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.pn(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){ee.LIB_NAME=e,ee.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(_({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:Se.gn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:gt;return t!==gt&&(t=gt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Pe))===ut||((t=this.sessionPersistence)==null?void 0:t.get_property(Pe))===ut}un(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===zs&&!this._isIdentified()&&We(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Dt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ii]))}sn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.un()||this.hn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.hn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}hn(e){return this.config.person_profiles==="never"?(w.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dn(Ii,!0),!0)}Wi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==st)}pn(){var e,t,s,r,n=this.Wi();return((e=this.persistence)==null?void 0:e.rr)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.rr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==qe){if(this.Di()){var s,r,n,a,o;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewM
1anager)==null||r.destroy(),this.sessionManager=new hn(this),this.pageViewManager=new Zr(this),this.persistence&&(this.sessionPropsManager=new un(this,this.sessionManager,this.persistence));var l,u=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=Se.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Fi(this.sessionRecording,new u(this)),this.en&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.en)))}var h,c;this.consent.optInOut(!0),this.pn(),this.tn(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==st&&((h=this.surveys)==null||h.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.rn()}else w.warn(pn)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==qe?(this.config.cookieless_mode===st&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.pn(),this.config.cookieless_mode===st&&(this.register({distinct_id:si,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.rn(),this.tn())):w.warn(pn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===qe||(this.config.cookieless_mode===st?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.pn()}_is_bot(){return pe?eo(pe,this.config.custom_blocked_useragents):void 0}rn(){E&&(E.visibilityState==="visible"?this.qi||(this.qi=!0,this.capture(vt,{title:E.title},{send_instantly:!0}),this.Bi&&(E.removeEventListener($i,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.rn.bind(this),te(E,$i,this.Bi)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Er(){var e,t,s,r,n,a,o=this.zi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(s="advanced_disable_decide",r=w,n=(t="advanced_disable_flags")in(e=o)&&!C(e[t]),a=s in e&&!C(e[s]),n?e[t]:!!a&&(r&&r.warn("Config field '"+s+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[s]))}it(e){var t;if(C(this.config.before_send))return e;var s=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(bo),r=L(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r){if(n=a(n),C(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return yo(e.event)?w.warn(o+". This can cause unexpected behavior."):w.info(o),null}n.properties&&!We(n.properties)||w.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of s)if(n.properties&&C(n.properties[l]))return w.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return(e=this.pageViewManager.Ut)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}Ui(e){var t=Re(e)&&!e,s=z.N()&&z.A("ph_debug")==="true";return!t&&(!!s||e)}}Se.__defaultExtensionClasses={},Se.gn=(()=>{var i=()=>{};return{trace:i,debug:i,info:i,warn:i,error:i,fatal:i}})(),(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=ll(i.prototype[e[t]])})(Se,["identify"]);class _n{constructor(e){this.disabled=e===!1;var t=J(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}}var us="$copy_autocapture",hs=K("[AutoCapture]");function cs(i,e){return e.length>i?e.slice(0,i)+"...":e}function cu(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Je(e));return e}function du(i,e){var t,s,{e:r,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsC
1hainAsString:l,disableCaptureUrlHashes:u}=e;if(!Je(i))return{props:{}};for(var h=[i],c=new Set([i]),d=i;d.parentNode&&!be(d,"body")&&Pa>h.length;)if(ka(d.parentNode)){var p=d.parentNode.host;if(c.has(p))break;c.add(p),h.push(p),d=p}else{if(!Je(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}var g,f,m=[],y={},P=!1,k=!1;if(V(h,(F=>{var b=Gs(F);if(be(F,"a")){var T=F.getAttribute("href");P=!!(b&&T&&zt(T))&&(u?Ye(T):T)}O(Mi(F),"ph-no-capture")&&(k=!0),m.push((function(R,N,q,G,B){B===void 0&&(B=!1);var j=R.tagName.toLowerCase(),Y={tag_name:j};pr.indexOf(j)>-1&&!q&&(Y.$el_text=j.toLowerCase()==="a"||j.toLowerCase()==="button"?cs(1024,Jr(R)):cs(1024,Qt(R)));var he=Mi(R);he.length>0&&(Y.classes=he.filter((function(Z){return Z!==""}))),V(R.attributes,(function(Z){var oe;if((!Ta(R)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&(G==null||!G.includes(Z.name))&&!N&&zt(Z.value)&&(!U(oe=Z.name)||oe.substring(0,10)!=="_ngcontent"&&oe.substring(0,7)!=="_nghost")){var re=Z.value;Z.name==="class"&&(re=dr(re).join(" ")),Y["attr__"+Z.name]=cs(1024,Z.name==="href"&&B?Ye(re):re)}}));for(var ke=1,ge=1,ye=R;ye=cu(ye);)ke++,ye.tagName===R.tagName&&ge++;return Y.nth_child=ke,Y.nth_of_type=ge,Y})(F,n,a,o,u));var M=(function(R){if(!Gs(R))return{};var N={};return V(R.attributes,(function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var G=q.name.replace("data-ph-capture-attribute-",""),B=q.value;G&&B&&zt(B)&&(N[G]=B)}})),N})(F);W(y,M)})),k)return{props:{},explicitNoCapture:k};if(a||(m[0].$el_text=be(i,"a")||be(i,"button")?Jr(i):Qt(i)),P){var S,A;m[0].attr__href=P;var D=(S=Kt(P))==null?void 0:S.host,I=v==null||(A=v.location)==null?void 0:A.host;D&&I&&D!==I&&(g=P)}return{props:W({$event_type:r.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(f=m,(function(F){return F.map((b=>{var T,M,R="";if(b.tag_name&&(R+=b.tag_name),b.attr_class)for(var N of(b.attr_class.sort(),b.attr_class))R+="."+N.replace(/"/g,"");var q=_({},b.text?{text:b.text}:{},{"nth-child":(T=b.nth_child)!==null&&T!==void 0?T:0,"nth-of-type":(M=b.nth_of_type)!==null&&M!==void 0?M:0},b.href?{href:b.href}:{},b.attr_id?{attr_id:b.attr_id}:{},b.attributes),G={};return vi(q).sort(((B,j)=>{var[Y]=B,[he]=j;return Y.localeCompare(he)})).forEach((B=>{var[j,Y]=B;return G[Qr(j.toString())]=Qr(Y.toString())})),(R+=":")+vi(G).map((B=>{var[j,Y]=B;return j+'="'+Y+'"'})).join("")})).join(";")})((function(F){return F.map((b=>{var T,M,R={text:(T=b.$el_text)==null?void 0:T.slice(0,400),tag_name:b.tag_name,href:(M=b.attr__href)==null?void 0:M.slice(0,2048),attr_class:Al(b),attr_id:b.attr__id,nth_child:b.nth_child,nth_of_type:b.nth_of_type,attributes:{}};return vi(b).filter((N=>{var[q]=N;return q.indexOf("attr__")===0})).forEach((N=>{var[q,G]=N;return R.attributes[q]=G})),R}))})(f)))},(t=m[0])!=null&&t.$el_text?{$el_text:(s=m[0])==null?void 0:s.$el_text}:{},g&&r.type==="click"?{$external_click_url:g}:{},y)}}var Ot=K("[ExceptionAutocapture]"),mn=()=>{},pu=K("[TracingHeaders]"),Ze=K("[Web Vitals]"),yn=9e5,bn="disabled",wn="lazy_loading",Ct="awaiting_config",hi="missing_config";K("[SessionRecording]"),K("[SessionRecording]");var tr="[SessionRecording]",Oe=K(tr),vu=K("[Heatmaps]");function xn(i){return J(i)&&"clientX"in i&&"clientY"in i&&ue(i.clientX)&&ue(i.clientY)}var ds=K("[Product Tours]"),ps=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(lr))},gu=["$set_once","$set"],Ie=K("[SiteApps]"),Sn="Error while initializing PostHog app with config id ";function dt(i,e,t){if(C(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class fu{constructor(e){this.mn=new mr,this.yn=(t,s)=>this.bn(t,s)&&this._n(t,s)&&this.wn(t,s)&&this.xn(t,s),this.bn=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.kn=new Set,this.Sn=new Set}init(){var e,t;x((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,r)=>{this.on(s,r)}))}register(e){var t,s;if(!x((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.Sn)==null||o.add(a),(l=a.steps)==null||l.forEach((u=>{var h;(h=this.kn)==null||h.add(u?.event||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))}
1)),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.kn.has(e)||this.kn.has(t?.event))&&this.Sn&&((s=this.Sn)==null?void 0:s.size)>0&&this.Sn.forEach((r=>{this.Cn(t,r)&&this.mn.emit("actionCaptured",r.name)}))}In(e){this.onAction("actionCaptured",(t=>e(t)))}Cn(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.yn(e,s))return!0;return!1}onAction(e,t){return this.mn.on(e,t)}_n(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!dt(r,t.url,t.url_matching||"contains"))return!1}return!0}wn(e,t){return!!this.Tn(e,t)&&!!this.Mn(e,t)&&!!this.En(e,t)}Tn(e,t){var s;if(t==null||!t.href)return!0;var r=this.Pn(e);if(r.length>0)return r.some((o=>dt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&dt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Mn(e,t){var s;if(t==null||!t.text)return!0;var r=this.Pn(e);if(r.length>0)return r.some((u=>dt(u.text,t.text,t.text_matching||"exact")||dt(u.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=(function(u){for(var h,c=[],d=/(?::|")text="(.*?)"/g;!C(h=d.exec(u));)c.includes(h[1])||c.push(h[1]);return c})(l),a=t.text,o=t.text_matching||"exact",n.some((u=>dt(u,a,o))))}En(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Pn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}xn(e,t){return t==null||!t.properties||t.properties.length===0||so(t.properties.reduce(((s,r)=>{var n=L(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s}),{}),e?.properties)}}class _u{constructor(e){this.Rn=[],this._instance=e,this.On=new Map,this.Ln=new Map,this.Fn=new Map}An(e,t){return!!e&&so(e.propertyFilters,t?.properties)}Dn(e,t){var s=new Map;return e.forEach((r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}}))})),s}$n(e,t,s){var r=(s===At.Activation?this.On:this.Ln).get(e),n=[];return this.Nn((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find((u=>u.name===e));return this.An(l,t)}))}register(e){var t;x((t=this._instance)==null?void 0:t._addCaptureHook)||(this.qn(e),this.Bn(e))}Bn(e){var t=e.filter((s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.jn==null&&(this.jn=new fu(this._instance),this.jn.init(),this.jn.In((s=>{this.onAction(s)}))),t.forEach((s=>{var r,n,a,o,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.jn)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var h=this.Fn.get(u.name);h&&h.push(s.id),this.Fn.set(u.name,h||[s.id])}})))})))}qn(e){var t,s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),r=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this.On=this.Dn(e,At.Activation),this.Ln=this.Dn(e,At.Cancellation))}onEvent(e,t){var s,r,n=this.Hn(),a=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Un(e,a);if(o==="consume")return n.info("event consumed activated item, remov
1ing it",{event:e,itemId:a}),void this.zn([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),void this.Vn(a)}if(this.Ln.has(e)){var l=this.$n(e,t,At.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((h=>h.id))}),this.zn(l.map((h=>h.id))),l.forEach((h=>this.Wn(h.id))))}if(this.On.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.On.get(e)});var u=this.$n(e,t,At.Activation);this.Gn(u.map((h=>h.id)))}}onAction(e){this.Fn.has(e)&&this.Gn(this.Fn.get(e)||[])}Gn(e){e.length!==0&&(this.Rn=[...new Set([...this.Rn,...e])],this.Hn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.Rn=this.Rn.filter((s=>s!==e));var t=this.Zn();t.includes(e)||this.Qn([...t,e])}zn(e){var t=new Set(e);this.Rn=this.Rn.filter((n=>!t.has(n)));var s=this.Zn(),r=s.filter((n=>!t.has(n)));r.length!==s.length&&this.Qn(r)}Zn(){var e,t=this.Jn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getActivatedIds(){return[...new Set([...this.Zn(),...this.Rn])].filter((e=>!this.Kn(e)))}reset(){this.Rn=[],this.Zn().length>0&&this.Qn([])}getEventToItemsMap(){return this.On}Yn(){return this.jn}}class mu extends _u{constructor(e){super(e)}Jn(){return Ds}Xn(){return Be.SHOWN}Nn(e){var t;(t=this._instance)==null||t.getSurveys(e)}Wn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Hn(){return H}Qn(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ds]:e})}Kn(){return!1}Un(e,t){var s;this.Nn((n=>{s=n.find((a=>a.id===t))}));var r=!s||(function(n){var a,o,l,u=((a=(o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)!==null&&a!==void 0?a:0)>0;return n.schedule===jl.Always||!((l=n.conditions)==null||(l=l.events)==null||!l.repeatedActivation||!u)})(s);return r?e===Be.SHOWN?"consume":"ignore":e===Be.SHOWN?"persist":e===Be.DISMISSED||e===Be.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var vs="SDK is not enabled or survey functionality is not yet loaded",En="Disabled. Not loading surveys.",yu=v!=null&&v.location?Oi(v.location.hash,"__posthog")||Oi(location.hash,"state"):null,kn="_postHogToolbarParams",Pn=K("[Toolbar]"),ne=K("[FeatureFlags]"),Xe=K("[FeatureFlags]",{debugEnabled:!0}),gs=`" failed. Feature flags didn't load in time.`,Fn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},An=i=>{var e={};for(var[t,s]of vi(i||{}))s&&(e[t]=s);return e},Ce=K("[Error tracking]"),In="Refusing to render web experiment since the viewer is a likely bot",bu={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>Di(e,i),not_regex:(i,e)=>!Di(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i};class ce{get Se(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{ce.es("retrieved web experiments from the server"),t.ts=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.ts&&(ce.es("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.ts)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);U(o)&&n.variants[o]&&t.rs(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];ce.ns(u,t._instance)&&t.rs(n.name,l,u.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())ce.es(In);else if(!this.Se.disable_web_experiments){if(C(this.ts))return this.ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ce.es("applying feature flags",e),e.forEach((t=>{var s;if(this.ts&&(s=this.ts)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.ts)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.rs(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=ce.getWindowLocation();if(e!=null&&e.search){var t=St(e?.search,"__experiment_id"),s=St(e?.search,"__experiment_variant");t&&s&&(ce.es("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this.ss(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.Se.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}ss(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(ce.es("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.rs(r[0].name,t,r[0].variants[t].transforms))}static ns(e,t){return!C(e.conditions)&&ce.os(e,t)&&ce.ls(e)}static os(e,t){var s;if(C(e.conditions)||C((s=e.conditions)==null?void 0:s.url))return!0;var r=ce.getWindowLocation();if(r){var n,a,o,l=Sa(t,r.href);return(n=e.conditions)==null||!n.url||bu[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}
1static getWindowLocation(){return v?.location}static ls(e){var t;if(C(e.conditions)||C((t=e.conditions)==null?void 0:t.utm))return!0;var s=ja();if(s.utm_source){var r,n,a,o,l,u,h,c,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==s.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,f=(h=e.conditions)==null||(h=h.utm)==null||!h.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==s.utm_term;return d&&g&&f&&p}return!1}static es(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];w.info("[WebExperiments] "+e,s)}rs(e,t,s){this._is_bot()?ce.es(In):t!=="control"?s.forEach((r=>{if(r.selector){var n;ce.es("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a?.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):ce.es("Control variants leave the page unmodified.")}_is_bot(){return pe&&this._instance?eo(pe,this.Se.custom_blocked_useragents):void 0}}var xe=K("[Conversations]"),et="Conversations not available yet.",$n="console",Bi={featureFlags:class{constructor(i){this.us=!1,this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=0,this.bs=()=>{var e=this._s();this.ys=0,e&&this.reloadFeatureFlags()},this._instance=i,this.featureFlagEventHandlers=[],v&&te(v,"online",this.bs)}destroy(){v?.removeEventListener("online",this.bs)}get Se(){return this._instance.config}get ti(){return this._instance.persistence}ws(i){return this._instance.get_property(i)}xs(){var i,e;return(i=(e=this.ti)==null?void 0:e.nr(this.Se.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}ks(){return!!this.xs()&&(this.gs||this.ds||(this.gs=!0,ne.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ss(){var i,e=(i=this.Se.evaluation_contexts)!==null&&i!==void 0?i:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ps||(ne.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ps=!0),e!=null&&e.length?e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||ne.error("Invalid evaluation context found:",t,"Expected non-empty string"),s})):[]}Cs(){return this.Ss().length>0}Is(){var i=this.Se.flag_keys;if(!x(i)){if(L(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||ne.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ne.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,{config:t}=this._instance,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter((u=>!!s[u])).reduce(((u,h)=>(u[h]=s[h]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,h)=>(a[h]&&(u[h]=a[h]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s,r,n=t!=null&&t.merge&&(s=this.ws(rt))!==null&&s!==void 0?s:{},a=t!=null&&t.merge&&(r=this.ws(pi))!==null&&r!==void 0?r:{},o=_({},n,i),l=_({},a,e),u={};for(var[h,c]of Object.entries(o))u[h]={key:h,enabled:Fr(c),variant:Ar(c),reason:void 0,metadata:x(l?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}};this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.hs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.ws(Os),e=this.ws(De),t=this.ws(pt);if(!t&&!e)return i||{};var s=W({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],u=e?.[n],h=x(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,c=x(u)?l.variant:typeof u=="string"?u:void 0,d=t?.[n],p=_({},l,{enabled:h,variant:h?c??l?.variant:void 0});h!==l?.enabled&&(p.original_enabled=l?.enabled),c!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=_({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=p}return this.us||(ne.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.us=!0),s}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map((t=>{var s=i[t];return{key:t,enabled:Fr(s),variant:Ar(s),payload:Pr(e[t])}}))}getFlagVariants(){var i=this.ws(rt),e=this.ws(De);if(!e)return i||{};for(var t=W({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.us||(ne.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.us=!0),t}getFlagPayloads(){var i=this.ws(pi),e=this.ws(pt);if(!e)return i||{};for(var t=W({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.us||(ne.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.us=!0),t}reloadFeatureFlags(){this.cs||this.Se.advanced_disable_feature_flags||this._s()||this.Ts||(this._instance.Ni.emit("featureFlagsReloading",!0),this.Ts=setTimeout((()=>{this.Ms()}),5))}Es(){clearTimeout(this.Ts),this.Ts=void 0}ensureFlagsLoaded(){this.hs||this.ds||this.Ts||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.cs=i}Ms(i){var e;if(this.Es(),!this._instance.Er()&&!this._s())if(this.ds)this.vs=!0;else{var t=this.Se.token,s=this.ws(Pi),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},((e=this.ti)==null?void 0:e.get_initial_props())||{},this.ws(tt)||{}),group_properties:this.ws(it),timezone:Va()};ve(s)||x(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.Se.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Cs()&&(r.evaluation_contexts=this.Ss());var n=this.Is();x(n)||(r.flag_keys=n);var a=!!this.Se.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ds=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.Se.disable_compression?void 0:de.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:l=>{var u,h,c,d=!0;if(this.Ps(l.statusCode),l.statusCode===200&&(this.vs||(this.$anon_distinct_id=void 0),d=!1),this.ds=!1,!r.disable_flags||this.vs){this.fs=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(u=l.json)!=null&&u.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var g,f=!((h=l.json)==null||(h=h.quotaLimited)==null||!h.includes("feature_flags"));f&&p.push("quota_limited"),(c=this.ti)==null||c.register({[js]:p}),f?ne.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags((g=l.json)!==null&&g!==void 0?g:{},d,{partialResponse:a}),this.vs&&(this.vs=!1,this.Ms()))}}})}}_s(){return Da(this.ys,3)}Ps(i){this.ys=Na(i,this.ys,3,(()=>ne.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else ne.warn('getFeatureFlag for key "'+i+gs)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],a=String(r),o=this.ws(Cs)||void 0,l=this.ws(Jt)||void 0,u=this.ws(Ut)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,c=this._instance.get_session_id(),d=this.ws(Ns);c&&c!==d&&(u={},(h=this.ti)==null||h.register({[Ut]:u,[Ns]:c}))}if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(a))){var p,g,f,m,y,P,k,S,A,D;L(u[i])?u[i].push(a):u[i]=[a],(p=this.ti)==null||p.register({[Ut]:u});var I=this.getFeatureFlagDetails(i),F=[...(g=this.ws(js))!==null&&g!==void 0?g:[]];x(r)&&F.push("flag_missing");var b={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((f=this.Se.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[i])||null,$feature_flag_bootstrapped_payload:((m=this.Se.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[i])||null,$used_bootstrap_value:!this.fs};x(I==null||(y=I.metadata)==null?void 0:y.version)||(b.$feature_flag_version=I.metadata.version);var T,M=(P=I==null||(k=I.reason)==null?void 0:k.description)!==null&&P!==void 0?P:I==null||(S=I.reason)==null?void 0:S.code;M&&(b.$feature_flag_reason=M),I!=null&&(A=I.metadata)!=null&&A.id&&(b.$feature_flag_id=I.metadata.id),x(I?.original_variant)&&x(I?.original_enabled)||(b.$feature_flag_original_response=x(I.original_variant)?I.original_enabled:I.original_variant),I!=null&&(D=I.metadata)!=null&&D.original_payload&&(b.$feature_flag_original_payload=I==null||(T=I.metadata)==null?void 0:T.original_payload),F.length&&(b.$feature_flag_error=F.join(",")),this._instance.capture("$feature_flag_called",b)}if(s)return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Pr(n)}}}else ne.warn('getFeatureFlagResult for key "'+i+gs)}getRemoteConfigPayload(i,e){var t=this.Se.token,s={distinct_id:this._instance.get_distinct_id(),token:t};this.Cs()&&(s.evaluation_contexts=this.Ss());var r=this.Is();x(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Se.disable_compression?void 0:de.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.fs){if(this.hs||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return x(t)?void 0:!!t}ne.warn('isFeatureEnabled for key "'+i+gs)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.ti){this.hs=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,h,c){l===void 0&&(l={}),u===void 0&&(u={}),h===void 0&&(h={});var d=(F=>{var b=F.flags;return b?(F.featureFlags=Object.fromEntries(Object.keys(b).map((T=>{var M;return[T,(M=b[T].variant)!==null&&M!==void 0?M:b[T].enabled]}))),F.featureFlagPayloads=Object.fromEntries(Object.keys(b).filter((T=>b[T].enabled)).filter((T=>{var M;return(M=b[T].metadata)==null?void 0:M.payload})).map((T=>{var M;return[T,(M=b[T].metadata)==null?void 0:M.payload]}
1)))):F.featureFlags&&ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),F})(a),p=d.flags,g=d.featureFlags,f=d.featureFlagPayloads;if(g){var m=a.requestId,y=a.evaluatedAt;if(L(g)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(g)for(var k=0;g.length>k;k++)P[g[k]]=!0;o&&o.register({[di]:g,[rt]:P})}else{var S=g,A=f,D=p;if(c!=null&&c.partialResponse)S=_({},l,S),A=_({},u,A),D=_({},h,D);else if(a.errorsWhileComputingFlags)if(p){var I=new Set(Object.keys(p).filter((F=>{var b;return!((b=p[F])!=null&&b.failed)})));S=_({},l,Object.fromEntries(Object.entries(S).filter((F=>{var[b]=F;return I.has(b)})))),A=_({},u,Object.fromEntries(Object.entries(A||{}).filter((F=>{var[b]=F;return I.has(b)})))),D=_({},h,Object.fromEntries(Object.entries(D||{}).filter((F=>{var[b]=F;return I.has(b)}))))}else S=_({},l,S),A=_({},u,A),D=_({},h,D);o&&o.register(_({[di]:Object.keys(An(S)),[rt]:S||{},[pi]:A||{},[Os]:D||{}},m?{[Cs]:m}:{},y?{[Jt]:y}:{}))}}})(i,this.ti,s,r,n,t),e||(this.gs=!1),this.Rs(e)}}override(i,e){e===void 0&&(e=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}
1overrideFeatureFlags(i){if(!this._instance.__loaded||!this.ti)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.ti.unregister(De),this.ti.unregister(pt),this.Rs(),Xe.info("All overrides cleared");if(L(i)){var e=Fn(i);return this.ti.register({[De]:e}),this.Rs(),Xe.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.us=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.ti.unregister(De),Xe.info("Flag overrides cleared");else if(s.flags){if(L(s.flags)){var r=Fn(s.flags);this.ti.register({[De]:r})}else this.ti.register({[De]:s.flags});Xe.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.ti.unregister(pt),Xe.info("Payload overrides cleared")):s.payloads&&(this.ti.register({[pt]:s.payloads}),Xe.info("Payload overrides set",{payloads:s.payloads}))),void this.Rs()}if(i&&typeof i=="object")return this.ti.register({[De]:i}),this.Rs(),Xe.info("Flag overrides set",{flags:i});ne.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}
1onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.hs){var{flags:e,flagVariants:t}=this.Os();try{i(e,t)}catch(s){ne.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.ws(jt)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=_({},this.getFlagVariants(),{[i]:e});(s=this.ti)==null||s.register({[di]:Object.keys(An(o)),[rt]:o}),this.Rs()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.ws(jt),r=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+r),method:"GET",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.ti)==null||a.unregister(jt),(o=this.ti)==null||o.register({[jt]:l}),i(l)}}})}Os(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,s)=>(t[s]=e[s],t)),{})}}Rs(i){var{flags:e,flagVariants:t}=this.Os();this.featureFlagEventHandlers.forEach((s=>{try{s(e,t,{errorsLoading:i})}catch(r){ne.error("Error while running feature flags callback",r)}}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.ws(tt)||{},s=i?.$set||(i!=null&&i.$set_once?{}:i),r=i?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this._instance.register({[tt]:_({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=_({},this.ws(tt)||{});i.forEach((s=>{delete t[s]})),this._instance.register({[tt]:t}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this._instance.unregister(tt),i&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.ws(it)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((s=>{t[s]=_({},t[s],i[s]),delete i[s]})),this._instance.register({[it]:_({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.ws(it)||{};this._instance.register({[it]:_({},e,{[i]:{}})})}else this._instance.unregister(it)}reset(){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.$anon_distinct_id=void 0,this.Es(),this.us=!1,this.ys=0}}},wu={sessionRecording:class{get Se(){return this._instance.config}get ti(){return this._instance.persistence}get started(){var i;return!((i=this.Ls)==null||!i.isStarted)}get status(){var i,e;return this.Fs===Ct||this.Fs===hi?this.Fs:(i=(e=this.Ls)==null?void 0:e.status)!==null&&i!==void 0?i:this.Fs}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fs=bn,this.As=void 0,this._instance=i,!this._instance.sessionManager)throw Oe.error("started without valid sessionManager"),new Error(tr+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===qe)throw new Error(tr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ds(){var i,e=!((i=this._instance.get_property(nt))==null||!i.enabled),t=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.Ds||(e=this.Ls)==null||!e.isStarted){var t=!x(Object.assign)&&!x(Array.from);this.Ds&&t?(this.$s(i),Oe.info("starting")):(this.Fs=bn,this.stopRecording())}}$s(i){var e,t,s;this.Ds&&(this.Fs!==Ct&&this.Fs!==hi&&(this.Fs=wn),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=$.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Ns(i):(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.qs,(r=>{if(r)return Oe.error("could not load recorder",r);this.Ns(i)})))}stopRecording(){var i,e;(i=this.As)==null||i.call(this),this.As=void 0,(e=this.Ls)==null||e.stop()}Bs(){var i,e;(i=this.As)==null||i.call(this),this.As=void 0,(e=this.Ls)==null||e.discard()}js(){var i,e;(i=this.ti)==null||i.unregister(ur),(e=this.ti)==null||e.unregister(da)}Hs(i,e){if(C(i))return null;var t,s=ue(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>
11?(Oe.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}Us(i){if(this.ti){var e,t,s=this.ti,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.Hs((n=this.Se.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Hs(a?.sampleRate,"remote config sampleRate"),u=o??l;C(u)&&this.js();var h=a?.minimumDurationMilliseconds;s.register({[nt]:_({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:_({capturePerformance:i.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:x(h)?null:h,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.As)==null||e.call(this),this.As=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.Us(i),void this.Bs()):(this.Us(i),void this.startIfEnabledOrStop()):(this.Fs===Ct&&(this.Fs=hi,Oe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.Ls)!=null&&t.log?this.Ls.log(i,e):Oe.warn("log called before recorder was ready")}get qs(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(nt);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}zs(){var i,e,t=this._instance.get_property(nt);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return Oe.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var s=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-s}Ns(i){var e,t;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return Oe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ba]:!0});if(this.Ls||(this.Ls=(t=$.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.Ls._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.zs())return this.Fs===hi||this.Fs===Ct?void 0:(this.Fs=Ct,Oe.info("persisted remote config is stale, requesting fresh config before starting"),void new Ga(this._instance).load());this.Fs=wn,this.Ls.start(i)}onRRwebEmit(i){var e;(e=this.Ls)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.Ls||(e=this.ti)==null||e.register({[va]:!0}),(i=this.Ls)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.Ls||(e=this.ti)==null||e.register({[pa]:!0}),(i=this.Ls)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.Ls||(t=this.ti)==null||t.register({[i==="url"?ga:fa]:!0}),(e=this.Ls)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.Ls)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.Ls)==null||!t.tryAddCustomEvent(i,e))}}},xu={autocapture:class{constructor(i){this.Vs=!1,this.Ws=null,this.Gs=!1,this.instance=i,this.rageclicks=new _n(i.config.rageclick),this.Zs=null}initialize(){this.startIfEnabled()}get Se(){var i,e,t=J(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((s=>new RegExp(s))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((s=>new RegExp(s))),t}Qs(){if(this.isBrowserSupported()){if(v&&E){var i=t=>{t=t||v?.event;try{this.Js(t)}catch(s){hs.error("Failed to capture event",s)}};if(te(E,"submit",i,{capture:!0}),te(E,"change",i,{capture:!0}),te(E,"click",i,{capture:!0}),this.Se.capture_copied_text){var e=t=>{t=t||v?.event;try{this.Js(t,us)}catch(s){hs.error("Failed to capture copy/cut event",s)}};te(E,"copy",e,{capture:!0}),te(E,"cut",e,{capture:!0})}}}else hs.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Qs(),this.Vs=!0)}
1onRemoteConfig(i){i.elementsChainAsString&&(this.Gs=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Fs]:!!i.autocapture_opt_out}),this.Ws=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.Zs=i}getElementSelectors(i){var e,t=[];return(e=this.Zs)==null||e.forEach((s=>{var r=E?.querySelectorAll(s);r?.forEach((n=>{i===n&&t.push(s)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[Fs];if(ve(this.Ws)&&!Re(t)&&!this.instance.Er())return!1;var s=(e=this.Ws)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}Js(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=es(i);Ea(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&Yr(s,this.instance.config.rageclick)&&this.Js(i,"$rageclick");var r=e===us;if(s&&(function(c,d,p,g,f,m){var y,P,k,S,A,D;if(p===void 0&&(p=void 0),!v||vr(c)||(y=p)!=null&&y.url_allowlist&&!Vr(p.url_allowlist,m)||(P=p)!=null&&P.url_ignorelist&&Vr(p.url_ignorelist,m))return!1;if((k=p)!=null&&k.dom_event_allowlist){var I=p.dom_event_allowlist;if(I&&!I.some((R=>d.type===R)))return!1}var{parentIsUsefulElement:F,targetElementList:b}=$a(c,g);if(!(function(R,N){var q=N?.element_allowlist;if(x(q))return!0;var G,B=function(Y){if(q.some((he=>Y.tagName.toLowerCase()===he)))return{v:!0}};for(var j of R)if(G=B(j))return G.v;return!1})(b,p)||!Vs(b,(S=p)==null?void 0:S.css_selector_allowlist)||Vs(b,(A=(D=p)==null?void 0:D.css_selector_ignorelist)!==null&&A!==void 0?A:wl))return!1;try{var T=v.getComputedStyle(c);if(T&&T.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var M=c.tagName.toLowerCase();switch(M){case"html":return!1;case"form":return(f||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(f||["change","click"]).indexOf(d.type)>=0;default:return F?(f||["click"]).indexOf(d.type)>=0:(f||["click"]).indexOf(d.type)>=0&&(pr.indexOf(M)>-1||c.getAttribute("contenteditable")==="true")}})(s,i,this.Se,r,r?["copy","cut"]:void 0,this.instance)){var{props:n,explicitNoCapture:a}=du(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var o=this.getElementSelectors(s);if(o&&o.length>0&&(n.$element_selectors=o),e===us){var l,u=Fa(v==null||(l=v.getSelection())==null?void 0:l.toString()),h=i.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Fe(E?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.Ks=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ys&&this.Ys(),this.Ys=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Xs("pushState"),this.Xs("replaceState"),this.eo())}Xs(i){var e;if(v&&((e=v.history[i])==null||!e.__posthog_wrapped__)){var t=this;(function(s,r,n){try{if(!(r in s))return mn;var a={next:s[r]},o=n((function(){for(var l=arguments.length,u=new Array(l),h=0;l>h;h++)u[h]=arguments[h];return a.next.apply(this,u)}));return Fe(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),s[r]=o,()=>{if(s[r]!==o)for(var l=s[r];Fe(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else s[r]=a.next}}catch{return mn}})(v.history,i,(s=>function(r,n,a){s.call(this,r,n,a),t.ro(i)}))}}ro(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.Ks&&this.isEnabled&&this._instance.capture(vt,{navigation_type:i}),this.Ks=t}catch(s){w.error("Error capturing "+i+" pageview",s)}}eo(){if(!this.Ys){var i=()=>{this.ro("popstate")};te(v,"popstate",i),this.Ys=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(i){var e;this.io=!1,this.Vs=!1,this.no=null,this.instance=i,this.io=!((e=this.instance.persistence)==null||!e.props[As]),this.rageclicks=new _n(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return J(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(i=this.Se.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return C(this.Se.capture_heatmaps)?C(this.Se.enable_heatmaps)?this.io:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Vs)return;vu.info("starting..."),this.so(),this.ke()}else{var i;clearInterval((i=this.no)!==null&&i!==void 0?i:void 0),this.oo(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[As]:e}),this.io=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}ao(i){this.fe(i.originalEvent,"deadclick")}ke(){this.no&&clearInterval(this.no),this.no=E?.visibilityState==="visible"?setInterval(this.zr.bind(this),this.flushIntervalMilliseconds):null}so(){v&&E&&(this.lo=this.zr.bind(this),te(v,Ti,this.lo),this.uo=i=>this.fe(i||v?.event),te(E,"click",this.uo,{capture:!0}),this.ho=i=>this.do(i||v?.event),te(E,"mousemove",this.ho,{capture:!0}),this.co=new Kr(this.instance,Il,this.ao.bind(this)),this.co.startIfEnabledOrStop(),this.vo=this.ke.bind(this),te(E,$i,this.vo),this.Vs=!0)}oo(){var i;v&&E&&(this.lo&&v.removeEventListener(Ti,this.lo),this.uo&&E.removeEventListener("click",this.uo,{capture:!0}),this.ho&&E.removeEventListener("mousemove",this.ho,{capture:!0}),this.vo&&E.removeEventListener($i,this.vo),clearTimeout(this.fo),(i=this.co)==null||i.stop(),this.Vs=!1)}po(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var u=a;u&&Je(u)&&!be(u,"body");){if(u===l)return!1;var h=void 0;try{var c,d,p;h=(c=(d=(p=u.ownerDocument)==null?void 0:p.defaultView)!==null&&d!==void 0?d:v)==null?void 0:c.getComputedStyle(u).position}catch{return!1}if(O(o,h))return!0;u=Aa(u)}return!1})(es(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}fe(i,e){var t;if(e===void 0&&(e="click"),!zr(i.target)&&xn(i)){var s=this.po(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&Yr(es(i),this.instance.config.rageclick)&&this.kt(_({}
1,s,{type:"rageclick"})),this.kt(s)}}do(i){!zr(i.target)&&xn(i)&&(clearTimeout(this.fo),this.fo=setTimeout((()=>{this.kt(this.po(i,"mousemove"))}),500))}kt(i){if(v){var e=this.Se.disable_capture_url_hashes?Ye(v.location.href):v.location.href,t=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...Et,...t||[]]:[],r=Zt(e,s,Xt);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(i)}}zr(){this.R&&!We(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Kr,webVitalsAutocapture:class{constructor(i){var e;this.io=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.mo=()=>{clearTimeout(this.yo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,s)=>_({},t,{["$web_vitals_"+s.name+"_event"]:_({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.bo=t=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._o();if(!x(r))if(C(t?.name)||C(t?.value))Ze.error("Invalid metric received",t);else if(!this.wo||this.wo>t.value){this.R.url!==r&&(this.mo(),this.yo=setTimeout(this.mo,this.flushToCaptureTimeoutMs)),x(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=x(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),a=_({},t,{$current_url:r,timestamp:Date.now()});x(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.mo()}else Ze.error("Ignoring metric with value >= "+this.wo,t)},this.xo=()=>{if(!this.Vs){var t,s,r,n,a=$.__PosthogExtensions__;x(a)||x(a.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:s,onFCP:r,onINP:n}=a.postHogWebVitalsCallbacks),t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.bo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.bo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.bo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.bo.bind(this)),this.Vs=!0):Ze.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.io=!((e=this._instance.persistence)==null||!e.props[Rs]),this.startIfEnabled()}get ko(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=J(this.ko)?(i=this.ko)==null?void 0:i.web_vitals_allowed_metrics:void 0;return C(t)?((e=this._instance.persistence)==null?void 0:e.props[Ms])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(J(this.ko)?this.ko.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=J(this.ko)?this.ko.web_vitals_attribution:void 0;return i!=null&&i}get wo(){var i=J(this.ko)&&ue(this.ko.__web_vitals_max_value)?this.ko.__web_vitals_max_value:yn;return i>0&&6e4>=i?yn:i}get isEnabled(){var i=se?.protocol;if(i!=="http:"&&i!=="https:")return Ze.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=J(this.ko)?this.ko.web_vitals:Re(this.ko)?this.ko:void 0;return Re(e)?e:this.io}startIfEnabled(){this.isEnabled&&!this.Vs&&(Ze.info("enabled, starting..."),this.Bt(this.xo))}onRemoteConfig(i){if("capturePerformance"in i){var e=J(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=J(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Rs]:e}),this._instance.persistence.register({[Ms]:t})),this.io=e,this.startIfEnabled()}}Bt(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?Ze.error("failed to load script",s):i()}))}_o(){var i=v?this._instance.config.disable_capture_url_hashes?Ye(v.location.href):v.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...Et,...e||[]]:[];return Zt(i,t,Xt)}Ze.error("Could not determine current URL")}}},Su={exceptionObserver:class{constructor(i){var e,t,s;this.xo=()=>{var r;if(v&&this.isEnabled&&(r=$.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.So&&this.Se.capture_unhandled_errors&&(this.So=n(this.captureException.bind(this))),!this.Co&&this.Se.capture_unhandled_rejections&&(this.Co=a(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=o(this.captureException.bind(this)))}catch(l){Ot.error("failed to start",l),this.To()}}},this._instance=i,this.Mo=!((e=this._instance.persistence)==null||!e.props[Is]),this.Eo=new So({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Ae:Ot}),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return J(i)?e=_({},e,i):(x(i)?this.Mo:i)&&(e=_({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ot.info("enabled"),this.To(),this.Bt(this.xo)):this.To()}Bt(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return Ot.error("failed to load script",s);i()}))}To(){var i,e,t;(i=this.So)==null||i.call(this),this.So=void 0,(e=this.Co)==null||e.call(this),this.Co=void 0,(t=this.Io)==null||t.call(this),this.Io=void 0}onRemoteConfig(i){"autocaptureExceptions"in i&&(this.Mo=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Is]:this.Mo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}
1captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.Eo.consumeRateLimit(r)?Ot.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.Ro=[],this.Oo=new qo([new Yo,new sl,new Qo,new Jo,new tl,new el,new Zo,new il],(function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var u=[],h=o.split(` 2`),c=l;h.length>c;c++){var d=h[c];if(1024>=d.length){var p=qr.test(d)?d.replace(qr,"$1"):d;if(!p.match(/\S*Error: /)){for(var g of n){var f=g(p,s);if(f){u.push(f);break}}if(u.length>=50)break}}}return(function(m){if(!m.length)return[];var y=Array.from(m);return y.reverse(),y.slice(0,50).map((P=>{return _({},P,{filename:P.filename||(k=y,k[k.length-1]||{}).filename,function:P.function||xt});var k}))})(u)}})("web:javascript",zo,Wo)),this._instance=i,this.Ro=(e=(t=this._instance.persistence)==null?void 0:t.get_property($s))!==null&&e!==void 0?e:[],this.Lo=ki(this.Fo()),this.Ao=new nl(this.Lo)}onConfigChange(){this.Lo=ki(this.Fo()),this.Ao.setConfig(this.Lo)}onRemoteConfig(i){var e,t,s;if("errorTracking"in i){var r=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(s=i.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Ro=r,this._instance.persistence&&this._instance.persistence.register({[$s]:this.Ro,[Ts]:n})}}get Do(){var i,e=!!this._instance.get_property(Ts),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.Oo.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.Lo.enabled)try{if(!U(i)||i.trim().length===0)return void Ce.warn("Ignoring exception step because message must be a non-empty string");var t=this.$o(e),{sanitizedProperties:s,droppedKeys:r}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce(((o,l)=>rl.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(t);r.length>0&&Ce.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Ao.add(_({[Si]:i,[Ei]:new Date().toISOString()},s))}catch(n){Ce.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.No(e)){if(this.qo(e))return this.Bo("Exception dropped: matched a suppression rule"),void Ce.info("Skipping exception capture because a suppression rule matched");if(!this.Do&&this.jo(e))return this.Bo("Exception dropped: thrown by a browser extension"),void Ce.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ho(e))return this.Bo("Exception dropped: thrown by the PostHog SDK"),void Ce.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.Lo.enabled&&C(i.$exception_steps)?this.Uo(i):i;try{var s=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",an:!0});return s&&this.Ao.clear(),s}catch(r){return Ce.error("Failed to capture exception event. Dropping this exception.",r),void this.Ao.clear()}}catch(r){return void Ce.error("Failed to process exception event. Ignoring this exception.",r)}}Uo(i){try{var e=this.Ao.getAttachable();return e.length===0?i:_({},i,{$exception_steps:e})}catch(t){return Ce.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}Bo(i){this.Lo.enabled&&this.Ao.add({[Si]:i,[Ei]:new Date().toISOString()})}$o(i){return J(i)?_({},i):{}}Fo(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}qo(i){if(i.length===0)return!1;var e=i.reduce(((t,s)=>{var{type:r,value:n}=s;return U(r)&&r.length>0&&t.$exception_types.push(r),U(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.Ro.some((t=>{var s=t.values.map((r=>{var n,a=io[r.operator],o=L(r.value)?r.value:[r.value],l=(n=e[r.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)}));return t.type==="OR"?s.some(Boolean):s.every(Boolean)}))}jo(i){return i.flatMap((e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Ho(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}No(i){return!C(i)&&L(i)}}},Eu=_({productTours:class{get ti(){return this._instance.persistence}constructor(i){this.zo=null,this.Vo=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if("productTours"in i){var e,t;if(this.ti&&this.ti.register({[lr]:!!i.productTours}),!ps(this._instance))return!this.zo&&C((e=this.ti)==null?void 0:e.props[qt])||ds.info("product tours disabled; stopping and clearing cached tours"),(t=this.zo)==null||t.stop(),this.zo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.zo&&ps(this._instance)&&this.Bt((()=>this.Wo()))}Bt(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?ds.error("Could not load product tours script",s):i()}))}Wo(){var i;!this.zo&&(i=$.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.zo=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!L(this.Vo)||e){var t=this.ti;if(t){var s=t.props[qt];if(L(s)&&!e)return this.Vo=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{if(ps(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return ds.error(a),void i([],{isLoaded:!1,error:a})}var o=L(r.json.product_tours)?r.json.product_tours:[];this.Vo=o,t&&t.register({[qt]:o}),i(o,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.Vo,{isLoaded:!0})}getActiveProductTours(i){C(this.zo)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.zo.getActiveProductTours(i)}showProductTour(i){var e;(e=this.zo)==null||e.showTourById(i)}previewTour(i){this.zo?this.zo.previewTour(i):this.Bt((()=>{var e;this.Wo(),(e=this.zo)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.zo)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.zo)==null||i.nextStep()}previousStep(){var i;(i=this.zo)==null||i.previousStep()}clearCache(){var i;this.Vo=null,(i=this.ti)==null||i.unregister(qt)}resetTour(i){var e;(e=this.zo)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.zo)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.zo)==null||e.cancelPendingTour(i)}}},Bi),ku={siteApps:class{constructor(i){this.Go=0,this._instance=i,this.Zo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qo(i,e){if(e){var t=this.globalsForEvent(e);this.Zo.push(t),this.Zo.length>1e3&&(this.Zo=this.Zo.slice(10))}}get siteAppLoaders(){var i;return(i=$._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.Qo.bind(this));this.Jo=()=>{i(),this.Zo=[],this.Jo=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[c,d]of Object.entries(h))l[c]={id:u[c],type:c,properties:d};var{$set_once:p,$set:g}=i;return{event:_({},Rn(i,gu),{properties:_({},i.properties,g?{$set:_({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},p?{$set_once:_({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},p)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Ko(i){var e,t=(e=i.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(i)||(Ie.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(i)||(Ie.error("prepare_external_dependency_script returned null"),null):i}Yo(){var i,e,t,s,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=E?.defaultView,u=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!u)return()=>{};if(this.Go++,this.Xo)return this.ea();var h=[],c=this,d=new WeakSet,p=(m,y,P)=>{if(m!=null&&m[y]){var k=m[y];m[y]=P(k),h.push((()=>{m[y]=k}))}},g=m=>{if(d.has(m))return m;var y=c.Ko(m);return y&&d.add(y),y},f=m=>m.map((y=>typeof y=="string"?y:g(y))).filter((y=>!ve(y)));return p(u,"appendChild",(m=>function(y){var P=g(y);return P?m.call(this,P):y})),p(u,"insertBefore",(m=>function(y,P){var k=g(y);return k?m.call(this,k,P):y})),p(u,"replaceChild",(m=>function(y,P){var k=g(y);return k?m.call(this,k,P):P})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(s=l.DocumentFragment)==null?void 0:s.prototype].forEach((m=>{p(m,"append",(y=>function(){for(var P=arguments.length,k=new Array(P),S=0;P>S;S++)k[S]=arguments[S];return y.apply(this,f(k))})),p(m,"prepend",(y=>function(){for(var P=arguments.length,k=new Array(P),S=0;P>S;S++)k[S]=arguments[S];return y.apply(this,f(k))}))})),[(r=l.Element)==null?void 0:r.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((m=>{p(m,"before",(y=>function(){for(var P=arguments.length,k=new Array(P),S=0;P>S;S++)k[S]=arguments[S];return y.apply(this,f(k))})),p(m,"after",(y=>function(){for(var P=arguments.length,k=new Array(P),S=0;P>S;S++)k[S]=arguments[S];return y.apply(this,f(k))})),p(m,"replaceWith",(y=>function(){for(var P=arguments.length,k=new Array(P),S=0;P>S;S++)k[S]=arguments[S];var A=f(k);return k.length&&!A.length?void 0:y.apply(this,A)}))})),p((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(y,P){var k=g(P);return k?m.call(this,y,k):null})),this.Xo=()=>{h.forEach((m=>m())),this.Xo=void 0},this.ea()}ea(){var i=!1;return()=>{var e;i||(i=!0,this.Go--,this.Go===0&&((e=this.Xo)==null||e.call(this)))}}ta(i,e){e===void 0&&(e=!0);var t=this.Yo();try{var s=i(t);return e&&t(),s}catch(r){throw t(),r}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.Zo.length&&(Ie.info("Processing "+this.Zo.length+" events for site app with id "+i.id),this.Zo.forEac
2h((o=>this.ta((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Jo)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Ie.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var{processEvent:n}=this.ta((a=>i.init({posthog:this._instance,callback(o){a(),r(o)}})),!1);n&&(e.processEvent=n),s=!0}catch(a){Ie.error(Sn+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){Ie.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}ra(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}ia(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),s=function(n){try{e.ta((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Ie.error("Error while processing event "+i.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.ra(),void this._instance.on("eventCaptured",(l=>this.ia(l)))):void Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Jo)==null||t.call(this),(s=i.siteApps)!=null&&s.length)if(this.isEnabled){var n=function(l){var u;$["__$$ph_site_app_"+l]=r._instance,(u=$.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(r._instance,o,(h=>{if(h)return Ie.error(Sn+l,h)}))};for(var{id:a,url:o}of i.siteApps)n(a)}else Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Pu={tracingHeaders:class{constructor(i){this.na=void 0,this.sa=void 0,this.oa=void 0,this.xo=()=>{var e,t,s=this.aa();s?(x(this.na)&&(this.na=(e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),x(this.sa)&&(this.sa=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.To()},this._instance=i}initialize(){this.startIfEnabledOrStop()}Bt(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return pu.error("failed to load script",s);i()}))}la(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}aa(){var i=this.la();return L(i)?(L(this.oa)?this.oa.splice(0,this.oa.length,...i):this.oa=[...i],i.length>0?this.oa:void 0):(L(this.oa)&&this.oa.splice(0),this.oa=i||void 0,this.oa)}To(){var i,e;(i=this.na)==null||i.call(this),(e=this.sa)==null||e.call(this),this.na=void 0,this.sa=void 0}startIfEnabledOrStop(){this.aa()?this.Bt(this.xo):this.To()}}},Fu=_({surveys:class{get Se(){return this._instance.config}constructor(i){this.ua=void 0,this._surveyManager=null,this.ha=!1,this.da=[],this.ca=null,this.va=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Se.disable_surveys){var e=i.surveys;if(C(e))return H.warn("Flags not loaded yet. Not loading surveys.");var t=L(e);this.ua=t?e.length>0:e,H.info("flags response received, isSurveysEnabled: "+this.ua),this.loadIfEnabled()}}reset(){try{var i;(i=this._surveyEventReceiver)==null||i.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var s=localStorage.key(t);(s!=null&&s.startsWith(er)||s!=null&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.ha)H.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)H.info(En);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var i=$?.__PosthogExtensions__;if(i){if(!x(this.ua)||this.Se.advanced_enable_surveys){var e=this.ua||this.Se.advanced_enable_surveys;this.ha=!0;try{var t=i.generateSurveys;if(t)return void this.fa(t,e);var s=i.loadExternalDependency;if(!s)return void this.pa(hr);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.pa("Could not load surveys script",r):this.fa(i.generateSurveys,e)}))}catch(r){throw this.pa("Error initializing surveys",r),r}finally{this.ha=!1}}}else H.error("PostHog Extensions not found.")}}fa(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new mu(this._instance),H.info("Surveys loaded successfully"),this.ga({isLoaded:!0})}pa(i,e){H.error(i,e),this.ga({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.da.push(i),this._surveyManager&&this.ga({isLoaded:!0}),()=>{this.da=this.da.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Se.disable_surveys)return H.info(En),i([]);var t,s=this._instance.get_property(Ls);if(s&&!e)return i(s,{isLoaded:!0}
2),void(this.ma()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.ca?this.ca.then((r=>{var{surveys:n,context:a}=r;return i(n,a)})):(typeof Promise<"u"&&(this.ca=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:r=>{var n;this.ca=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;H.error(o),this.va=Date.now();var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}this.va=null;var u,h=r.json.surveys||[],c=h.filter((p=>(function(g){return!(!g.start_date||g.end_date)})(p)&&((function(g){var f;return!((f=g.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)})(p)||(function(g){var f;return!((f=g.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(p))));c.length>0&&((u=this._surveyEventReceiver)==null||u.register(c)),(n=this._instance.persistence)==null||n.register({[Ls]:h,[Fi]:Date.now()});var d={isLoaded:!0};i(h,d),t?.({surveys:h,context:d})}}))}ma(){return this.ya()&&!this.ca&&!this.ba()}ya(){var i=this._instance.get_property(Fi);return ue(i)&&Date.now()-i>3e5}ba(){return ue(this.va)&&3e5>Date.now()-this.va}markSurveyAsSeen(i,e){var t,s={id:i,current_iteration:(t=e?.iteration)!==null&&t!==void 0?t:null};ro(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ga(i){for(var e of this.da)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){H.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!C(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);H.warn("init was not called")}_a(i){var e=null;return this.getSurveys((t=>{var s;e=(s=t.find((r=>r.id===i)))!==null&&s!==void 0?s:null})),e}wa(i){if(C(this._surveyManager))return{eligible:!1,reason:vs};var e=typeof i=="string"?this._a(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(C(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:vs};var e=this.wa(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return C(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vs})):new Promise((t=>{this.getSurveys((s=>{var r,n=(r=s.find((o=>o.id===i)))!==null&&r!==void 0?r:null;if(n){var a=this.wa(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(C(this._surveyManager))H.warn("init was not called");else{var r=typeof i=="string"?this._a(i):i;if(r!=null&&r.id)if(ru.includes(r.type)){var n=E?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(H.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,t),H.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);H.warn("Survey element not found")}else H.warn("Surveys of type "+r.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(i,e){var t;if(C(this._surveyManager))H.warn("init was not called");else{var s=this._a(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=_({},s,{appearance:_({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ws.Popover&&e.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(s);if(!n.visible)return void H.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==Ws.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(i){C(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload==null||i.handlePageUnload()}}},Bi),Au={toolbar:class{constructor(i){this.instance=i}xa(i){$.ph_toolbar_state=i}ka(){var i;return(i=$.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),wa(this.instance.config)||!v||!E)return!1;i=i??v.location,t=t??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var s,r=yu||Oi(i.hash,"__posthog")||Oi(i.hash,"state"),n=r?Hr((()=>JSON.parse(atob(decodeURIComponent(r)))))||Hr((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(kn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Sa(i){var e=$.ph_load_toolbar||$.ph_load_editor;!C(e)&&Fe(e)?e(i,this.instance):Pn.warn("No toolbar load function found")}loadToolbar(i){var e=!(E==null||!E.getElementById(_a));if(!v||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=_({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(v.localStorage.setItem(kn,JSON.stringify(_({},s,{source:void 0}))),this.ka()===2)this.Sa(s);else if(this.ka()===0){var r;this.xa(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Pn.error("[Toolbar] Failed to load",n),void this.xa(0);this.xa(2),this.Sa(s)})),te(v,"turbolinks:load",(()=>{this.xa(0),this.loadToolbar(s)}))}return!0}Ca(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Iu=_({experiments:ce},Bi),$u={conversations:class{constructor(i){this.Ia=void 0,this._conversationsManager=null,this.Ta=!1,this.Ma=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;C(e)||(Re(e)?this.Ia=e:(this.Ia=e.enabled,this.Ma=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Ia=void 0,this.Ma=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ta||this._instance.config.disable_conversations||wa(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=$?.__PosthogExtensions__;if(i&&!x(this.Ia)&&this.Ia)if(this.Ma&&this.Ma.token){this.Ta=!0;try{var e=i.initConversations;if(e)return this.Ea(e),void(this.Ta=!1);var t=i.loadExternalDependency;if(!t)return void this.Pa(hr);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.Pa("Could not load conversations script",s):this.Ea(i.initConversations),this.Ta=!1}))}catch(s){this.Pa("Error initializing conversations",s),this.Ta=!1}}else xe.error("Conversations enabled but missing token in remote config.")}}Ea(i){if(this.Ma)try{this._conversationsManager=i(this.Ma,this._instance),xe.info("Conversations loaded successfully")}catch(e){this.Pa("Error completing conversations initialization",e)}else xe.error("Cannot complete initialization: remote config is null")}Pa(i,e){xe.error(i,e),this._conversationsManager=null,this.Ta=!1}show(){this._conversationsManager?this._conversationsManager.show():xe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ia===!0&&!ve(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return ie((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(xe.warn(et),null)}))()}getMessages(i,e){var t=this;return ie((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(xe.warn(et),null)}))()}markAsRead(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(xe.warn(et),null)}))()}getTickets(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(xe.warn(et),null)}))()}requestRestoreLink(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(xe.warn(et),null)}))()}restoreFromToken(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(xe.warn(et),null)}))()}restoreFromUrlToken(){var i=this;return ie((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(xe.warn(et),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}vn(){var i;(i=this._conversationsManager)==null||i.setIdentity()}fn(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Tu={logs:class{constructor(i){var e;this.Ra=!1,this.Oa=!1,this.Ae=K("[logs]"),this.Or=[],this.La=[],this.ys=0,this.Fa=()=>{var t,s;this.ys=0,(t=this.Aa)==null||t.onReconnect(),(s=this.Da)==null||s.onReconnect()},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Ra=!0),v&&te(v,"online",this.Fa)}$a(i,e,t,s){var r,n=(function(a,o){var l,u,h,c,d,p,g,f=(l=a?.flushIntervalMs)!==null&&l!==void 0?l:3e3,m=(u=a?.maxBufferSize)!==null&&u!==void 0?u:100,y=o!=null&&o.consoleCapture?void 0:(h=a?.maxLogsPerInterval)!==null&&h!==void 0?h:1e3,P=x(y)?Math.max(m,2048):Math.max(m,y),k=a?.resourceAttributes;return{serviceName:(c=(d=k?.["service.name"])!==null&&d!==void 0?d:a?.serviceName)!==null&&c!==void 0?c:o?.serviceNameDefault,serviceVersion:(p=k?.["service.version"])!==null&&p!==void 0?p:a?.serviceVersion,environment:(g=k?.["deployment.environment"])!==null&&g!==void 0?g:a?.environment,resourceAttributes:k,beforeSend:a?.beforeSend,flushIntervalMs:f,maxBufferSize:m,maxQueueSize:P,maxBatchRecordsPerPost:100,rateCapWindowMs:f,maxLogsPerInterval:y,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Do(this.Na(i,e),n,this.Ae,(()=>this.qa()),(a=>a()),void 0,s),n]}Ba(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;return this.Aa&&this.ja===t||((e=this.Aa)==null||e.reset(),this.ja=t,[this.Aa,this.Ha]=this.$a((()=>this.Or),(s=>{this.Or=s}))),this.Aa}Ua(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;return this.Da&&this.za===t||((e=this.Da)==null||e.reset(),this.za=t,[this.Da,this.Va]=this.$a((()=>this.La),(s=>{this.La=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$n)),this.Da}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!C(t)&&t&&(this.Ra=!0,this.loadIfEnabled())}reset(){var i,e;this.Or=[],(i=this.Aa)==null||i.reset(),this.La=[],(e=this.Da)==null||e.reset(),this.ys=0}captureLog(i){this.Ba().captureLog(i)}le(i){this.Ua().captureLog(i)}get logger(){return this.Wa||(this.Wa={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Wa}flushLogs(i){i?this.Ga(i):(this.Aa&&this.Aa.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))),this.Da&&this.Da.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.Ra&&!this.Oa){var i=$?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.Ae.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.Oa=!0)})):this.Ae.error(hr)}else this.Ae.error("PostHog Extensions not found.")}}Na(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:s=>s===Ne.LogsQueue?i():void 0,setPersistedProperty(s,r){var n;s===Ne.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},ht:s=>this.ht(s),getLibraryId:()=>ee.LIB_NAME,getLibraryVersion:()=>ee.LIB_VERSION}}ht(i){return new Promise((e=>{if(Da(this.ys,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var t=!1,s=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Za(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.Qa(a),a>=200&&300>a)s({kind:"ok"});else if(a===413)s({kind:"too-large"});else if(a!==0&&a!==429&&500>a)s({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;s({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}Qa(i){(i!==0||this._instance.__loaded)&&(this.ys=Na(i,this.ys,3,(()=>
2this.Ae.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."))))}Ga(i){this.Or.length>0&&this.Ja(i,this.Or,this.Ha,ee.LIB_NAME,(e=>{this.Or=e})),this.La.length>0&&this.Ja(i,this.La,this.Va,$n,(e=>{this.La=e}))}Ja(i,e,t,s,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=oa(n,aa(t,ee.LIB_NAME,ee.LIB_VERSION),s,ee.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Za(),data:a,compression:"best-available",batchKey:"logs",transport:i})}}Za(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}qa(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t,windowId:s,sessionStartTimestamp:r,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=s,C(r)||(e.sessionStartTimestamp=r),C(n)||(e.lastActivityTimestamp=n)}if($!=null&&(i=$.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ye($.location.href):$.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},Ru={metrics:class{constructor(i){this.Ae=K("[metrics]"),this._instance=i}initialize(){}Ba(){var i,e,t,s,r,n,a,o,l,u=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.Aa&&this.ja===u||((e=this.Aa)==null||e.reset(),this.ja=u,this.Aa=new No(this.Na(),{serviceName:(s=(l=(t=u)==null?void 0:t.resourceAttributes)==null?void 0:l["service.name"])!==null&&s!==void 0?s:t?.serviceName,serviceVersion:(r=l?.["service.version"])!==null&&r!==void 0?r:t?.serviceVersion,environment:(n=l?.["deployment.environment"])!==null&&n!==void 0?n:t?.environment,resourceAttributes:l,beforeSend:t?.beforeSend,flushIntervalMs:(a=t?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(o=t?.maxSeriesPerFlush)!==null&&o!==void 0?o:1e3},this.Ae)),this.Aa}count(i,e,t){e===void 0&&(e=1),this.Ba().count(i,e,t)}gauge(i,e,t){this.Ba().gauge(i,e,t)}histogram(i,e,t){this.Ba().histogram(i,e,t)}flush(i){if(!this.Aa)return Promise.resolve();if(i){var e=this.Aa.drainWindow();return e&&this.Tt(e,i),Promise.resolve()}return this.Aa.flush().catch((t=>this.Ae.error("PostHog metrics flush failed:",t)))}reset(){var i;(i=this.Aa)==null||i.reset()}Na(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},Tt:t=>e.Tt(t),getLibraryId:()=>ee.LIB_NAME,getLibraryVersion:()=>ee.LIB_VERSION}}Tt(i,e){return new Promise((t=>{var s=!1,r=a=>{s||(s=!0,clearTimeout(n),t(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(_({method:"POST",url:this.Ka(),data:i,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==429&&500>o)r({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;r({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}Ka(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Mu=_({},Bi,wu,xu,Su,Eu,ku,Fu,Pu,Au,Iu,$u,Tu,Ru);Se.__defaultExtensionClasses=_({},Mu);var Ou=(function(){ee.SDK_DIST_CHANNEL="npm";var i=Gt[gt]=new Se;return(function(){function e(){e.done||(e.done=!0,ao=!1,V(Gt,(function(t){t._dom_loaded()})))}E!=null&&E.addEventListener?E.readyState==="complete"?e():te(E,"DOMContentLoaded",e,{capture:!1}):v&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{de as Compression,Ws as DisplaySurveyType,Se as PostHog,ql as ProductTourEventName,en as ProductTourEventProperties,Be as SurveyEventName,rs as SurveyEventProperties,At as SurveyEventType,jl as SurveySchedule,ss as SurveyType,Ou as default,Ou as posthog};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.