!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,s=null==i?void 0:i.location,n=null==i?void 0:i.fetch,o=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,a=null==i?void 0:i.AbortController,l=null==i?void 0:i.CompressionStream,h=null==e?void 0:e.userAgent;function u(){return!(!t||!1===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"0.7.0",LIB_NAME:"browser-common"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var m=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function y(t){return"string"==typeof t||t}function b(t){return"string"==typeof t?t:void 0}var w=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],x=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),S=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),k=["$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"],E=["token"],P=20,T=1e3,C=1e4,R="[Circular]",F="[Truncated]",I="[Unserializable]",M="[Function]";function A(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}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","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","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"],D=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return O.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function j(t,i){return-1!==t.indexOf(i)}var L=function(t){return t.trim()},N=function(t){return t.replace(/^\$/,"")};function B(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var z=Object.prototype,U=z.hasOwnProperty,q=z.toString,H=Array.isArray||function(t){return"[object Array]"===q.call(t)},V=t=>"function"==typeof t,W=t=>t===Object(t)&&!H(t),G=t=>{if(W(t)){for(var i in t)if(U.call(t,i))return!1;return!0}return!1},K=t=>void 0===t,J=t=>"[object String]"==q.call(t),Y=t=>J(t)&&0===t.trim().length,Q=t=>null===t,X=t=>K(t)||Q(t),Z=t=>"[object Number]"==q.call(t)&&t==t,tt=t=>Z(t)&&t>0,it=t=>"[object Boolean]"===q.call(t),et=t=>t instanceof FormData,rt=t=>j(k,t),st=t=>j(E,t);function nt(t){return null===t||"object"!=typeof t}function ot(t,i){return{}.toString.call(t)==="[object "+i+"]"}function at(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ht(t,Error)}}function lt(t){return"undefined"!=typeof Event&&ht(t,Event)}function ht(t,i){try{return t instanceof i}catch(t){return!1}}var ut=[!0,"true",1,"1","yes"],dt=t=>j(ut,t),vt=[!1,"false",0,"0","no"];function ct(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),Z(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),ct(s||e,i,e,r))}class ft{constructor(t){this.k={},this.S=t.S,this.C=ct(t.bucketSize,0,100,t.I),this.R=ct(t.refillRate,0,this.C,t.I),this.A=ct(t.refillInterval,0,864e5,t.I)}O(t,i){var e=Math.floor((i-t.lastAccess)/this.A);e>0&&(t.tokens=Math.min(t.tokens+e*this.R,this.C),t.lastAccess=t.lastAccess+e*this.A)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,e):this.k[r]=s={tokens:this.C,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.S)||i.call(this,t)),0===s.tokens)}stop(){this.k={}}}var pt="Mobile",gt="iOS",_t="Android",mt="Tablet",yt=_t+" "+mt,bt="iPad",wt="Apple",xt=wt+" Watch",St="Safari",kt="BlackBerry",Et="Samsung",$t=Et+"Browser",Pt=Et+" Internet",Tt="Chrome",Ct=Tt+" OS",Rt=Tt+" "+gt,Ft="Internet Explorer",It=Ft+" "+pt,Mt="Opera",At=Mt+" Mini",Ot="Edge",Dt="Microsoft "+Ot,jt="Firefox",Lt=jt+" "+gt,Nt="Nintendo",Bt="PlayStation",zt="Xbox",Ut=_t+" "+pt,qt=pt+" "+St,Ht="Windows",Vt=Ht+" Phone",Wt="Nokia",Gt="Ouya",Kt="Generic",Jt=Kt+" "+pt.toLowerCase(),Yt=Kt+" "+mt.toLowerCase(),Qt="Konqueror",Xt="Oculus Browser",Zt="Vivaldi",ti="Yandex",ii="Whale",ei="DuckDuckGo",ri="Pale Moon",si="Waterfox",ni="Brave",oi="Google Search App",ai="(\\d+(\\.\\d+)?)",li=new RegExp("Version/"+ai),hi=new RegExp(zt,"i"),ui=new RegExp(Bt+" \\w+","i"),di=new RegExp(Nt+" \\w+","i"),vi=new RegExp(kt+"|PlayBook|BB10","i"),ci={"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"},fi=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?ni:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&j(t,"GSA/")?oi:j(t," OPR/")&&j(t,"Mini")?At:j(t," OPR/")?Mt:vi.test(t)?kt:j(t,"IE"+pt)||j(t,"WPDesktop")?It:j(t,"OculusBrowser")?Xt:j(t,$t)?Pt:j(t,Ot)||j(t,"Edg/")?Dt:j(t,Zt+"/")?Zt:j(t,"YaBrowser/")?ti:j(t,ii+"/")?ii:j(t,ei+"/")||j(t,"Ddg/")?ei:j(t,"FBIOS")?"Facebook "+pt:j(t,"UCWEB")||j(t,"UCBrowser")?"UC Browser":j(t,"CriOS")?Rt:j(t,"CrMo")||j(t,Tt)?Tt:j(t,_t)&&j(t,St)?Ut:j(t,"FxiOS")?Lt:j(t.toLowerCase(),Qt.toLowerCase())?Qt:j(t,ni+"/")?ni:((t,i)=>i&&j(i,wt)||function(t){return j(t,St)&&!j(t,Tt)&&!j(t,_t)}(t))(t,i)?j(t,pt)?qt:St:j(t,"PaleMoon/")?ri:j(t,si+"/")?si:j(t,jt)?jt:j(t,"MSIE")||j(t,"Trident/")?Ft:j(t,"Gecko")?jt:"")},pi={[It]:[new RegExp("rv:"+ai)],[Dt]:[new RegExp(Ot+"?\\/"+ai)],[Tt]:[new RegExp("("+Tt+"|CrMo)\\/"+ai)],[Rt]:[new RegExp("CriOS\\/"+ai)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ai)],[St]:[li],[qt]:[li],[Mt]:[new RegExp("(Opera|OPR)\\/"+ai)],[jt]:[new RegExp(jt+"\\/"+ai)],[Lt]:[new RegExp("FxiOS\\/"+ai)],[Qt]:[new RegExp("Konqueror[:/]?"+ai,"i")],[kt]:[new RegExp(kt+" "+ai),li],[Ut]:[new RegExp("android\\s"+ai,"i")],[Pt]:[new RegExp($t+"\\/"+ai)],[Xt]:[new RegExp("OculusBrowser\\/"+ai)],[Zt]:[new RegExp(Zt+"\\/"+ai)],[ti]:[new RegExp("YaBrowser\\/"+ai)],[ii]:[new RegExp(ii+"\\/"+ai)],[ni]:[new RegExp(ni+"\\/"+ai)],[ei]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ai)],[ri]:[new RegExp("PaleMoon\\/"+ai)],[si]:[new RegExp(si+"\\/"+ai)],[oi]:[new RegExp("GSA\\/"+ai)],[Ft]:[new RegExp("(rv:|MSIE )"+ai)],Mozilla:[new RegExp("rv:"+ai)]},gi=function(t,i,e,r){var s=fi(t,i,e,r),n=pi[s];if(K(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},_i=[[new RegExp(zt+"; "+zt+" (.*?)[);]","i"),t=>[zt,t&&t[1]||""]],[new RegExp(Nt,"i"),[Nt,""]],[new RegExp(Bt,"i"),[Bt,""]],[vi,[kt,""]],[new RegExp(Ht,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Vt,""];if(new RegExp(pt).test(i)&&!/IEMobile\b/.test(i))return[Ht+" "+pt,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=ci[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Ht,r]}return[Ht,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[gt,[t[3],t[4],t[5]||"0"].join(".")]:[gt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=K(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+_t+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+_t+")","i"),t=>t&&t[2]?[_t,[t[2],t[3],t[4]||"0"].join(".")]:[_t,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ct,""]],[/Linux|debian/i,["Linux",""]]],mi=function(t){return di.test(t)?Nt:ui.test(t)?Bt:hi.test(t)?zt:new RegExp(Gt,"i").test(t)?Gt:new RegExp("("+Vt+"|WPDesktop)","i").test(t)?Vt:/iPad/.test(t)?bt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?xt:vi.test(t)?kt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Wt,"i").test(t)?Wt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(pt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?_t:yt:new RegExp("(pda|"+pt+")","i").test(t)?Jt:new RegExp(mt,"i").test(t)&&!new RegExp(mt+" pc","i").test(t)?Yt:""},yi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function bi(t,i){return"string"==typeof(e=t)&&yi.test(e)?t:i();var e}function wi(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function xi(t){return t?t.split("#")[0]:t}function Si(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function ki(t,i,e){return Ei.apply(this,arguments)}function Ei(){return(Ei=p((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Si((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var $i,Pi="NativeGzipValidationError",Ti=t=>t.length>=2&&31===t[0]&&139===t[1],Ci=(t,i)=>t===S.GZipJS||i===S.GZipJS||"gzip"===i,Ri=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Fi=t=>{throw wi(Pi,"Native gzip produced invalid output: "+t)},Ii=function(){var t=p((function*(t,i){18>t.size&&Fi("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ti(e)&&8===e[2]||Fi("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if($i)return $i;$i=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;$i[t]=i>>>0}return $i})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Fi("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Fi("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Mi(){return Mi=p((function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=p((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield Ii(l,r),l}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Mi.apply(this,arguments)}var Ai={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Oi=Ai.info,Di=0x8000000000000000,ji={}.propertyIsEnumerable;function Li(t,i){try{return zi(t,i,{ancestors:new WeakSet,remainingNodes:C},0)}catch(t){return[]}}function Ni(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:F};if(e.remainingNodes--,it(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Di||-Di>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:A(t)};if("function"==typeof t)return{stringValue:M};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:R};if(r>=P)return{stringValue:F};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?A(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Ni(a.call(t),i,e,r+1)}catch(t){}return H(t)?{arrayValue:{values:Bi(t,i,e,r+1)}}:{kvlistValue:{values:zi(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:A(String(t))}}function Bi(t,i,e,r){for(var s=[],n=Math.min(t.length,T),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(X(a))continue;s.push(Ni(a,i,e,r))}catch(t){s.push({stringValue:I})}return t.length>o&&s.push({stringValue:F}),s}function zi(t,i,e,r){var s=[];for(var n in t)if(ji.call(t,n)){if(s.length>=T||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(Q(o)||K(o))continue;s.push({key:A(n),value:Ni(o,i,e,r)})}catch(t){s.push({key:A(n),value:{stringValue:I}})}}return s}function Ui(t){try{return A(String(t))}catch(t){return I}}function qi(t,i,e,r){var s,n=Ai[t.level||"info"]||Oi,o=n.text,a=n.number,l=(void 0===(s=Z(r)?r:void 0)&&(s=Date.now()),String(s)+"000000"),h={};i.distinctId&&(h.posthogDistinctId=i.distinctId),i.sessionId&&(h.sessionId=i.sessionId),i.windowId&&(h["window.id"]=i.windowId),X(i.sessionStartTimestamp)||(h.sessionStartTimestamp=String(i.sessionStartTimestamp)),X(i.lastActivityTimestamp)||(h.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(h["url.full"]=i.currentUrl),i.screenName&&(h["screen.name"]=i.screenName),i.appState&&(h["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(h.feature_flags=i.activeFeatureFlags);var u=g({},h),d=t.attributes;if(d){var v=[];try{v=Object.keys(d)}catch(t){v=[]}for(var c of v){var f=void 0;try{f=d[c]}catch(t){f=I}Object.defineProperty(u,c,{value:f,enumerable:!0,writable:!0,configurable:!0})}}var p={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:o,body:{stringValue:Ui(t.body)},attributes:Li(u,e)};return t.trace_id&&(p.traceId=t.trace_id),t.span_id&&(p.spanId=t.span_id),K(t.trace_flags)||(p.flags=t.trace_flags),p}function Hi(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}function Vi(t,i,e,r){return{resourceLogs:[{resource:{attributes:Li(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Wi=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.vn=i,this.I=e,this.Pn=r,this.An=s,this.Fn=n,this.On=o,this.Ln=null,this.Dn=0,this.$n=0,this.Nn=0,this.qn=0,this.jn=0,this.Bn=!1,this.Hn=i.maxBufferSize,this.zn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.Un=i.flushIntervalMs,this.Wn=i.maxBatchRecordsPerPost,this.Vn=i.rateCapWindowMs,this.Gn=i.maxLogsPerInterval}clearQueue(){this.$n++,this._instance.setPersistedProperty(x.LogsQueue,[])}reset(){this.Zn(),this.qn=0,this.jn=0,this.Bn=!1,this.Nn=0,this.Wn=this.vn.maxBatchRecordsPerPost}onReconnect(){this.Nn=0,this.Qn()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Jn(t);if(null!==r)if(r.body){if(this.Kn()){var s={record:qi(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Pn(),this.I,null==i?void 0:i.occurredAtMs)};this.An((()=>this.Yn(s)))}}else this.I.info("Log was rejected in beforeSend function")}}Jn(t){var i=this.vn.beforeSend;if(!i)return t;var e=H(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Kn(){if(void 0===this.Gn)return!0;var t=Date.now(),i=t-this.qn;return this.Vn>i&&i>=0||(this.qn=t,this.jn=0,this.Bn=!1),this.Gn>this.jn?(this.jn++,!0):(this.Bn||(this.I.warn("captureLog dropping logs: exceeded "+this.Gn+" logs per "+this.Vn+"ms"),this.Bn=!0),!1)}flush(){var t=this;return p((function*(){if(!t._instance.isDisabled)return t.Ln||(t.Ln=t.Xn().finally((()=>{t.Ln=null}))),t.Ln}))()}Xn(){var t=this;return p((function*(){var i;t.Zn();var e=null!==(i=t._instance.getPersistedProperty(x.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.$n;t.Dn=0;var l=Math.min(e.length,t.Wn),h=e.slice(0,l),u=Vi(h.map((t=>t.record)),t.ts(),null!==(n=t.On)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.es(u);if(t.$n!==a)return;if("too-large"===d.kind&&h.length>1)t.Wn=Math.max(1,Math.floor(h.length/2)),t.I.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Wn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.vn.maxBatchRecordsPerPost>t.Wn&&(t.Wn=Math.min(t.vn.maxBatchRecordsPerPost,t.Wn+1)),yield t.rs(h.length),e=null!==(o=t._instance.getPersistedProperty(x.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}rs(t){var i=this;return p((function*(){var e,r=Math.max(0,t-i.Dn),s=null!==(e=i._instance.getPersistedProperty(x.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(x.LogsQueue,s.slice(r)),yield i.Fn()}))()}ts(){return Hi(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Yn(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(x.LogsQueue))&&void 0!==i?i:[];this.zn>e.length||(e.shift(),this.Dn++,this.I.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(x.LogsQueue,e),this.Hn>e.length?this.ns():this.Qn()}}ns(t){void 0===t&&(t=this.Un),this.ss||(this.ss=Si((()=>{this.ss=void 0,this.Qn()}),t))}os(){var t=Math.min(Math.max(0,this.Nn-1),6);return this.Un*Math.pow(2,t)}ls(){var t=this._instance.getPersistedProperty(x.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return p((function*(){i.Zn();var e=i.flush().catch((()=>{}));void 0!==t?yield ki(e,t):yield e}))()}flushWithTimeout(t){var i=this;return p((function*(){var e=i.flush();yield ki(e,t,(()=>{e.catch((()=>{}))}))}))()}Qn(){this.flush().then((()=>{this.Nn=0}),(t=>{this.Nn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ls()&&this.ns(this.os())}))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}};var Gi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ki(t){return String(t)+"000000"}function Ji(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let Yi=class{constructor(t,i,e){this._instance=t,this.vn=i,this.I=e,this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set,this.cs=0}count(t,i,e){void 0===i&&(i=1),this.fs({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.fs({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.fs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.Ln,e=function(){var e=p((function*(){i&&(yield i.catch((()=>{}))),yield t.ps()}));return function(){return e.apply(this,arguments)}}(),r=e().finally((()=>{this.Ln===r&&(this.Ln=null)}));return this.Ln=r,r}drainWindow(){if(0===this.us.size)return null;var t=this.us;return this.us=new Map,this.hs=!1,this.ds=new Map,this.vs=new Set,this.gs(t)}reset(){this.cs++,this.Zn(),this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set}fs(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.Jn(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.I.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?g({},i.attributes):void 0,r=Ji(i.type,i.name,i.unit,e)}catch(t){return void this.I.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var s=this.us.get(r);if(!s){if(!this.ys())return;s={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.us.set(r,s)}var n=this.ds.get(i.name);void 0===n?this.ds.set(i.name,i.type):n===i.type||this.vs.has(i.name)||(this.vs.add(i.name),this.I.warn("Metric name '"+i.name+"' is already used as a "+n+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.bs(s,i.value),this.ns()}else this.I.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}ys(){return this.vn.maxSeriesPerFlush>this.us.size||(this.hs||(this.hs=!0,this.I.warn("Metric series cap reached ("+this.vn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}bs(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Gi.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Gi)]+=1}}Jn(t){var i=this.vn.beforeSend;if(!i)return t;var e=H(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}ns(){this.ss||(this.ss=Si((()=>{this.ss=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.vn.flushIntervalMs))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}ps(){var t=this;return p((function*(){if(0!==t.us.size){var i=t.us;t.us=new Map,t.hs=!1,t.ds=new Map,t.vs=new Set;var e=t.cs,r=yield t._instance._s(t.gs(i));if(e===t.cs)switch(r.kind){case"ok":return;case"retry-later":return t.ws(i),void t.ns();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}gs(t){return i=this.ks(t),e=function(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Li(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}ks(t){var i=Ki(Date.now()),e=new Map;for(var r of t.values()){var s,n=Ji(r.type,r.name,r.unit,void 0),o=e.get(n);o||(o=g({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},e.set(n,o));var a=Li(null!==(s=r.attributes)&&void 0!==s?s:{},this.I),l=Ki(r.windowStartMs);if("count"===r.type){var h,u={attributes:a,startTimeUnixNano:l,timeUnixNano:i,asDouble:null!==(h=r.total)&&void 0!==h?h:0};o.sum.dataPoints.push(u)}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:i,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Gi})}return Array.from(e.values())}ws(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.us.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.ys()&&this.us.set(s,n)}}};var Qi,Xi,Zi;function te(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Zi&&e.length===Xi||(Xi=e.length,Zi=e.reduce(((e,r)=>{Qi||(Qi={});var s=Qi[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Qi[r]=[l,h];break}}return e}),{})),Zi}}class ie{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&H(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:te(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var ee="?";function re(t,i,e,r,s){var n={platform:t,filename:i,function:""===e?ee:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&""!==i};return K(r)||(n.lineno=r),K(s)||(n.colno=s),n}var se=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:ee,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ne=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,oe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ae=/\((\S*)(?::(\d+))(?::(\d+))\)/,le=(t,i)=>{var e=ne.exec(t);if(e)return re(i,e[1],ee,+e[2],+e[3]);var r=oe.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ae.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=se(r[1]||ee,r[2]);return re(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},he=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,de=(t,i)=>{var e=he.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ue.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||ee,o=se(n,s);return re(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ve=/\(error: (.*)\)/;class ce{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=J(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return ot(t,"DOMException")}isDOMError(t){return ot(t,"DOMError")}}class fe{match(t){return at(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class pe{constructor(){}match(t){return!!ot(t,"ErrorEvent")&&(null!=t.error||this.$i(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return g({},r,{stack:null!==(e=this.Ui(t))&&void 0!==e?e:r.stack,synthetic:!0})}$i(t){return J(t.message)&&t.message.length>0}Ui(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(J(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var ge=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _e{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(ge);return r&&(i=r[1],e=r[2]),[i,e]}}var me=["fatal","error","warning","log","info","debug"];function ye(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class be{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(lt(t))return t.constructor.name;var i="name"in t?t.name:void 0;return J(i)&&!Y(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+ye(t)}isSeverityLevel(t){return J(t)&&!Y(t)&&me.indexOf(t)>=0}getStack(t){try{return J(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:J(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(at(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class we{match(t){return lt(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ye(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class xe{match(t){return nt(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Se{match(t){return ot(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!lt(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return nt(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var ke="$message",Ee="$timestamp",$e=new Set([ke,Ee]),Pe={enabled:!0,max_bytes:32768};function Te(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Pe.enabled,max_bytes:Re(t.max_bytes,Pe.max_bytes)}:g({},Pe)}class Ce{constructor(t){this.Ss=[],this.xs=0,this.vn=Te(t)}setConfig(t){this.vn=Te(t),this.Cs()}add(t){var i=function(t){var i;try{i=B(t)}catch(t){return}try{var e=JSON.parse(i);if(!W(e))return;var r=e,s=r[ke],n=r[Ee];if(!J(s)||0===s.trim().length)return;if(!J(n)&&!Z(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.vn.max_bytes||(this.Ss.push({step:i.step,bytes:e}),this.xs+=e,this.Cs())}}getAttachable(){return this.Ss.map((t=>t.step))}clear(){this.Ss=[],this.xs=0}size(){return this.Ss.length}Cs(){for(;this.xs>this.vn.max_bytes&&this.Ss.length>0;){var t=this.Ss.shift();t&&(this.xs-=t.bytes)}}}function Re(t,i){if(!Z(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Fe=function(i,e){var r=(void 0===e?{}:e).debugEnabled,s={P(e){if(t&&(c.DEBUG||t.POSTHOG_DEBUG||r)&&!K(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(i,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.P("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.P("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.P("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.P("error",...i)},critical(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>Fe(i+" "+t,e)};return s},Ie=Fe("[PostHog.js]"),Me=Ie.createLogger,Ae=Me("[ExternalScriptsLoader]"),Oe=t=>{var i=null==r?void 0:r.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},De=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Ae.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var s=Oe(i);if(s){if(s.__posthog_loading_callback_fired)return e();var n=s.__posthog_loading_error;return n?e(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,e(t)})))}var o=()=>{if(!r)return e("document not found");if(Oe(i))return De(t,i,e);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},je={},Le=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=je[s];if("fallback"===r&&n){if(Oe(n))return void De(t,n,e);delete je[s]}De(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=Le(t,i);je[s]=a;var l=Oe(s);null==l||null==(o=l.parentNode)||o.removeChild(l),De(t,a,e)}else e(void 0,n)}:e)}else De(t,Le(t,i),e)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");De(t,o,e)}},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);De(t,r,e)};c.DEBUG=!1,c.LIB_VERSION="1.422.5",c.LIB_NAME="web";var Ne="$people_distinct_id",Be="distinct_id",ze="$device_id",Ue="$device_model",qe="__alias",He="__timers",Ve="$autocapture_disabled_server_side",We="$heatmaps_enabled_server_side",Ge="$exception_capture_enabled_server_side",Ke="$error_tracking_suppression_rules",Je="$error_tracking_capture_extension_exceptions",Ye="$web_vitals_enabled_server_side",Qe="$dead_clicks_enabled_server_side",Xe="$product_tours_enabled_server_side",Ze="$logs_capture_enabled_server_side",tr="$web_vitals_allowed_metrics",ir="$session_recording_remote_config",er="$replay_sample_rate",rr="$replay_override_sampling",sr="$replay_override_linked_flag",nr="$replay_override_url_trigger",or="$replay_override_event_trigger",ar="$sesid",lr="$session_is_sampled",hr="$enabled_feature_flags",ur="$active_feature_flags",dr="$early_access_features",vr="$feature_flag_details",cr="$feature_flag_payloads",fr="$feature_flag_request_id",pr="$minimal_flag_called_events",gr="$override_feature_flags",_r="$override_feature_flag_payloads",mr="$stored_person_properties",yr="$stored_group_properties",br="$groups",wr="$surveys",xr="$surveys_loaded_at",Sr="$surveys_activated",kr="$surveys_activated_session",Er="$surveys_activated_timestamps",$r="ph_product_tours",Pr="$flag_call_reported",Tr="$flag_call_reported_session_id",Cr="$feature_flag_errors",Rr="$feature_flag_evaluated_at",Fr="$user_state",Ir="$client_session_props",Mr="$capture_rate_limit",Ar="$initial_campaign_params",Or="$initial_referrer_info",Dr="$initial_person_info",jr="$epp",Lr="$posthog_cookieless",Nr="$cookieless_mode",Br="$sdk_debug_extensions_init_method",zr="$sdk_debug_extensions_init_time_ms",Ur="$sdk_debug_recording_script_not_loaded",qr="PostHog loadExternalDependency extension not found.",Hr="on_reject",Vr="always",Wr="anonymous",Gr="identified",Kr="identified_only",Jr="visibilitychange",Yr="beforeunload",Qr="$pageview",Xr="$pageleave",Zr="$identify",ts="$groupidentify";function is(t,i){H(t)&&t.forEach(i)}function es(t,i){if(!X(t))if(H(t))t.forEach(i);else if(et(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)U.call(t,e)&&i(t[e],e)}var rs=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function ss(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var ns=function(t){try{return t()}catch(t){return}},os=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Ie.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ie.critical(t)}}},as=function(t){var i={};return es(t,(function(t,e){(J(t)&&t.length>0||Z(t))&&(i[e]=t)})),i};var ls=["herokuapp.com","vercel.app","netlify.app"];function hs(t){var i=null==t?void 0:t.hostname;if(!J(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of ls)if(e===r)return!1;return!0}function us(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function ds(t){return"ph_toolbar_internal"===t.name}var vs=t=>{if(r){try{for(var i=t+"=",e=r.cookie.split(";").filter((t=>t.length)),s=0;e.length>s;s++){for(var n=e[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(i))return decodeURIComponent(n.substring(i.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Z(t)&&isFinite(t)&&Math.floor(t)===t});class cs{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new cs(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new cs(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class fs{generate(){var t=this.generateOrAbort();if(!K(t))return t;this.Gr=0;var i=this.generateOrAbort();if(K(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Gr)this.Gr=t,this.Qr();else{if(this.Gr>=t+1e4)return;this.Jr++,this.Jr>4398046511103&&(this.Gr++,this.Qr())}return cs.fromFieldsV7(this.Gr,Math.trunc(this.Jr/Math.pow(2,30)),this.Jr&Math.pow(2,30)-1,this.Yr.nextUint32())}Qr(){this.Jr=1024*this.Yr.nextUint32()+(1023&this.Yr.nextUint32())}constructor(){this.Gr=0,this.Jr=0,this.Yr=new _s}}var ps,gs=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!K(t.crypto)&&crypto.getRandomValues&&(gs=t=>crypto.getRandomValues(t));class _s{nextUint32(){return this.At.length>this.Kr||(gs(this.At),this.Kr=0),this.At[this.Kr++]}constructor(){this.At=new Uint32Array(8),this.Kr=1/0}}var ms=()=>ys().toString(),ys=()=>(ps||(ps=new fs)).generate(),bs="",ws=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var xs={Xr:()=>!!r,ii(t){Ie.error("cookieStore error: "+t)},ti:vs,ni(t){var i;try{i=JSON.parse(xs.ti(t))||{}}catch(t){}return i},ei(t,i,e,s,n){if(!r)return!1;try{var o="",a="",l=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=r),bs)return bs;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),s=Math.min(e.length,8),n="dmn_chk_"+ms();!bs&&s--;){var o=e.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(n)&&(i.cookie=a+";max-age=0",bs=o)}return bs}(t);if(!e){var s=(t=>{var i=t.match(ws);return i?i[0]:""})(t);s!==e&&Ie.info("Warning: cookie subdomain discovery mismatch",s,e),e=s}return e?"; domain=."+e:""}return""}(r.location.hostname,s);if(e){var h=new Date;h.setTime(h.getTime()+864e5*e),o="; expires="+h.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Ie.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},ri(t,i){if(null!=r&&r.cookie)try{xs.ei(t,"",-1,i)}catch(t){return}}},Ss=null,ks={Xr(){if(!Q(Ss))return Ss;var i=!0;if(K(t))i=!1;else try{var e="__mplssupport__";ks.ei(e,"xyz"),'"xyz"'!==ks.ti(e)&&(i=!1),ks.ri(e)}catch(t){i=!1}return i||Ie.error("localStorage unsupported; falling back to cookie store"),Ss=i,i},ii(t){Ie.error("localStorage error: "+t)},ti(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){ks.ii(t)}return null},ni(t){try{return JSON.parse(ks.ti(t))||{}}catch(t){}return null},ei(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){ks.ii(t)}return!1},ri(i){try{null==t||t.localStorage.removeItem(i)}catch(t){ks.ii(t)}}},Es=[mr,ur,hr,vr,cr,fr,Rr,Cr,Pr],$s=[ze,Be,ar,lr,jr,Dr,Fr],Ps=t=>t+"_cpm",Ts=["__proto__","constructor","prototype"],Cs=t=>{if(!W(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===Ts.indexOf(e)&&(i[e]=t[e])})),i},Rs=function(t,i){void 0===i&&(i=[]);var e={};return[...$s,...i].forEach((i=>{var r=t[i];K(r)||Q(r)||""===r||(e[i]=r)})),e},Fs=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Is=(t,i)=>({p:i,f:Fs(JSON.stringify(t))}),Ms=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=xs.ni(Ps(t)),r=(null==e?void 0:e.f)===Fs(i)&&H(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},As=(t,i)=>i+"|"+(xs.ti(Ps(t))||""),Os={},Ds={Xr:()=>!0,ii(t){Ie.error("memoryStorage error: "+t)},ti:t=>Os[t]||null,ni:t=>Os[t]||null,ei:(t,i)=>(Os[t]=i,!0),ri(t){delete Os[t]}},js=null,Ls={Xr(){if(!Q(js))return js;if(js=!0,K(t))js=!1;else try{var i="__support__";Ls.ei(i,"xyz"),'"xyz"'!==Ls.ti(i)&&(js=!1),Ls.ri(i)}catch(t){js=!1}return js},ii(t){Ie.error("sessionStorage error: ",t)},ti(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Ls.ii(t)}return null},ni(t){try{return JSON.parse(Ls.ti(t))||null}catch(t){}return null},ei(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){Ls.ii(t)}return!1},ri(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Ls.ii(t)}}};class Ns{constructor(t){this._instance=t}get vn(){return this._instance.config}get consent(){return this.Hs()?0:this.zs}isOptedOut(){return this.vn.cookieless_mode===Vr||this.isRejected()||-1===this.consent&&this.vn.cookieless_mode===Hr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.vn.opt_out_capturing_by_default}optInOut(t){this.Us.ei(this.Ws,t?1:0,this.vn.cookie_expiration,this.vn.cross_subdomain_cookie,this.vn.secure_cookie)}reset(){this.Us.ri(this.Ws,this.vn.cross_subdomain_cookie)}get Ws(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get zs(){var t=this.Us.ti(this.Ws);return dt(t)?1:j(vt,t)?0:-1}get Us(){var t=this.vn.opt_out_capturing_persistence_type,i="localStorage"===t?ks:xs;if(!this.Vs||this.Vs!==i){this.Vs=i;var e="localStorage"===t?xs:ks;e.ti(this.Ws)&&(this.Vs.ti(this.Ws)||this.optInOut(dt(e.ti(this.Ws))),e.ri(this.Ws,this.vn.cross_subdomain_cookie))}return this.Vs}Hs(){return!!this.vn.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,v.doNotTrack].some((t=>dt(t)))}}function Bs(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!V(r))return i;try{var s=r(i);return J(s)&&s?s:i}catch(t){return Ie.error("Error in get_current_url, falling back to window.location.href",t),i}}var zs="__POSTHOG_TOOLBAR__",Us=1,qs=3,Hs=11;function Vs(t){return t instanceof Element&&(t.id===zs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Ws(t){return!!t&&t.nodeType===Us}function Gs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Ks(t){return!!t&&t.nodeType===qs}function Js(t){return!!t&&t.nodeType===Hs&&Ws(t.host)}var Ys=1e3;function Qs(t){return t?L(t).split(/\s+/):[]}function Xs(i,e){var r=function(i){var e,r=null==t||null==(e=t.location)?void 0:e.href;return K(r)?void 0:Bs(i,r)}(e);return!!(r&&i&&i.some((t=>r.match(t))))}function Zs(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Qs(i)}function tn(t){return X(t)?null:L(t).split(/(\s+)/).filter((t=>En(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function en(t){var i="";return gn(t)&&!_n(t)&&t.childNodes&&t.childNodes.length&&es(t.childNodes,(function(t){var e;Ks(t)&&t.textContent&&(i+=null!==(e=tn(t.textContent))&&void 0!==e?e:"")})),L(i)}function rn(t){var i;return K(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var sn=["a","button","form","input","select","textarea","label"];function nn(t,i){if(K(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function on(t){var i=t.parentNode;return!(!i||!Ws(i))&&i}var an=[".ph-no-autocapture","[data-ph-no-autocapture]"],ln=["next","previous","prev",">","<"],hn=[...ln,"+","-","−","–"],un=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,dn=[".ph-no-rageclick",".ph-no-capture"],vn=["","text","search","email","password","url","tel","number"];function cn(i,e){if(!t||fn(i))return!1;var r,s,n,o,a;if(it(e)?(r=!!e&&dn,s=void 0,n=!1):(r=null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:dn,s=null==e?void 0:e.content_ignorelist,n=null!==(a=null==e?void 0:e.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Ws(t))&&(!!Gs(t,"textarea")||(Gs(t,"input")?j(vn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(i))return!1;var l=pn(i,!1).targetElementList;return!function(t,i){if(!1===t||K(t))return!1;var e;if(!0===t)e=ln;else{if(!H(t))return!1;if(t.length>10)return Ie.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>un(i,t)||un(r,t)))}))}(s,l.map((t=>{var i;return{safeText:en(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!nn(l,r)}var fn=t=>!t||Gs(t,"html")||!Ws(t),pn=(i,e)=>{if(!t||fn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!Gs(n,"body");)if(Js(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=on(n);if(!o)break;if(e||sn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function gn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Gs(r,"body");r=r.parentNode){if(e++>=Ys||i.has(r))return!1;i.add(r);var s=Zs(r);if(j(s,"ph-sensitive")||j(s,"ph-no-capture"))return!1}if(j(Zs(t),"ph-include"))return!0;var n=t.type||"";if(J(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!J(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function _n(t){return!!(Gs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Gs(t,"select")||Gs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var mn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),yn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,bn=[16,15,14,13],wn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),xn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Sn=/[0-9A-Za-z_]/;function kn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function En(t,i){if(void 0===i&&(i=!0),X(t))return!1;if(J(t)){t=L(t);var e=i?mn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(yn.lastIndex=0;i=yn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of bn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(mn.test(a)&&kn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?wn.test(t):function(t){var i;for(xn.lastIndex=0;i=xn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Sn.test(e)&&Sn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function $n(t){var i=en(t);return En(i=(i+" "+Pn(t)).trim())?i:""}function Pn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&es(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=en(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Pn(t)).trim())}catch(t){Ie.error("[AutoCapture]",t)}})),i}function Tn(t){return t.replace(/"|\\"/g,'\\"')}function Cn(t){var i=t.attr__class;if(i)return H(i)?i:Qs(i)}var Rn=Me("[Dead Clicks]"),Fn=()=>!0,In=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Qe)),r=t.instance.config.capture_dead_clicks;return it(r)?r:!!W(r)||e};class Mn{get lazyLoadedDeadClicksAutocapture(){return this.Gs}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Qe]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Zs((()=>{this.Qs()})):this.stop()}Zs(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Rn.error("failed to load script",i):t()}))}Qs(){var t;if(r){if(!this.Gs&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=W(this.instance.config.capture_dead_clicks)?g({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Gs=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Gs.start(r),Rn.info("starting...")}}else Rn.error("`document` not found. Cannot start.")}stop(){this.Gs&&(this.Gs.stop(),this.Gs=void 0,Rn.info("stopping..."))}}var An=Me("[SegmentIntegration]");var On="posthog-js";function Dn(t,i){var e=void 0===i?{}:i,r=e.organization,s=e.projectId,n=e.prefix,o=e.severityAllowList,a=void 0===o?["error"]:o,l=e.sendExceptionsToPostHog,h=void 0===l||l;return i=>{var e,o,l,u,d;if("*"!==a&&!a.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(e=i.exception)?void 0:e.values)||[],p=f.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(o=f[0])?void 0:o.value)||i.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(u=f[0])?void 0:u.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+i.event_id),h&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}class jn{constructor(t,i,e,r,s,n){this.name=On,this.setupOnce=function(o){o(Dn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ln{constructor(t){this.Js=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Ie.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Ks=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ys()}Ys(){var t;this.Xs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Js)}destroy(){var t;null==(t=this.Xs)||t.call(this),this.Xs=void 0}doPageView(i,e){var r,s=this.ta(i,e);return this.Ks={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.ta(t,null==(i=this.Ks)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ks)?void 0:t.pageViewId}}ta(t,i){var e=this.Ks;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(K(n)||K(o)||K(a)||K(l)||K(h)||K(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?ct(o/n,0,1,Ie):1,v=n>1?ct(a/n,0,1,Ie):1,c=l>1?ct(h/l,0,1,Ie):1,f=l>1?ct(u/l,0,1,Ie):1;r=rs(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Nn=["flags","surveys"],Bn={[Ne]:{exposure:"hidden"},[qe]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ve]:{exposure:"event"},[We]:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Qe]:{exposure:"event"},[Xe]:{exposure:"hidden"},[tr]:{exposure:"event"},[ir]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ar]:{exposure:"hidden"},[lr]:{exposure:"event"},[er]:{exposure:"event",shouldSkipFromEventProperties:t=>Q(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[hr]:{exposure:"hidden",storageGroup:"flags"},[ur]:{exposure:"hidden",storageGroup:"flags"},[dr]:{exposure:"hidden"},[vr]:{exposure:"hidden",storageGroup:"flags"},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[pr]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[wr]:{exposure:"hidden",storageGroup:"surveys"},[xr]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Sr]:{exposure:"event"},[kr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[$r]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Pr]:{exposure:"hidden"},[Tr]:{exposure:"hidden"},[br]:{exposure:"event"},[Cr]:{exposure:"hidden"},[Rr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fr]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[Dr]:{exposure:"hidden"},[jr]:{exposure:"hidden"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[Br]:{exposure:"event"},[zr]:{exposure:"event"},[Ur]:{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_pending_trigger_conditions:{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"}},zn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Un=t=>{var i=Bn[t];if(i)return i;for(var e of zn){var r=e[1];if(0===t.indexOf(e[0]))return r}},qn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return B(t)}},Hn=t=>{var i=null==r?void 0:r.createElement("a");return K(i)?null:(i.href=t,i)},Vn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!H(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Ie.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Wn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");H(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Gn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Kn=(t,i)=>t>=i&&u(),Jn=(t,i,e,r)=>{if(0===t){if(u()){var s=i+1;return s===e&&r(),s}return i}return 0},Yn="https?://(.*)",Qn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Xn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qn],Zn="",to=["li_fat_id"];function io(t,i,e){if(!r)return{};var s,n=i?[...Qn,...e||[]]:[],o=eo(Wn(r.URL,n,Zn),t),a=(s={},es(to,(function(t){var i=vs(t);s[t]=i||null})),s);return rs(a,o)}function eo(t,i){var e=Xn.concat(i||[]),r={};return es(e,(function(i){var e=Vn(t,i);r[i]=e||null})),r}function ro(t){var i=function(t){return t?0===t.search(Yn+"google.([^/?]*)")?"google":0===t.search(Yn+"bing.com")?"bing":0===t.search(Yn+"yahoo.com")?"yahoo":0===t.search(Yn+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!Q(i)){s.$search_engine=i;var n=r?Vn(r.referrer,e):"";n.length&&(s.ph_keyword=n)}return s}function so(){return navigator.language||navigator.userLanguage}var no="$direct";function oo(){return(null==r?void 0:r.referrer)||no}function ao(t,i,e){void 0===e&&(e=!1);var r=t?[...Qn,...i||[]]:[],n=e?xi(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:oo().substring(0,1e3),u:o?Wn(o,r,Zn):void 0}}function lo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?xi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==no?no:null==(e=Hn(r))?void 0:e.host};if(n){o.$current_url=n;var a=Hn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=eo(n);rs(o,l)}if(r){var h=ro(r);rs(o,h)}return o}function ho(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function uo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var vo={flags:Rr,surveys:xr},co=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],fo=t=>t+"_cookie_identity_change_pending",po="main",go=(t,i)=>{es(t,((e,r)=>{var s=Un(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class _o{constructor(i,e,r){if(void 0===r&&(r=!0),this.ea={},this.ia=!1,this.ra=!1,this.na=!1,this.sa=!1,this.vn=i,this.aa=r,this.props={},this.oa=void 0,this.la=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(i),this.Us=this.ua(i),this.ra=this.ha(i),this.load(),i.debug&&Ie.info("Persistence loaded",i.persistence,g({},this.props)),this.update_config(i,i,e),this.save(),t){var s=()=>this.flush();us(t,"beforeunload",s,{capture:!1}),us(t,"pagehide",s,{capture:!1})}}da(){var t,i=null==(t=this.vn)?void 0:t.persistence_save_debounce_ms;return Z(i)&&i>0?i:0}va(t){if(this.vn.cookieWinsOnConflict&&"localstorage+cookie"===this.vn.persistence.toLowerCase())if(t)try{var i=Rs(t,this.vn.cookie_persisted_properties||[]),e=Is(i,this.vn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=xs.ti(this.la)||void 0;s&&As(this.la,s)===r&&(this.ca=r,this.fa=s)}catch(t){}else try{var n=xs.ti(this.la)||void 0;this.ca=n?As(this.la,n):void 0,this.fa=n}catch(t){}}syncCookieProperties(){return this.pa(this.vn)}pa(t,i){if(void 0===i&&(i=!1),this.ga&&!i||this.sa||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=xs.ti(this.la)||void 0}catch(t){}if(!e||e===this.fa)return!1;var r,s=As(this.la,e);try{r=Cs(JSON.parse(e))}catch(t){return!1}if((xs.ti(this.la)||void 0)!==e)return!1;this.ca=s,this.fa=e;var n=Ms(this.la,e),o=[...$s,...n.properties],a={};if(Object.keys(r).forEach((t=>{var i=r[t];(K(i)||Q(i)||""===i||t===Fr&&i!==Wr&&i!==Gr)&&(a[t]=!0,delete r[t])})),G(r))return!1;var l=Be in r||r[Fr]===Wr||r[Fr]===Gr,h=this.props[Be],u=this.props[Fr],d=rs({},this.props);[...$s,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==Be&&t!==Fr)){var i=d[t];!n.isValid&&-1!==$s.indexOf(t)&&(!1===i||0===i)||delete d[t]}})),this.props=rs(d,r),!l||Fr in r||Fr in this.props||this.ma(Fr,Wr);var v=this.props[Be],c=this.props[Fr];return!l||v===h&&c===u||(this.na=!0,Ls.ei(fo(this.la),!0),this.ya(mr),this.ya(ur),this.ya(hr),this.ya(vr),this.ya(cr),this.ya(fr),this.ya(Rr),this.ya(Cr),this.ya(Pr),c===Wr&&(u===Gr||r[Fr]===Wr||!K(h)&&v!==h)&&(go(this.props,r),this.ya(yr)),c===Gr?this.props.$user_id=v:delete this.props.$user_id,this.ya(qe)),!0}consumeCookieIdentityChange(){var t=fo(this.la),i=this.na||!!Ls.ti(t);return this.na=!1,i&&Ls.ri(t),i}ba(t){return void 0===t&&(t=!1),!(this.sa||this.ga&&!t||!this.vn.cookieWinsOnConflict||"localstorage+cookie"!==this.vn.persistence.toLowerCase()||(this.sa=!0,0))}_a(){this.sa&&(K(this.wa)||(clearTimeout(this.wa),this.wa=void 0),delete this.ea[po],this.ka(!0))}Sa(t){if(void 0===t&&(t=!0),this.sa)try{t?this._a():K(this.wa)||(clearTimeout(this.wa),this.wa=void 0)}finally{this.sa=!1}}isDisabled(){return!!this.ga}ua(i){-1===co.indexOf(i.persistence.toLowerCase())&&(Ie.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e,r=function(i,e){void 0===i&&(i=[]),void 0===e&&(e=!1);var r=[...$s,...i];return g({},ks,{ni(t){try{var i,s={};try{i=xs.ti(t)||void 0,s=i?Cs(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse(ks.ti(t)||"{}");if(e){var a=Ms(t,i),l=[...$s,...a.properties],h={};Object.keys(s).forEach((t=>{var i=s[t];Q(i)||""===i||t===Fr&&i!==Wr&&i!==Gr||(h[t]=i)}));var u=Be in h||h[Fr]===Wr||h[Fr]===Gr;if(Object.keys(h).length>0){var d,v=o[Be],c=null!==(d=o[Fr])&&void 0!==d?d:Wr;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||t!==Be&&t!==Fr)){var i=o[t];!a.isValid&&-1!==$s.indexOf(t)&&(!1===i||0===i)||delete o[t]}})),!u||Fr in s||Fr in o||(o[Fr]=Wr),!u||(Be in h?h[Be]:o[Be])===v&&(Fr in h?h[Fr]:o[Fr])===c||(Es.forEach((t=>delete o[t])),h[Fr]===Gr&&Be in h?o.$user_id=h[Be]:delete o.$user_id,h[Fr]!==Gr&&(delete o[br],delete o[yr]),delete o.__alias)}n=rs(o,h)}else n=rs(s,o);return ks.ei(t,n),n}catch(t){}return null},ei(t,r,s,n,o,a){var l=ks.ei(t,r,void 0,void 0,a);try{var h=Rs(r,i);if(Object.keys(h).length){if(e){var u=Ps(t),d=Is(h,i);if(xs.ei(u,d,s,n,o,a),xs.ti(u)!==JSON.stringify(d)){xs.ri(u,n);var v=Rs(r);return xs.ei(t,v,s,n,o,a),l}}xs.ei(t,h,s,n,o,a)}}catch(t){ks.ii(t)}return l},ri(i,e){try{null==t||t.localStorage.removeItem(i),xs.ri(i,e),xs.ri(Ps(i),e)}catch(t){ks.ii(t)}}})}(i.cookie_persisted_properties||[],i.cookieWinsOnConflict),s=!1,n=i.persistence.toLowerCase();return"localstorage"===n&&ks.Xr()?(e=ks,s=!0):"localstorage+cookie"===n&&r.Xr()?(e=r,s=!0):"sessionstorage"===n&&Ls.Xr()?e=Ls:"memory"===n?e=Ds:"cookie"===n?e=xs:r.Xr()?(e=r,s=!0):e=xs,this.ia=s,e}xa(t){return this.la+"__"+t}ha(t){return this.ia&&!!t.split_storage}properties(){var t={};return es(this.props,((i,e)=>{var r=Un(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.ga||t){var i=this.vn.cookieWinsOnConflict&&"localstorage+cookie"===this.vn.persistence.toLowerCase(),e=i?ks.ni(this.la):null,r={};if(i)try{es(r=Cs(xs.ni(this.la)),((t,i)=>{(K(t)||Q(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.Us.ni(this.la);if(s&&(this.props=rs({},s)),this.ra&&this.Ca(),i&&s){var n,o,a=null==e?void 0:e[Be],l=null!==(n=null==e?void 0:e[Fr])&&void 0!==n?n:Wr,h=s[Be],u=null!==(o=s[Fr])&&void 0!==o?o:Wr;if(h!==a||u!==l){this.na=!0,Ls.ei(fo(this.la),!0);var d=rs({},this.props);Es.forEach((t=>delete d[t])),u===Wr&&(l===Gr||r[Fr]===Wr||!K(a)&&h!==a)&&(go(d,r),delete d[yr]),this.props=d;var v=new Set;Es.forEach((t=>{var i,e=null==(i=Un(t))?void 0:i.storageGroup;e&&v.add(e)})),v.forEach((t=>{var i={};es(this.props,((e,r)=>{var s;(null==(s=Un(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),G(i)?(ks.ri(this.xa(t)),this.ea[t]={}):ks.ei(this.xa(t),i)&&(this.ea[t]={persisted:!0,fingerprint:this.Ta(i,t)})}))}}Ls.ti(fo(this.la))&&(this.na=!0)}}Ca(){for(var t of Nn){var i=ks.ni(this.xa(t));if(i&&!G(i)){var e=this.Ma(t);e.persisted=!0,this.Ea(t)||(e.fingerprint=this.Ta(i,t)),this.Ia(t,i)||rs(this.props,i)}}}Ea(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Un(i))?void 0:e.storageGroup)===t}))}Ia(t,i){var e=vo[t];if(!e)return!1;var r=i[e],s=this.props[e];return Z(r)&&Z(s)&&s>r}refreshKey(t){var i;if(!this.ga){var e=this.ra?null==(i=Un(t))?void 0:i.storageGroup:void 0,r=e?ks.ni(this.xa(e)):this.Us.ni(this.la);if(r&&t in r)this.ma(t,r[t]);else{if(e){var s=this.Us.ni(this.la);if(s&&t in s)return void this.ma(t,s[t])}this.ya(t)}}}save(){if(!this.ga){var t=this.da();t>0?K(this.wa)&&(this.wa=setTimeout((()=>{this.wa=void 0,this.ka()}),t)):this.ka()}}flush(){K(this.wa)||(clearTimeout(this.wa),this.wa=void 0,this.ka())}ka(t){void 0===t&&(t=!1),this.ga||this.sa&&!t||(t||this.syncCookieProperties(),this.ra?this.Ra():this.Pa(this.Us,this.la,this.props,po)&&this.va(this.props))}Ra(){var t=this.Aa(),i=t.main,e=t.groups;for(var r of(this.Pa(this.Us,this.la,i,po)&&this.va(i),Nn)){var s,n=e[r];(!G(n)||null!=(s=this.ea[r])&&s.persisted)&&this.Pa(ks,this.xa(r),n,r)}}Aa(){var t={},i={flags:{},surveys:{}};return es(this.props,((e,r)=>{var s,n=null==(s=Un(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ta(t,i){if(i===po)return JSON.stringify(t)+"|"+this.Fa+"|"+this.Oa+"|"+this.La;var e={};return es(t,((t,i)=>{var r;e[i]=null!=(r=Un(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}Pa(t,i,e,r){var s,n=this.Ma(r);if(r!==po&&!n.dirty&&!K(n.fingerprint))return!1;try{if((s=this.Ta(e,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.ei(i,e,this.Fa,this.Oa,this.La,this.vn.debug)?(n.dirty=!1,r!==po&&(n.persisted=!0),K(s)||(n.fingerprint=s),!0):(this.vn.debug&&Ie.warn('failed to persist storage entry "'+i+'"; will retry on next save'),!1)}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(K(this.wa)||(clearTimeout(this.wa),this.wa=void 0),this.Us.ri(this.la,!1),this.Us.ri(this.la,!0),!e&&this.aa)for(var r of Nn)ks.ri(this.xa(r));e?delete this.ea[po]:this.ea={},this.ca=void 0,this.fa=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(W(t)){this.syncCookieProperties(),K(i)&&(i="None"),this.Fa=K(e)?this.Da:e;var r=!1;if(es(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.ma(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(W(t)){this.syncCookieProperties(),this.Fa=K(i)?this.Da:i;var e=!1;if(es(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||W(i)||H(i))&&(this.ma(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.ya(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.oa){var i=io(this.vn.custom_campaign_params,this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties);G(as(i))||this.register(i),this.oa=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?ro(t):{})}update_referrer_info(){var t;this.register_once({$referrer:oo(),$referring_domain:null!=r&&r.referrer&&(null==(t=Hn(r.referrer))?void 0:t.host)||no},void 0)}set_initial_person_info(){this.props[Ar]||this.props[Or]||this.register_once({[Dr]:ao(this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties,this.vn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};es([Or,Ar],(i=>{var e=this.props[i];e&&es(e,(function(i,e){t["$initial_"+N(e)]=i}))}));var i=this.props[Dr];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=lo(t,i),r={};return es(e,(function(t,i){r["$initial_"+N(i)]=t})),r}(i,this.vn.disable_capture_url_hashes);rs(t,e)}return t}safe_merge(t){return es(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){var r=t.persistence!==i.persistence,s=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,a=t.disable_persistence||!!e,l=!!this.ga&&!a;a||this.pa(i,l),this.vn=t,!a&&(r||s||o)&&(this.ca=void 0,this.fa=void 0,this.pa(g({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),l));var h=n||o?this.ua(t):this.Us,u=this.ha(t),d=n||u!==this.ra,v=!a&&(d||t.cross_subdomain_cookie!==this.Oa||t.secure_cookie!==this.La)&&this.ba(l);try{if(this.Da=this.Fa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.Us=h,this.ra=u,this.props=c,this.save()}else o&&(this.Us=h,a||(delete this.ea[po],this.ka()))}finally{v&&this.Sa()}}set_disabled(t){this.ga=t,this.ga?this.remove():this.save()}set_cross_subdomain(t){t!==this.Oa&&(this.Oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.La&&(this.La=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[He]||{};e[t]=i,this.ma(He,e),this.save()}remove_event_timer(t){var i=this.props[He]||{},e=i[t];return K(e)||(delete i[t],this.ma(He,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.ma(t,i),this.save()}ma(t,i){var e;this.props[t]=i,null!=(e=Un(t))&&e.volatile||this.$a(t)}ya(t){delete this.props[t],this.$a(t)}$a(t){var i,e=null==(i=Un(t))?void 0:i.storageGroup;e&&(this.Ma(e).dirty=!0)}Ma(t){return this.ea[t]||(this.ea[t]={})}}function mo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&V(e.then)&&e.then(void 0,(()=>{}))}}}}var yo="gzip-js",bo="base64",wo="events",xo="cancelEvents",So="survey shown",ko="survey dismissed",Eo="survey sent",$o="popover",Po=Me("[RateLimiter]");class To{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Po.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Po.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Mr))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(Z(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Na(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Mr,a),{isRateLimited:l,remainingTokens:a.tokens}}qa(t){var i=this.instance.config.property_denylist;return!H(i)||!i.includes(t)}ja(){var t;if(this.qa("$current_url")&&this.qa("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}Na(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ja(),o=this.qa("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()t(this.remoteConfig))):t()}Ha(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Co.info("Using preloaded remote config",this.remoteConfig),void this.za(this.remoteConfig);if(this._instance.Ua())return void Co.warn("Remote config is disabled. Falling back to local config.");this.Ba((t=>{if(!t)return Co.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ha((t=>{this.za(t.json,t)}));this.za(t)}))}catch(t){Co.error("Error loading remote config",t),this.za()}}za(t,i){!t&&i&&(0===i.statusCode?i.error||Co.warn("Failed to fetch remote config from PostHog."):Co.error("Failed to fetch remote config from PostHog."));try{this._instance.za(t?{ok:!0,config:t}:{ok:!1})}catch(t){Co.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Co.error("Error loading feature flags",t)}}}var Fo=Uint8Array,Io=Uint16Array,Mo=Uint32Array,Ao=new Fo([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]),Oo=new Fo([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]),Do=new Fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jo=function(t,i){for(var e=new Io(31),r=0;31>r;++r)e[r]=i+=1<r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Lo=jo(Ao,2),No=Lo[1];Lo[0][28]=258,No[258]=28;for(var Bo=jo(Oo,0)[1],zo=new Io(32768),Uo=0;32768>Uo;++Uo){var qo=(43690&Uo)>>>1|(21845&Uo)<<1;zo[Uo]=((65280&(qo=(61680&(qo=(52428&qo)>>>2|(13107&qo)<<2))>>>4|(3855&qo)<<4))>>>8|(255&qo)<<8)>>>1}var Ho=function(t,i,e){for(var r=t.length,s=0,n=new Io(i);r>s;++s)++n[t[s]-1];var o,a=new Io(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Io(1<s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<=d;++d)o[zo[d]>>>l]=h}else for(o=new Io(r),s=0;r>s;++s)o[s]=zo[a[t[s]-1]++]>>>15-t[s];return o},Vo=new Fo(288);for(Uo=0;144>Uo;++Uo)Vo[Uo]=8;for(Uo=144;256>Uo;++Uo)Vo[Uo]=9;for(Uo=256;280>Uo;++Uo)Vo[Uo]=7;for(Uo=280;288>Uo;++Uo)Vo[Uo]=8;var Wo=new Fo(32);for(Uo=0;32>Uo;++Uo)Wo[Uo]=5;var Go=Ho(Vo,9,0),Ko=Ho(Wo,5,0),Jo=function(t){return(t/8>>0)+(7&t&&1)},Yo=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Io?Io:t instanceof Mo?Mo:Fo)(e-i);return r.set(t.subarray(i,e)),r},Qo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Xo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Zo=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Fo(0),0];if(1==s){var o=new Fo(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Io(v+1),f=ta(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Fo(c),f]},ta=function(t,i,e){return-1==t.s?Math.max(ta(t.l,i,e+1),ta(t.r,i,e+1)):i[t.s]=e},ia=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Io(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ea=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ra=function(t,i,e){var r=e.length,s=Jo(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},sa=function(t,i,e,r,s,n,o,a,l,h,u){Qo(i,u++,e),++s[256];for(var d=Zo(s,15),v=d[0],c=d[1],f=Zo(n,15),p=f[0],g=f[1],_=ia(v),m=_[0],y=_[1],b=ia(p),w=b[0],x=b[1],S=new Io(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Zo(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Do[C-1]];--C);var R,F,I,M,A=h+5<<3,O=ea(s,Vo)+ea(n,Wo)+o,D=ea(s,v)+ea(n,p)+o+14+3*C+ea(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=A&&D>=A)return ra(i,u,t.subarray(l,l+h));if(Qo(i,u,1+(O>D)),u+=2,O>D){R=Ho(v,c,0),F=v,I=Ho(p,g,0),M=p;var j=Ho(P,T,0);for(Qo(i,u,y-257),Qo(i,u+5,x-1),Qo(i,u+10,C-4),u+=14,k=0;C>k;++k)Qo(i,u+3*k,P[Do[k]]);u+=3*C;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)Qo(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(Qo(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else R=Go,F=Vo,I=Ko,M=Wo;for(k=0;a>k;++k)if(r[k]>255){var z;Xo(i,u,R[257+(z=r[k]>>>18&31)]),u+=F[z+257],z>7&&(Qo(i,u,r[k]>>>23&31),u+=Ao[z]);var U=31&r[k];Xo(i,u,I[U]),u+=M[U],U>3&&(Xo(i,u,r[k]>>>5&8191),u+=Oo[U])}else Xo(i,u,R[r[k]]),u+=F[r[k]];return Xo(i,u,R[256]),u+F[256]},na=new Mo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oa=function(){for(var t=new Mo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),aa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function la(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=oa[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Fo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ra(l,h,t.subarray(u,d)):(l[u]=!0,h=ra(l,h,t.subarray(u,o)))}else{for(var v=na[i-1],c=v>>>13,f=8191&v,p=(1<u;++u){var R=b(u),F=32767&u,I=_[R];if(g[F]=I,_[R]=F,u>=T){var M=o-u;if((k>7e3||P>24576)&&M>423){h=sa(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var O=2,D=0,j=f,L=F-I&32767;if(M>2&&R==b(u-L))for(var N=Math.min(c,M)-1,B=Math.min(32767,u),z=Math.min(258,M);B>=L&&--j&&F!=I;){if(t[u+O]==t[u+O-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>O){if(O=U,D=L,U>N)break;var q=Math.min(L,U-2),H=0;for(A=0;q>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(F=I)-(I=g[F])+32768&32767}if(D){w[P++]=268435456|No[O]<<18|Bo[D];var G=31&No[O],K=31&Bo[D];E+=Ao[G]+Oo[K],++x[257+G],++S[K],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=sa(t,l,!0,w,x,S,E,P,C,u-C,h)}return Yo(a,0,r+Jo(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&aa(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),aa(h,u-8,e.d()),aa(h,u-4,r),h}var ha=!!o||!!n,ua="text/plain",da=!1,va=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},ca=function(t,i,e){var r;void 0===e&&(e=!0);var s=t.split("?"),n=s[0],o=s[1],a=g({},i),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=a[s])&&void 0!==i?i:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return es(t,(function(t,i){K(t)||K(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(a);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},fa=t=>{if(t.Wa)return t.Wa;var i=t.data,e=t.compression;if(i){if(e===yo){var r=la(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Fo(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Fo(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Yo(r,0,s)}(qn(i)),{mtime:0});return{contentType:ua,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===bo){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(qn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:qn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=qn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},pa=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:ca(t.url,{compression:bo}),encodedBody:fa(g({},t,{compression:bo,Wa:void 0}))}:{url:va(t.url,"compression"),encodedBody:fa(g({},t,{compression:void 0,Wa:void 0}))};try{i=fa(t)}catch(i){if(Ci(t.compression,Vn(t.url,"compression")))return Ie.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&Ci(t.compression,Vn(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?Ti(new Uint8Array(e)):ArrayBuffer.isView(e)&&Ti(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(da=!0,r()):{url:t.url,encodedBody:i}},ga=t=>{try{return pa(t)}catch(i){return Ie.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},_a=function(){var t=p((function*(t){var i=qn(t.data),e=yield function(t,i,e){return Mi.apply(this,arguments)}(i,c.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return g({},t,{Wa:{contentType:ua,body:r,estimatedSize:r.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),ma=/Failed to fetch|NetworkError|Load failed/i,ya=t=>"TypeError"===(null==t?void 0:t.name)&&ma.test((null==t?void 0:t.message)||""),ba=t=>{var i=ga(t);if(i){var e=i.url,r=i.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,h=s.estimatedSize,u=new Headers;es(t.headers,(function(t,i){u.append(i,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var i;v=!0,c.abort(wi("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))}),t.timeout)}}var f=i=>{v&&"AbortError"===(null==i?void 0:i.name)||ya(i)?Ie.warn(i):Ie.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var p;n(e,g({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Va&&52428.8>(h||0),body:l,signal:null==(p=d)?void 0:p.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Ie.error(t)}null==t.callback||t.callback(r)})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),f(t)}}},wa=t=>{try{var i,r=pa(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(e.sendBeacon(s,h))return;var u=H(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(H(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>H(t.data)?i:g({},t.data,{batch:i});return wa(g({},t,{data:v(u.slice(0,d))})),void wa(g({},t,{data:v(u.slice(d))}))}Ie.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ba(g({},t,{Va:!0}))}catch(t){Ie.warn("Beacon send failed",t)}},xa=(t,i,e,r)=>{var s="query"===r?"POST"===i?"sent_at":"_":void 0;return ca(e===yo?va(t,"compression"):t,g({},s?{[s]:Date.now().toString()}:{},e===yo?{}:{compression:e}))},Sa=[];n&&Sa.push({transport:"fetch",method:ba}),o&&Sa.push({transport:"XHR",method(t){var i=ga(t);if(i){var e=new o,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;es(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(a)}}}),null!=e&&e.sendBeacon&&Sa.push({transport:"sendBeacon",method:wa});var ka=3e3;class Ea{constructor(t,i){this.Ga=!0,this.Za=[],this.Qa=ct((null==i?void 0:i.flush_interval_ms)||ka,250,5e3,Ie.createLogger("flush interval"),ka),this.Ja=t}enqueue(t){this.Za.push(t),this.Ka||this.Ya()}unload(){this.Xa();var t=this.Za.length>0?this.eo():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.io(g({},t,{transport:"sendBeacon"}))}))}enable(){this.Ga=!1,this.Ya()}Ya(){var t=this;this.Ga||(this.Ka=setTimeout((()=>{if(this.Xa(),this.Za.length>0){var i=this.eo(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&H(e.data)&&es(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.io(e)};for(var r in i)e()}}),this.Qa))}io(t){try{this.Ja(t)}catch(t){Ie.error(t)}}Xa(){clearTimeout(this.Ka),this.Ka=void 0}eo(){var t={};return es(this.Za,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;K(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Za=[],t}}var $a=["retriesPerformedSoFar"];class Pa{constructor(i){this.ro=!1,this.no=3e3,this.Za=[],this._instance=i,this.Za=[],this.so=!0,!K(t)&&"onLine"in t.navigator&&(this.so=t.navigator.onLine,this.ao=()=>{this.so=!0,this.oo()},this.lo=()=>{this.so=!1},us(t,"online",this.ao),us(t,"offline",this.lo))}get length(){return this.Za.length}retriableRequest(t){var i=t.retriesPerformedSoFar,e=_(t,$a);tt(i)&&(e.url=ca(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Yn(g({retriesPerformedSoFar:i},e));0===t.statusCode&&Ie.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=i?i:0)+" retries.")}null==e.callback||e.callback(t)}}))}Yn(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.Za.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Ie.warn(s),this.ro||(this.ro=!0,this.uo())}uo(){if(this.ho&&clearTimeout(this.ho),0===this.Za.length)return this.ro=!1,void(this.ho=void 0);this.ho=setTimeout((()=>{this.so&&this.Za.length>0&&this.oo(),this.uo()}),this.no)}oo(){var t=Date.now(),i=[],e=this.Za.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.Za=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var i of(this.ho&&(clearTimeout(this.ho),this.ho=void 0),this.ro=!1,K(t)||(this.ao&&(t.removeEventListener("online",this.ao),this.ao=void 0),this.lo&&(t.removeEventListener("offline",this.lo),this.lo=void 0)),this.Za)){var e=i.requestOptions;try{this._instance._send_request(g({},e,{transport:"sendBeacon"}))}catch(t){Ie.error(t)}}this.Za=[]}}class Ta{constructor(t){this.do=()=>{var t,i,e,r;this.vo||(this.vo={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.vo.lastScrollY=Math.ceil(n),this.vo.maxScrollY=Math.max(n,null!==(t=this.vo.maxScrollY)&&void 0!==t?t:0),this.vo.maxScrollHeight=Math.max(o,null!==(i=this.vo.maxScrollHeight)&&void 0!==i?i:0),this.vo.lastContentY=a,this.vo.maxContentY=Math.max(a,null!==(e=this.vo.maxContentY)&&void 0!==e?e:0),this.vo.maxContentHeight=Math.max(l,null!==(r=this.vo.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get co(){return this._instance.config.scroll_root_selector}getContext(){return this.vo}resetContext(){var t=this.vo;return setTimeout(this.do,0),t}startMeasuringScrollPosition(){us(t,"scroll",this.do,{capture:!0}),us(t,"scrollend",this.do,{capture:!0}),us(t,"resize",this.do)}scrollElement(){if(!this.co)return null==t?void 0:t.document.documentElement;var i=H(this.co)?this.co:[this.co];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}fo(i){var e="y"===i?"scrollTop":"scrollLeft";if(this.co){var r=this.scrollElement();return r&&r[e]||0}return t?"y"===i?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.fo("y")}scrollX(){return this.fo("x")}}var Ca=t=>ao(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Ra{constructor(t,i,e,r){this.xt=t=>{var i=this.po();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.mo(this._instance)};this.yo.register({[Ir]:e})}},this._instance=t,this.bo=i,this.yo=e,this.mo=r||Ca,this.bo.onSessionId(this.xt)}po(){return this.yo.props[Ir]}getSetOnceProps(){var t,i=null==(t=this.po())?void 0:t.props;return i?"r"in i?lo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return es(as(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+N(e)]=i})),t}}class Fa{on(t,i){return this._o[t]||(this._o[t]=[]),this._o[t].push(i),()=>{this._o[t]=this._o[t].filter((t=>t!==i))}}emit(t,i){for(var e of this._o[t]||[])e(i);for(var r of this._o["*"]||[])r(t,i)}constructor(){this._o={}}}var Ia=Me("[SessionId]"),Ma=864e5;class Aa{on(t,i){return this.wo.on(t,i)}constructor(t,i,e){var r;if(this.ko=null,this.So=null,this.xo=[],this.Co=void 0,this.To=!1,this.wo=new Fa,this.Mo=(t,i)=>!(!tt(t)||!tt(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Vr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.vn=t.config,this.yo=t.persistence,this.Ct=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this.Eo=void 0,this._sessionActivityTimestamp=null,this.Io=i||ms,this.Ro=e||ms;var s=this.vn.persistence_name||this.vn.token;if(this._sessionTimeoutMs=1e3*ct(this.vn.session_idle_timeout_seconds||1800,60,36e3,Ia.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Po(),this.Ao="ph_"+s+"_window_id",this.Fo="ph_"+s+"_primary_window_exists",this.Oo()){var n=Ls.ni(this.Ao),o=Ls.ni(this.Fo);n&&!o?this.Ct=n:Ls.ri(this.Ao),Ls.ei(this.Fo,!0)}null!=(r=this.vn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.vn.bootstrap.sessionID),this.Lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return K(this.xo)&&(this.xo=[]),this.xo.push(t),this.Le&&t(this.Le,this.Ct),()=>{this.xo=this.xo.filter((i=>i!==t))}}Oo(){return"memory"!==this.vn.persistence&&!this.yo.ga&&Ls.Xr()}Do(t){t!==this.Ct&&(this.Ct=t,this.Oo()&&Ls.ei(this.Ao,t))}$o(){return this.Ct?this.Ct:this.Oo()?Ls.ni(this.Ao):null}No(t){var i=this.ko;return!Q(i)&&!Q(t)&&5e3>Math.abs(t-i)}qo(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Le||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Le=t,s&&!r||s&&this.No(i)||(this.ko=i,this.yo.register({[ar]:[i,t,e]}))}jo(){var t,i=null==(t=this.vn)?void 0:t.persistence_save_debounce_ms;return tt(i)&&i>0}Bo(){this.jo()?this.yo.refreshKey(ar):(this.yo.flush(),this.yo.load())}Ho(){var t;if(!Q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ko){this.Bo();var i=this.zo();i[1]===this.Le&&i[2]===this._sessionStartTimestamp&&(this.ko=this._sessionActivityTimestamp,this.yo.register({[ar]:[this._sessionActivityTimestamp,null!==(t=this.Le)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.yo.flush())}}Uo(){var t=this.zo()[0],i=tt(t)?t:0,e=tt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Wo(t){return this.Bo(),this.Mo(t,this.Uo())}zo(){var t=this.yo.props[ar];return H(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ko=null,this.Eo=void 0,clearTimeout(this.Vo),this.Vo=void 0,this.qo(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Ia.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ia.error("Invalid sessionID in bootstrap",t)}}(t);return!K(e)&&(i?this.Eo={sessionId:t,sessionStartTimestamp:e}:this.qo(t,(new Date).getTime(),e),!0)}destroy(){this.To=!0,this.Ho(),clearTimeout(this.Vo),this.Vo=void 0,this.Co&&t&&(t.removeEventListener(Yr,this.Co,{capture:!1}),this.Co=void 0),this.xo=[]}Lo(){this.Co=()=>{this.Ho(),this.Oo()&&Ls.ri(this.Fo)},us(t,Yr,this.Co,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.vn.cookieless_mode===Vr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Le;if(e)this.So=r;else if(Q(this.So)||this.So>r||r-this.So>=1e3){var n,o;null==(n=(o=this.yo).syncCookieProperties)||n.call(o),this.So=r}var a=this.zo(),l=a[1],h=a[2],u=!K(s)&&l!==s,d=this.Uo(),v=this.$o(),c=this.Eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ma),p=c?f:tt(h)&&Math.abs(r-h)>Ma,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Mo(r,d);if(b){(b=this.Wo(r))||Ia.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.zo();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.Io(),v=this.Ro(),Ia.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Eo=void 0,g=!0}else v||(v=this.Ro(),g=!0),(_=_||l!==y)&&(Ia.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=tt(d)&&t&&!p?d:r,k=tt(h)?h:(new Date).getTime();this.Do(v),this.qo(l,S,k),t||this.Po();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.xo.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}Po(){this.To||(clearTimeout(this.Vo),this.Vo=setTimeout((()=>{if(!this.To)if(this.Wo((new Date).getTime())){var t=this.Le;this.resetSessionId(),this.wo.emit("forcedIdleReset",{idleSessionId:t})}else this.Po()}),1.1*this.sessionTimeoutMs))}}var Oa=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&D(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>D(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Da(){return(Da=p((function*(){var t=null==e?void 0:e.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),r=null==i?void 0:i.model;return J(r)&&r.length>0?r:void 0}catch(t){return void Ie.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function ja(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var La=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Na=t=>t.toLowerCase(),Ba={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>La(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!La(i,t))))),icontains:(t,i)=>i.map(Na).some((i=>t.map(Na).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Na).every((i=>t.map(Na).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Ba[e.operator];return!!s&&s(e.values,[String(r)])}))}function Ua(t,i,e){return qn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var qa="custom",Ha="i.posthog.com",Va=/^\/static\//,Wa=["/s/","/e/","/i/"];class Ga{constructor(t){this.Go={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ha,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Go[this.apiHost]||(this.Go[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":qa),this.Go[this.apiHost]}Zo(t){if(Va.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Qo(t){var i=Hn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Jo(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Hn(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&Wa.some((t=>0===i.indexOf(t)))){var a=this.Qo(r);if(a){var l,h=this.apiHost,u=this.Ko;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Ko=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Ko,e=this.Qo(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.Jo(t,i,this.uiHost+i);if("flags"===t)return this.Jo(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.Zo(i);if(e)return this.Jo(t,i,""+e+i)}if(this.region===qa)return this.Jo(t,i,this.apiHost+i);var r=Ha+i;switch(t){case"assets":return this.Jo(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Jo(t,i,"https://"+this.region+"."+r)}}}var Ka=Me("[Surveys]"),Ja="seenSurvey_",Ya=t=>{try{var i=(t=>((t,i)=>""+t+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(Ja,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Ka.error("Failed to persist survey seen state",t)}},Qa=["popover","widget","api"],Xa={ignoreConditions:!1,ignoreDelay:!1,displayType:$o},Za=Me("[PostHog ExternalIntegrations]"),tl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class il{constructor(t){this._instance=t}Zs(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Za.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.Zs(tl[n],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=v.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class el{constructor(t,i){this.I=t,this.Os=i,this.Yo=new Map,this.Rs=!1}add(t){var i=this;return p((function*(){if(i.Rs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Yo.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Yo.set(t.name,t);try{var e=t.setup(i.Os);e&&(yield e)}catch(e){var r=i.Yo.get(t.name)===t;r&&i.Yo.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Xo(t)}}))()}getExtension(t){return this.Yo.get(t)}dispose(){if(!this.Rs){this.Rs=!0;var t=Array.from(this.Yo.values()).reverse();for(var i of(this.Yo.clear(),t))this.Xo(i)}}Xo(t){try{var i=null==t.dispose?void 0:t.dispose();i&&V(i.then)&&i.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class rl{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);K(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var sl="extensionsRemoteConfig";class nl{constructor(t){this.Rs=!1,this.instance=t,this.I=Ie,this.tl=t.el,this.kv=new rl(t),this.onEvent=t=>mo(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Rs)return mo((()=>{}));var i=i=>{try{t(i)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},e=this.instance.il.on(sl,i);return this.tl&&i(this.tl),mo(e)},this.rl=new el(Ie.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(ze))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ze);return"string"==typeof t?t:void 0}get library(){return{name:c.LIB_NAME,version:c.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.rl.add(t)}getExtension(t){return this.rl.getExtension(t)}capture(t,i,e){var r=this;return p((function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return mo(this.instance.nl(t))}handleRemoteConfig(t){this.Rs||(this.tl=t,this.instance.il.emit(sl,t))}sendRequest(t,i){var e=this;return p((function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?ca(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?S.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,e.instance._send_request(n)}))}))()}dispose(){this.Rs||(this.Rs=!0,this.rl.dispose())}}var ol={},al=0,ll=()=>{},hl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ul="Surveys module not available",dl="sanitize_properties is deprecated. Use before_send instead",vl="Invalid value for property_denylist config: ",cl=["token","distinct_id",Nr],fl="posthog",pl=!ha&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),gl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},_l=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:hs(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ll,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&J(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Ie.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:Kr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ka},error_tracking:{},_onCapture:ll},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:hn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:gl(t),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),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(i))},ml=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],yl=t=>{var i={};for(var e of ml){var r=e[0],s=e[1];K(t[r])||(i[s]=t[r])}var n=rs({},i,t),o=t.__preview_external_dependency_versioned_paths;return K(o)||(K(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),J(o)&&K(t.asset_host)&&(n.asset_host=o)),H(t.property_blacklist)&&(K(t.property_denylist)?n.property_denylist=t.property_blacklist:H(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ie.error(vl+t.property_denylist)),n};class bl{constructor(){this.__forceAllowLocalhost=!1}get sl(){return this.__forceAllowLocalhost}set sl(t){Ie.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class wl{al(t,i){if(t){var e=this.Yo.indexOf(t);-1!==e&&this.Yo.splice(e,1)}return this.Yo.push(i),null==i.initialize||i.initialize(),i}ol(){return this.config.cookieless_mode===Vr||this.config.cookieless_mode===Hr&&this.consent.isRejected()}ll(){if(!this.ol()&&this.get_distinct_id()===Lr){var t=this.persistence;if(t){this.ul()||t.load(!0);var i=this.get_distinct_id();if(!i||i===Lr){var e=this.config.get_device_id(ms());this.register({distinct_id:e,$device_id:e}),t.set_property(Fr,Wr)}this.hl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new bl,this.dl=!1,this.version=c.LIB_VERSION,this.vl=new Set,this.cl="",this.il=new Fa,this.Yo=[],this.fl=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=_l(),this.SentryIntegration=jn,this.sentryIntegration=t=>function(t,i){var e=Dn(t,i);return{name:On,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pl=!1,this.gl=null,this.ml=null,this.yl=null,this.scrollManager=new Ta(this),this.pageViewManager=new Ln(this),this.rateLimiter=new To(this),this.requestRouter=new Ga(this),this.consent=new Ns(this),this.externalIntegrations=new il(this);var i=null!==(t=wl.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=J(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=J(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Ie.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==fl){var r,s=null!==(r=ol[e])&&void 0!==r?r:new wl;return s._init(t,i,e),ol[e]=s,ol[fl][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;void 0===e&&(e={});var o,a=J(i)?i.trim():"";if(!a)return Ie.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=_l(e.defaults),e.debug=this.bl(e.debug),this._l=e,this.wl=[],e.person_profiles?this.ml=e.person_profiles:e.process_person&&(this.ml=e.process_person);var l=_l(e.defaults),h=yl(e),u=rs({},l,h,{name:r,token:a});W(l.rageclick)&&W(h.rageclick)&&(u.rageclick=rs({},l.rageclick,h.rageclick)),W(l.session_recording)&&W(h.session_recording)&&(u.session_recording=rs({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&Ie.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:yo;var d=this.ul();if(this.persistence=new _o(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _o(g({},this.config,{persistence:"sessionStorage"}),d,!1),this.cl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ls.Xr()){var v=Ls.ni(this.cl);H(v)&&v.forEach((t=>{J(t)&&this.vl.add(t)}))}else Ls.ri(this.cl);var f=g({},this.persistence.props),p=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.kl=new Ea((t=>this.Sl(t)),this.config.request_queue_config),this.xl=new Pa(this),this.__request_queue=[];var _=this.ol();if(_||(this.sessionManager=new Aa(this),this.sessionPropsManager=new Ra(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Cl()}))),this.Tl(),this.config.__preview_deferred_init_extensions?(Ie.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ml(_)}),0)):(Ie.info("Initializing extensions synchronously"),this.Ml(_)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Ie.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:f,s:p}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=g({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Fr);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Wr)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Gr)Ie.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var w=this.config.get_device_id(ms()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Fr,e.bootstrap.isIdentifiedID?Gr:Wr),this.register({distinct_id:m,$device_id:x})}}if(_)this.register_once({distinct_id:Lr,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ms());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Fr,Wr)}return us(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||ms();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Fr,Gr)),i()},s=e.user();"then"in s&&V(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||An.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(An.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(An.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,Qr),identify:t=>i(t,Zr),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.El())):this.El(),V(this.config._onCapture)&&this.config._onCapture!==ll&&(Ie.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ie.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 Da.apply(this,arguments)}().then((t=>{t&&this.register({[Ue]:t})})).catch(ll),this}Il(t){var i=t;return J(i.name)&&V(i.setup)}Rl(t,i){this.Il(t)?i.push((()=>{this.Pl().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((i=>{Ie.error('Failed to dispose browser extension "'+t.name+'"',i)}))})):this.Yo.push(t)}Tl(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=wl.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.Al)||r.call(this),this.Al=void 0,this.featureFlags=new o(this)),V(this.featureFlags.onReloading)&&V(this.featureFlags.setup)?this.Al||(this.Al=this.featureFlags.onReloading((()=>{this.il.emit("featureFlagsReloading",!0)})),this.Pl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Ml(t){var i,e,r,s,n,o,a,l=performance.now(),h=g({},wl.__defaultExtensionClasses,this.config.__extensionClasses),u=[];h.exceptions&&this.Yo.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.Yo.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Yo.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Yo.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Yo.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Rl(this.autocapture=new h.autocapture(this),u),h.surveys&&this.Rl(this.surveys=null!==(e=this.surveys)&&void 0!==e?e:new h.surveys(this),u),h.logs&&this.Rl(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this),u),h.metrics&&this.Yo.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new h.metrics(this)),h.conversations&&this.Yo.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new h.conversations(this)),h.productTours&&this.Yo.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Yo.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Yo.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Yo.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Yo.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,In)),h.toolbar&&this.Yo.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new h.toolbar(this)),h.experiments&&this.Yo.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new h.experiments(this)),this.Yo.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.Fl){var t=this.Fl;this.Fl=void 0,this.Yo.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.Ol(u,l)}Ol(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Ol(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Ie.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Br]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[zr]:r}),this.config.__preview_deferred_init_extensions&&Ie.info("PostHog extensions initialized ("+r+"ms)")}za(t){var i;if(!r||!r.body)return Ie.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.za(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Fl=t),this.el=t,this.compression=void 0,t.ok){var e,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=j(s.supportedCompression,yo)?yo:j(s.supportedCompression,bo)?bo:void 0),null!=(e=s.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.ml?this.ml:Kr}),null==(i=this.Ll)||i.handleRemoteConfig(t),this.Yo.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}El(){try{this.config.loaded(this)}catch(t){Ie.critical("`loaded` function failed",t)}if(this.Dl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ol())&&this.$l()}),1),this.Nl=new Ro(this),this.Nl.load()}Dl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.kl)||t.enable())}_dom_loaded(){this.is_capturing()&&is(this.__request_queue,(t=>this.Sl(t))),this.__request_queue=[],this.Dl()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.ql()&&this.capture(Xr),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.kl)||r.unload(),null==(s=this.xl)||s.unload()):this.ql()&&this.capture(Xr,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?pl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(K(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4;var n,o,a,h,u,d=null!==(i=s.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&K(s.compression)&&s.data&&(s.compression=bo),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(h=(H(n=s.data)?n:[n]).map((t=>g({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),H(t)?t.map((t=>g({},t,{sent_at:i}))):g({},t,{sent_at:i})}(s.data))),s.url=xa(s.url,s.method,s.compression,s.timestampMode);var v=Sa.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){ya(t)?Ie.warn(t):Ie.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===yo&&l&&"undefined"!=typeof Promise&&!da?_a(s).then((t=>{f(t)})).catch((i=>{if(Ri(i))return da=!0,void f(g({},s,{compression:void 0,url:xa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return Ri(t)||i===Pi})(i)&&(da=!0),f(s)})):c(s)})(g({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Sl(t){this.xl?this.xl.retriableRequest(t):this._send_request(t)}_execute_array(t){al++;try{var i,e=[],r=[],s=[];is(t,(t=>{if(t)if(H(i=t[0]))s.push(t);else if(V(t))try{t.call(this)}catch(i){Ie.error("Error executing queued PostHog call",t,i)}else H(t)&&"alias"===i?e.push(t):H(t)&&-1!==i.indexOf("capture")&&V(this[i])?s.push(t):r.push(t)}));var n=function(t,i){is(t,(function(t){try{if(H(t[0])){var e=i;es(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Ie.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{al--}}push(t){if(al>0&&H(t)&&J(t[0])){var i=wl.prototype[t[0]];V(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.kl){if(this.is_capturing())if(!K(t)&&J(t)){this.ll();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var h=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=i&&i.$current_url&&!J(null==i?void 0:i.$current_url)&&(Ie.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.jl||Ie.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 u=new Date,d=(null==e?void 0:e.timestamp)||u,v=bi(null==e?void 0:e.uuid,ms),c={uuid:v,event:t,properties:this.calculateEventProperties(t,i||{},d,v)};t===Qr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),h&&(c.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var f="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(pr);(null==e?void 0:e.$set)&&!f&&(c.$set=null==e?void 0:e.$set);var p=null==e?void 0:e.$unset;p&&(c.$unset=p);var _,m,y,b=f?void 0:this.Bl(null==e?void 0:e.$set_once,t!==ts,t===Zr);if(b&&(c.$set_once=b),null!=e&&e._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>J(t)?t.slice(0,s):t,a=new Set,c=function t(i,e){if(i!==Object(i))return o?o(i):i;if(!a.has(i)){var r;if(a.add(i),H(i))r=[],is(i,(i=>{r.push(t(i))}));else{var s={};es(i,((i,e)=>{a.has(i)||(s[e]=t(i,e))})),r=s}return r}}(n)),c.timestamp=d,K(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),f&&(c.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return w.forEach(r),i.forEach(r),e}(c.properties,cl)),t===ko||t===Eo){var x=null==i?void 0:i.$survey_id,S=null==i?void 0:i.$survey_iteration;Ya({id:x,current_iteration:S}),c.$set=g({},c.$set,{[(_={id:x,current_iteration:S},m=t===Eo?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===So&&(c.$set=g({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var k=null==i?void 0:i.$product_tour_type;k&&(c.$set=g({},c.$set,{["$product_tour_last_seen_date/"+k]:(new Date).toISOString()}))}var E=g({},c.properties.$set,c.$set);if(G(E)||this.setPersonPropertiesForFlags(E),!X(this.config.before_send)){var P=this.Jn(c);if(!P)return;(c=P).uuid=bi(c.uuid,ms)}this.il.emit("eventCaptured",c);var T=null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),C={method:"POST",url:T,data:c,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey,transport:null==e?void 0:e.transport};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Sl(C):this.kl.enqueue(C),c}Ie.critical("This capture call is ignored due to client rate limiting.")}}else Ie.error("No event name provided to posthog.capture")}else Ie.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}getExtension(t){var i;return null==(i=this.Ll)?void 0:i.getExtension(t)}Pl(){var t;return null!==(t=this.Ll)&&void 0!==t?t:this.Ll=new nl(this)}nl(t){this.fl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.fl.indexOf(t);-1!==e&&this.fl.splice(e,1)}}}Hl(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.yl=null,this.persistence.get_property(Fr)===Wr&&(null==(r=this.sessionPersistence)||r.clear(),this.vl.clear(),this.zl()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(i,e,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.Hl();var l=a?void 0:this.persistence.remove_event_timer(i),u=g({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.ol()&&(u[Nr]=!0),"$snapshot"===i){var d=g({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!J(u.distinct_id)&&!Z(u.distinct_id)||Y(u.distinct_id))&&Ie.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,f=function(i,e,r,n){var o,a,l,u;if(void 0===n&&(n=!1),!h)return{};var d,v=i?[...Qn,...e||[]]:[],f=function(t){for(var i=0;_i.length>i;i++){var e=_i[i],r=e[1],s=e[0].exec(t),n=s&&(V(r)?r(s,t):r);if(n)return n}return["",""]}(h),p=f[0],g=f[1],_=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};K(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(l=t.screen)?void 0:l.width,S=null==t||null==(u=t.screen)?void 0:u.height,k=null==t?void 0:t.devicePixelRatio;K(b)||(y.userAgentDataPlatform=b),K(w)||(y.maxTouchPoints=w),K(x)||(y.screenWidth=x),K(S)||(y.screenHeight=S),K(k)||(y.devicePixelRatio=k);var E,P,T,C,R,F,I,M,A=rs(as({$os:p,$os_version:g,$browser:fi(h,navigator.vendor,_,m),$device:mi(h),$device_type:(P=h,T=y,M=mi(P),M===bt||M===yt||"Kobo"===M||"Kindle Fire"===M||M===Yt?mt:M===Nt||M===zt||M===Bt||M===Gt?"Console":M===xt?"Wearable":M?pt:"Android"===(null==T?void 0:T.userAgentDataPlatform)&&(null!==(C=null==T?void 0:T.maxTouchPoints)&&void 0!==C?C:0)>0?600>Math.min(null!==(R=null==T?void 0:T.screenWidth)&&void 0!==R?R:0,null!==(F=null==T?void 0:T.screenHeight)&&void 0!==F?F:0)/(null!==(I=null==T?void 0:T.devicePixelRatio)&&void 0!==I?I:1)?pt:mt:"Desktop"),$timezone:ho(),$timezone_offset:uo()}),{$current_url:Wn(n?xi(null==s?void 0:s.href):null==s?void 0:s.href,v,Zn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:gi(h,navigator.vendor,_,m),$browser_language:so(),$browser_language_prefix:(E=so(),"string"==typeof E?E.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:c.LIB_NAME,$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return c.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=c.SDK_DIST_CHANNEL),A}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),_=p.windowId;u.$session_id=p.sessionId,u.$window_id=_}this.sessionPropsManager&&rs(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&rs(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.xl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===qa&&(u.$lib_custom_api_host=this.config.api_host),v=i!==Qr||a?i!==Xr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=rs(u,v),i===Qr&&r&&(u.title=r.title),!K(l)){var y=n.getTime()-l;u.$duration=parseFloat((y/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();es(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t]}));var x={};if(this.fl.length>0)for(var S of this.fl.slice())try{rs(x,S())}catch(t){Ie.error("Failed to produce browser extension event properties",t)}(u=rs({},f,b,w,g({},x,u))).$is_identified=this._isIdentified(),H(this.config.property_denylist)?es(this.config.property_denylist,(function(t){delete u[t]})):Ie.error(vl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Ie.error(dl),u=k(u,i));var E=this.Ul();return u.$process_person_profile=E,E&&!a&&this.Wl("_calculate_event_properties"),u}Bl(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Ul())return t;if(this.dl&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=rs({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ie.error(dl),o=a(o,"$set_once")),i&&(this.dl=!0),G(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.Hl(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.vl.add(t))),this.zl()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.vl.delete(t),this.zl()}Vl(t,i){this.register({[t]:i})}Cl(){this.vl.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.vl.clear(),this.zl()}zl(){var t;if(this.cl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.ga||!Ls.Xr())Ls.ri(this.cl);else{var i=[];this.vl.forEach((t=>i.push(t))),i.length>0?Ls.ei(this.cl,i):Ls.ri(this.cl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.il.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ul}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:ul})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:ul})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Xa),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:ul}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:ul})}Gl(t){return!t||Y(t)?(Ie.critical("Unique user id has not been set in posthog.identify"),!1):t===Lr?(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ie.uninitializedWarning("posthog.identify");if(Z(t)&&(t=t.toString(),Ie.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Gl(t)&&this.Wl("posthog.identify")){this.ll();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Hl(!1),o=this.persistence.ba(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ze)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(qe)&&(this.unregister(qe),this.register({distinct_id:t}));var h,u=(this.persistence.get_property(Fr)||Wr)===Wr,d=t!==l,v=!d&&u;if(d&&u)this.persistence.set_property(Fr,Gr),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture(Zr,{distinct_id:t,$anon_distinct_id:l},{$set:i||{},$set_once:e||{}}),this.yl=Ua(t,i,e),null==(h=this.featureFlags)||h.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Fr,Gr);var c=i||{},f=e||{};this.setPersonPropertiesForFlags({$set:c,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture("$set",{$set:c,$set_once:f}),this.yl=Ua(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Pr)):v&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Sa(a)}}}setPersonProperties(t,i){if((t||i)&&this.Wl("posthog.setPersonProperties")){var e=Ua(this.get_distinct_id(),t,i);this.yl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.yl=e):Ie.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(H(t)?t:[t]).filter((t=>J(t)&&t.length>0));0!==e.length&&this.Wl("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.yl=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.Hl();var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},s,{[t]:i})}),n||e){var o={$group_type:t,$group_key:i};e&&(o.$group_set=e),this.capture(ts,o)}e&&this.setGroupPropertiesForFlags({[t]:e}),n&&!e&&this.reloadFeatureFlags()}else Ie.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Wl("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=it(t)?t:null==t?void 0:t.resetDeviceID,e=it(t)||null==t?void 0:t.bootstrap;this.Zl(i,!1,e)}Zl(t,i,e){var r,s,n;if(void 0===i&&(i=!1),Ie.info("reset"),!this.__loaded)return Ie.uninitializedWarning("posthog.reset");var o=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this._l)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.Ua());var a=this.get_property(ze),l=this.get_property(Ue),h=this.get_property(ir),u=this.is_capturing();this.consent.reset(),i||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.ba?void 0:n.ba(),v=!1;try{var c,f,p,_,m,y,b,w,x,S,k,E,P;if(null==(c=this.persistence)||c.clear(),null==(f=this.sessionPersistence)||f.clear(),this.vl.clear(),this.zl(),K(h)||null==(S=this.persistence)||S.register({[ir]:h}),null==(p=this.surveys)||p.reset(),null==(_=this.featureFlags)||_.reset(),null==(m=this.conversations)||m.reset(),null==(y=this.logs)||y.reset(),null==(b=this.metrics)||b.reset(),null==(w=this.persistence)||w.set_property(Fr,Wr),null==(x=this.sessionManager)||x.resetSessionId(),this.yl=null,this.config.cookieless_mode===Vr)this.register_once({distinct_id:Lr,$device_id:null},"");else{var T=this.config.get_device_id(ms());this.register_once({distinct_id:T,$device_id:t?T:a},""),t||K(l)||this.register({[Ue]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.ol()||(null==(P=this.persistence)||P.set_property(Fr,e.isIdentifiedID?Gr:Wr),this.register({distinct_id:e.distinctID})),null==(k=this.featureFlags)||k.initialize(),!(K(o)||null!=(E=this.sessionManager)&&E.setBootstrapSessionId(o,!0))){var C=g({},e);delete C.sessionID,this.config.bootstrap=C}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var R;d&&(null==(R=this.persistence)||null==R.Sa||R.Sa(v))}this.reloadFeatureFlags()}shutdown(t){var i=this;return p((function*(){var t,e,r,s,n;if(i.__loaded){i.Pl().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.kl)||s.unload(),null==(n=i.xl)||n.unload();try{var o;null==(o=i.featureFlags)||o.destroy()}catch(t){Ie.error("Error while destroying feature flags",t)}}else Ie.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Ql()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Jl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Ne)?(Ie.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wl("posthog.alias")?(K(i)&&(i=this.get_distinct_id()),t!==i?(this.Vl(qe,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ie.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(W(t)){var e,r,s,n,o,a,l,h,u,d,v,f;rs(this.config,yl(t));var p=this.ul();null==(e=this.persistence)||e.update_config(this.config,i,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _o(g({},this.config,{persistence:"sessionStorage"}),p,!1);var _,m=this.bl(this.config.debug);it(m)&&(this.config.debug=m),it(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,ks.Xr()&&ks.ei("ph_debug",!0),Ie.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,ks.Xr()&&ks.ri("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.Ua()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.hl(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){c.LIB_NAME=t,c.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:wl.Kl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:fl;return i!==fl&&(i=fl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Fr))===Gr||(null==(i=this.sessionPersistence)?void 0:i.get_property(Fr))===Gr}Ul(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===Kr&&!this._isIdentified()&&G(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[qe])&&(null==(i=this.persistence)||null==(i=i.props)||!i[jr]))}ql(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Ul()||this.Wl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wl(t){return"never"===this.config.person_profiles?(Ie.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Vl(jr,!0),!0)}ul(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Hr)}hl(){var t,i,e,r,s,n=this.ul();return this.is_capturing()||null==(e=this.logs)||e.Yl(),(null==(t=this.persistence)?void 0:t.ga)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i.ga)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.vl.clear(),this.zl()),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==Vr){if(this.ol()){var e,r,s,n,o;this.Zl(!0,!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Aa(this),this.pageViewManager=new Ln(this),this.persistence&&(this.sessionPropsManager=new Ra(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=wl.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.al(this.sessionRecording,new l(this)),this.el&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.el)))}var h,u;this.consent.optInOut(!0),this.hl(),this.Dl(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==Hr&&(null==(h=this.surveys)||h.loadIfEnabled()),(K(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$l()}else Ie.warn(hl)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==Vr?(this.config.cookieless_mode===Hr&&this.consent.isOptedIn()&&this.Zl(!0,!0),this.consent.optInOut(!1),this.hl(),this.config.cookieless_mode===Hr&&(this.register({distinct_id:Lr,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(i=this.sessionManager)||i.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.$l(),this.Dl())):Ie.warn(hl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Vr||(this.config.cookieless_mode===Hr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hl()}_is_bot(){return e?Oa(e,this.config.custom_blocked_useragents):void 0}$l(){r&&("visible"===r.visibilityState?this.pl||(this.pl=!0,this.capture(Qr,{title:r.title},{send_instantly:!0}),this.gl&&(r.removeEventListener(Jr,this.gl),this.gl=null)):this.gl||(this.gl=this.$l.bind(this),us(r,Jr,this.gl)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Ua(){var t=this._l||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ie.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,r,s){var n=i in t&&!X(t[i]),o=e in t&&!X(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ie)}Jn(t){var i;if(X(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(st),r=H(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),X(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return rt(t.event)?Ie.warn(o+". This can cause unexpected behavior."):Ie.info(o),null}s.properties&&!G(s.properties)||Ie.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Ie.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&X(s.properties[a]))return Ie.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ks)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}bl(t){var i=it(t)&&!t,e=ks.Xr()&&"true"===ks.ti("ph_debug");return!i&&(!!e||t)}}wl.__defaultExtensionClasses={},wl.Kl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=os(t.prototype[i[e]])}(wl,["identify"]);class xl{constructor(t){this.disabled=!1===t;var i=W(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Sl="$copy_autocapture",kl=Me("[AutoCapture]");function El(t,i){return i.length>t?i.slice(0,t)+"...":i}function $l(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ws(i));return i}function Pl(i,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Ws(i))return{props:{}};for(var d=[i],v=new Set([i]),c=i;c.parentNode&&!Gs(c,"body")&&Ys>d.length;)if(Js(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Ws(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,m=[],y={},b=!1,w=!1;if(es(d,(t=>{var i=gn(t);if(Gs(t,"a")){var e=t.getAttribute("href");b=!!(i&&e&&En(e))&&(u?xi(e):e)}j(Zs(t),"ph-no-capture")&&(w=!0),m.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};sn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?El(1024,$n(t)):El(1024,en(t)));var a=Zs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),es(t.attributes,(function(e){var n;if((!_n(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&En(e.value)&&(!J(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Qs(a).join(" ")),o["attr__"+e.name]=El(1024,"href"===e.name&&s?xi(a):a)}}));for(var l=1,h=1,u=t;u=$l(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!gn(t))return{};var i={};return es(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&En(r)&&(i[e]=r)}})),i}(t);rs(y,r)})),w)return{props:{},explicitNoCapture:w};if(a||(m[0].$el_text=Gs(i,"a")||Gs(i,"button")?$n(i):en(i)),b){var x,S;m[0].attr__href=b;var k=null==(x=Hn(b))?void 0:x.host,E=null==t||null==(S=t.location)?void 0:S.host;k&&E&&k!==E&&(p=b)}return{props:rs({$event_type:n.type,$ce_version:1},h?{}:{$elements:m},{$elements_chain:(_=m,function(t){return t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return ss(n).sort(((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r})).forEach((t=>{var i=t[1];return o[Tn(t[0].toString())]=Tn(i.toString())})),(r+=":")+ss(o).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Cn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ss(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}class Tl{constructor(t){this.name="autocapture",this.Ts=!1,this.Ms=null,this.Es=!1,this.Is=!1,this.vn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Rs=!1,this.Ps=t,this.Ps.refresh(this.vn),this.rageclicks=new xl(this.vn.rageclick),this.As=null}setup(t){this.Fs(),this.Os=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Rs?i.dispose():(this.Ls=i,this.startIfEnabled())}dispose(){var t;this.Rs||(this.Rs=!0,this.Os=void 0,null==(t=this.Ls)||t.dispose(),this.Ls=void 0,this.Ds())}$s(){return this.Ps.refresh(this.vn),this.vn}Fs(){var t,i;return this.$s(),this.vn.url_allowlist=null==(t=this.vn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.vn.url_ignorelist=null==(i=this.vn.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.vn}Ns(){if(this.isBrowserSupported()){if(t&&r){var i=this.qs=i=>{i=i||(null==t?void 0:t.event);try{this.js(i)}catch(t){kl.error("Failed to capture event",t)}};if(us(r,"submit",i,{capture:!0}),us(r,"change",i,{capture:!0}),us(r,"click",i,{capture:!0}),this.$s().capture_copied_text){var e=this.Bs=i=>{i=i||(null==t?void 0:t.event);try{this.js(i,Sl)}catch(t){kl.error("Failed to capture clipboard event",t)}};us(r,"copy",e,{capture:!0}),us(r,"cut",e,{capture:!0}),us(r,"paste",e,{capture:!0})}}}else kl.info("Disabling Automatic Event Collection because this browser is not supported")}Ds(){this.qs&&(null==r||r.removeEventListener("submit",this.qs,!0),null==r||r.removeEventListener("change",this.qs,!0),null==r||r.removeEventListener("click",this.qs,!0),this.qs=void 0),this.Bs&&(null==r||r.removeEventListener("copy",this.Bs,!0),null==r||r.removeEventListener("cut",this.Bs,!0),null==r||r.removeEventListener("paste",this.Bs,!0),this.Bs=void 0),this.Ts=!1}startIfEnabled(){!this.Rs&&this.Os&&this.isEnabled&&!this.Ts&&(this.Ns(),this.Ts=!0)}onRemoteConfig(t){if(!this.Rs)if(this.Es=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Is=i.elementsChainAsString);var e,r=i.autocapture_opt_out;it(r)&&(null==(e=this.Os)||e.kv.set(Ve,r),this.Ms=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.As=t}getElementSelectors(t){var i,e=[];return null==(i=this.As)||i.forEach((i=>{var s=null==r?void 0:r.querySelectorAll(i);null==s||s.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Rs)return!1;var e=null==(t=this.Os)?void 0:t.kv.get(Ve),r=this.Ms,s=this.$s(),n=s.remoteRequestsDisabled&&!this.Es;if(Q(r)&&!it(e)&&!n)return!1;var o=null!==(i=this.Ms)&&void 0!==i?i:!!e;return!!s.enabled&&!o}js(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=rn(i);Ks(r)&&(r=r.parentNode||null);var s,n=this.Fs();"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&cn(r,n.rageclick)&&this.js(i,"$rageclick");var o=e===Sl,a=o?g({},n,{dom_event_allowlist:void 0}):n;if(r&&function(i,e,r,s,n,o){var a;if(!t||fn(i))return!1;if(null!=r&&r.url_allowlist&&!Xs(r.url_allowlist,o))return!1;if(null!=r&&r.url_ignorelist&&Xs(r.url_ignorelist,o))return!1;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>e.type===t)))return!1}var h=pn(i,s),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(K(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,r))return!1;if(!nn(d,null==r?void 0:r.css_selector_allowlist))return!1;if(nn(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:an))return!1;try{var v=t.getComputedStyle(i);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var c=i.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return u?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(sn.indexOf(c)>-1||"true"===i.getAttribute("contenteditable"))}}(r,i,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=Pl(r,{e:i,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Is,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),e===Sl){var v=i.type||"clipboard";if("paste"!==v){var c,f,p=null==t||null==(c=t.getSelection())?void 0:c.toString(),_=tn(p);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.Os)||l.capture(e,u).catch((t=>kl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return V(null==r?void 0:r.querySelectorAll)}}class Cl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=W(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Ua(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var Rl=Me("[ExceptionAutocapture]"),Fl=()=>{},Il=t=>{var i;if(V(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Ml(t,i,e){try{if(!(i in t))return Fl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return V(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=Il(e);n;){if(n.next===s)return void(n.next=r.next);n=Il(e=n.next)}else t[i]=r.next}}catch(t){return Fl}}var Al=Me("[TracingHeaders]"),Ol=Me("[Web Vitals]"),Dl=9e5,jl=["CLS","FCP","INP","LCP"],Ll=["INP","LCP"],Nl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Bl="disabled",zl="lazy_loading",Ul="awaiting_config",ql="missing_config";Me("[SessionRecording]"),Me("[SessionRecording]");var Hl="[SessionRecording]",Vl=Me(Hl),Wl=Me("[Heatmaps]");function Gl(t){return W(t)&&"clientX"in t&&"clientY"in t&&Z(t.clientX)&&Z(t.clientY)}var Kl=Me("[Product Tours]"),Jl=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Xe))},Yl=["$set_once","$set"],Ql=Me("[SiteApps]"),Xl="Error while initializing PostHog app with config id ",Zl=(t,i)=>null!=t&&t.then?t.then(i):i(t),th="SDK is not enabled or survey functionality is not yet loaded",ih="Disabled. Not loading surveys.";class eh{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Xl=!1,this.tu=[],this.eu=null,this.iu=null,this.Rs=!1,this.ru=new Set,this.onRemoteConfig=t=>{if(!this.Rs&&!this.vn.disableSurveys){if(!t.ok)return Ka.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(X(i))return Ka.warn("Flags not loaded yet. Not loading surveys.");this.nu=it(i)?i:i.length>0,Ka.info("flags response received, isSurveysEnabled: "+this.nu),this.loadIfEnabled()}},this.Ps=t,this.su=i}setup(t){if(!this.Rs)return this.au=t,Zl(t.kv.initialize(),(()=>{if(this.au===t&&!this.Rs){this.au=void 0,this.Os=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Rs?i.dispose():(this.Ls=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Rs||(this.Rs=!0,this.au=void 0,this.Os=void 0,null==(t=this.Ls)||t.dispose(),this.Ls=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.tu=[],this.eu=null,this.ru.forEach((t=>clearTimeout(t))),this.ru.clear())}get vn(){return this.Ps.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;elocalStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Rs&&this.Os){var t=this.vn;if(!this._surveyManager)if(this.Xl)Ka.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ka.info(ih);else if(t.cookielessMode&&this.Ps.isOptedOut())Ka.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ps.getExtensions();if(i){if(!K(this.nu)||t.advancedEnableSurveys){var e=this.nu||t.advancedEnableSurveys;this.Xl=!0;try{var r=i.generateSurveys;if(r)return this.ou(r,e),void(this.Xl=!1);var s=i.loadExternalDependency;if(!s)return this.lu(qr),void(this.Xl=!1);s((t=>{try{if(this.Rs)return;var i=this.Ps.getExtensions();t||null==i||!i.generateSurveys?this.lu("Could not load surveys script",t):this.ou(i.generateSurveys,e)}finally{this.Xl=!1}}))}catch(t){throw this.Xl=!1,this.lu("Error initializing surveys",t),t}}}else Ka.error("PostHog Extensions not found.")}}}ou(t,i){this.Rs||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ps.createEventReceiver(),Ka.info("Surveys loaded successfully"),this.uu({isLoaded:!0}))}lu(t,i){Ka.error(t,i),this.uu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.tu.push(t),this._surveyManager&&this.uu({isLoaded:!0}),()=>{this.tu=this.tu.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Os)&&void 0!==e?e:this.su;if(r&&!this.Rs){if(this.vn.disableSurveys)return Ka.info(ih),t([]);var s=r.kv.get(wr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.hu()&&this.getSurveys((()=>{}),!0));if(this.eu)this.eu.then((i=>{this.Rs||t(i.surveys,i.context)})).catch((t=>Ka.error("Error in survey callback",t)));else{var n=this.du("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.vn.requestTimeoutMs}).then((t=>{try{return this.vu(r,t)}catch(t){return Ka.error("Error processing surveys response",t),this.vu(r,{statusCode:0,error:t})}}),(t=>this.vu(r,{statusCode:0,error:t})));this.eu=n;var o=()=>{this.eu===n&&(this.eu=null)};n.then((i=>{o(),this.Rs||t(i.surveys,i.context)}),o).catch((t=>Ka.error("Error in survey callback",t)))}}}du(t,i){var e=this.Os;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(th)})))}vu(t,i){if(this.Rs)return{surveys:[],context:{isLoaded:!1,error:th}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Ka.error(r):i.error||Ka.warn(r),this.iu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.iu=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(ja(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[wr]:n,[xr]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}hu(){return this.cu()&&!this.eu&&!this.fu()}cu(){var t,i,e=null==(t=null!==(i=this.Os)&&void 0!==i?i:this.su)?void 0:t.kv.get(xr);return Z(e)&&Date.now()-e>3e5}fu(){return Z(this.iu)&&3e5>Date.now()-this.iu}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ya(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}uu(t){for(var i of this.tu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ka.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!X(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ka.warn("init was not called")}pu(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}gu(t){if(X(this._surveyManager))return{eligible:!1,reason:th};var i="string"==typeof t?this.pu(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}mu(t){if(X(this._surveyManager))return{eligible:!1,reason:th};var i="string"==typeof t?this.pu(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(X(this._surveyManager))return Ka.warn("init was not called"),{visible:!1,disabledReason:th};var i=this.mu(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return X(this._surveyManager)?(Ka.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:th})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.mu(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var s;if(X(this._surveyManager))Ka.warn("init was not called");else{var n="string"==typeof t?this.pu(t):t;if(null!=n&&n.id)if(Qa.includes(n.type)){var o=null==r?void 0:r.querySelector(i);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){Ka.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var t,i;this.ru.delete(a),this.Rs||(Ka.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(n,o,e),Ka.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.ru.add(a)}else this._surveyManager.renderSurvey(n,o,e);else Ka.warn("Survey element not found")}else Ka.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Ka.warn("Survey not found")}}displaySurvey(t,i){var e;if(X(this._surveyManager))Ka.warn("init was not called");else{var r=this.pu(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==$o&&i.initialResponses&&Ka.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.gu(r);if(!n.eligible)return void Ka.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Ka.warn("Survey not found")}}cancelPendingSurvey(t){X(this._surveyManager)?Ka.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function rh(t,i,e){if(X(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class sh{constructor(t){this.yu=new Set,this.bu=new Set,this._u=new Fa,this.wu=(t,i)=>this.ku(t,i)&&this.Su(t,i)&&this.xu(t,i)&&this.Cu(t,i),this.ku=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;K(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Tu=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Tu)||t.call(this),this.Tu=void 0,this._u=new Fa}register(t){var i,e;if(!K(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.yu.add(t),null==(i=t.steps)||i.forEach((t=>{this.bu.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.yu.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.yu.clear(),this.bu.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.bu.has(t)||this.bu.has(i.event))&&this.yu.forEach((t=>{this.Mu(i,t)&&this._u.emit("actionCaptured",t.name)}))}Eu(t){this.onAction("actionCaptured",(i=>t(i)))}Mu(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.wu(t,e))return!0;return!1}onAction(t,i){return this._u.on(t,i)}Su(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!rh(r,i.url,i.url_matching||"contains"))return!1}return!0}xu(t,i){return!!this.Iu(t,i)&&!!this.Ru(t,i)&&!!this.Pu(t,i)}Iu(t,i){var e;if(null==i||!i.href)return!0;var r=this.Au(t);if(r.length>0)return r.some((t=>rh(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&rh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Ru(t,i){var e;if(null==i||!i.text)return!0;var r=this.Au(t);if(r.length>0)return r.some((t=>rh(t.text,i.text,i.text_matching||"exact")||rh(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!X(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>rh(t,n,o))))}Pu(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}Au(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Cu(t,i){return null==i||!i.properties||0===i.properties.length||za(i.properties.reduce(((t,i)=>{var e=H(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class nh{constructor(t){var i;this.Fu=[],this._instance=t,this.Ou=new Map,this.Lu=new Map,this.Du=new Map,this.$u=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.Nu(t)))}qu(t){return!1}ju(){return null}Bu(t){}Hu(){}zu(t,i){return!!t&&za(t.propertyFilters,null==i?void 0:i.properties)}Uu(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}Wu(t,i,e){var r=(e===wo?this.Ou:this.Lu).get(t),s=[];return this.Vu((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.zu(n,i)}))}register(t){this.Gu(t,!1)}replace(t){this.Gu(t,!0)}Gu(t,i){var e;K(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Zu(t,i),this.Qu(t,i))}Qu(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.Du.clear(),0!==e.length){this.Ju||(this.Ju=new sh(this._instance),this.Ju.init(),this.Ju.Eu((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.Du.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.Du.set(i.name,s)}}))})),i?this.Ju.replace(r):this.Ju.register(r)}else{var s;i&&(null==(s=this.Ju)||s.replace([]))}}Ku(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}Zu(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.Uu(t,wo),a=this.Uu(t,xo);i?(this.Ou=o,this.Lu=a):(this.Ku(this.Ou,o),this.Ku(this.Lu,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Tu)&&void 0!==e||(this.Tu=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Yu(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Xu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.th([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.eh(n),void this.ih([n])}if(this.Lu.has(t)){var a=this.Wu(t,i,xo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.th(a.map((t=>t.id))),a.forEach((t=>this.rh(t.id))))}if(this.Ou.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Ou.get(t)});var l=this.Wu(t,i,wo);this.nh(l.map((t=>t.id)))}}onAction(t){this.Du.has(t)&&this.nh(this.Du.get(t)||[])}nh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.qu(s)?this.eh(s)&&this.sh(s):r.push(s);r.length>0&&(this.Fu=[...new Set([...this.Fu,...r])]),this.Yu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}eh(t){this.Fu=this.Fu.filter((i=>i!==t));var i=this.ah();return!i.includes(t)&&(this.oh([...i,t]),this.lh(),!0)}th(t){var i=new Set(t);this.Fu=this.Fu.filter((t=>!i.has(t)));var e=this.uh(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.oh(r),0===r.length&&this.hh()),this.ih(t)}dh(){var t,i=this.ju();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}sh(t){if(this.ju()){var i=this.dh();this.Bu(g({},i,{[t]:Date.now()}))}}ih(t){if(this.ju()){var i=this.dh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(G(e)?this.Hu():this.Bu(e))}}fh(){this.ju()&&this.Hu()}getActivationTimestamp(t){if(this.ah().includes(t)){var i=this.dh()[t];return Z(i)?i:void 0}}uh(){var t,i=this.ph();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}ah(){var t,i,e=this.uh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.gh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}lh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.mh(i)}hh(){this.yh()}Nu(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.gh()];if(e&&e!==t){var r=this.uh(),s=this.dh();r.length>0&&(this.oh([]),r.filter((t=>Z(s[t]))).forEach((t=>this.rh(t)))),this.hh(),this.fh()}}getActivatedIds(){return[...new Set([...this.ah(),...this.Fu])].filter((t=>!this.bh(t)))}dispose(){var t,i,e;null==(t=this.$u)||t.call(this),this.$u=void 0,null==(i=this.Tu)||i.call(this),this.Tu=void 0,null==(e=this.Ju)||e.dispose(),this.Ju=void 0}reset(){this.Fu=[],this.uh().length>0&&this.oh([]),this.hh(),this.fh()}getEventToItemsMap(){return this.Ou}_h(){return this.Ju}}class oh extends nh{constructor(t){super(t)}ph(){return Sr}gh(){return kr}ju(){return Er}Bu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Er]:t})}Hu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Er)}qu(t){var i,e;this.Vu((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return Z(r)&&r>0}wh(){return So}Vu(t){var i;null==(i=this._instance)||i.getSurveys(t)}rh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Yu(){return Ka}oh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Sr]:t})}mh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[kr]:t})}yh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(kr)}bh(){return!1}Xu(t,i){var e;this.Vu((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return ja(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===So?"consume":"ignore":t===So?"persist":t===ko||t===Eo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ah{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);K(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class lh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==v?void 0:v.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new oh(this._instance)}}var hh=null!=t&&t.location?Gn(t.location.hash,"__posthog")||Gn(location.hash,"state"):null,uh="_postHogToolbarParams",dh=Me("[Toolbar]"),vh=Me("[FeatureFlags]");class ch{constructor(t,i){void 0===i&&(i=!1),this.kh=!1,this.update(t,i)}update(t,i){this.Sh=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:H(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.kh||(vh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.kh=!0),K(t.flag_keys)||H(t.flag_keys)||vh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Sh}}var fh=Me("[FeatureFlags]"),ph=Me("[FeatureFlags]",{debugEnabled:!0}),gh="\" failed. Feature flags didn't load in time.",_h="connection_error",mh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},yh=t=>{var i={};for(var e of ss(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},bh=Me("[Error tracking]"),wh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],xh=["__firefox__","__gCrWeb"],Sh="Refusing to render web experiment since the viewer is a likely bot",kh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>La(i,t),not_regex:(t,i)=>!La(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Eh{get vn(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Eh.xh("retrieved web experiments from the server"),i.Ch=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Ch&&(Eh.xh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Ch)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);J(r)&&t.variants[r]&&i.Th(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Eh.Mh(n,i._instance)&&i.Th(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Eh.xh(Sh);else if(!this.vn.disable_web_experiments){if(X(this.Ch))return this.Ch=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Eh.xh("applying feature flags",t),t.forEach((t=>{var i;if(this.Ch&&null!=(i=this.Ch)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Ch)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Th(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Eh.getWindowLocation();if(null!=t&&t.search){var i=Vn(null==t?void 0:t.search,"__experiment_id"),e=Vn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Eh.xh("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Eh(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.vn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.vn.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.vn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Eh(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Eh.xh("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Th(r[0].name,i,r[0].variants[i].transforms))}static Mh(t,i){return!X(t.conditions)&&Eh.Ih(t,i)&&Eh.Rh(t)}static Ih(t,i){var e;if(X(t.conditions)||X(null==(e=t.conditions)?void 0:e.url))return!0;var r=Eh.getWindowLocation();if(r){var s,n,o,a=Bs(i,r.href);return null==(s=t.conditions)||!s.url||kh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Rh(t){var i;if(X(t.conditions)||X(null==(i=t.conditions)?void 0:i.utm))return!0;var e=io();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static xh(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Ie.info("[WebExperiments] "+t,e)}Th(t,i,e){this._is_bot()?Eh.xh(Sh):"control"!==i?e.forEach((e=>{if(e.selector){var r;Eh.xh("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Eh.xh("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Oa(e,this.vn.custom_blocked_useragents):void 0}}var $h=Me("[Conversations]"),Ph="Conversations not available yet.";function Th(t,i){var e,r,s,n,o,a,l,h=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=i&&i.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=K(d)?Math.max(u,2048):Math.max(u,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Ch=["debug","log","warn","error","info"],Rh="console",Fh="__posthogHandledLogsRequestError",Ih=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Fh]=!0,e},Mh=t=>!!t&&"object"==typeof t&&!0===t[Fh],Ah={featureFlags:class{constructor(t){this.name="featureFlags",this.Ph=!1,this.featureFlagEventHandlers=[],this.I=fh,this.Ah={},this.Fh={},this.Oh=[],this.Lh=!1,this.Dh=!1,this.$h=0,this.Nh=!1,this.qh=!1,this.jh=!1,this.Bh=!1,this.Hh=0,this.Ht=()=>{var t=this.zh();this.Hh=0,t&&this.reloadFeatureFlags()},this.Uh=()=>{var t,i=this.Wh;K(i)||this.vn.remoteRequestsDisabled||!r||"hidden"===r.visibilityState||Date.now()-(null!==(t=this.Vh)&&void 0!==t?t:0){"visible"===(null==r?void 0:r.visibilityState)&&this.Uh()},"get"in t?this.Ps=t:(this.Zh=new ch(t.config,t.Ua()),this.Ps=this.Zh)}updateConfig(t,i){var e;null==(e=this.Zh)||e.update(t,i),this.Os&&this.Qh()}setup(t){return this.au=t,this.I=t.logger.createLogger("[FeatureFlags]"),Zl(t.kv.initialize(),(()=>{this.au===t&&(this.au=void 0,this.Os=t,this.Jh(t))}))}Jh(i){if(this.Os===i)return t&&us(t,"online",this.Ht),this.Qh(),this.Kh=i.registerDynamicEventProperties((()=>this.Yh()?this.Ah:this.Fh)),this.Xh(),this.initialize()}Qh(){var t=this.vn.refreshIntervalMs,i=!this.vn.remoteRequestsDisabled&&r&&!K(t)&&t>0?t:void 0;i!==this.Wh&&(this.td(),K(i)||(this.Wh=i,this.Gh(),null!=r&&r.addEventListener&&us(r,Jr,this.$t)))}Gh(){K(this.Wh)||(K(this.ed)||clearInterval(this.ed),this.Vh=Date.now(),this.ed=setInterval(this.Uh,this.Wh))}td(){K(this.ed)||(clearInterval(this.ed),this.ed=void 0,null==r||null==r.removeEventListener||r.removeEventListener(Jr,this.$t)),this.Wh=void 0,this.Vh=void 0}destroy(){this.rd()}dispose(){this.rd()}rd(){var i;this.td(),this.$h++,this.qh=!1,this.au=void 0,this.Os&&(this.nd(),null==(i=this.Kh)||i.dispose(),this.Kh=void 0,this.Oh=[],null==t||t.removeEventListener("online",this.Ht),this.Os=void 0)}get vn(){return this.Ps.get()}sd(t){var i;return null==(i=this.Os)?void 0:i.kv.get(t)}ei(t){this.ad((()=>{var i;return null==(i=this.Os)?void 0:i.kv.set(t)}))}ri(t){this.ad((()=>{var i;return null==(i=this.Os)?void 0:i.kv.remove(t)}))}ad(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}Xh(){var t={};for(var i of[ur,cr,fr,gr]){var e=this.sd(i);K(e)||(t[i]=e)}this.Ah=t;var r=g({},t),s=this.sd(hr);if(s)for(var n of Object.entries(s))r["$feature/"+n[0]]=n[1];this.Fh=r}Yh(){var t=this.vn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.sd(Rr);return"number"!=typeof i||Date.now()-i>t}od(){return!!this.Yh()&&(this.Bh||this.Dh||(this.Bh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ld(){var t=this.vn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}ud(){var t=this.vn.flagKeys;if(!K(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.vn,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.hd({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r,s,n=null!=e&&e.merge&&null!==(r=this.sd(hr))&&void 0!==r?r:{},o=null!=e&&e.merge&&null!==(s=this.sd(cr))&&void 0!==s?s:{},a=g({},n,t),l=g({},o,i),h={};for(var u of Object.entries(a)){var d=u[0],v=u[1];h[d]={key:d,enabled:y(v),variant:b(v),reason:void 0,metadata:K(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.hd({flags:h})}get hasLoadedFlags(){return this.Lh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.sd(vr),i=this.sd(gr),e=this.sd(_r);if(!e&&!i)return t||{};var r=rs({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=K(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=K(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Ph||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.Ph=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:y(r),variant:b(r),payload:m(i[e])}}))}getFlagVariants(){var t=this.sd(hr),i=this.sd(gr);if(!i)return t||{};for(var e=rs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Ph||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Ph=!0),e}getFlagPayloads(){var t=this.sd(cr),i=this.sd(_r);if(!i)return t||{};for(var e=rs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Ph||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Ph=!0),e}reloadFeatureFlags(){this.Nh||this.vn.featureFlagsDisabled||this.zh()||this.dd||(this.Oh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.dd=setTimeout((()=>{this.vd()}),5))}nd(){clearTimeout(this.dd),this.dd=void 0}onReloading(t){return this.Oh.push(t),()=>{this.Oh=this.Oh.filter((i=>i!==t))}}ensureFlagsLoaded(){this.Lh||this.Dh||this.dd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Nh=t}resetFlagCallReported(){this.ri(Pr)}vd(t){this.nd();var i=this.Os;if(i&&!this.vn.remoteRequestsDisabled&&!this.zh())if(this.Dh)this.qh=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},i.initialPersonProperties,this.sd(mr)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.sd(yr),timezone:ho()};K(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.vn.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.ld();r.length&&(e.evaluation_contexts=r);var s=this.ud();K(s)||(e.flag_keys=s);var n=this.vn.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.$h;this.Dh=!0;var l=()=>{this.qh&&(this.qh=!1,this.vd())},h=t=>{this.Dh=!1,a===this.$h?(this.ei({[Cr]:[_h]}),this.I.error("Feature flag request failed",t),l()):l()};try{i.sendRequest(o,{target:"flags",method:"POST",body:e,compression:this.vn.compression,sentAt:"body",timeoutMs:this.vn.requestTimeoutMs}).then((t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},o=200!==t.statusCode;if(this.Dh=!1,a===this.$h){if(this.fd(t.statusCode),o||this.qh||(this.$anon_distinct_id=void 0),!e.disable_flags||this.qh){this.jh=!o;var h=[];t.error?h.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?_h:"unknown_error"):200!==t.statusCode&&h.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&h.push("quota_limited"),this.ei({[Cr]:h}),u?this.I.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."):e.disable_flags||this.hd(s,o,{partialResponse:n}),l()}}else l()})).catch(h)}catch(t){h(t)}}}zh(){return Kn(this.Hh,3)}fd(t){this.Hh=Jn(t,this.Hh,3,(()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+gh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var e,r=this.getFlagVariants(),s=t in r,n=r[t],o=this.getFlagPayloads()[t],a=String(n),l=this.sd(fr)||void 0,h=this.sd(Rr)||void 0,u=this.sd(Pr)||{};if(this.vn.deduplicateCallsPerSession){var d,v=null==(d=this.Os)?void 0:d.session.sessionId,c=this.sd(Tr);v&&v!==c&&(u={},e=v)}if(i.send_event||!("send_event"in i))if(t in u&&u[t].includes(a))e&&this.ei({[Pr]:u,[Tr]:e});else{var f,p,_,y,b,w,x,S,k,E,P,T;H(u[t])?u[t].push(a):u[t]=[a],this.ei(g({[Pr]:u},e?{[Tr]:e}:{}));var C=this.getFeatureFlagDetails(t),R=[...null!==(f=this.sd(Cr))&&void 0!==f?f:[]];K(n)&&R.push("flag_missing");var F={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:null!==(p=null==(_=this.vn.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(y=null==(b=this.vn.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.jh};K(null==C||null==(w=C.metadata)?void 0:w.has_experiment)||(F.$feature_flag_has_experiment=C.metadata.has_experiment),K(null==C||null==(x=C.metadata)?void 0:x.version)||(F.$feature_flag_version=C.metadata.version);var I,M=null!==(S=null==C||null==(k=C.reason)?void 0:k.description)&&void 0!==S?S:null==C||null==(E=C.reason)?void 0:E.code;M&&(F.$feature_flag_reason=M),null!=C&&null!=(P=C.metadata)&&P.id&&(F.$feature_flag_id=C.metadata.id),K(null==C?void 0:C.original_variant)&&K(null==C?void 0:C.original_enabled)||(F.$feature_flag_original_response=K(C.original_variant)?C.original_enabled:C.original_variant),null!=C&&null!=(T=C.metadata)&&T.original_payload&&(F.$feature_flag_original_payload=null==C||null==(I=C.metadata)?void 0:I.original_payload),R.length&&(F.$feature_flag_error=R.join(",")),this.pd(F)}else e&&this.ei({[Pr]:u,[Tr]:e});if(s)return{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:m(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+gh)}pd(t){try{var i;null==(i=this.Os)||i.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.gd(t,i)}gd(t,i){var e=this;return p((function*(){var r=e.Os;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.ld();n.length&&(s.evaluation_contexts=n);var o,a=e.ud();K(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e.vn.compression,sentAt:"body",timeoutMs:e.vn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void e.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.jh)return i.defaultValue;if(!(this.Lh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+gh),i.defaultValue;var e=this.getFeatureFlag(t,i);return K(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.hd(t,i,e)}hd(t,i,e){if(this.Os){this.Lh=!0;var r=function(t,i,e,r,s,n){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===n&&(n=fh);var o=((t,i)=>{var e=t.flags;return e?g({},t,{featureFlags:Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,n),a=o.flags,l=o.featureFlags,h=o.featureFlagPayloads;if(l){var u=t.requestId,d=t.evaluatedAt;if(H(l)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;return{[ur]:l,[hr]:v,[pr]:!1}}var f=l,p=h,_=a;if(null!=s&&s.partialResponse)f=g({},i,f),p=g({},e,p),_=g({},r,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var i;return!(null!=(i=a[t])&&i.failed)})));f=g({},i,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=g({},e,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),_=g({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))))}else f=g({},i,f),p=g({},e,p),_=g({},r,_);return g({[ur]:Object.keys(yh(f)),[hr]:f||{},[cr]:p||{},[vr]:_||{},[pr]:!0===t.minimalFlagCalledEvents},u?{[fr]:u}:{},d?{[Rr]:d}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.I);r&&this.ei(r),i||(this.Bh=!1),this.md(i)}}override(t,i){void 0===i&&(i=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.yd(t)}yd(t){if(this.Os){if(!1===t)return this.ri([gr,_r]),this.md(),void ph.info("All overrides cleared");if(H(t))return this.ei({[gr]:mh(t)}),this.md(),void ph.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.Ph=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[gr]=H(s)?mh(s):s),n&&(r[_r]=n),Object.keys(r).length&&this.ei(r),!1===s&&!1===n?this.ri([gr,_r]):!1===s?this.ri(gr):!1===n&&this.ri(_r),this.md(),!1===s?ph.info("Flag overrides cleared"):s&&ph.info("Flag overrides set",{flags:s}),void(!1===n?ph.info("Payload overrides cleared"):n&&ph.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ei({[gr]:t}),this.md(),void ph.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Lh){var i=this.bd(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r=(this.sd(dr)||[]).find((i=>i.flagKey===t)),s={["$feature_enrollment/"+t]:i},n={$feature_flag:t,$feature_enrollment:i,$set:s};r&&(n.$early_access_feature_name=r.name),e&&(n.$feature_enrollment_stage=e);var o=g({},this.getFlagVariants(),{[t]:i});this.ei({[ur]:Object.keys(yh(o)),[hr]:o,[mr]:g({},this.sd(mr)||{},s)}),this.md();try{var a;null==(a=this.Os)||a.capture("$feature_enrollment_update",n).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.sd(dr);!r||i?this._d(t,e):t(r)}_d(t,i){var e=this;return p((function*(){var r=e.Os;if(r){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;e.ei({[dr]:s=o.json.earlyAccessFeatures})}catch(t){return void e.I.error("Early access feature request failed",t)}try{t(s)}catch(t){e.I.error("Early access feature callback failed",t)}}}))()}bd(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}md(t){this.Xh();var i=this.bd(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.wd(t,i)}wd(t,i){void 0===i&&(i=!0);var e=this.sd(mr)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in e||(n[o]=s[o]));this.ei({[mr]:g({},e,n,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=g({},this.sd(mr)||{});t.forEach((t=>{delete e[t]})),this.ei({[mr]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.ri(mr),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.sd(yr)||{},r=g({},e);for(var s of Object.keys(t))r[s]=g({},e[s],t[s]);this.ei({[yr]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.sd(yr)||{};this.ei({[yr]:g({},i,{[t]:{}})})}else this.ri(yr)}reset(){this.$h++,this.qh=!1,this.Ah={},this.Fh={},this.Lh=!1,this.Nh=!1,this.jh=!1,this.$anon_distinct_id=void 0,this.nd(),this.Ph=!1,this.Hh=0}}},Oh={sessionRecording:class{get vn(){return this._instance.config}get yo(){return this._instance.persistence}get started(){var t;return!(null==(t=this.kd)||!t.isStarted)}get status(){var t,i;return this.Sd===Ul||this.Sd===ql?this.Sd:null!==(t=null==(i=this.kd)?void 0:i.status)&&void 0!==t?t:this.Sd}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Sd=Bl,this.xd=void 0,this.Cd=!1,this.Dt=(()=>{var i;if(null==r||!r.visibilityState||"visible"===r.visibilityState)return!0;var e=null==t||null==(i=t.performance)||null==i.getEntriesByType?void 0:i.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.$t=()=>{var t;"visible"===(null==r?void 0:r.visibilityState)&&(this.Dt=!0,null==(t=this.kd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw Vl.error("started without valid sessionManager"),new Error(Hl+" started without valid sessionManager. This is a bug.");if(this.vn.cookieless_mode===Vr)throw new Error(Hl+' cannot be used with cookieless_mode="always"');null!=r&&r.addEventListener&&us(r,"visibilitychange",this.$t)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Cd=!0,null==r||null==r.removeEventListener||r.removeEventListener("visibilitychange",this.$t),this.stopRecording()}get Td(){var i,e=!(null==(i=this._instance.get_property(ir))||!i.enabled),r=!this.vn.disable_session_recording,s=this.vn.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!(this.Cd||this.Td&&null!=(i=this.kd)&&i.isStarted)){var e=!K(Object.assign)&&!K(Array.from);this.Td&&e?(this.Md(t),Vl.info("starting")):(this.Sd=Bl,this.stopRecording())}}Md(t){var i,e,r;this.Td&&(this.Sd!==Ul&&this.Sd!==ql&&(this.Sd=zl),null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ed(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Id,(i=>{if(i)return this._instance.register_for_session({[Ur]:!0}),Vl.error("could not load recorder",i);this.Ed(t)})))}stopRecording(){var t,i;null==(t=this.xd)||t.call(this),this.xd=void 0,null==(i=this.kd)||i.stop()}Rd(){var t,i;null==(t=this.xd)||t.call(this),this.xd=void 0,null==(i=this.kd)||i.discard()}Pd(){var t,i;null==(t=this.yo)||t.unregister(lr),null==(i=this.yo)||i.unregister(er)}Ad(t,i){if(X(t))return null;var e,r=Z(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Vl.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Fd(t){if(this.yo){var i,e,r=this.yo,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ad(null==(i=this.vn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.Ad(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;X(o)&&this.Pd();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ir]:g({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:K(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};s(),null==(i=this.xd)||i.call(this),this.xd=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Fd(i),void this.Rd()):(this.Fd(i),void this.startIfEnabledOrStop()):(this.Sd===Ul&&(this.Sd=ql,Vl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.kd)&&e.log?this.kd.log(t,i):Vl.warn("log called before recorder was ready")}get Id(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ir);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Od(){var t,i=this._instance.get_property(ir);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Vl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!X(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Ed(t){var i,e,r;if(!this.Cd){if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)return Vl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ur]:!0});var s;if(this.kd||(this.kd=null==(s=v.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Dt),this.kd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Od()){if(this.Sd===ql||this.Sd===Ul)return;return this.Sd=Ul,Vl.info("persisted remote config is stale, requesting fresh config before starting"),void new Ro(this._instance).load()}this.Sd=zl,null==(e=(r=this.kd).setDocumentWasEverVisible)||e.call(r,this.Dt),this.kd.start(t)}}onRRwebEmit(t){var i;null==(i=this.kd)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.kd||null==(i=this.yo)||i.register({[sr]:!0}),null==(t=this.kd)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.kd||null==(i=this.yo)||i.register({[rr]:!0}),null==(t=this.kd)||t.overrideSampling()}overrideTrigger(t){var i,e;this.kd||null==(e=this.yo)||e.register({["url"===t?nr:or]:!0}),null==(i=this.kd)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.kd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.kd)||!e.tryAddCustomEvent(t,i))}}},Dh={autocapture:class extends Tl{constructor(t){super(new Cl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Ld=this.Dd()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.$d();return!!(t.path||t.search||this.Nd(t))}startIfEnabled(){this.isEnabled&&(Ie.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Ld=this.Dd(),this.startIfEnabled()}stop(){this.qd&&this.qd(),this.qd=void 0,this.jd&&this.jd(),this.jd=void 0,Ie.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Bd("pushState"),this.Bd("replaceState"),this.Hd(),this.Nd()&&this.zd())}Bd(i){var e;if(t&&(null==(e=t.history[i])||!e.__posthog_wrapped__)){var r=this;Ml(t.history,i,(t=>function(e,s,n){t.call(this,e,s,n),r.Ud(i)}))}}Dd(){var i=null==t?void 0:t.location;if(null!=i&&i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}$d(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:W(t)?t:{}}Nd(t){return void 0===t&&(t=this.$d()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Wd(t){var i=this.$d(),e=this.Ld;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Nd(i)&&t.hash!==e.hash))}Ud(t){try{var i=this.Dd();if(!i)return;this.Wd(i)&&this._instance.capture(Qr,{navigation_type:t}),this.Ld=i}catch(i){Ie.error("Error capturing "+t+" pageview",i)}}Hd(){if(!this.qd){var i=()=>{this.Ud("popstate")};us(t,"popstate",i),this.qd=()=>{t&&t.removeEventListener("popstate",i)}}}zd(){if(!this.jd){var i=()=>{this.Ud("hashchange")};us(t,"hashchange",i),this.jd=()=>{t&&t.removeEventListener("hashchange",i)}}}},heatmaps:class{get vn(){return this.instance.config}constructor(t){var i;this.Vd=!1,this.Ts=!1,this.Gd=null,this.instance=t,this.Vd=!(null==(i=this.instance.persistence)||!i.props[We]),this.rageclicks=new xl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return W(this.vn.capture_heatmaps)&&this.vn.capture_heatmaps.flush_interval_milliseconds&&(t=this.vn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return X(this.vn.capture_heatmaps)?X(this.vn.enable_heatmaps)?this.Vd:this.vn.enable_heatmaps:!1!==this.vn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ts)return;Wl.info("starting..."),this.Zd(),this.$t()}else{var t;clearInterval(null!==(t=this.Gd)&&void 0!==t?t:void 0),this.Qd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[We]:e}),this.Vd=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.At;return this.At=void 0,t}Jd(t){Gl(t.originalEvent)&&this.Qi(t.originalEvent,"deadclick")}$t(){this.Gd&&clearInterval(this.Gd),this.Gd=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.oo.bind(this),this.flushIntervalMilliseconds):null}Zd(){t&&r&&(this.Kd=this.oo.bind(this),us(t,Yr,this.Kd),this.Yd=i=>this.Qi(i||(null==t?void 0:t.event)),us(r,"click",this.Yd,{capture:!0}),this.Xd=i=>this.tv(i||(null==t?void 0:t.event)),us(r,"mousemove",this.Xd,{capture:!0}),this.ev=new Mn(this.instance,Fn,this.Jd.bind(this)),this.ev.startIfEnabledOrStop(),this.iv=this.$t.bind(this),us(r,Jr,this.iv),this.Ts=!0)}Qd(){var i;t&&r&&(this.Kd&&t.removeEventListener(Yr,this.Kd),this.Yd&&r.removeEventListener("click",this.Yd,{capture:!0}),this.Xd&&r.removeEventListener("mousemove",this.Xd,{capture:!0}),this.iv&&r.removeEventListener(Jr,this.iv),clearTimeout(this.rv),null==(i=this.ev)||i.stop(),this.Ts=!1)}nv(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Ws(s)&&!Gs(s,"body");){if(s===r)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position}catch(t){return!1}if(j(e,n))return!0;s=on(s)}return!1}(rn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}Qi(t,i){var e;if(void 0===i&&(i="click"),!Vs(t.target)&&Gl(t)){var r=this.nv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&cn(rn(t),this.instance.config.rageclick)&&this.fs(g({},r,{type:"rageclick"})),this.fs(r)}}tv(t){!Vs(t.target)&&Gl(t)&&(clearTimeout(this.rv),this.rv=setTimeout((()=>{this.fs(this.nv(t,"mousemove"))}),500))}fs(i){if(t){var e=this.vn.disable_capture_url_hashes?xi(t.location.href):t.location.href,r=this.vn.custom_personal_data_properties,s=this.vn.mask_personal_data_properties?[...Qn,...r||[]]:[],n=Wn(e,s,Zn);this.At=this.At||{},this.At[n]||(this.At[n]=[]),this.At[n].push(i)}}oo(){this.At&&!G(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Mn,webVitalsAutocapture:class{constructor(t){var i;this.Vd=!1,this.Ts=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.sv=()=>{clearTimeout(this.av),this.av=void 0,0!==this.At.metrics.length&&(this._instance.capture("$web_vitals",g({$current_url:this.At.url},this.At.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ov=t=>{var i;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},X(null==t?void 0:t.name)||X(null==t?void 0:t.value))Ol.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.lv(e);if(!K(r)){var s=Z(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.uv||this.uv>t.value){this.At.navigationKey!==s&&(this.sv(),this.av=setTimeout(this.sv,this.flushToCaptureTimeoutMs)),K(this.At.navigationKey)&&(this.At.navigationKey=s,this.At.url=r),this.At.firstMetricTimestamp=K(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;var n=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),o=g({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete o.entries,W(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var a={};for(var l of Nl){var h="url"===l&&"string"==typeof t.attribution[l]?this.lv(t.attribution[l]):t.attribution[l];K(h)||(a[l]=h)}o.attribution=a}else delete o.attribution;K(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.At.metrics.push(o),this.At.metrics.length===this.allowedMetrics.length&&this.sv()}else Ol.error("Ignoring metric with value >= "+this.uv,t)}}},this.hv=()=>{if(!this.Ts){var t,i,e,r,s=!1,n=v.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.dv])||("web-vitals"===this.dv&&K(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!K(a)){var l=a.withoutAttribution,h=this.attributionMetrics;s=!K(l),t=h.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,i=h.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,e=h.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,r=h.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(t&&i&&e&&r){var u={reportSoftNavs:this.useSoftNavs},d=s&&this.attributionMetrics.indexOf("INP")>-1?g({},u,{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&t(this.ov.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ov.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&e(this.ov.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&r(this.ov.bind(this),d),this.Ts=!0}else Ol.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Vd=!(null==(i=this._instance.persistence)||!i.props[Ye]),this.startIfEnabled()}get vv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=W(this.vv)?null==(t=this.vv)?void 0:t.web_vitals_allowed_metrics:void 0;return X(e)?(null==(i=this._instance.persistence)?void 0:i.props[tr])||jl:e}get flushToCaptureTimeoutMs(){return(W(this.vv)?this.vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=W(this.vv)?this.vv.web_vitals_attribution:void 0;return it(t)?t?jl:[]:H(t)?t:Ll}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=W(this.vv)?this.vv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get uv(){var t=W(this.vv)&&Z(this.vv.__web_vitals_max_value)?this.vv.__web_vitals_max_value:Dl;return t>0&&6e4>=t?Dl:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Ol.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=W(this.vv)?this.vv.web_vitals:it(this.vv)?this.vv:void 0;return it(i)?i:this.Vd}startIfEnabled(){this.isEnabled&&!this.Ts&&(Ol.info("enabled, starting..."),this.Zs(this.hv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=W(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=W(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ye]:e}),this._instance.persistence.register({[tr]:r})),this.Vd=e,this.startIfEnabled()}}}get dv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Zs(t){var i=v.__PosthogExtensions__,e=this.dv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&K(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Ol.error("failed to load script",i):t()}))}lv(i){var e=i||(null==t?void 0:t.location.href);if(e){var r=this._instance.config.disable_capture_url_hashes?xi(e):e,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Qn,...s||[]]:[];return Wn(r,n,Zn)}Ol.error("Could not determine current URL")}}},jh={exceptionObserver:class{constructor(i){var e;this.hv=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fv&&this.vn.capture_unhandled_errors&&(this.fv=e(this.captureException.bind(this))),!this.pv&&this.vn.capture_unhandled_rejections&&(this.pv=r(this.captureException.bind(this))),!this.gv&&this.vn.capture_console_errors&&(this.gv=s(this.captureException.bind(this)))}catch(t){Rl.error("failed to start",t),this.mv()}}},this._instance=i,this.yv=!(null==(e=this._instance.persistence)||!e.props[Ge]),this.de=new ft(g({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:Rl})),this.vn=this.bv(),this.startIfEnabledOrStop()}bv(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return W(t)?i=g({},i,t):(K(t)?this.yv:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.vn.capture_console_errors||this.vn.capture_unhandled_errors||this.vn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Rl.info("enabled"),this.mv(),this.Zs(this.hv)):this.mv()}Zs(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Rl.error("failed to load script",i);t()}))}mv(){var t,i,e;null==(t=this.fv)||t.call(this),this.fv=void 0,null==(i=this.pv)||i.call(this),this.pv=void 0,null==(e=this.gv)||e.call(this),this.gv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.yv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.yv}),this.vn=this.bv(),this.startIfEnabledOrStop())}}onConfigChange(){this.vn=this.bv()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.de.consumeRateLimit(s)?Rl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this._v=[],this.wv=new ie([new ce,new Se,new pe,new fe,new we,new be,new _e,new xe],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=ve.test(a)?a.replace(ve,"$1"):a;if(!l.match(/\S*Error: /)){for(var h of e){var u=h(l,t);if(u){s.push(u);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||ee});var e}))}(s)}}("web:javascript",le,de)),this._instance=t,this._v=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ke))&&void 0!==i?i:[],this.Sv=Te(this.xv()),this.Cv=new Ce(this.Sv)}onConfigChange(){this.Sv=Te(this.xv()),this.Cv.setConfig(this.Sv)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this._v=n,this._instance.persistence&&this._instance.persistence.register({[Ke]:this._v,[Je]:o})}}}get Tv(){var t,i=!!this._instance.get_property(Je),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.wv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Sv.enabled)try{if(!J(t)||0===t.trim().length)return void bh.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>$e.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.Mv(i)),r=e.sanitizedProperties,s=e.droppedKeys;s.length>0&&bh.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Cv.add(g({[ke]:t,[Ee]:(new Date).toISOString()},r))}catch(t){bh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Ev(i)){if(this.Iv(i))return this.Rv("Exception dropped: matched a suppression rule"),void bh.info("Skipping exception capture because a suppression rule matched");if(!this.Tv&&this.Pv(i))return this.Rv("Exception dropped: thrown by a browser extension"),void bh.info("Skipping exception capture because it was thrown by an extension");if(!this.Tv&&this.Av(i))return this.Rv("Exception dropped: thrown by an injected browser script"),void bh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Fv(i))return this.Rv("Exception dropped: thrown by the PostHog SDK"),void bh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Sv.enabled&&X(t.$exception_steps)?this.Ov(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",jl:!0});return s&&this.Cv.clear(),s}catch(t){return bh.error("Failed to capture exception event. Dropping this exception.",t),void this.Cv.clear()}}catch(t){return void bh.error("Failed to process exception event. Ignoring this exception.",t)}var n}Ov(t){try{var i=this.Cv.getAttachable();return 0===i.length?t:g({},t,{$exception_steps:i})}catch(i){return bh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Rv(t){this.Sv.enabled&&this.Cv.add({[ke]:t,[Ee]:(new Date).toISOString()})}Mv(t){return W(t)?g({},t):{}}xv(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Iv(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return J(e)&&e.length>0&&t.$exception_types.push(e),J(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this._v.some((t=>{var e=t.values.map((t=>{var e=Ba[t.operator],r=i[t.key];if(!e||!r)return!1;var s=H(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return bh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Pv(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>{var i=t.filename;return!!i&&wh.some((t=>i.startsWith(t)))}))}Av(t){return t.some((t=>{var i=t.value;return J(i)&&xh.some((t=>i.includes(t)))}))}Fv(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Ev(t){return!X(t)&&H(t)}}},Lh=g({productTours:class{get yo(){return this._instance.persistence}constructor(t){this.Lv=null,this.Dv=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.yo&&this.yo.register({[Xe]:!!i.productTours}),!Jl(this._instance))return!this.Lv&&X(null==(e=this.yo)?void 0:e.props[$r])||Kl.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Lv)||r.stop(),this.Lv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Lv&&Jl(this._instance)&&this.Zs((()=>this.$v()))}Zs(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?Kl.error("Could not load product tours script",i):t()}))}$v(){var t;!this.Lv&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Lv=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!H(this.Dv)||i){var e=this.yo;if(e){var r=e.props[$r];if(H(r)&&!i)return this.Dv=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(Jl(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||Kl.warn(s):Kl.error(s),void t([],{isLoaded:!1,error:s})}var n=H(i.json.product_tours)?i.json.product_tours:[];this.Dv=n,e&&e.register({[$r]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Dv,{isLoaded:!0})}getActiveProductTours(t){X(this.Lv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Lv.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Lv)||i.showTourById(t)}previewTour(t){this.Lv?this.Lv.previewTour(t):this.Zs((()=>{var i;this.$v(),null==(i=this.Lv)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Lv)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Lv)||t.nextStep()}previousStep(){var t;null==(t=this.Lv)||t.previousStep()}clearCache(){var t;this.Dv=null,null==(t=this.yo)||t.unregister($r)}resetTour(t){var i;null==(i=this.Lv)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Lv)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Lv)||i.cancelPendingTour(t)}}},Ah),Nh={siteApps:class{constructor(t){this.Nv=0,this._instance=t,this.qv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}jv(t,i){if(i){var e=this.globalsForEvent(i);this.qv.push(e),this.qv.length>1e3&&(this.qv=this.qv.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.jv.bind(this));this.Bv=()=>{t(),this.qv=[],this.Bv=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(u)){var v=d[0];l[v]={id:h[v],type:v,properties:d[1]}}var c=t.$set_once,f=t.$set;return{event:g({},_(t,Yl),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Hv(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Ql.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Ql.error("prepare_external_dependency_script returned null"),null):t}zv(){var t,i,e,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=null==r?void 0:r.defaultView,u=null==h||null==(t=h.Node)?void 0:t.prototype;if(!h||!u)return()=>{};if(this.Nv++,this.Uv)return this.Wv();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push((()=>{t[i]=r}))}},p=t=>{if(c.has(t))return t;var i=v.Hv(t);return i&&c.add(i),i},g=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!Q(t)));return f(u,"appendChild",(t=>function(i){var e=p(i);return e?t.call(this,e):i})),f(u,"insertBefore",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i})),f(u,"replaceChild",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e})),[null==(i=h.Element)?void 0:i.prototype,null==(e=h.Document)?void 0:e.prototype,null==(s=h.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}))})),[null==(n=h.Element)?void 0:n.prototype,null==(o=h.CharacterData)?void 0:o.prototype,null==(a=h.DocumentType)?void 0:a.prototype].forEach((t=>{f(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=g(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=h.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null})),this.Uv=()=>{d.forEach((t=>t())),this.Uv=void 0},this.Wv()}Wv(){var t=!1;return()=>{var i;t||(t=!0,this.Nv--,0===this.Nv&&(null==(i=this.Uv)||i.call(this)))}}Vv(t,i){void 0===i&&(i=!0);var e=this.zv();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.qv.length&&(Ql.info("Processing "+this.qv.length+" events for site app with id "+t.id),this.qv.forEach((t=>this.Vv((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.Bv)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Ql.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.Vv((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Ql.error(Xl+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Ql.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Gv(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Zv(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.Vv((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){Ql.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Gv(),void this._instance.on("eventCaptured",(t=>this.Zv(t)))):void Ql.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Bv)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;v["__$$ph_site_app_"+i]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return Ql.error(Xl+i,t)}))};for(var a of n.siteApps)o()}else Ql.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Bh={tracingHeaders:class{constructor(t){this.Qv=void 0,this.Jv=void 0,this.Kv=void 0,this.hv=()=>{var t,i,e=this.Yv();e?(K(this.Qv)&&(this.Qv=null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),K(this.Jv)&&(this.Jv=null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Zs(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Al.error("failed to load script",i);t()}))}Xv(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Yv(){var t=this.Xv();return H(t)?(H(this.Kv)?this.Kv.splice(0,this.Kv.length,...t):this.Kv=[...t],t.length>0?this.Kv:void 0):(H(this.Kv)&&this.Kv.splice(0),this.Kv=t||void 0,this.Kv)}mv(){var t,i;null==(t=this.Qv)||t.call(this),null==(i=this.Jv)||i.call(this),this.Qv=void 0,this.Jv=void 0}startIfEnabledOrStop(){this.Yv()?this.Zs(this.hv):this.mv()}}},zh=g({surveys:class extends eh{constructor(t){var i;super(new lh(t),{get projectToken(){return i.config.token},kv:new ah(i=t)}),this._instance=t}du(t,i){var e=i.query?ca(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Ah),Uh={toolbar:class{constructor(t){this.instance=t}tc(t){v.ph_toolbar_state=t}ec(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,s){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0),ds(this.instance.config))return!1;if(!t||!r)return!1;i=null!=i?i:t.location,s=null!=s?s:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var n,o=hh||Gn(i.hash,"__posthog")||Gn(i.hash,"state"),a=o?ns((()=>JSON.parse(atob(decodeURIComponent(o)))))||ns((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?i.hash=a.desiredHash:s?s.replaceState(s.state,"",i.pathname+i.search):i.hash="")):((n=JSON.parse(e.getItem(uh)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}ic(t){var i=v.ph_load_toolbar||v.ph_load_editor;!X(i)&&V(i)?i(t,this.instance):dh.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==r||!r.getElementById(zs));if(!t||e)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(uh,JSON.stringify(g({},n,{source:void 0}))),2===this.ec())this.ic(n);else if(0===this.ec()){var o;this.tc(1),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return dh.error("[Toolbar] Failed to load",t),void this.tc(0);this.tc(2),this.ic(n)})),us(t,"turbolinks:load",(()=>{this.tc(0),this.loadToolbar(n)}))}return!0}rc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},qh=g({experiments:Eh},Ah),Hh={conversations:class{constructor(t){this.nc=void 0,this._conversationsManager=null,this.sc=!1,this.Fe=null,this.ac=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.oc=t.ok,t.ok)){var i=t.config.conversations;X(i)||(it(i)?this.nc=i:(this.nc=i.enabled,this.Fe=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.nc=void 0,this.Fe=null,this.oc=void 0,this.ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.sc||this._instance.config.disable_conversations||ds(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!K(this.nc)&&this.nc)if(this.Fe&&this.Fe.token){this.sc=!0;try{var i=t.initConversations;if(i)return this.lc(i),void(this.sc=!1);var e=t.loadExternalDependency;if(!e)return void this.uc(qr);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.uc("Could not load conversations script",i):this.lc(t.initConversations),this.sc=!1}))}catch(t){this.uc("Error initializing conversations",t),this.sc=!1}}else $h.error("Conversations enabled but missing token in remote config.")}}lc(t){if(this.Fe)try{this._conversationsManager=t(this.Fe,this._instance),this.ac=!1,$h.info("Conversations loaded successfully")}catch(t){this.uc("Error completing conversations initialization",t)}else $h.error("Cannot complete initialization: remote config is null")}uc(t,i){$h.error(t,i),this._conversationsManager=null,this.sc=!1,this.ac=!0}show(){this._conversationsManager?this._conversationsManager.show():$h.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.nc&&!Q(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ds(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.oc?"remote_config_failed":K(this.nc)?this.oc?"disabled_in_project":"remote_config_pending":this.nc?X(this.Fe)||!this.Fe.token?"missing_token":null!=v&&v.__PosthogExtensions__?this.sc?"initializing":this.ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):($h.warn(Ph),null)}))()}getMessages(t,i){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):($h.warn(Ph),null)}))()}markAsRead(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):($h.warn(Ph),null)}))()}getTickets(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):($h.warn(Ph),null)}))()}requestRestoreLink(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):($h.warn(Ph),null)}))()}restoreFromToken(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):($h.warn(Ph),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():($h.warn(Ph),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Ql(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Jl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Vh={logs:class{constructor(i){var e,r=this;this.name="logs",this.hc=!1,this.dc=!1,this.vc=!1,this.I=Me("[logs]"),this.cc=g({},this.I,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(Mh)||r.I.error(...i)}}),this.Za=[],this.fc=[],this.Hh=0,this.Rs=!1,this.gc=[],this.mc=[],this.yc=!1,this.bc=!1,this._c=()=>{var t,i;this.Rs||(this.Hh=0,null==(t=this.wc)||t.onReconnect(),null==(i=this.kc)||i.onReconnect())},this._instance=i,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.hc=!0),t&&us(t,"online",this._c)}Sc(t,i,e,r){var s,n=Th(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Wi(this.xc(t,i),n,this.cc,(()=>this.Cc()),(t=>t()),void 0,r),n]}Tc(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.wc||this.Mc!==i){var e;null==(e=this.wc)||e.reset(),this.Mc=i;var r=this.Sc((()=>this.Za),(t=>{this.Za=t}));this.wc=r[0],this.Ec=r[1]}return this.wc}Ic(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.kc||this.Rc!==i){var e;null==(e=this.kc)||e.reset(),this.Rc=i;var r=this.Sc((()=>this.fc),(t=>{this.fc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Rh);this.kc=r[0],this.Pc=r[1]}return this.kc}setup(t){var i;if(!this.Rs){this.Os=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.hc=!0),(this.hc||this.Ac()&&this.Fc())&&this.Oc();var e=!1,r=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.Rs?r.dispose():(this.Ls=r,e||this.loadIfEnabled())}}dispose(){var i,e,r,s;this.Rs||(this.Rs=!0,this.Lc(),null==(i=this.Ls)||i.dispose(),this.Ls=void 0,this.Os=void 0,this.vc=!1,null==t||t.removeEventListener("online",this._c),null==(e=this.Dc)||e.call(this),this.Dc=void 0,null==(r=this.wc)||r.reset(),null==(s=this.kc)||s.reset())}onRemoteConfig(t){var i,e;if(!this.Rs){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;X(r)?this.$c():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[Ze]:!!r}),r?(this.hc=!0,this.dc||this.Oc(),this.loadIfEnabled()):this.$c())}}reset(){var t,i,e,r;this.Lc(),null==(t=this.wc)||t.clearQueue(),this.Za=[],null==(i=this.wc)||i.reset(),null==(e=this.kc)||e.clearQueue(),this.fc=[],null==(r=this.kc)||r.reset(),this.Hh=0}captureLog(t){this.Rs||this.Tc().captureLog(t)}captureConsoleLog(t){this.Rs||this.Ic().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Rs||this.Ic().captureLog(t,{context:i,occurredAtMs:e})}Fc(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[Ze])}Ac(){var t,i;return null==(t=this._instance)||null==t.Ua||!t.Ua()||!(null==(i=v._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Yl(){var t;this.Lc(),null==(t=this.kc)||t.clearQueue(),this.fc=[]}$c(){this.hc||this.Lc()}Oc(){var t,i=this;if(!this.yc&&null!=v&&v.console){var e=Th(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(v.console[t])}catch(t){return 0}if(!r)return 0;i.mc.push(Ml(v.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.Nc(t,n,e)}catch(t){}return s.apply(v.console,n)};return n.__rrweb_original__=r,n})))};for(var s of Ch)r(s);this.yc=!0,this.qc=setTimeout((()=>{this.Lc()}),3e4)}}Nc(t,i,e){var r;if(this.yc&&!this.bc&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.gc.length){this.bc=!0;try{this.gc.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Cc()})}finally{this.bc=!1}}}else this.Lc()}Lc(){if(this.gc=[],this.yc){for(var t of(this.yc=!1,this.qc&&(clearTimeout(this.qc),this.qc=void 0),this.mc))t();this.mc=[]}}jc(){var t=this.gc;return this.Lc(),t}get logger(){return this.Bc||(this.Bc={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.Bc}flushLogs(t){t?this.Hc(t):(this.wc&&this.wc.flush().catch((t=>this.zc(t))),this.kc&&this.kc.flush().catch((t=>this.zc(t))))}zc(t){Mh(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Rs&&this.hc&&!this.dc&&!this.vc){var t=null==v?void 0:v.__PosthogExtensions__;if(!t)return this.I.error("PostHog Extensions not found."),void this.Lc();var i=t.loadExternalDependency;if(!i)return this.I.error(qr),void this.Lc();this.vc=!0;try{i(this._instance,"logs",(i=>{if(this.vc=!1,!this.Rs&&this.hc){var e=t.logs;if(i||null==e||!e.initializeLogs)this.I.error("Could not load logs script",i),this.Lc();else{var r,s,n=this.jc();this.Dc=e.initializeLogs(null!==(r=this.Os)&&void 0!==r?r:this._instance),this.dc=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Os)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.vc=!1,t}}}xc(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===x.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===x.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},es:t=>this.es(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}es(t){return new Promise((i=>{if(Kn(this.Hh,3))i({kind:"fatal",error:Ih(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Ih(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Uc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Wc(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Ih(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}Wc(t){(0!==t||this._instance.__loaded)&&(this.Hh=Jn(t,this.Hh,3,(()=>this.I.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."))))}Hc(t){this.Za.length>0&&this.Vc(t,this.Za,this.Ec,c.LIB_NAME,(t=>{this.Za=t})),this.fc.length>0&&this.Vc(t,this.fc,this.Pc,Rh,(t=>{this.fc=t}))}Vc(t,i,e,r,s){if(0!==i.length){var n=i.map((t=>t.record));s([]);var o=Vi(n,Hi(e,c.LIB_NAME,c.LIB_VERSION),r,c.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Uc(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Uc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Cc(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,X(s)||(i.sessionStartTimestamp=s),X(n)||(i.lastActivityTimestamp=n)}if(null!=v&&null!=(t=v.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?xi(v.location.href):v.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Wh={metrics:class{constructor(t){this.I=Me("[metrics]"),this._instance=t}initialize(){}Tc(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.wc&&this.Mc===e||(null==(i=this.wc)||i.reset(),this.Mc=e,this.wc=new Yi(this.xc(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.I)),this.wc}count(t,i,e){void 0===i&&(i=1),this.Tc().count(t,i,e)}gauge(t,i,e){this.Tc().gauge(t,i,e)}histogram(t,i,e){this.Tc().histogram(t,i,e)}flush(t){if(!this.wc)return Promise.resolve();if(t){var i=this.wc.drainWindow();return i&&this._s(i,t),Promise.resolve()}return this.wc.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.wc)||t.reset()}xc(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},_s:t=>i._s(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}_s(t,i){return new Promise((e=>{var r=!1,s=t=>{r||(r=!0,clearTimeout(n),e(t))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(g({method:"POST",url:this.Gc(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)s({kind:"ok"});else if(413===i)s({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)s({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;s({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}Gc(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gh=g({},Ah,Oh,Dh,jh,Lh,Nh,zh,Bh,Uh,qh,Hh,Vh,Wh);wl.__defaultExtensionClasses=g({},Gh),function(){c.SDK_DIST_CHANNEL="cdn";var i=v.posthog;if(!i||H(i._i)){var e=ol[fl]=new wl;if(i){var s=[];es(i._i,(function(t){if(t&&H(t)){var r=e.init(t[0],t[1],t[2]),n=i[t[2]]||i;r.__loaded&&-1===s.indexOf(n)&&(s.push(n),r._execute_array.call(r.people,n.people),r._execute_array(n))}}))}e.__SV=1,v.posthog=e,function(){function i(){i.done||(i.done=!0,pl=!1,es(ol,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?i():us(r,"DOMContentLoaded",i,{capture:!1}):t&&Ie.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}(); //# sourceMappingURL=array.js.map