PageSourceSearch

https://memoryhole.app/assets/app-f2f712885aa847d0d757938d6c6811ac.js?vsn=d

js memoryhole.app collected 2026-09-24 12:07:13 UTC 327,959 bytes, 81 lines download raw bytes

1var Xu=Object.defineProperty,eh=Object.defineProperties;var th=Object.getOwnPropertyDescriptors;var xo=Object.getOwnPropertySymbols;var ih=Object.prototype.hasOwnProperty,sh=Object.prototype.propertyIsEnumerable;var So=(i,e,t)=>e in i?Xu(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ri=(i,e)=>{for(var t in e||(e={}))ih.call(e,t)&&So(i,t,e[t]);if(xo)for(var t of xo(e))sh.call(e,t)&&So(i,t,e[t]);return i},Ws=(i,e)=>eh(i,th(e));import"phoenix_html";function rh(i){i.directive("collapse",e),e.inline=(t,{modifiers:s})=>{s.includes("min")&&(t._x_doShow=()=>{},t._x_doHide=()=>{})};function e(t,{modifiers:s}){let r=ko(s,"duration",250)/1e3,n=ko(s,"min",0),o=!s.includes("min");t._x_isShown||(t.style.height=`${n}px`),!t._x_isShown&&o&&(t.hidden=!0),t._x_isShown||(t.style.overflow="hidden");let a=(u,h)=>{let c=i.setStyles(u,h);return h.height?()=>{}:c},l={transitionProperty:"height",transitionDuration:`${r}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};t._x_transition={in(u=()=>{},h=()=>{}){o&&(t.hidden=!1),o&&(t.style.display=null);let c=t.getBoundingClientRect().height;t.style.height="auto";let d=t.getBoundingClientRect().height;c===d&&(c=n),i.transition(t,i.setStyles,{during:l,start:{height:c+"px"},end:{height:d+"px"}},()=>t._x_isShown=!0,()=>{Math.abs(t.getBoundingClientRect().height-d)<1&&(t.style.overflow=null)})},out(u=()=>{},h=()=>{}){let c=t.getBoundingClientRect().height;i.transition(t,a,{during:l,start:{height:c+"px"},end:{height:n+"px"}},()=>t.style.overflow="hidden",()=>{t._x_isShown=!1,t.style.height==`${n}px`&&o&&(t.style.display="none",t.hidden=!0)})}}}}function ko(i,e,t){if(i.indexOf(e)===-1)return t;let s=i[i.indexOf(e)+1];if(!s)return t;if(e==="duration"){let r=s.match(/([0-9]+)ms/);if(r)return r[1]}if(e==="min"){let r=s.match(/([0-9]+)px/);if(r)return r[1]}return s}var To=rh;import kd from"@alpinejs/persist";import ii from"alpinejs";import{decode as Td}from"blurhash";import{Socket as Pd}from"phoenix";import{LiveSocket as Cd}from"phoenix_live_view";import _o from"topbar";var m=typeof window!="undefined"?window:void 0,Se=typeof globalThis!="undefined"?globalThis:m,ge=Se==null?void 0:Se.navigator,S=Se==null?void 0:Se.document,ne=Se==null?void 0:Se.location,Yn=Se==null?void 0:Se.fetch,Sr=Se!=null&&Se.XMLHttpRequest&&"withCredentials"in new Se.XMLHttpRequest?Se.XMLHttpRequest:void 0,Po=Se==null?void 0:Se.AbortController,nh=Se==null?void 0:Se.CompressionStream,Ie=ge==null?void 0:ge.userAgent;function Ba(){return!(!m||m.navigator.onLine===!1)}var ni=typeof globalThis!="undefined"?globalThis:m;ni&&typeof self=="undefined"&&(ni.self=ni),ni&&typeof File=="undefined"&&(ni.File=function(){});var F=m!=null?m:{},Q={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};function Co(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(s,r)}function X(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Co(n,s,r,o,a,"next",l)}function a(l){Co(n,s,r,o,a,"throw",l)}o(void 0)})}}function E(){return E=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},E.apply(null,arguments)}function qa(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var Ao=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch(e){return i}};function Io(i){return typeof i=="string"||i}function Oo(i){return typeof i=="string"?i:void 0}var oh=["$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"],Ye=function(i){return i.AnonymousId="anonymous_id",
1i.DistinctId="distinct_id",i.Props="props",i.EnablePersonProcessing="enable_person_processing",i.PersonMode="person_mode",i.FeatureFlagDetails="feature_flag_details",i.FeatureFlags="feature_flags",i.FeatureFlagPayloads="feature_flag_payloads",i.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",i.BootstrapFeatureFlags="bootstrap_feature_flags",i.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",i.OverrideFeatureFlags="override_feature_flags",i.Queue="queue",i.AiQueue="ai_queue",i.AiCaptureQueue="ai_capture_queue",i.LogsQueue="logs_queue",i.OptedOut="opted_out",i.SessionId="session_id",i.SessionStartTimestamp="session_start_timestamp",i.SessionLastTimestamp="session_timestamp",i.PersonProperties="person_properties",i.GroupProperties="group_properties",i.InstalledAppBuild="installed_app_build",i.InstalledAppVersion="installed_app_version",i.SessionReplay="session_replay",i.PushRegistered="push_registered",i.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",i.SurveyLastSeenDate="survey_last_seen_date",i.SurveysSeen="surveys_seen",i.Surveys="surveys",i.RemoteConfig="remote_config",i.FlagsEndpointWasHit="flags_endpoint_was_hit",i.DeviceId="device_id",i}({}),kr=function(i){return i.GZipJS="gzip-js",i.Base64="base64",i}({}),ah=["$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"],lh=["token"],uh=20,ja=1e3,hh=1e4,ch="[Circular]",Tr="[Truncated]",Os="[Unserializable]",dh="[Function]";function Bt(i){for(var e="",t=0;i.length>t;t++){var s=i.charCodeAt(t);if(55296>s||s>56319)e+=56320>s||s>57343?i[t]:"\uFFFD";else{var r=i.charCodeAt(t+1);56320>r||r>57343?e+="\uFFFD":(e+=i[t]+i[t+1],t++)}}return e}var ph=["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"],Fo=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return ph.concat(e).some(s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1})};function R(i,e){return i.indexOf(e)!==-1}var Fs=function(i){return i.trim()},Pr=function(i){return i.replace(/^\$/,"")};function Ua(i){var e,t=[];return(e=JSON.stringify(i,function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(r))return"[Circular]";t.push(r)}return r}}))!==null&&e!==void 0?e:"null"}var Va=Object.prototype,za=Va.hasOwnProperty,Ls=Va.toString,L=Array.isArray||function(i){return Ls.call(i)==="[object Array]"},xe=i=>typeof i=="function",z=i=>i===Object(i)&&!L(i),De=i=>{if(z(i)){for(var e in i)if(za.call(i,e))return!1;return!0}return!1},b=i=>i===void 0,j=i=>Ls.call(i)=="[object String]",yi=i=>j(i)&&i.trim().length===0,le=i=>i===null,D=i=>b(i)||le(i),ue=i=>Ls.call(i)=="[object Number]"&&i==i,Xe=i=>ue(i)&&i>0,Pe=i=>Ls.call(i)==="[object Boolean]",vh=i=>i instanceof FormData,gh=i=>R(ah,i),fh=i=>R(lh,i);function Wa(i){return i===null||typeof i!="object"}function es(i,e){return{}.toString.call(i)==="[object "+e+"]"}function Ga(i){switch({}
1.toString.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Ya(i,Error)}}function Kn(i){return typeof Event!="undefined"&&Ya(i,Event)}function Ya(i,e){try{return i instanceof e}catch(t){return!1}}var _h=[!0,"true",1,"1","yes"],Gs=i=>R(_h,i),mh=[!1,"false",0,"0","no"];function Ze(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),ue(i)?i>t?(s.warn(" cannot be  greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Ze(r||t,e,t,s))}var Cr=class{constructor(e){this.C={},this.I=e.I,this.R=Ze(e.bucketSize,0,100,e.A),this.O=Ze(e.refillRate,0,this.R,e.A),this.N=Ze(e.refillInterval,0,864e5,e.A)}F(e,t){var s=Math.floor((t-e.lastAccess)/this.N);s>0&&(e.tokens=Math.min(e.tokens+s*this.O,this.R),e.lastAccess=e.lastAccess+s*this.N)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.C[r];return n?this.F(n,s):this.C[r]=n={tokens:this.R,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)==null||t.call(this,e)),n.tokens===0)}stop(){this.C={}}},Re="Mobile",ts="iOS",rt="Android",zt="Tablet",Ka=rt+" "+zt,Za="iPad",Qa="Apple",Ja=Qa+" Watch",bi="Safari",Wt="BlackBerry",Xa="Samsung",el=Xa+"Browser",tl=Xa+" Internet",kt="Chrome",yh=kt+" OS",il=kt+" "+ts,Zn="Internet Explorer",sl=Zn+" "+Re,Qn="Opera",bh=Qn+" Mini",Jn="Edge",rl="Microsoft "+Jn,qt="Firefox",nl=qt+" "+ts,Ti="Nintendo",Pi="PlayStation",jt="Xbox",ol=rt+" "+Re,al=Re+" "+bi,gi="Windows",Ar=gi+" Phone",Lo="Nokia",Ir="Ouya",ll="Generic",wh=ll+" "+Re.toLowerCase(),ul=ll+" "+zt.toLowerCase(),Or="Konqueror",hl="Oculus Browser",is="Vivaldi",cl="Yandex",ss="Whale",Fr="DuckDuckGo",dl="Pale Moon",rs="Waterfox",wi="Brave",ns="Claude",os="Codex",as="ChatGPT",pl="Google Search App",se="(\\d+(\\.\\d+)?)",Ys=new RegExp("Version/"+se),Ks=new RegExp("("+ns+"|"+os+"|"+as+")\\/"+se),Eh=new RegExp(jt,"i"),xh=new RegExp(Pi+" \\w+","i"),Sh=new RegExp(Ti+" \\w+","i"),Xn=new RegExp(Wt+"|PlayBook|BB10","i"),kh={"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"},vl=function(i,e,t,s){e=e||"";var r=function(n){return n!=null&&n.brave?wi:null}(t);return r||(s!=null&&s.detectGoogleSearchApp&&R(i,"GSA/")?pl:R(i," OPR/")&&R(i,"Mini")?bh:R(i," OPR/")?Qn:Xn.test(i)?Wt:R(i,"IE"+Re)||R(i,"WPDesktop")?sl:R(i,"OculusBrowser")?hl:R(i,el)?tl:R(i,Jn)||R(i,"Edg/")?rl:R(i,is+"/")?is:R(i,"YaBrowser/")?cl:R(i,ss+"/")?ss:R(i,Fr+"/")||R(i,"Ddg/")?Fr:R(i,ns+"/")?ns:R(i,os+"/")?os:R(i,as+"/")?as:R(i,"FBIOS")?"Facebook "+Re:R(i,"UCWEB")||R(i,"UCBrowser")?"UC Browser":R(i,"CriOS")?il:R(i,"CrMo")||R(i,kt)?kt:R(i,rt)&&R(i,bi)?ol:R(i,"FxiOS")?nl:R(i.toLowerCase(),Or.toLowerCase())?Or:R(i,wi+"/")?wi:((n,o)=>o&&R(o,Qa)||function(a){return R(a,bi)&&!R(a,kt)&&!R(a,rt)}(n))(i,e)?R(i,Re)?al:bi:R(i,"PaleMoon/")?dl:R(i,rs+"/")?rs:R(i,qt)?qt:R(i,"MSIE")||R(i,"Trident/")?Zn:R(i,"Gecko")?qt:"")},Th={[sl]:[new RegExp("rv:"+se)],[rl]:[new RegExp(Jn+"?\\/"+se)],[kt]:[new RegExp("("+kt+"|CrMo)\\/"+se)],[il]:[new RegExp("CriOS\\/"+se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+se)],[bi]:[Ys],[al]:[Ys],[Qn]:[new RegExp("(Opera|OPR)\\/"+se)],[qt]:[new RegExp(qt+"\\/"+se)],[nl]:[new RegExp("FxiOS\\/"+se)],[Or]:[new RegExp("Konqueror[:/]?"+se,"i")],[Wt]:[new RegExp(Wt+" "+se),Ys],[ol]:[new RegExp("android\\s"+se,"i")],[tl]:[new RegExp(el+"\\/"+se)],[hl]:[new RegExp("OculusBrowser\\/"+se)],[is]:[new RegExp(is+"\\/"+se)],[cl]:[new RegExp("YaBrowser\\/"+se)],[ss]:[new RegExp(ss+"\\/"+se)],[wi]:[new RegExp(wi+"\\/"+se)],[ns]:[Ks],[os]:[Ks],[as]:[Ks],[Fr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+se)],[dl]:[new RegExp("PaleMoon\\/"+se)],[rs]:[new RegExp(rs+"\\/"+se)],[pl]:[new RegExp("GSA\\/"+se)],[Zn]:[new RegExp("(rv:|MSIE )"+se)],Mozilla:[new RegExp("rv:"+se)]},Ph=function(i,e,t,s){var r=vl(i,e,t,s),n=Th[r];if(b(n))return null;for(var o=0;n.length>o;o++){var a=i.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},$o=[[new RegExp(jt+"; "+jt+" (.*?)[);]","i"),i=>[jt,i&&i[1]||""]],[new RegExp(Ti,"i"),[Ti,""]],[new RegExp(Pi,"i"),[Pi,""]],[Xn,[Wt,""]],[new RegExp(gi,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ar,""];if(new RegExp(Re).test(e)&&!/IEMobile\b/.test(e))return[gi+" "+Re,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=kh[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[gi,s]}return[gi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[ts,[i[3],i[4],i[5]||"0"].join(".")]:[ts,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=b(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rt+")","i"),i=>i&&i[2]?[rt,[i[2],i[3],i[4]||"0"].join(".")]:[rt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[yh,""]],[/Linux|debian/i,["Linux",""]]],gl=function(i){for(var e=0;$o.length>e;e++){var t=$o[e],s=t[1],r=t[0].exec(i),n=r&&(xe(s)?s(r,i):s);if(n)return n}return["",""]},Ro=function(i){return Sh.test(i)?Ti:xh.test(i)?Pi:Eh.test(i)?jt:new RegExp(Ir,"i").test(i)?Ir:ne
1w RegExp("("+Ar+"|WPDesktop)","i").test(i)?Ar:/iPad/.test(i)?Za:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Ja:Xn.test(i)?Wt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Lo,"i").test(i)?Lo:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(Re).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?rt:Ka:new RegExp("(pda|"+Re+")","i").test(i)?wh:new RegExp(zt,"i").test(i)&&!new RegExp(zt+" pc","i").test(i)?ul:""},Ch=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Mo(i,e){return typeof(t=i)=="string"&&Ch.test(t)?i:e();var t}function fl(i,e){var t=new Error(e);try{Object.defineProperty(t,"name",{value:i,writable:!0,enumerable:!0,configurable:!0})}catch(s){}return t}function dt(i){return i&&i.split("#")[0]}function eo(i,e){var t=setTimeout(i,e);return t!=null&&t.unref&&(t==null||t.unref()),t}function No(i,e,t){return _l.apply(this,arguments)}function _l(){return(_l=X(function*(i,e,t){var s;try{return yield Promise.race([i,new Promise((r,n)=>{s=eo(()=>{try{t==null||t(),r()}catch(o){n(o)}},e)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var oi,ml="NativeGzipValidationError",Lr=i=>i.length>=2&&i[0]===31&&i[1]===139,Do=(i,e)=>i===kr.GZipJS||e===kr.GZipJS||e==="gzip",Ho=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",Mi=i=>{throw fl(ml,"Native gzip produced invalid output: "+i)},Ah=function(){var i=X(function*(e,t){18>e.size&&Mi("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Lr(s)&&s[2]===8||Mi("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(oi)return oi;oi=[];for(var h=0;256>h;h++){for(var c=h,d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;oi[h]=c>>>0}return oi})(),l=4294967295,u=0;o.length>u;u++)l=a[255&(l^o[u])]^l>>>8;return(4294967295^l)>>>0})(t)&&Mi("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&Mi("invalid-size")});return function(e,t){return i.apply(this,arguments)}}();function $r(){return $r=X(function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),o=n.write(s).then(()=>n.close()).catch(function(){var u=X(function*(h){try{yield n.abort(h)}catch(c){}throw h});return function(h){return u.apply(this,arguments)}}()),a=new Response(r.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield Ah(l,s),l}catch(u){if(t!=null&&t.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}}),$r.apply(this,arguments)}var Bo=9223372036854776e3,Ih="9223372036854775808",Oh={}.propertyIsEnumerable;function ls(i,e){try{return yl(i,e,{ancestors:new WeakSet,remainingNodes:hh},0)}catch(t){return[]}}function to(i,e,t,s){if(0>=t.remainingNodes)return{stringValue:Tr};if(t.remainingNodes--,Pe(i))return{boolValue:i};if(typeof i=="bigint")return function(l,u){var h=l.toString(),c=BigInt(Ih);return l>=c||-c>l?(u==null||u.debug("Attribute "+h+" is outside the int64 range; encoding it as a string"),{stringValue:h}):{intValue:h}}(i,e);if(typeof i=="number"){if(!Number.isFinite(i))return{stringValue:String(i)};if(Number.isInteger(i)){if(Number.isSafeInteger(i))return{intValue:String(i)};if(typeof BigInt=="undefined")return{stringValue:String(i)};var r=BigInt(i).toString();return i>=Bo||-Bo>i?(e==null||e.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}return{doubleValue:i}}if(typeof i=="string")return{stringValue:Bt(i)};if(typeof i=="function")return{stringValue:dh};if(typeof i=="symbol")return{stringValue:String(i)};if(typeof i=="object"&&i!==null){if(t.ancestors.has(i))return{stringValue:ch};if(s>=uh)return{stringValue:Tr};if(i instanceof Date){var n=i.getTime(),o=Number.isFinite(n)?i.toISOString():String(i);
1return{stringValue:typeof o=="string"?Bt(o):String(o)}}t.ancestors.add(i);try{try{var a=i.toJSON;if(typeof a=="function")return to(a.call(i),e,t,s+1)}catch(l){}return L(i)?{arrayValue:{values:Fh(i,e,t,s+1)}}:{kvlistValue:{values:yl(i,e,t,s+1)}}}finally{t.ancestors.delete(i)}}return{stringValue:Bt(String(i))}}function Fh(i,e,t,s){for(var r=[],n=Math.min(i.length,ja),o=0;n>o&&t.remainingNodes>0;o++)try{var a=o in i?i[o]:void 0;if(D(a))continue;r.push(to(a,e,t,s))}catch(l){r.push({stringValue:Os})}return i.length>o&&r.push({stringValue:Tr}),r}function yl(i,e,t,s){var r=[];for(var n in i)if(Oh.call(i,n)){if(!n){e==null||e.debug("Dropping an attribute with an empty key");continue}if(r.length>=ja||0>=t.remainingNodes){e==null||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=i[n];if(le(o)||b(o))continue;r.push({key:Bt(n),value:to(o,e,t,s)})}catch(a){r.push({key:Bt(n),value:{stringValue:Os}})}}return r}function bl(i,e,t){return E({},i.resourceAttributes,{"service.name":i.serviceName||"unknown_service"},i.environment&&{"deployment.environment":i.environment},i.serviceVersion&&{"service.version":i.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}var qo={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},wl={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}},Lh=wl.info;function $h(i){try{return Bt(String(i))}catch(e){return Os}}function Rh(i,e,t,s){var r,n=wl[i.level||"info"]||Lh,o=n.text,a=n.number,l=((r=ue(s)?s:void 0)===void 0&&(r=Date.now()),String(r)+"000000"),u={};e.distinctId&&(u.posthogDistinctId=e.distinctId),e.sessionId&&(u.sessionId=e.sessionId),e.windowId&&(u["window.id"]=e.windowId),D(e.sessionStartTimestamp)||(u.sessionStartTimestamp=String(e.sessionStartTimestamp)),D(e.lastActivityTimestamp)||(u.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(u["url.full"]=e.currentUrl),e.screenName&&(u["screen.name"]=e.screenName),e.appState&&(u["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(u.feature_flags=e.activeFeatureFlags);var h=E({},u),c=i.attributes;if(c){var d=[];try{d=Object.keys(c)}catch(f){d=[]}for(var g of d){var p=void 0;try{p=c[g]}catch(f){p=Os}Object.defineProperty(h,g,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var v={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:o,body:{stringValue:$h(i.body)},attributes:ls(h,t)};return i.trace_id&&(v.traceId=i.trace_id),i.span_id&&(v.spanId=i.span_id),b(i.trace_flags)||(v.flags=i.trace_flags),v}function El(i,e,t){return bl(i,e,t)}function xl(i,e,t,s){return{resourceLogs:[{resource:{attributes:ls(e)},scopeLogs:[{scope:{name:t,version:s},logRecords:i}]}]}}var Mh=class{constructor(i,e,t,s,r,n,o){var a;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.mn=e,this.A=t,this.Pn=s,this.Fn=r,this.$n=n,this.Nn=o,this.qn=null,this.jn=0,this.Bn=0,this.Hn=0,this.zn=0,this.Un=0,this.Wn=!1,this.Vn=e.maxBufferSize,this.Gn=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.Zn=e.flushIntervalMs,this.Qn=e.maxBatchRecordsPerPost,this.Jn=e.rateCapWindowMs,this.Kn=e.maxLogsPerInterval}clearQueue(){this.Bn++,this._instance.setPersistedProperty(Ye.LogsQueue,[])}reset(){this.Yn(),this.zn=0,this.Un=0,this.Wn=!1,this.Hn=0,this.Qn=this.mn.maxBatchRecordsPerPost}onReconnect(){this.Hn=0,this.Xn()}captureLog(i,e){var t;if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var s=this.ts(i);if(s!==null)if(s.body){if(this.es()){var r={record:Rh(s,(t=e==null?void 0:e.context)!==null&&t!==void 0?t:this.Pn(),this.A,e==null?void 0:e.occurredAtMs)};this.Fn(()=>this.rs(r))}}else this.A.info("Log was rejected in beforeSend function")}}ts(i){var e=this.mn.beforeSend;if(!e)return i;var t=L(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;s=n}catch(o){return this.A.error("Error in beforeSend function for log:",o),null}return s}es(){if(this.Kn===void 0)return!0;var i=Date.now(),e=i-this.zn;return this.Jn>e&&e>=0||(this.zn=i,this.Un=0,this.Wn=!1),this.Kn>this.Un?(this.Un++,!0):(this.Wn||(this.A.warn("captureLog dropping logs: exceeded "+this.Kn+" logs per "+this.Jn+"ms"),this.Wn=!0),!1)}flush(){var i=this;return X(function*(){if(!i._instance.isDisabled)return i.qn||(i.qn=i.ns().finally(()=>{i.qn=null})),i.qn})()}ns(){var i=this;return X(function*(){var e;i.Yn();var t=(e=i._instance.getPersistedProperty(Ye.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var s=t.length,r=0;t.length>0&&s>r;){var n,o,a=i.Bn;i.jn=0;var l=Math.min(t.length,i.Qn),u=t.slice(0,l),h=xl(u.map(d=>d.record),i.ss(),(n=i.Nn)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),c=yield i._instance.os(h);if(i.Bn!==a)return;if(c.kind==="too-large"&&u.length>1)i.Qn=Math.max(1,Math.floor(u.length/2)),i.A.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+i.Qn);else if(c.kind==="retry-later"||(c.kind==="too-large"?i.A.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record 
1is larger than the server cap and cannot be split further."):c.kind==="ok"&&i.mn.maxBatchRecordsPerPost>i.Qn&&(i.Qn=Math.min(i.mn.maxBatchRecordsPerPost,i.Qn+1)),yield i.ls(u.length),t=(o=i._instance.getPersistedProperty(Ye.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,c.kind==="fatal"))throw c.error}})()}ls(i){var e=this;return X(function*(){var t,s=Math.max(0,i-e.jn),r=(t=e._instance.getPersistedProperty(Ye.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Ye.LogsQueue,r.slice(s)),yield e.$n()})()}ss(){return El(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}rs(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Ye.LogsQueue))!==null&&e!==void 0?e:[];this.Gn>t.length||(t.shift(),this.jn++,this.A.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(Ye.LogsQueue,t),this.Vn>t.length?this.us():this.Xn()}}us(i){i===void 0&&(i=this.Zn),this.hs||(this.hs=eo(()=>{this.hs=void 0,this.Xn()},i))}ds(){var i=Math.min(Math.max(0,this.Hn-1),6);return this.Zn*Math.pow(2,i)}vs(){var i=this._instance.getPersistedProperty(Ye.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return X(function*(){e.Yn();var t=e.flush().catch(()=>{});i!==void 0?yield No(t,i):yield t})()}flushWithTimeout(i){var e=this;return X(function*(){var t=e.flush();yield No(t,i,()=>{t.catch(()=>{})})})()}Xn(){this.flush().then(()=>{this.Hn=0},i=>{this.Hn++,this.A.error("PostHog logs flush failed:",i)}).finally(()=>{!this._instance.isDisabled&&this.vs()&&this.us(this.ds())})}Yn(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}},Zs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function jo(i){return String(i)+"000000"}function Uo(i,e,t,s){var r="";return s&&(r=Object.keys(s).sort().map(n=>JSON.stringify(n)+":"+JSON.stringify(s[n])).join(",")),i+"\0"+e+"\0"+(t!=null?t:"")+"\0"+r}var Nh=class{constructor(i,e,t){this._instance=i,this.mn=e,this.A=t,this.cs=new Map,this.qn=null,this.fs=!1,this.ps=new Map,this.gs=new Set,this.ys=0}count(i,e,t){e===void 0&&(e=1),this.bs({name:i,type:"count",value:e,unit:t==null?void 0:t.unit,attributes:t==null?void 0:t.attributes})}gauge(i,e,t){this.bs({name:i,type:"gauge",value:e,unit:t==null?void 0:t.unit,attributes:t==null?void 0:t.attributes})}histogram(i,e,t){this.bs({name:i,type:"histogram",value:e,unit:t==null?void 0:t.unit,attributes:t==null?void 0:t.attributes})}flush(){var i=this,e=this.qn,t=function(){var r=X(function*(){e&&(yield e.catch(()=>{})),yield i._s()});return function(){return r.apply(this,arguments)}}(),s=t().finally(()=>{this.qn===s&&(this.qn=null)});return this.qn=s,s}drainWindow(){if(this.cs.size===0)return null;var i=this.cs;return this.cs=new Map,this.fs=!1,this.ps=new Map,this.gs=new Set,this.ws(i)}reset(){this.ys++,this.Yn(),this.cs=new Map,this.qn=null,this.fs=!1,this.ps=new Map,this.gs=new Set}bs(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.ts(i);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.A.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,s;try{t=e.attributes?E({},e.attributes):void 0,s=Uo(e.type,e.name,e.unit,t)}catch(o){return void this.A.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var r=this.cs.get(s);if(!r){if(!this.ks())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.cs.set(s,r)}var n=this.ps.get(e.name);n===void 0?this.ps.set(e.name,e.type):n===e.type||this.gs.has(e.name)||(this.gs.add(e.name),this.A.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ss(r,e.value),this.us()}else this.A.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}ks(){return this.mn.maxSeriesPerFlush>this.cs.size||(this.fs||(this.fs=!0,this.A.warn("Metric series cap reached ("+this.mn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ss(i,e){var t;switch(i.type){case"count":i.total=((t=i.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":i.last=e;break;case"histogram":i.hist||(i.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Zs.length+1).fill(0)});var s=i.hist;s.count+=1,s.sum+=e,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e),s.bucketCounts[function(r,n){for(var o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length}(e,Zs)]+=1}}ts(i){var e=this.mn.beforeSend;if(!e)return i;var t=L(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;s=n}catch(o){return this.A.error("Error in beforeSend function for metric:",o),null}return s}us(){this.hs||(this.hs=eo(()=>{this.hs=void 0,this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})},this.mn.flushIntervalMs))}Yn(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}_s(){var i=this;return X(function*(){if(i.cs.size!==0){var e=i.cs;i.cs=new Map,i.fs=!1,i.ps=new Map,i.gs=new Set;var t=i.ys,s=yield i._instance.xs(i.ws(e));if(t===i.ys)switch(s.kind){case"ok":return;case"retry-later":return i.Cs(e),void i.us();case"too-large":return void i.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.A.error("Failed to send metrics batch:",s.error)}}})()}ws(i){return e=this.Ts(i),t=function(n,o,a){return bl(n,o,a)}(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ls(t)},scopeMetrics:[{scope:{name:s,version:r},metrics:e}]}]};var e,t,s,r}Ts(i){var e=jo(Date.now()),t=new Map;for(var s of i.values()){var r,n=Uo(s.type,s.name,s.unit,void 0),o=t.get(n);o||(o=E({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,o));var a=ls((r=s.attributes)!==null&&r!==void 0?r:{},this.A),l=jo(s.windowStartMs);if(s.type==="count"){var u,h={attributes:a,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=s.total)!==null&&u!==void 0?u:0};o.sum.dataPoints.push(h)}else if(s.type==="gauge"){var c,d={attributes:a,timeUnixNano:e,asDouble:(c=s.last)!==null&&c!==void 0?c:0};o.gauge.dataPoints.push(d)}else s.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Zs})}return Array.from(t.values())}Cs(i){var e,t;for(var s of i){var r=s[0],n=s[1],o=this.cs.get(r);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((t=n.total)!==null&&t!==void 0?t: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.ks()&&this.cs.set(r,n)}}},Ni,Vo,Qs;function Dh(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Qs&&t.length===Vo||(Vo=t.length,Qs=t.reduce((s,r)=>{Ni||(Ni={});var n=Ni[r];if(n)s[n[0]]=n[1];else for(var o=i(r),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,h=e[r];if(u&&h){s[u]=h,Ni[r]=[u,h];break}}return s},{})),Qs}}var Rr=class{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(o,s),$exception_level:"error"}}modifyFrames(e){var t=this;return X(function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&L(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),E({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map(s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return X(function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s})()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Dh(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,o)=>{if(4>=o){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return E({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}},Gt="?";function Mr(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?Gt:t,in_app:!(e!=null&&e.startsWith("webkit-masked-url://"))&&e!=="<anonymous>"};return b(s)||(n.lineno=s),b(r)||(n.colno=r),n}var Sl=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:Gt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Hh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Bh=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qh=/\((\S*)(?::(\d+))(?::(\d+))\)/,jh=(i,e)=>{var t=Hh.exec(i);if(t)return Mr(e,t[1],Gt,+t[2],+t[3]);var s=Bh.exec(i);if(s){if(s[2]&&s[2].indexOf("eval")===0){var r=qh.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=Sl(s[1]||Gt,s[2]);return Mr(e,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Uh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Vh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zh=(i,e)=>{var t=Uh.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=Vh.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||Gt,o=Sl(n,r);return Mr(e,r=o[1],n=o[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},zo=/\(error: (.*)\)/,Nr=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return es(e,"DOMException")}isDOMError(e){return es(e,"DOMError")}},Dr=class{match(e){return Ga(e)}coerce(e,t){var s,r=this.getStack(e),n=r===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:r!=null?r:(s=t.syntheticException)==null?void 0:s.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},Hr=class{constructor(){}match(e){return!!es(e,"ErrorEvent")&&(e.error!=null||this.Vi(e))}coerce(e,t){var s;if(e.error!=null)return t.apply(e.error);var r=t.apply(e.message);return E({},r,{stack:(s=this.Zi(e))!==null&&s!==void 0?s:r.stack,synthetic:!0})}Vi(e){return j(e.message)&&e.message.length>0}Zi(e){var t,s,r=e,n=(t=r.lineno)!==null&&t!==void 0?t:0,o=(s=r.colno)!==null&&s!==void 0?s:0;if(j(r.filename)&&r.filename.length!==0&&n!==0)return`Error
2    at `+r.filename+":"+n+":"+o}},Wh=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Br=class{match(e){return typeof e=="string"}coerce(e,t){var s,r=this.getInfos(e),n=r[0],o=r[1];return{type:n!=null?n:"Error",value:o!=null?o:e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(Wh);return r&&(t=r[1],s=r[2]),[t,s]}},Gh=["fatal","error","warning","log","info","debug"];function kl(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");
2if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}var qr=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(s=this.getStack(e))!==null&&s!==void 0?s:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Kn(e))return e.constructor.name;var t="name"in e?e.name:void 0;return j(t)&&!yi(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+kl(e)}isSeverityLevel(e){return j(e)&&!yi(e)&&Gh.indexOf(e)>=0}getStack(e){try{return j(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:j(e.stack)&&e.stack.length>0?e.stack:void 0}catch(t){return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(Ga(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(s){return}}},jr=class{match(e){return Kn(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+kl(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Ur=class{match(e){return Wa(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Vr=class{match(e){return es(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Kn(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch(s){return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return Wa(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}},us="$message",hs="$timestamp",Yh=new Set([us,hs]),Js={enabled:!0,max_bytes:32768};function cs(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:Js.enabled,max_bytes:Kh(i.max_bytes,Js.max_bytes)}:E({},Js)}var zr=class{constructor(e){this.Ms=[],this.Es=0,this.mn=cs(e)}setConfig(e){this.mn=cs(e),this.Is()}
2add(e){var t=function(r){var n;try{n=Ua(r)}catch(h){return}try{var o=JSON.parse(n);if(!z(o))return;var a=o,l=a[us],u=a[hs];return!j(l)||l.trim().length===0||!j(u)&&!ue(u)?void 0:{step:a,json:n}}catch(h){return}}(e);if(t){var s=function(r){if(typeof TextEncoder!="undefined")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),o=0,a=0;n.length>a;a++)n[a]==="%"?(o+=1,a+=2):o+=1;return o}(t.json);s>this.mn.max_bytes||(this.Ms.push({step:t.step,bytes:s}),this.Es+=s,this.Is())}}getAttachable(){return this.Ms.map(e=>e.step)}clear(){this.Ms=[],this.Es=0}size(){return this.Ms.length}Is(){for(;this.Es>this.mn.max_bytes&&this.Ms.length>0;){var e=this.Ms.shift();e&&(this.Es-=e.bytes)}}};function Kh(i,e){if(!ue(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var Tl=function(i,e){var t=(e===void 0?{}:e).debugEnabled,s={q(r){if(m&&(Q.DEBUG||m.POSTHOG_DEBUG||t)&&!b(m.console)&&m.console){for(var n=("__rrweb_original__"in m.console[r])?m.console[r].__rrweb_original__:m.console[r],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];n(i,...a)}},debug(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.q("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.q("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.q("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.q("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>Tl(i+" "+r,n)};return s},k=Tl("[PostHog.js]"),ie=k.createLogger,Zh=ie("[ExternalScriptsLoader]"),ds=i=>{var e=S==null?void 0:S.querySelectorAll("script");if(e){for(var t=0;e.length>t;t++)if(e[t].src===i||e[t].getAttribute("src")===i)return e[t]}},wt=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Zh.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=ds(e);if(s){if(s.__posthog_loading_callback_fired)return t();var r=s.__posthog_loading_error;return r?t(r):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,t(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,t(o)}))}var n=()=>{if(!S)return t("document not found");if(ds(e))return wt(i,e,t);var o=S.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=u=>{o.__posthog_loading_callback_fired=!0,t(void 0,u)},o.onerror=u=>{o.__posthog_loading_error=u,t(u)},i.config.prepare_external_dependency_script&&(o=i.config.prepare_external_dependency_script(o)),!o)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")S.head.appendChild(o);else{var a,l=S.querySelectorAll("body > script");l.length>0?(a=l[0].parentNode)==null||a.insertBefore(o,l[0]):S.body.appendChild(o)}};S!=null&&S.body?n():S==null||S.addEventListener("DOMContentLoaded",n)},Xs={},Wo=(i,e)=>{var t="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var s=3e5;t=t+"&t="+Math.floor(Date.now()/s)*s}return i.requestRouter.endpointFor("assets",t)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s=i.config.strict_script_versioning;if(s){var r=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js"),n=Xs[r];if(s==="fallback"&&n){if(ds(n))return void wt(i,n,t);delete Xs[r]}wt(i,r,s==="fallback"?(a,l)=>{if(a)if(typeof a=="string")t(a);else{var u,h=Wo(i,e);Xs[r]=h;var c=ds(r);c==null||(u=c.parentNode)==null||u.removeChild(c),wt(i,h,t)}else t(void 0,l)}:t)}else wt(i,Wo(i,e),t)}else{var o=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");wt(i,o,t)}},F.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);wt(i,s,t)};Q.DEBUG=!1,Q.LIB_VERSION="1.425.1",Q.LIB_NAME="web";var Pl="$people_distinct_id",me="distinct_id",Ci="$device_id",er="$device_model",Nt="__alias",fi="__timers",Wr="$autocapture_disabled_server_side",Gr="$heatmaps_enabled_server_side",Yr="$exception_capture_enabled_server_side",Kr="$error_tracking_suppression_rules",Zr="$error_tracking_capture_extension_exceptions",Qr="$web_vitals_enabled_server_side",io="$dead_clicks_enabled_server_side",so="$product_tours_enabled_server_side",Jr="$logs_capture_enabled_server_side",Xr="$web_vitals_allowed_metrics",St="$session_recording_remote_config",Cl="$replay_sample_rate",Al="$replay_override_sampling",Il="$replay_override_linked_flag",Ol="$replay_override_url_trigger",Fl="$replay_override_event_trigger",Dt="$sesid",ro="$session_is_sampled",ke="$enabled_feature_flags",He="$active_feature_flags",Yi="$early_access_features",ht="$feature_flag_details",Ue="$feature_flag_payloads",ct="$feature_flag_request_id",Ut="$minimal_flag_called_events",Ge="$override_feature_flags",Et="$override_feature_flag_payloads",Fe="$stored_person_properties",Ke="$stored_group_properties",Ll="$groups",en="$surveys",ps="$surveys_loaded_at",tn="$surveys_activated",Ki="$surveys_activated_session",Zi="$surveys_activated_timestamps",_i="ph_product_tours",tt="$flag_call_reported",mi="$flag_call_reported_session_id",Vt="$feature_flag_errors",nt="$feature_flag_evaluated_at",H="$user_state",sn="$client_session_props",rn="$capture_rate_limit",nn="$initial_campaign_params",on="$initial_referrer_info",vs="$initial_person_info",gs="$epp",Ct="$posthog_cookieless",$l="$cookieless_mode",Rl="$sdk_debug_extensions_init_method",Ml="$sdk_debug_extensions_init_time_ms",an="$sdk_debug_recording_script_not_loaded",no="PostHog loadExternalDependency extension not found.",ut="on_reject",it="always",he="anonymous",we="identified",ln="identified_only",Yt="visibilitychange",fs="beforeunload",Rt="$pageview",tr="$pageleave",ir="$identify",Go="$groupidentify";
2function Di(i,e){L(i)&&i.forEach(e)}function G(i,e){if(!D(i))if(L(i))i.forEach(e);else if(vh(i))i.forEach((s,r)=>e(s,r));else for(var t in i)za.call(i,t)&&e(i[t],t)}var J=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function Qi(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Yo=function(i){try{return i()}catch(e){return}},Qh=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){k.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),k.critical(r)}}},oo=function(i){var e={};return G(i,function(t,s){(j(t)&&t.length>0||ue(t))&&(e[s]=t)}),e},Jh=["herokuapp.com","vercel.app","netlify.app"];function Xh(i){var e=i==null?void 0:i.hostname;if(!j(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of Jh)if(t===s)return!1;return!0}function Z(i,e,t,s){var r=s!=null?s:{},n=r.capture,o=r.passive;i==null||i.addEventListener(e,t,{capture:n!==void 0&&n,passive:o===void 0||o})}function un(i){return i.name==="ph_toolbar_internal"}var hn=i=>{if(S){try{for(var e=i+"=",t=S.cookie.split(";").filter(n=>n.length),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch(n){}return null}};Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return ue(i)&&isFinite(i)&&Math.floor(i)===i});var Kt=class{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>
2>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new Kt(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Kt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}},cn=class{generate(){var e=this.generateOrAbort();if(!b(e))return e;this.Kr=0;var t=this.generateOrAbort();if(b(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.Kr)this.Kr=e,this.Xr();else{if(this.Kr>=e+1e4)return;this.ei++,this.ei>4398046511103&&(this.Kr++,this.Xr())}return Kt.fromFieldsV7(this.Kr,Math.trunc(this.ei/Math.pow(2,30)),this.ei&Math.pow(2,30)-1,this.ti.nextUint32())}Xr(){this.ei=1024*this.ti.nextUint32()+(1023&this.ti.nextUint32())}constructor(){this.Kr=0,this.ei=0,this.ti=new dn}},Ko,Nl=i=>{if(typeof UUIDV7_DENY_WEAK_RNG!="undefined"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};m&&!b(m.crypto)&&crypto.getRandomValues&&(Nl=i=>crypto.getRandomValues(i));var dn=class{nextUint32(){return this.Pt.length>this.ri||(Nl(this.Pt),this.ri=0),this.Pt[this.ri++]}constructor(){this.Pt=new Uint32Array(8),this.ri=1/0}},Ve=()=>ec().toString(),ec=()=>(Ko||(Ko=new cn)).generate(),ai="",tc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,At=null,re={ii(){if(!le(At))return At;if(At=!1,S)try{var i="__ph_cookie_support_"+Ve();re.ni(i,"xyz"),At=hn(i)==='"xyz"',re.oi(i)}catch(e){At=!1}return At},si(i){k.error("cookieStore error: "+i)},ai:hn,ui(i){var e;try{e=JSON.parse(re.ai(i))||{}}catch(t){}return e},ni(i,e,t,s,r){if(!S)return!1;try{var n="",o="",a=function(h,c){if(c){var d=function(p,v){if(v===void 0&&(v=S),ai)return ai;if(!v||["localhost","127.0.0.1"].includes(p))return"";for(var f=p.split("."),_=Math.min(f.length,8),y="dmn_chk_"+Ve();!ai&&_--;){var w=f.slice(_).join("."),T=y+"=1;domain=."+w+";path=/";v.cookie=T+";max-age=3",v.cookie.includes(y)&&(v.cookie=T+";max-age=0",ai=w)}return ai}(h);if(!d){var g=(p=>{var v=p.match(tc);return v?v[0]:""})(h);g!==d&&k.info("Warning: cookie subdomain discovery mismatch",g,d),d=g}return d?"; domain=."+d:""}return""}(S.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&k.warn("cookieStore warning: large cookie, len="+u.length),S.cookie=u,!0}catch(h){return!1}},oi(i,e){if(S!=null&&S.cookie)try{re.ni(i,"",-1,e)}catch(t){return}}},sr=null,q={ii(){if(!le(sr))return sr;var i=!0;if(b(m))i=!1;else try{var e="__mplssupport__";q.ni(e,"xyz"),q.ai(e)!=='"xyz"'&&(i=!1),q.oi(e)}catch(t){i=!1}return i||k.error("localStorage unsupported; falling back to cookie store"),sr=i,i},si(i){k.error("localStorage error: "+i)},ai(i){try{return m==null?void 0:m.localStorage.getItem(i)}catch(e){q.si(e)}return null},ui(i){try{return JSON.parse(q.ai(i))||{}}catch(e){}return null},ni(i,e){try{return m==null||m.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){q.si(t)}return!1},oi(i){try{m==null||m.localStorage.removeItem(i)}catch(e){q.si(e)}}},rr=[Fe,He,ke,ht,Ue,ct,nt,Vt,tt],xt=[Ci,me,Dt,ro,gs,vs,H],_s=i=>i+"_cpm",ic=["__proto__","constructor","prototype"],nr=i=>{if(!z(i))return{};var e={};
2return Object.keys(i).forEach(t=>{ic.indexOf(t)===-1&&(e[t]=i[t])}),e},or=function(i,e){e===void 0&&(e=[]);var t={};return[...xt,...e].forEach(s=>{var r=i[s];b(r)||le(r)||r===""||(t[s]=r)}),t},Dl=i=>{for(var e=5381,t=2166136261,s=0;i.length>s;s++){var r=i.charCodeAt(s);e=33*e^r,t=Math.imul(t^r,16777619)}return i.length.toString(36)+"."+(e>>>0).toString(36)+"."+(t>>>0).toString(36)},Zo=(i,e)=>({p:e,f:Dl(JSON.stringify(i))}),Qo=(i,e)=>{if(!e)return{properties:[],isValid:!1};try{var t=re.ui(_s(i)),s=(t==null?void 0:t.f)===Dl(e)&&L(t.p);return{properties:s?t.p:[],isValid:s}}catch(r){return{properties:[],isValid:!1}}},ar=(i,e)=>e+"|"+(re.ai(_s(i))||""),It={},pn={ii:()=>!0,si(i){k.error("memoryStorage error: "+i)},ai:i=>i in It?It[i]:null,ui:i=>i in It?It[i]:null,ni:(i,e)=>(It[i]=e,!0),oi(i){delete It[i]}},gt=null,K={ii(){if(!le(gt))return gt;if(gt=!0,b(m))gt=!1;else try{var i="__support__";K.ni(i,"xyz"),K.ai(i)!=='"xyz"'&&(gt=!1),K.oi(i)}catch(e){gt=!1}return gt},si(i){k.error("sessionStorage error: ",i)},ai(i){try{return m==null?void 0:m.sessionStorage.getItem(i)}catch(e){K.si(e)}return null},ui(i){try{return JSON.parse(K.ai(i))||null}catch(e){}return null},ni(i,e){try{return m==null||m.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){K.si(t)}return!1},oi(i){try{m==null||m.sessionStorage.removeItem(i)}catch(e){K.si(e)}}},vn=class{constructor(e){this._instance=e}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===it||this.isRejected()||this.consent===-1&&this.mn.cookieless_mode===ut}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.mn.opt_out_capturing_by_default}optInOut(e){this.Zs.ni(this.Qs,e?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var e=this._instance.config,t=e.token,s=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(s?s+t:"__ph_opt_in_out_"+t)}get Gs(){var e=this.Zs.ai(this.Qs);return Gs(e)?1:R(mh,e)?0:-1}get Zs(){var e=this.mn.opt_out_capturing_persistence_type,t=e==="localStorage"?q:re,s=t.ii()?t:pn;if(!this.Js||this.Js!==s){this.Js=s;var r=e==="localStorage"?re:q;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(Gs(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[ge==null?void 0:ge.doNotTrack,ge==null?void 0:ge.msDoNotTrack,F.doNotTrack,ge==null?void 0:ge.globalPrivacyControl].some(e=>Gs(e))}};function Hl(i,e){var t,s=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!xe(s))return e;try{var r=s(e);return j(r)&&r?r:e}catch(n){return k.error("Error in get_current_url, falling back to window.location.href",n),e}}var Bl="__POSTHOG_TOOLBAR__",sc=1,rc=3,nc=11;function Jo(i){return i instanceof Element&&(i.id===Bl||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function pt(i){return!!i&&i.nodeType===sc}function $e(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function ql(i){return!!i&&i.nodeType===rc}function jl(i){return!!i&&i.nodeType===nc&&pt(i.host)}var Ul=1e3;function ao(i){return i?Fs(i).split(/\s+/):[]}function Xo(i,e){var t=function(s){var r,n=m==null||(r=m.location)==null?void 0:r.href;return b(n)?void 0:Hl(s,n)}(e);return!!(t&&i&&i.some(s=>t.match(s)))}function ms(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return ao(e)}function Vl(i){return D(i)?null:Fs(i).split(/(\s+)/).filter(e=>Ei(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ai(i){var e="";return _n(i)&&!Kl(i)&&i.childNodes&&i.childNodes.length&&G(i.childNodes,function(t){var s;ql(t)&&t.textContent&&(e+=(s=Vl(t.textContent))!==null&&s!==void 0?s:"")}),Fs(e)}function gn(i){var e;return b(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null}var lo=["a","button","form","input","select","textarea","label"];function fn(i,e){if(b(e))return!0;var t,s=function(n){if(e.some(o=>function(a,l){var u=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!u&&u.call(a,l)}catch(h){return!1}}(n,o)))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function zl(i){var e=i.parentNode;return!(!e||!pt(e))&&e}var oc=[".ph-no-autocapture","[data-ph-no-autocapture]"],Wl=["next","previous","prev",">","<"],ac=[...Wl,"+","-","\u2212","\u2013"],ea=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,ta=[".ph-no-rageclick",".ph-no-capture"],lc=["","text","search","email","password","url","tel","number"];function Gl(i,e){if(!m||uo(i))return!1;var t,s,r,n,o;if(Pe(e)?(t=!!e&&ta,s=void 0,r=!1):(t=(n=e==null?void 0:e.css_selector_ignorelist)!==null&&n!==void 0?n:ta,s=e==null?void 0:e.content_ignorelist,r=(o=e==null?void 0:e.ignore_text_selection)!==null&&o!==void 0&&o),t===!1||r&&function(l){return!(!l||!pt(l))&&(!!$e(l,"textarea")||($e(l,"input")?R(lc,(l.getAttribute("type")||"").toLowerCase()):function(u){if(u.isContentEditable)return!0;var h=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return h==="true"||h===""}(l)))}(i))return!1;var a=Yl(i,!1).targetElementList;return!function(l,u){if(l===!1||b(l))return!1;var h;if(l===!0)h=Wl;else{if(!L(l))return!1;if(l.length>10)return k.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;h=l.map(c=>c.toLowerCase())}return u.some(c=>
2{var d=c.safeText,g=c.ariaLabel;return h.some(p=>ea(d,p)||ea(g,p))})}(s,a.map(l=>{var u;return{safeText:Ai(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}}))&&!fn(a,t)}var uo=i=>!i||$e(i,"html")||!pt(i),Yl=(i,e)=>{if(!m||uo(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!$e(r,"body");)if(jl(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=zl(r);if(!n)break;if(e||lo.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var o=m.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch(a){}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function _n(i){for(var e=new Set,t=0,s=i;s.parentNode&&!$e(s,"body");s=s.parentNode){if(t++>=Ul||e.has(s))return!1;e.add(s);var r=ms(s);if(R(r,"ph-sensitive")||R(r,"ph-no-capture"))return!1}if(R(ms(i),"ph-include"))return!0;var n=i.type||"";if(j(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=i.name||i.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 Kl(i){return!!($e(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||$e(i,"select")||$e(i,"textarea")||i.getAttribute("contenteditable")==="true")}var ia=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}))$"),sa=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,uc=[16,15,14,13],hc=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),ra=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),na=/[0-9A-Za-z_]/;function cc(i){for(var e=0,t=!1,s=i.length-1;s>=0;s--){var r=i.charCodeAt(s)-48;t&&(r*=2)>9&&(r-=9),e+=r,t=!t}return e%10==0}function Ei(i,e){if(e===void 0&&(e=!0),D(i))return!1;if(j(i)){i=Fs(i);var t=e?ia.test((i||"").replace(/[- ]/g,"")):function(r){var n;for(sa.lastIndex=0;n=sa.exec(r);){var o=n[2];if(o)for(var a=o.replace(/[- ]/g,""),l=0;a.length>l;l++)for(var u of uc){var h=l+u;if(a.length>=h){var c=a.slice(l,h);if(ia.test(c)&&cc(c))return!0}}}return!1}(i);if(t)return!1;var s=e?hc.test(i):function(r){var n;for(ra.lastIndex=0;n=ra.exec(r);){var o=n[1],a=n[3];if(!(o&&a&&na.test(o)&&na.test(a)))return!0}return!1}(i);if(s)return!1}return!0}function oa(i){var e=Ai(i);return Ei(e=(e+" "+Zl(i)).trim())?e:""}function Zl(i){var e="";return i&&i.childNodes&&i.childNodes.length&&G(i.childNodes,function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=Ai(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Zl(t)).trim())}catch(n){k.error("[AutoCapture]",n)}}),e}function aa(i){return i.replace(/"|\\"/g,'\\"')}function dc(i){var e=i.attr__class;if(e)return L(e)?e:ao(e)}var Hi=ie("[Dead Clicks]"),pc=()=>!0,vc=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(io)),s=i.instance.config.capture_dead_clicks;return Pe(s)?s:!!z(s)||t},ys=class{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[io]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys(()=>{this.Xs()}):this.stop()}Ys(e){var t,s;(t=F.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=F.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?Hi.error("failed to load script",r):e()})}Xs(){var e;if(S){if(!this.Ks&&(e=F.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=z(this.instance.config.capture_dead_clicks)?E({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ks=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ks.start(S),Hi.info("starting...")}}else Hi.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Hi.info("stopping..."))}},lr=ie("[SegmentIntegration]"),Ql="posthog-js";function Jl(i,e){var t=e===void 0?{}:e,s=t.organization,r=t.projectId,n=t.prefix,o=t.severityAllowList,a=o===void 0?["error"]:o,l=t.sendExceptionsToPostHog,u=l===void 0||l;return h=>{var c,d,g,p,v;if(a!=="*"&&!a.includes(h.level)||!i.__loaded)return h;h.tags||(h.tags={});var f=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/pers
2on/"+i.get_distinct_id());h.tags["PostHog Person URL"]=f,i.sessionRecordingStarted()&&(h.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var _,y=((c=h.exception)==null?void 0:c.values)||[],w=y.map(x=>E({},x,{stacktrace:x.stacktrace?E({},x.stacktrace,{type:"raw",frames:(x.stacktrace.frames||[]).map(M=>E({},M,{platform:"web:javascript"}))}):void 0})),T={$exception_message:((d=y[0])==null?void 0:d.value)||h.message,$exception_type:(g=y[0])==null?void 0:g.type,$exception_level:h.level,$exception_list:w,$sentry_event_id:h.event_id,$sentry_exception:h.exception,$sentry_exception_message:((p=y[0])==null?void 0:p.value)||h.message,$sentry_exception_type:(v=y[0])==null?void 0:v.type,$sentry_tags:h.tags};return s&&r&&(T.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+h.event_id),u&&((_=i.exceptions)==null||_.sendExceptionEvent(T)),h}}var mn=class{constructor(e,t,s,r,n,o){this.name=Ql,this.setupOnce=function(a){a(Jl(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},bs=class{constructor(e){this.ta=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(k.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.ea=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ia()}ia(){var e;this.ra=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.ta)}destroy(){var e;(e=this.ra)==null||e.call(this),this.ra=void 0}doPageView(e,t){var s,r=this.na(e,t);return this.ea={pathname:(s=m==null?void 0:m.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.na(e,(t=this.ea)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ea)==null?void 0:e.pageViewId}}na(e,t){var s=this.ea;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var o=n.maxScrollHeight,a=n.lastScrollY,l=n.maxScrollY,u=n.maxContentHeight,h=n.lastContentY,c=n.maxContentY;if(!(b(o)||b(a)||b(l)||b(u)||b(h)||b(c))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h),c=Math.ceil(c);var d=o>1?Ze(a/o,0,1,k):1,g=o>1?Ze(l/o,0,1,k):1,p=u>1?Ze(h/u,0,1,k):1,v=u>1?Ze(c/u,0,1,k):1;r=J(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}},li=["flags","surveys"],gc={[Pl]:{exposure:"hidden"},[Nt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[fi]:{exposure:"hidden"},[Wr]:{exposure:"event"},[Gr]:{exposure:"hidden"},[Jr]:{exposure:"hidden"},[Yr]:{exposure:"event"},[Kr]:{exposure:"hidden"},[Zr]:{exposure:"event"},[Qr]:{exposure:"event"},[io]:{exposure:"event"},[so]:{exposure:"hidden"},[Xr]:{exposure:"event"},[St]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Dt]:{exposure:"hidden"},[ro]:{exposure:"event"},[Cl]:{exposure:"event",shouldSkipFromEventProperties:i=>le(i)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags"},[He]:{exposure:"hidden",storageGroup:"flags"},[Yi]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden",storageGroup:"flags"},[ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0}
2,[Ut]:{exposure:"hidden",storageGroup:"flags"},[Ge]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},[en]:{exposure:"hidden",storageGroup:"surveys"},[ps]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[tn]:{exposure:"event"},[Ki]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[_i]:{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"},[tt]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[Ll]:{exposure:"event"},[Vt]:{exposure:"hidden"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[H]:{exposure:"hidden"},[sn]:{exposure:"hidden"},[rn]:{exposure:"hidden"},[nn]:{exposure:"hidden"},[on]:{exposure:"hidden"},[vs]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[Al]:{exposure:"event"},[Il]:{exposure:"event"},[Ol]:{exposure:"event"},[Fl]:{exposure:"event"},[Rl]:{exposure:"event"},[Ml]:{exposure:"event"},[an]:{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"}
2,$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"}},fc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ye=i=>{var e=gc[i];if(e)return e;for(var t of fc){var s=t[1];if(i.indexOf(t[0])===0)return s}},Ht=(i,e)=>{try{return JSON.stringify(i,(t,s)=>typeof s=="bigint"?s.toString():s,e)}catch(t){return Ua(i)}},Zt=i=>{var e=S==null?void 0:S.createElement("a");return b(e)?null:(e.href=i,e)},Qt=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!L(t)||2>t.length)return"";var o=t[1];try{o=decodeURIComponent(o)}catch(a){k.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ii=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");L(c)&&(e.includes(c[0])?u.push(c[0]+"="+t):u.push(l[h]))}var d=a;return o!=null&&(d+="?"+u.join("&")),r!=null&&(d+="#"+r),d},ws=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Xl=(i,e)=>i>=e&&Ba(),eu=(i,e,t,s)=>{if(i===0){if(Ba()){var r=e+1;return r===t&&s(),r}return e}return 0},Bi="https?://(.*)",Jt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],_c=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jt],Oi="<masked>",mc=["li_fat_id"];function tu(i,e,t){if(!S)return{};var s,r=e?[...Jt,...t||[]]:[],n=iu(Ii(S.URL,r,Oi),i),o=(s={},G(mc,function(a){var l=hn(a);s[a]=l||null}),s);return J(o,n)}function iu(i,e){var t=_c.concat(e||[]),s={};return G(t,function(r){var n=Qt(i,r);s[r]=n||null}),s}function su(i){var e=function(n){return n?n.search(Bi+"google.([^/?]*)")===0?"google":n.search(Bi+"bing.com")===0?"bing":n.search(Bi+"yahoo.com")===0?"yahoo":n.search(Bi+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",s={};if(!le(e)){s.$search_engine=e;var r=S?Qt(S.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function la(){return navigator.language||navigator.userLanguage}var Es="$direct";function ru(){return(S==null?void 0:S.referrer)||Es}function nu(i,e,t){t===void 0&&(t=!1);var s=i?[...Jt,...e||[]]:[],r=t?dt(ne==null?void 0:ne.href):ne==null?void 0:ne.href,n=r==null?void 0:r.substring(0,1e3);return{r:ru().substring(0,1e3),u:n?Ii(n,s,Oi):void 0}}function ou(i,e){var t;e===void 0&&(e=!1);var s=i.r,r=i.u,n=e?dt(r):r,o={$referrer:s,$referring_domain:s==null?void 0:s==Es?Es:(t=Zt(s))==null?void 0:t.host};if(n){o.$current_url=n;var a=Zt(n);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;var l=iu(n);J(o,l)}if(s){var u=su(s);J(o,u)}return o}function au(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}function yc(){try{return new Date().getTimezoneOffset()}catch(i){return}}var bc={flags:nt,surveys:ps},wc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],qi=i=>i+"_cookie_identity_change_pending",ce="main",et=[ke,He,ht,Ue,ct,nt,Ut,Fe],ur=i=>et.indexOf(i)!==-1,ft=(i,e)=>{try{return JSON.stringify(i)===JSON.stringify(e)}catch(t){return i===e}},Ot=i=>{if(!i)return{};var e=JSON.parse(i);return z(e)?e:{}},ua=(i,e)=>{G(i,(t,s)=>{var r=ye(s);r&&r.exposure!=="event"||{}.hasOwnProperty.call(e,s)||delete i[s]})},xi=class{constructor(e,t,s){if(s===void 0&&(s=!0),this.sa={},this.aa=!1,this.oa=!1,this.la=!1,this.ua=!1,this.ha=new Map,this.da=!1,this.va=!1,this.ca=!1,this.fa=new Set,this.mn=e,this.pa=s,this.props={},this.ga=void 0,this.ma=(n=>{var o="";return n.token&&(o=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+o+"_posthog"})(e),this.Zs=this.ya(e),this.oa=this.ba(e),this.load(),this._a(),e.debug&&
vendor: 1,934 bytes, line 2
2k.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save(),m){var r=()=>this.flush();Z(m,"beforeunload",r,{capture:!1}),Z(m,"pagehide",r,{capture:!1}),this.wa=n=>{if(this.aa&&(!n.storageArea||n.storageArea===(m==null?void 0:m.localStorage))&&n.key)if(n.key!==this.ma){if(this.oa){var o=li.find(a=>n.key===this.ka(a));o&&this.Sa(n.key,o)}}else this.Sa(n.key,ce)},Z(m,"storage",this.wa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(t=>{var s=t[0],r=t[1],n=this.ha.get(s);if(ur(s)&&n!==!0)if(r!==!0){var o=new Set(n||[]);r.forEach(a=>o.add(a)),o.size&&this.xa(s,o)}else this.xa(s,!0)})}onCrossTabFeatureFlagChange(e){return this.fa.add(e),()=>this.fa.delete(e)}destroy(){this.wa&&m&&(m.removeEventListener("storage",this.wa),this.wa=void 0),this.fa.clear()}Sa(e,t,s){if(s===void 0&&(s=!0),this.Ca)return!1;var r,n;try{if(n=q.ai(e),le(n)){var o=this.Ta(t);return o.storageValue=null,t!==ce&&(o.persisted=!1),!1}r=Ot(n)}catch(u){return!1}var a=t===ce?r:q.ui(this.ma);if(a&&this.Ma(a))return!1;var l=this.Ea(r,t,s);return t===ce&&this.oa&&!ft(this.Ia().main,r)||this.Ra(r,t,!0,n),l}Ma(e){var t=this.props[me],s=e[me];return!b(t)&&!b(s)&&t!==s}Ra(e,t,s,r){var n=this.Ta(t);n.storageValue=r,t!==ce&&(n.persisted=s);try{n.fingerprint=this.Pa(e,t)}catch(o){n.fingerprint=void 0}}Ea(e,t,s){var r=!1;return et.forEach(n=>{var o,a=(o=ye(n))==null?void 0:o.storageGroup;if(!(t===ce&&this.oa&&a||t!==ce&&a!==t)){var l=n in e,u=this.Aa(n,l?e[n]:void 0),h=this.ha.has(n)?n in this.props:l;h===n in this.props&&ft(u,this.props[n])||(h?this.Fa(n,u,!1):this.Oa(n,!1),r=!0)}}),r&&s&&this.fa.forEach(n=>n()),r}La(){if(!this.aa)return!1;try{this.ca=!1;var e,t=q.ai(this.ma),s=this.Ta(ce),r=!1,n=!1;if(t!==s.storageValue)if(le(t))s.storageValue=null;else{if(e=Ot(t),this.ca=!this.va&&this.Ma(e),this.ca)return!1;n=this.Ea(e,ce,!1),!this.oa||ft(this.Ia().main,e)?this.Ra(e,ce,!0,t):s.storageValue=t,r=!0}
2return this.oa&&li.forEach(o=>{var a=q.ai(this.ka(o)),l=this.Ta(o),u=e||{},h=r&&et.some(d=>{var g;return((g=ye(d))==null?void 0:g.storageGroup)===o&&d in u});if(a!==l.storageValue||h){if(le(a))return l.storageValue=null,l.persisted=!1,void(h&&(n=this.Ea(u,o,!1)||n));var c=Ot(a);n=this.Ea(c,o,!1)||n,this.Ra(c,o,!0,a)}}),n}catch(o){return!1}}xa(e,t){this.ha.set(e,t);var s=ye(e);s!=null&&s.volatile||(this.Ta((this.oa?s==null?void 0:s.storageGroup:void 0)||ce).fingerprint=void 0,this.Da(e))}$a(){et.forEach(e=>this.ha.set(e,!0))}_a(){if(this.aa)try{var e=q.ai(this.ma),t=Ot(e);this.Ta(ce).storageValue=e,et.forEach(s=>{var r,n=this.oa?(r=ye(s))==null?void 0:r.storageGroup:void 0,o=n?q.ai(this.ka(n)):null;if(n){var a=this.Ta(n);a.storageValue=o,a.persisted=!le(o)}var l=n&&!le(o)?Ot(o):t;s in this.props?this.Na(s,l[s],this.props[s]):s in l&&this.xa(s,!0)})}catch(s){}}Aa(e,t){var s=this.ha.get(e);if(!s)return t;if(s===!0)return this.props[e];if(e===He){var r=new Set(L(t)?t:[]),n=new Set(L(this.props[e])?this.props[e]:[]);return s.forEach(l=>n.has(l)?r.add(l):r.delete(l)),Array.from(r)}var o=z(t)?E({},t):{},a=z(this.props[e])?this.props[e]:{};return s.forEach(l=>{l in a?o[l]=a[l]:delete o[l]}),o}Na(e,t,s){if(ur(e)){var r=this.ha.get(e);if(r!==!0){var n=t;if(this.aa)try{var o,a=this.oa?(o=ye(e))==null?void 0:o.storageGroup:void 0,l=a?this.ka(a):this.ma;n=Ot(q.ai(l))[e]}catch(v){}var u=new Set(r||[]);if(e===He){if(!b(t)&&!L(t)||!b(n)&&!L(n)||!L(s))return void this.xa(e,!0);var h=new Set(t||[]),c=new Set(n||[]),d=new Set(s);new Set([...h,...d]).forEach(v=>{h.has(v)!==d.has(v)&&u.add(v)}),u.forEach(v=>{c.has(v)===d.has(v)&&u.delete(v)})}else{if(!z(s))return void(ft(n,s)?this.ha.delete(e):this.xa(e,!0));if(!b(t)&&!z(t)||b(t)&&De(s)&&b(n))return void this.xa(e,!0);var g=z(t)?t:{},p=z(n)?n:{};new Set([...Object.keys(g),...Object.keys(s)]).forEach(v=>{v in g==v in s&&ft(g[v],s[v])||u.add(v)}),u.forEach(v=>{v in p==v in s&&ft(p[v],s[v])&&u.delete(v)})}u.size?this.xa(e,u):this.ha.delete(e)}}}qa(){var e,t=(e=this.mn)==null?void 0:e.persistence_save_debounce_ms;return ue(t)&&t>0?t:0}ja(e){if(this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie")if(e)try{var t=or(e,this.mn.cookie_persisted_properties||[]),s=Zo(t,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(t)+"|"+JSON.stringify(s),n=re.ai(this.ma)||void 0;n&&ar(this.ma,n)===r&&(this.Ba=r,this.Ha=n)}catch(a){}else try{var o=re.ai(this.ma)||void 0;this.Ba=o?ar(this.ma,o):void 0,this.Ha=o}catch(a){}}syncCookieProperties(){return this.za(this.mn)}za(e,t){if(t===void 0&&(t=!1),this.Ca&&!t||this.ua||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;var s;try{s=re.ai(this.ma)||void 0}catch(f){}if(!s||s===this.Ha)return!1;var r,n=ar(this.ma,s);try{r=nr(JSON.parse(s))}catch(f){return!1}if((re.ai(this.ma)||void 0)!==s)return!1;this.Ba=n,this.Ha=s;var o=Qo(this.ma,s),a=[...xt,...o.properties],l={};if(Object.keys(r).forEach(f=>{var _=r[f];(b(_)||le(_)||_===""||f===H&&_!==he&&_!==we)&&(l[f]=!0,delete r[f])}),De(r))return!1;var u=me in r||r[H]===he||r[H]===we,h=this.props,c=h[me],d=h[H],g=J({},h);[...xt,...e.cookie_persisted_properties||[]].forEach(f=>{if(a.indexOf(f)!==-1&&!(f in r)&&!l[f]&&(u||f!==me&&f!==H)){var _=g[f];!o.isValid&&xt.indexOf(f)!==-1&&(_===!1||_===0)||delete g[f]}}),this.props=J(g,r),et.forEach(f=>{var _=f in this.props;f in h===_&&ft(h[f],this.props[f])||(_?this.Na(f,h[f],this.props[f]):this.xa(f,!0))}),!u||H in r||H in this.props||this.Fa(H,he);var p=this.props[me],v=this.props[H];return!u||p===c&&v===d||(this.va=!0,this.la=!0,K.ni(qi(this.ma),!0),this.Oa(Fe),this.Oa(He),this.Oa(ke),this.Oa(ht),this.Oa(Ue),this.Oa(ct),this.Oa(nt),this.Oa(Vt),this.Oa(tt),v===he&&(d===we||r[H]===he||!b(c)&&p!==c)&&(ua(this.props,r),this.Oa(Ke)),v===we?this.props.$user_id=p:delete this.props.$user_id,this.Oa(Nt)),!0}
2consumeCookieIdentityChange(){var e=qi(this.ma),t=this.la||!!K.ai(e);return this.la=!1,t&&K.oi(e),t}Ua(e){return e===void 0&&(e=!1),!(this.ua||this.Ca&&!e||!this.mn.cookieWinsOnConflict||this.mn.persistence.toLowerCase()!=="localstorage+cookie"||(this.ua=!0,0))}Wa(){this.ua&&(b(this.Va)||(clearTimeout(this.Va),this.Va=void 0),delete this.sa[ce],this.Ga(!0))}Za(e){if(e===void 0&&(e=!0),this.ua)try{e?this.Wa():b(this.Va)||(clearTimeout(this.Va),this.Va=void 0)}finally{this.ua=!1}}isDisabled(){return!!this.Ca}ya(e){wc.indexOf(e.persistence.toLowerCase())===-1&&(k.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var l=[...xt,...o];return E({},q,{ui(u){try{var h,c={};try{h=re.ai(u)||void 0,c=h?nr(JSON.parse(h)):{}}catch(x){}var d,g=JSON.parse(q.ai(u)||"{}");if(a){var p=Qo(u,h),v=[...xt,...p.properties],f={};Object.keys(c).forEach(x=>{var M=c[x];le(M)||M===""||x===H&&M!==he&&M!==we||(f[x]=M)});var _=me in f||f[H]===he||f[H]===we;if(Object.keys(f).length>0){var y,w=g[me],T=(y=g[H])!==null&&y!==void 0?y:he;l.forEach(x=>{if(v.indexOf(x)!==-1&&!(x in c)&&(_||x!==me&&x!==H)){var M=g[x];!p.isValid&&xt.indexOf(x)!==-1&&(M===!1||M===0)||delete g[x]}}),!_||H in c||H in g||(g[H]=he),!_||(me in f?f[me]:g[me])===w&&(H in f?f[H]:g[H])===T||(rr.forEach(x=>delete g[x]),f[H]===we&&me in f?g.$user_id=f[me]:delete g.$user_id,f[H]!==we&&(delete g[Ll],delete g[Ke]),delete g.__alias)}d=J(g,f)}else d=J(c,g);return q.ni(u,d),d}catch(x){}return null},ni(u,h,c,d,g,p){var v=q.ni(u,h,void 0,void 0,p);try{var f=or(h,o);if(Object.keys(f).length){if(a){var _=_s(u),y=Zo(f,o);if(re.ni(_,y,c,d,g,p),re.ai(_)!==JSON.stringify(y)){re.oi(_,d);var w=or(h);return re.ni(u,w,c,d,g,p),v}}re.ni(u,f,c,d,g,p)}}catch(T){q.si(T)}return v},oi(u,h){try{m==null||m.localStorage.removeItem(u),re.oi(u,h),re.oi(_s(u),h)}catch(c){q.si(c)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&q.ii()?(t=q,r=!0):n==="localstorage+cookie"&&s.ii()?(t=s,r=!0):n==="sessionstorage"&&K.ii()?t=K:n==="memory"?t=pn:n==="cookie"&&re.ii()?t=re:s.ii()?(t=s,r=!0):t=re.ii()?re:pn,this.aa=r,t}ka(e){return this.ma+"__"+e}ba(e){return this.aa&&!!e.split_storage}properties(){var e={};return G(this.props,(t,s)=>{var r=ye(s);if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t))return;e[s]=t}}),e}load(e){if(e===void 0&&(e=!1),!this.Ca||e){var t=this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie",s=t?q.ui(this.ma):null,r={};if(t)try{G(r=nr(re.ui(this.ma)),(p,v)=>{(b(p)||le(p)||p==="")&&delete r[v]})}catch(p){}var n=this.Zs.ui(this.ma);if(n&&(this.props=J({},n)),this.oa&&this.Qa(),t&&n){var o,a,l=s==null?void 0:s[me],u=(o=s==null?void 0:s[H])!==null&&o!==void 0?o:he,h=n[me],c=(a=n[H])!==null&&a!==void 0?a:he;if(h!==l||c!==u){this.la=!0,K.ni(qi(this.ma),!0);var d=J({},this.props);rr.forEach(p=>delete d[p]),c===he&&(u===we||r[H]===he||!b(l)&&h!==l)&&(ua(d,r),delete d[Ke]),this.props=d;var g=new Set;rr.forEach(p=>{var v,f=(v=ye(p))==null?void 0:v.storageGroup;f&&g.add(f)}),g.forEach(p=>{var v={};G(this.props,(f,_)=>{var y;((y=ye(_))==null?void 0:y.storageGroup)===p&&(v[_]=f)}),De(v)?(q.oi(this.ka(p)),this.sa[p]={}):q.ni(this.ka(p),v)&&(this.sa[p]={persisted:!0,fingerprint:this.Pa(v,p)})})}}K.ai(qi(this.ma))&&(this.la=!0)}}Qa(){for(var e of li){var t=q.ui(this.ka(e));if(t&&!De(t)){var s=this.Ta(e);s.persisted=!0,this.Ja(e)||(s.fingerprint=this.Pa(t,e)),this.Ka(e,t)||J(this.props,t)}}}Ja(e){return Object.keys(this.props).some(t=>{var s;return((s=ye(t))==null?void 0:s.storageGroup)===e})}Ka(e,t){var s=bc[e];if(!s)return!1;var r=t[s],n=this.props[s];return ue(r)&&ue(n)&&n>r}refreshKey(e){var t;if(!this.Ca){var s=this.oa?(t=ye(e))==null?void 0:t.storageGroup:void 0,r=s?q.ui(this.ka(s)):this.Zs.ui(this.ma);if(r&&e in r)this.Fa(e,r[e]);else{if(s){var n=this.Zs.ui(this.ma);if(n&&e in n)return void this.Fa(e,n[e])}this.Oa(e)}}}save(){if(!this.Ca){var e=this.qa();e>0?b(this.Va)&&(this.Va=setTimeout(()=>{this.Va=void 0,this.Ga()},e)):this.Ga()}}flush(){b(this.Va)||(clearTimeout(this.Va),this.Va=void 0,this.Ga())}Ga(e){if(e===void 0&&(e=!1),!(this.Ca||this.ua&&!e)){e||this.syncCookieProperties();var t=!e&&!this.da;t||(this.ca=!1);var s=!!t&&this.La();if(this.ca)this.mn.debug&&k.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.oa)return this.Ya(),void(s&&this.fa.forEach(n=>n()));var r=this.Xa(this.Zs,this.ma,this.props,ce);r==="written"&&this.ja(this.props),r!=="failed"&&(this.ha.clear(),this.va=!1),s&&this.fa.forEach(n=>n())}}}Ya(){var e=this,t=this.Ia(),s=t.main,r=t.groups,n=this.Xa(this.Zs,this.ma,s,ce);n==="written"&&this.ja(s),n!=="failed"&&(this.va=!1,et.forEach(l=>{var u;(u=ye(l))!=null&&u.storageGroup||this.ha.delete(l)}));var o=function(l){var u,h=r[l];if(De(h)&&((u=e.sa[l])==null||!u.persisted))return et.forEach(d=>{var g;
2((g=ye(d))==null?void 0:g.storageGroup)===l&&e.ha.delete(d)}),1;var c=e.Xa(q,e.ka(l),h,l);c!=="failed"&&et.forEach(d=>{var g=ye(d);(g==null?void 0:g.storageGroup)!==l||c!=="written"&&g.volatile||e.ha.delete(d)})};for(var a of li)o(a)}Ia(){var e={},t={flags:{},surveys:{}};return G(this.props,(s,r)=>{var n,o=(n=ye(r))==null?void 0:n.storageGroup;o?t[o][r]=s:e[r]=s}),{main:e,groups:t}}Pa(e,t){if(t===ce)return JSON.stringify(e)+"|"+this.eo+"|"+this.io+"|"+this.ro;var s={};return G(e,(r,n)=>{var o;s[n]=(o=ye(n))!=null&&o.volatile?"__volatile__":r}),JSON.stringify(s)}Xa(e,t,s,r){var n,o=this.Ta(r);if(r!==ce&&!o.dirty&&!b(o.fingerprint))return"skipped";try{if((n=this.Pa(s,r))===o.fingerprint)return o.dirty=!1,"skipped"}catch(a){n=void 0}return e.ni(t,s,this.eo,this.io,this.ro,this.mn.debug)?(o.dirty=!1,r!==ce&&(o.persisted=!0),b(n)||(o.fingerprint=n),this.aa&&(o.storageValue=q.ai(t)),"written"):(this.mn.debug&&k.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,s=t!==void 0&&t;if(this.$a(),b(this.Va)||(clearTimeout(this.Va),this.Va=void 0),this.Zs.oi(this.ma,!1),this.Zs.oi(this.ma,!0),!s&&this.pa)for(var r of li)q.oi(this.ka(r));s?delete this.sa[ce]:this.sa={},this.Ba=void 0,this.Ha=void 0}clear(){this.remove(),this.props={}}register_once(e,t,s){if(z(e)){this.syncCookieProperties(),b(t)&&(t="None"),this.eo=b(s)?this.no:s;var r=!1;if(G(e,(n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.Fa(o,n),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(z(e)){this.syncCookieProperties(),this.eo=b(t)?this.no:t;var s=!1;if(G(e,(r,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==r||z(r)||L(r))&&(this.Fa(n,r),s=!0)}),s)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t=typeof e=="string"?[e]:e,s=!1;for(var r of t)r in this.props&&(this.Oa(r),s=!0);s&&this.save()}update_campaign_params(){var e=S==null?void 0:S.URL;if(e!==this.ga){var t=tu(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties);De(oo(t))||this.register(t),this.ga=e}}update_search_keyword(){var e;this.register((e=S==null?void 0:S.referrer)?su(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ru(),$referring_domain:S!=null&&S.referrer&&((e=Zt(S.referrer))==null?void 0:e.host)||Es},void 0)}set_initial_person_info(){this.props[nn]||this.props[on]||this.register_once({[vs]:nu(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};G([on,nn],r=>{var n=this.props[r];n&&G(n,function(o,a){e["$initial_"+Pr(a)]=o})});var t=this.props[vs];if(t){var s=function(r,n){n===void 0&&(n=!1);var o=ou(r,n),a={};return G(o,function(l,u){a["$initial_"+Pr(u)]=l}),a}(t,this.mn.disable_capture_url_hashes);J(e,s)}return e}safe_merge(e){return G(this.props,function(t,s){s in e||(e[s]=t)}),e}update_config(e,t,s){var r=e.persistence!==t.persistence,n=!((v,f)=>{if(v.length!==f.length)return!1;var _=[...v].sort(),y=[...f].sort();return _.every((w,T)=>w===y[T])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=r||n,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!s,u=!!this.Ca&&!l;l||this.za(t,u),this.mn=e,!l&&(r||n||a)&&(this.Ba=void 0,this.Ha=void 0,this.za(E({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),u));var h=o||a?this.ya(e):this.Zs,c=this.ba(e),d=o||c!==this.oa,g=!l&&(d||e.cross_subdomain_cookie!==this.io||e.secure_cookie!==this.ro)&&this.Ua(u);this.da=d;try{if(this.no=this.eo=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var p=this.props;this.clear(),this.Zs=h,this.oa=c,this.props=p,this.save()}else a&&(this.Zs=h,l||(delete this.sa[ce],this.Ga()))}finally{this.da=!1,g&&this.Za()}}set_disabled(e){this.Ca=e,this.Ca?this.remove():this.save()}set_cross_subdomain(e){e!==this.io&&(this.io=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.ro&&(this.ro=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[fi]||{};s[e]=t,this.Fa(fi,s),this.save()}remove_event_timer(e){var t=this.props[fi]||{},s=t[e];return b(s)||(delete t[e],this.Fa(fi,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Fa(e,t),this.save()}Fa(e,t,s){var r;s===void 0&&(s=!0);var n=this.props[e];
2this.props[e]=t,s&&(e!==me&&e!==H||n===t||(this.va=!0),this.Na(e,n,t),(r=ye(e))!=null&&r.volatile||this.Da(e))}Oa(e,t){t===void 0&&(t=!0),delete this.props[e],t&&(ur(e)&&this.xa(e,!0),this.Da(e))}Da(e){var t,s=(t=ye(e))==null?void 0:t.storageGroup;s&&(this.Ta(s).dirty=!0)}Ta(e){return this.sa[e]||(this.sa[e]={})}};function ji(i){var e=!0;return{dispose(){if(e){e=!1;var t=i();t&&xe(t.then)&&t.then(void 0,()=>{})}}}}var Le={GZipJS:"gzip-js",Base64:"base64"},ui={Activation:"events",Cancellation:"cancelEvents"};var hr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var st={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},cr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},yn={Popover:"popover",Inline:"inline"};var Ec={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ha={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ca=ie("[RateLimiter]"),bn=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(r=>{ca.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4})}catch(r){return void ca.warn('could not rate limit - continuing. Error: "'+(r==null?void 0:r.message)+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(rn))!==null&&t!==void 0?t:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var u=1>l.tokens;
2if(u||e||(l.tokens=Math.max(0,l.tokens-1)),u&&!e){var h=(ue(l.dropped)?l.dropped:0)+1;l.dropped=h,!this.lastEventRateLimited&&this.so(h)&&(l.dropped=0)}return this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(rn,l),{isRateLimited:u,remainingTokens:l.tokens}}ao(e){var t=this.instance.config.property_denylist;return!L(t)||!t.includes(e)}oo(){var e;if(this.ao("$current_url")&&this.ao("$pathname")&&ne!=null&&ne.pathname)return""+((e=ne.origin)!==null&&e!==void 0?e:"")+ne.pathname}so(e){var t,s,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=this.oo(),a=this.ao("$session_id")?(t=(s=this.instance).get_session_id)==null?void 0:t.call(s):void 0,l=[e+" event(s) dropped since the last warning",o?"triggered on "+o:void 0,a?"session "+a:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},lt=ie("[RemoteConfig]"),xs=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}lo(e){var t,s;(t=F.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=F.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}uo(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return lt.info("Using preloaded remote config",this.remoteConfig),void this.ho(this.remoteConfig);if(this._instance.do())return void lt.warn("Remote config is disabled. Falling back to local config.");this.lo(e=>{if(!e)return lt.info("No config found after loading remote JS config. Falling back to JSON."),void this.uo(t=>{this.ho(t.json,t)});this.ho(e)})}catch(e){lt.error("Error loading remote config",e),this.ho()}}ho(e,t){!e&&t&&(t.statusCode===0?t.error||lt.warn("Failed to fetch remote config from PostHog."):lt.error("Failed to fetch remote config from PostHog."));try{this._instance.ho(e?{ok:!0,config:e}:{ok:!1})}catch(r){lt.error("Error applying remote config",r)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var s;(s=this._instance.featureFlags)==null||s.ensureFlagsLoaded()}catch(r){lt.error("Error loading feature flags",r)}}};var Be=Uint8Array,Ce=Uint16Array,Xt=Uint32Array,ho=new Be([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]),co=new Be([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]),da=new Be([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lu=function(i,e){for(var t=new Ce(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new Xt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},uu=lu(ho,2),wn=uu[1];uu[0][28]=258,wn[258]=28;
vendor: 5,609 bytes, line 2
2for(En=lu(co,0)[1],Ss=new Ce(32768),te=0;32768>te;++te)_t=(43690&te)>>>1|(21845&te)<<1,Ss[te]=((65280&(_t=(61680&(_t=(52428&_t)>>>2|(13107&_t)<<2))>>>4|(3855&_t)<<4))>>>8|(255&_t)<<8)>>>1;var _t,En,Ss,te,Si=function(i,e,t){for(var s=i.length,r=0,n=new Ce(e);s>r;++r)++n[i[r]-1];var o,a=new Ce(e);for(r=0;e>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(t){o=new Ce(1<<e);var l=15-e;for(r=0;s>r;++r)if(i[r])for(var u=r<<4|i[r],h=e-i[r],c=a[i[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Ss[c]>>>l]=u}else for(o=new Ce(s),r=0;s>r;++r)o[r]=Ss[a[i[r]-1]++]>>>15-i[r];return o},Tt=new Be(288);for(te=0;144>te;++te)Tt[te]=8;for(te=144;256>te;++te)Tt[te]=9;for(te=256;280>te;++te)Tt[te]=7;for(te=280;288>te;++te)Tt[te]=8;var ks=new Be(32);for(te=0;32>te;++te)ks[te]=5;var xc=Si(Tt,9,0),Sc=Si(ks,5,0),hu=function(i){return(i/8>>0)+(7&i&&1)},cu=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof Ce?Ce:i instanceof Xt?Xt:Be)(t-e);return s.set(i.subarray(e,t)),s},Qe=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},hi=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},dr=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new Be(0),0];if(r==1){var o=new Be(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(x,M){return x.f-M.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],u=0,h=1,c=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=r-1;)a=t[t[c].f>t[u].f?u++:c++],l=t[u!=h&&t[c].f>t[u].f?u++:c++],t[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var g=new Ce(d+1),p=xn(t[h-1],g,0);if(p>e){s=0;var v=0,f=p-e,_=1<<f;for(n.sort(function(x,M){return g[M.s]-g[x.s]||x.f-M.f});r>s;++s){var y=n[s].s;if(e>=g[y])break;v+=_-(1<<p-g[y]),g[y]=e}for(v>>>=f;v>0;){var w=n[s].s;e>g[w]?v-=1<<e-g[w]++-1:++s}for(;s>=0&&v;--s){var T=n[s].s;g[T]==e&&(--g[T],++v)}p=e}return[new Be(g),p]},xn=function(i,e,t){return i.s==-1?Math.max(xn(i.l,e,t+1),xn(i.r,e,t+1)):e[i.s]=t},pa=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Ce(++e),s=0,r=i[0],n=1,o=function(l){t[s++]=l},a=1;e>=a;++a)if(i[a]==r&&a!=e)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=i[a]}return[t.subarray(0,s),e]},ci=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},Sn=function(i,e,t){var s=t.length,r=hu(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},va=function(i,e,t,s,r,n,o,a,l,u,h){Qe(e,h++,t),++r[256];for(var c=dr(r,15),d=c[0],g=c[1],p=dr(n,15),v=p[0],f=p[1],_=pa(d),y=_[0],w=_[1],T=pa(v),x=T[0],M=T[1],N=new Ce(19),P=0;y.length>P;++P)N[31&y[P]]++;for(P=0;x.length>P;++P)N[31&x[P]]++;for(var O=dr(N,7),A=O[0],$=O[1],I=19;I>4&&!A[da[I-1]];--I);var C,U,V,B,Y=u+5<<3,ee=ci(r,Tt)+ci(n,ks)+o,pe=ci(r,d)+ci(n,v)+o+14+3*I+ci(N,A)+(2*N[16]+3*N[17]+7*N[18]);if(ee>=Y&&pe>=Y)return Sn(e,h,i.subarray(l,l+u));if(Qe(e,h,1+(ee>pe)),h+=2,ee>pe){C=Si(d,g,0),U=d,V=Si(v,f,0),B=v;var fe=Si(A,$,0);for(Qe(e,h,w-257),Qe(e,h+5,M-1),Qe(e,h+10,I-4),h+=14,P=0;I>P;++P)Qe(e,h+3*P,A[da[P]]);h+=3*I;for(var Ee=[y,x],Oe=0;2>Oe;++Oe){var oe=Ee[Oe];for(P=0;oe.length>P;++P)Qe(e,h,fe[_e=31&oe[P]]),h+=A[_e],_e>15&&(Qe(e,h,oe[P]>>>5&127),h+=oe[P]>>>12)}}else C=xc,U=Tt,V=Sc,B=ks;for(P=0;a>P;++P)if(s[P]>255){var _e;hi(e,h,C[257+(_e=s[P]>>>18&31)]),h+=U[_e+257],_e>7&&(Qe(e,h,s[P]>>>23&31),h+=ho[_e]);var ve=31&s[P];hi(e,h,V[ve]),h+=B[ve],ve>3&&(hi(e,h,s[P]>>>5&8191),h+=co[ve])}else hi(e,h,C[s[P]]),h+=U[s[P]];return hi(e,h,C[256]),h+U[256]},kc=new Xt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tc=function(){for(var i=new Xt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),pr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Pc(i,e){e===void 0&&(e={});var t=function(){var c=4294967295;return{p(d){for(var g=c,p=0;d.length>p;++p)g=Tc[255&g^d[p]]^g>>>8;c=g},d(){return 4294967295^c}}}(),s=i.length;t.p(i);var r,n,o,a,l,u=(a=10+((r=e).filename&&r.filename.length+1||0),l=8,function(c,d,g,p,v,f){var _=c.length,y=new Be(p+_+5*(1+Math.floor(_/7e3))+v),w=y.subarray(p,y.length-v),T=0;if(!d||8>_)for(var x=0;_>=x;x+=65535){var M=x+65535;_>M?T=Sn(w,T,c.subarray(x,M)):(w[x]=!0,T=Sn(w,T,c.subarray(x,_)))}else{for(var N=kc[d-1],P=N>>>13,O=8191&N,A=(1<<g)-1,$=new Ce(32768),I=new Ce(A+1),C=Math.ceil(g/3),U=2*C,V=function(zs){return(c[zs]^c[zs+1]<<C^c[zs+2]<<U)&A},B=new Xt(25e3),Y=new Ce(288),ee=new Ce(32),pe=0,fe=0,Ee=(x=0,0),Oe=0,oe=0;_>x;++x){var _e=V(x),ve=32767&x,ze=I[_e];if($[ve]=ze,I[_e]=ve,x>=Oe){var vt=_-x;if((pe>7e3||Ee>24576)&&vt>423){T=va(c,w,0,B,Y,ee,fe,Ee,oe,x-oe,T),Ee=pe=fe=0,oe=x;for(var ae=0;286>ae;++ae)Y[ae]=0;for(ae=0;30>ae;++ae)ee[ae]=0}var qe=2,ot=0,si=O,Me=ve-ze&32767;if(vt>2&&_e==V(x-Me))for(var Ae=Math.min(P,vt)-1,Ri=Math.min(32767,x),Qu=Math.min(258,vt);Ri>=Me&&--si&&ve!=ze;){if(c[x+qe]==c[x+qe-Me]){for(var at=0;Qu>at&&c[x+at]==c[x+at-Me];++at);if(at>qe){if(qe=at,ot=Me,at>Ae)break;var Ju=Math.min(Me,at-2),yo=0;for(ae=0;Ju>ae;++ae){var Vs=x-Me+ae+32768&32767,bo=Vs-$[Vs]+32768&32767;bo>yo&&(yo=bo,ze=Vs)}}}Me+=(ve=ze)-(ze=$[ve])+32768&32767}if(ot){B[Ee++]=268435456|wn[qe]<<18|En[ot];var wo=31&wn[qe],Eo=31&En[ot];fe+=ho[wo]+co[Eo],++Y[257+wo],++ee[Eo],Oe=x+qe,++pe}else B[Ee++]=c[x],++Y[c[x]]}}T=va(c,w,!0,B,Y,ee,fe,Ee,oe,x-oe,T)}return cu(y,0,p+hu(T)+v)}(n=i,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(c,d){var g=d.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>
2d.level?4:d.level==9?2:0,c[9]=3,d.mtime!=0&&pr(c,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),g){c[3]=8;for(var p=0;g.length>=p;++p)c[p+10]=g.charCodeAt(p)}}(u,e),pr(u,h-8,t.d()),pr(u,h-4,s),u}var Cc=!!Sr||!!Yn,du="text/plain",Ji=!1,pu=(i,e)=>{var t=i.split("#"),s=t[1],r=t[0].split("?"),n=r[0],o=r[1];if(!o)return i;var a=o.split("&").filter(l=>l.split("=")[0]!==e).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},Fi=function(i,e,t){var s;t===void 0&&(t=!0);var r=i.split("?"),n=r[0],o=r[1],a=E({},e),l=(s=o==null?void 0:o.split("&").map(h=>{var c,d=h.split("="),g=d[0],p=t&&(c=a[g])!==null&&c!==void 0?c:d[1];return delete a[g],g+"="+p}))!==null&&s!==void 0?s:[],u=function(h,c){var d,g;c===void 0&&(c="&");var p=[];return G(h,function(v,f){b(v)||b(f)||f==="undefined"||(d=encodeURIComponent((_=>_ instanceof File)(v)?v.name:v.toString()),g=encodeURIComponent(f),p[p.length]=g+"="+d)}),p.join(c)}(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},vr=i=>{if(i.vo)return i.vo;var e=i.data,t=i.compression;if(e){if(t===Le.GZipJS){var s=Pc(function(a,l){var u=a.length;if(typeof TextEncoder!="undefined")return new TextEncoder().encode(a);for(var h=new Be(a.length+(a.length>>>1)),c=0,d=function(f){h[c++]=f},g=0;u>g;++g){if(c+5>h.length){var p=new Be(c+8+(u-g<<1));p.set(h),h=p}var v=a.charCodeAt(g);128>v?d(v):2048>v?(d(192|v>>>6),d(128|63&v)):v>55295&&57344>v?(d(240|(v=65536+(1047552&v)|1023&a.charCodeAt(++g))>>>18),d(128|v>>>12&63),d(128|v>>>6&63),d(128|63&v)):(d(224|v>>>12),d(128|v>>>6&63),d(128|63&v))}return cu(h,0,c)}(Ht(e)),{mtime:0});return{contentType:du,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===Le.Base64){var r=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,u)=>String.fromCharCode(parseInt(u,16))))}(Ht(e)),n=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Ht(a)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ht(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},vu=i=>{var e,t,s=()=>i.transport==="sendBeacon"?{url:Fi(i.url,{compression:Le.Base64}),encodedBody:vr(E({},i,{compression:Le.Base64,vo:void 0}))}:{url:pu(i.url,"compression"),encodedBody:vr(E({},i,{compression:void 0,vo:void 0}))};try{e=vr(i)}catch(r){if(Do(i.compression,Qt(i.url,"compression")))return k.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&Do(i.compression,Qt(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?Lr(new Uint8Array(t)):ArrayBuffer.isView(t)&&Lr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(Ji=!0,s()):{url:i.url,encodedBody:e}},gu=i=>{try{return vu(i)}catch(e){return k.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},Ac=function(){var i=X(function*(e){var t=Ht(e.data),s=yield function(n,o,a){return $r.apply(this,arguments)}(t,Q.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return E({},e,{vo:{contentType:du,body:r,estimatedSize:r.byteLength}})});return function(e){return i.apply(this,arguments)}}(),Ic=/Failed to fetch|NetworkError|Load failed/i,fu=i=>(i==null?void 0:i.name)==="TypeError"&&Ic.test((i==null?void 0:i.message)||""),_u=i=>{var e=gu(i);if(e){var t=e.url,s=e.encodedBody,r=s!=null?s:{},n=r.contentType,o=r.body,a=r.estimatedSize,l=new Headers;G(i.headers,function(p,v){l.append(v,p)}),n&&l.append("Content-Type",n);var u=null,h=!1;if(Po){var c=new Po;u={signal:c.signal,timeout:setTimeout(()=>{var p;h=!0,c.abort(fl("AbortError","PostHog request timed out"+((p=i.timeout)?" after "+p+"ms":"")))},i.timeout)}}var d=p=>{h&&(p==null?void 0:p.name)==="AbortError"||fu(p)?k.warn(p):k.error(p),i.callback==null||i.callback({statusCode:0,error:p})};try{var g;Yn(t,E({method:(i==null?void 0:i.method)||"GET",headers:l,keepalive:i.method==="POST"&&!i.co&&52428.8>(a||0),body:o,signal:(g=u)==null?void 0:g.signal},i.fetchOptions)).then(p=>p.text().then(v=>{var f={statusCode:p.status,text:v};if(p.status===200)try{f.json=JSON.parse(v)}catch(_){k.error(_)}i.callback==null||i.callback(f)})).catch(d).finally(()=>u?clearTimeout(u.timeout):null)}catch(p){u&&clearTimeout(u.timeout),d(p)}}},kn=i=>{try{var e,t=vu(i),s=t.url,r=t.encodedBody,n=r!=null?r:{},o=n.body,a=n.estimatedSize;if(!o)return;var l=o instanceof Blob?o:new Blob([o],{type:n.contentType});if(ge.sendBeacon(s,l))return;var u=L(i.data)?i.data:(e=i.data)==null?void 0:e.batch;if(L(u)&&u.length>1&&(a!=null?a:0)>16384){var h=Math.ceil(u.length/2),c=d=>L(i.data)?d:E({},i.data,{batch:d});return kn(E({},i,{data:c(u.slice(0,h))})),void kn(E({},i,{data:c(u.slice(h))}))}k.warn("Beacon of ~"+(a!=null?a:0)+" bytes was rejected by the browser, falling back to fetch"),_u(E({},i,{co:!0}))}catch(d){k.warn("Beacon send failed",d)}},ga=(i,e,t,s)=>{var r=s==="query"?e==="POST"?"sent_at":"_":void 0;return Fi(t===Le.GZipJS?pu(i,"compression"):i,E({},r?{[r]:Date.now().toString()}:{},t===Le.GZipJS?{}:{compression:t}))},Xi=[];Yn&&Xi.push({transport:"fetch",method:_u}),Sr&&Xi.push({transport:"XHR",method(i){var e=gu(i);if(e){var t=new Sr,s=e.encodedBody;t.open(i.method||"GET",e.url,!0);var r=s!=null?s:{},n=r.contentType,o=r.body;G(i.headers,function(a,l){t.setRequestHeader(l,a)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var a={statusCode:t.status,text:t.responseText};if(t.status===200)try{a.json=JSON.parse(t.responseText)}catch(l){}i.callback==null||i.callback(a)}},t.send(o)}}}),ge!=null&&ge.sendBeacon&&Xi.push({transport:"sendBeacon",method:kn});var Tn=3e3,Pn=class{constructor(e,t){this.fo=!0,this.po=[],this.mo=Ze((t==null?void 0:t.flush_interval_ms)||Tn,250,5e3,k.createLogger("flush interval"),Tn),this.yo=e}enqueue(e){this.po.push(e),this.bo||this._o()}unload(){this.wo();var e=this.po.length>0?this.ko():{},t=Object.values(e);[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.So(E({},s,{transport:"sendBeacon"}))})}enable(){this.fo=!1,this._o()}_o(){var e=this;this.fo||(this.bo=setTimeout(()=>{if(this.wo(),this.po.length>0){var t=this.ko(),s=function(){var n=t[r],o=new Date().getTime();n.data&&L(n.data)&&G(n.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.So(n)};for(var r in t)s()}},this.mo))}So(e){try{this.yo(e)}catch(t){k.error(t)}}wo(){clearTimeout(this.bo),this.bo=void 0}ko(){var e={};return G(this.po,t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;b(e[n])&&(e[n]=E({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)}),this.po=[],e}},Oc=["retriesPerformedSoFar"],Cn=class{constructor(e){this.xo=!1,this.Co=3e3,this.po=[],this._instance=e,this.po=[],this.To=!0,!b(m)&&"onLine"in m.navigator&&(this.To=m.navigator.onLine,this.Mo=()=>{this.To=!0,this.Eo()},this.Io=()=>{this.To=!1},Z(m,"online",this.Mo),Z(m,"offline",this.Io))}get length(){return this.po.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=qa(e,Oc);Xe(t)&&(s.url=Fi(s.url,{retry_count:t})),this._instance._send_request(E({},s,{callback:r=>{if(r.statusCode!==200&&(400>
2r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t!=null?t:0))return void this.rs(E({retriesPerformedSoFar:t},s));r.statusCode===0&&k.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(t!=null?t:0)+" retries.")}s.callback==null||s.callback(r)}}))}rs(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),h=Math.random()-.5;return Math.ceil(u+h*(u-l))}(t),r=Date.now()+s;this.po.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),k.warn(n),this.xo||(this.xo=!0,this.Ro())}Ro(){if(this.Po&&clearTimeout(this.Po),this.po.length===0)return this.xo=!1,void(this.Po=void 0);this.Po=setTimeout(()=>{this.To&&this.po.length>0&&this.Eo(),this.Ro()},this.Co)}Eo(){var e=Date.now(),t=[],s=this.po.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.po=t,s.length>0)for(var r of s)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Po&&(clearTimeout(this.Po),this.Po=void 0),this.xo=!1,b(m)||(this.Mo&&(m.removeEventListener("online",this.Mo),this.Mo=void 0),this.Io&&(m.removeEventListener("offline",this.Io),this.Io=void 0)),this.po)){var t=e.requestOptions;try{this._instance._send_request(E({},t,{transport:"sendBeacon"}))}catch(s){k.error(s)}}this.po=[]}},An=class{constructor(e){this.Ao=()=>{var t,s,r,n;this.Fo||(this.Fo={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),h=(o==null?void 0:o.scrollHeight)||0;this.Fo.lastScrollY=Math.ceil(a),this.Fo.maxScrollY=Math.max(a,(t=this.Fo.maxScrollY)!==null&&t!==void 0?t:0),this.Fo.maxScrollHeight=Math.max(l,(s=this.Fo.maxScrollHeight)!==null&&s!==void 0?s:0),this.Fo.lastContentY=u,this.Fo.maxContentY=Math.max(u,(r=this.Fo.maxContentY)!==null&&r!==void 0?r:0),this.Fo.maxContentHeight=Math.max(h,(n=this.Fo.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Oo(){return this._instance.config.scroll_root_selector}getContext(){return this.Fo}resetContext(){var e=this.Fo;return setTimeout(this.Ao,0),e}startMeasuringScrollPosition(){Z(m,"scroll",this.Ao,{capture:!0}),Z(m,"scrollend",this.Ao,{capture:!0}),Z(m,"resize",this.Ao)}scrollElement(){if(!this.Oo)return m==null?void 0:m.document.documentElement;var e=L(this.Oo)?this.Oo:[this.Oo];for(var t of e){var s=m==null?void 0:m.document.querySelector(t);if(s)return s}}Lo(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.Oo){var s=this.scrollElement();return s&&s[t]||0}return m?e==="y"?m.scrollY||m.pageYOffset||m.document.documentElement.scrollTop||0:m.scrollX||m.pageXOffset||m.document.documentElement.scrollLeft||0:0}scrollY(){return this.Lo("y")}scrollX(){return this.Lo("x")}},Fc=i=>nu(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties,i==null?void 0:i.config.disable_capture_url_hashes),Ts=class{constructor(e,t,s,r){this.Tt=n=>{var o=this.Do();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.$o(this._instance)};this.No.register({[sn]:a})}},this._instance=e,this.qo=t,this.No=s,this.$o=r||Fc,this.qo.onSessionId(this.Tt)}Do(){return this.No.props[sn]}getSetOnceProps(){var e,t=(e=this.Do())==null?void 0:e.props;return t?"r"in t?ou(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return G(oo(this.getSetOnceProps()),(t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+Pr(s)]=t}),e}},ei=class{on(e,t){return this.jo[e]||(this.jo[e]=[]),this.jo[e].push(t),()=>{this.jo[e]=this.jo[e].filter(s=>s!==t)}}emit(e,t){for(var s of this.jo[e]||[])s(t);for(var r of this.jo["*"]||[])r(e,t)}constructor(){this.jo={}}},Ft=ie("[SessionId]"),fa=864e5,Ps=class{on(e,t){return this.Bo.on(e,t)}constructor(e,t,s){var r;if(this.Ho=null,this.zo=null,this.Uo=[],this.Wo=void 0,this.Vo=!1,this.Bo=new ei,this.Go=(l,u)=>!(!Xe(l)||!Xe(u))&&Math.abs(l-u)>
2this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===it)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=e.config,this.No=e.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Zo=void 0,this._sessionActivityTimestamp=null,this.Qo=t||Ve,this.Jo=s||Ve;var n=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*Ze(this.mn.session_idle_timeout_seconds||1800,60,36e3,Ft.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ko(),this.Yo="ph_"+n+"_window_id",this.Xo="ph_"+n+"_primary_window_exists",this.tl()){var o=K.ui(this.Yo),a=K.ui(this.Xo);o&&!a?this.It=o:K.oi(this.Yo),K.ni(this.Xo,!0)}(r=this.mn.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.el()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.Uo)&&(this.Uo=[]),this.Uo.push(e),this.Pe&&e(this.Pe,this.It),()=>{this.Uo=this.Uo.filter(t=>t!==e)}}tl(){return this.mn.persistence!=="memory"&&!this.No.Ca&&K.ii()}il(e){e!==this.It&&(this.It=e,this.tl()&&K.ni(this.Yo,e))}rl(){return this.It?this.It:this.tl()?K.ui(this.Yo):null}nl(e){var t=this.Ho;return!le(t)&&!le(e)&&5e3>Math.abs(e-t)}sl(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Pe||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Pe=e,n&&!r||n&&this.nl(t)||(this.Ho=t,this.No.register({[Dt]:[t,e,s]}))}al(){var e,t=(e=this.mn)==null?void 0:e.persistence_save_debounce_ms;return Xe(t)&&t>0}ol(){this.al()?this.No.refreshKey(Dt):(this.No.flush(),this.No.load())}ll(){var e;if(!le(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ho){this.ol();var t=this.ul();t[1]===this.Pe&&t[2]===this._sessionStartTimestamp&&(this.Ho=this._sessionActivityTimestamp,this.No.register({[Dt]:[this._sessionActivityTimestamp,(e=this.Pe)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.No.flush())}}hl(){var e=this.ul()[0],t=Xe(e)?e:0,s=Xe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}dl(e){return this.ol(),this.Go(e,this.hl())}ul(){var e=this.No.props[Dt];return L(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ho=null,this.Zo=void 0,clearTimeout(this.vl),this.vl=void 0,this.sl(null,null,null)}setBootstrapSessionId(e,t){t===void 0&&(t=!1);var s=function(r,n){n===void 0&&(n=new Date().getTime());try{var o=(a=>{var l=a.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return o>n+6e4?void Ft.error("Bootstrap sessionID cannot be in the future"):o}catch(a){return void Ft.error("Invalid sessionID in bootstrap",a)}}(e);return!b(s)&&(t?this.Zo={sessionId:e,sessionStartTimestamp:s}:this.sl(e,new Date().getTime(),s),!0)}destroy(){this.Vo=!0,this.ll(),clearTimeout(this.vl),this.vl=void 0,this.Wo&&m&&(m.removeEventListener(fs,this.Wo,{capture:!1}),this.Wo=void 0),this.Uo=[]}el(){this.Wo=()=>{this.ll(),this.tl()&&K.oi(this.Xo)},Z(m,fs,this.Wo,{capture:!1})}checkAndGetSessionAndWindowId(e,t,s){if(e===void 0&&(e=!1),t===void 0&&(t=null),s===void 0&&(s=!1),this.mn.cookieless_mode===it)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),n=this.Pe;if(s)this.zo=r;else if(le(this.zo)||this.zo>r||r-this.zo>=1e3){var o,a;(o=(a=this.No).syncCookieProperties)==null||o.call(a),this.zo=r}var l=this.ul(),u=l[1],h=l[2],c=!b(n)&&u!==n,d=this.hl(),g=this.rl(),p=this.Zo,v=!!p&&(p.sessionStartTimestamp>r+6e4||r-p.sessionStartTimestamp>fa),f=p?v:Xe(h)&&Math.abs(r-h)>fa,_=!1,y=c,w=!u||!!p,T=u,x=!w&&!e&&this.Go(r,d);if(x){(x=this.dl(r))||Ft.info("cross-tab refresh kept the session alive",{sessionId:u});var M=this.ul();u=M[1],h=M[2]}if(w||x||f){y=!1;var N=p&&!v;u=N?p.sessionId:this.Qo(),g=this.Jo(),Ft.info("new session ID assigned",{sessionId:u,windowId:g,bootstrapped:!!N,changeReason:{noSessionId:w,activityTimeout:x,sessionPastMaximumLength:f}}),h=N?p.sessionStartTimestamp:r,this.Zo=void 0,_=!0}else g||(g=this.Jo(),_=!0),(y=y||u!==T)&&(Ft.info("adopted cross-tab session id",{sessionId:u,windowId:g}),_=!0);var P=Xe(d)&&e&&!f?d:r,O=Xe(h)?h:new Date().getTime();this.il(g),this.sl(u,P,O),e||this.Ko();var A={noSessionId:w,activityTimeout:x,sessionPastMaximumLength:f,crossTabAdoption:y};
2return _&&this.Uo.forEach($=>$(u,g,A)),{sessionId:u,windowId:g,sessionStartTimestamp:O,changeReason:_?A:void 0,lastActivityTimestamp:d}}Ko(){this.Vo||(clearTimeout(this.vl),this.vl=setTimeout(()=>{if(!this.Vo)if(this.dl(new Date().getTime())){var e=this.Pe;this.resetSessionId(),this.Bo.emit("forcedIdleReset",{idleSessionId:e})}else this.Ko()},1.1*this.sessionTimeoutMs))}},mu=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Fo(t,e))return!0;try{var s=i==null?void 0:i.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>Fo(r==null?void 0:r.brand,e)))return!0}catch(r){}return!!i.webdriver};function yu(){return(yu=X(function*(){var i=ge==null?void 0:ge.userAgentData;if(i!=null&&i.getHighEntropyValues)try{var e=yield i.getHighEntropyValues(["model"]),t=e==null?void 0:e.model;return j(t)&&t.length>0?t:void 0}catch(s){return void k.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}})).apply(this,arguments)}function bu(i){var e;return!((e=i.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var Cs=(i,e)=>{if(!(t=>{try{new RegExp(t)}catch(s){return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch(t){return!1}},Ui=i=>i.toLowerCase(),wu={exact:(i,e)=>e.some(t=>i.some(s=>t===s)),is_not:(i,e)=>e.every(t=>i.every(s=>t!==s)),regex:(i,e)=>e.some(t=>i.some(s=>Cs(t,s))),not_regex:(i,e)=>e.every(t=>i.every(s=>!Cs(t,s))),icontains:(i,e)=>e.map(Ui).some(t=>i.map(Ui).some(s=>t.includes(s))),not_icontains:(i,e)=>e.map(Ui).every(t=>i.map(Ui).every(s=>!t.includes(s))),gt:(i,e)=>e.some(t=>{var s=parseFloat(t);return!isNaN(s)&&i.some(r=>s>parseFloat(r))}),lt:(i,e)=>e.some(t=>{var s=parseFloat(t);return!isNaN(s)&&i.some(r=>s<parseFloat(r))})};function Eu(i,e){return!i||Object.entries(i).every(t=>{var s=t[1],r=e==null?void 0:e[t[0]];if(r==null)return!1;var n=wu[s.operator];return!!n&&n(s.values,[String(r)])})}function gr(i,e,t){return Ht({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var In="custom",_a="i.posthog.com",Lc=/^\/static\//,$c=["/s/","/e/","/i/"],On=class{constructor(e){this.cl={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+_a,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.cl[this.apiHost]||(this.cl[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":In),this.cl[this.apiHost]}fl(e){if(Lc.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}pl(e){var t=Zt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}gl(e,t,s){if(e==="ui")return s;var r=s,n=this.instance.config.rewriteRequestPath;if(n){var o,a=((o=Zt(s))==null?void 0:o.href)||s;r=n(new URL(a)).toString()}if(n&&e==="api"&&$c.some(d=>t.indexOf(d)===0)){var l=this.pl(r);if(l){var u,h=this.apiHost,c=this.ml;((u=c)==null?void 0:u.apiHost)===h&&c.rewriteRequestPath===n||(c={apiHost:h,rewriteRequestPath:n,urls:new Set},this.ml=c),c.urls.add(l)}}return r}isIngestionEndpoint(e){var t=this.ml,s=this.pl(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!s&&t.urls.has(s)}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.gl(e,t,this.uiHost+t);if(e==="flags")return this.gl(e,t,this.flagsApiHost+t);if(e==="assets"){var s=this.fl(t);if(s)return this.gl(e,t,""+s+t)}if(this.region===In)return this.gl(e,t,this.apiHost+t);var r=_a+t;switch(e){case"assets":return this.gl(e,t,"https://"+this.region+"-assets."+r);case"api":return this.gl(e,t,"https://"+this.region+"."+r)}}},W=ie("[Surveys]"),xu="seenSurvey_",Su=i=>{try{var e=(t=>((s,r)=>""+xu+function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id}(r))(0,t))(i);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){W.error("Failed to persist survey seen state",t)}}
2,Rc=[hr.Popover,hr.Widget,hr.API],Mc={ignoreConditions:!1,ignoreDelay:!1,displayType:yn.Popover},Nc=ie("[PostHog ExternalIntegrations]"),Dc={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Fn=class{constructor(e){this._instance=e}Ys(e,t){var s;(s=F.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,r=>{if(r)return Nc.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e=this,t=function(){var n,o,a,l=s[0],u=s[1];!u||(n=F.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.Ys(Dc[l],()=>{var h;(h=F.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[l])==null||h.start(e._instance)}),!u&&(o=F.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[l]&&((a=F.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[l])==null||a.stop())};for(var s of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;t()}}},Ln=class{constructor(e,t){this.A=e,this.Ns=t,this.yl=new Map,this.Os=!1}add(e){var t=this;return X(function*(){if(t.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.yl.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.yl.set(e.name,e);try{var s=e.setup(t.Ns);s&&(yield s)}catch(n){var r=t.yl.get(e.name)===e;r&&t.yl.delete(e.name),t.A.error('Failed to set up browser extension "'+e.name+'"',n),r&&t.bl(e)}})()}getExtension(e){return this.yl.get(e)}dispose(){if(!this.Os){this.Os=!0;var e=Array.from(this.yl.values()).reverse();for(var t of(this.yl.clear(),e))this.bl(t)}}bl(e){try{var t=e.dispose==null?void 0:e.dispose();t&&xe(t.then)&&t.then(void 0,s=>{this.A.error('Failed to dispose browser extension "'+e.name+'"',s)})}catch(s){this.A.error('Failed to dispose browser extension "'+e.name+'"',s)}}},$n=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);var s={};for(var r of e){var n=t==null?void 0:t.get_property(r);b(n)||(s[r]=n)}return s}set(e,t){var s;(s=this._instance.persistence)==null||s.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}},ma="extensionsRemoteConfig",Rn=class{constructor(e){this.Os=!1,this.instance=e,this.A=k,this._l=e.wl,this.kv=new $n(e),this.onEvent=t=>ji(this.instance.on("eventCaptured",s=>{try{t({event:s.event,properties:s.properties})}catch(r){this.A.error("Browser extension event listener failed",r)}})),this.onRemoteConfig=t=>{if(this.Os)return ji(()=>{});var s=n=>{try{t(n)}catch(o){this.A.error("Browser extension remote config listener failed",o)}},r=this.instance.kl.on(ma,s);return this._l&&s(this._l),ji(r)},this.Sl=new Ln(k.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(Ci))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(Ci);return typeof e=="string"?e:void 0}get library(){return{name:Q.LIB_NAME,version:Q.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)==null?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,s,r,n=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n==null?void 0:n.sessionId)!==null&&t!==void 0?t:"",windowId:(s=n==null?void 0:n.windowId)!==null&&s!==void 0?s:"",sessionStartTimestamp:(r=n==null?void 0:n.sessionStartTimestamp)!==null&&r!==void 0?r:0}}catch(o){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.Sl.add(e)}getExtension(e){return this.Sl.getExtension(e)}capture(e,t,s){var r=this;return X(function*(){s?r.instance.capture(e,t,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):r.instance.capture(e,t)})()}registerDynamicEventProperties(e){return ji(this.instance.xl(e))}handleRemoteConfig(e){this.Os||(this._l=e,this.instance.kl.emit(ma,e))}sendRequest(e,t){var s=this;return X(function*(){var r;t===void 0&&(t={});var n=s.instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",e),o={method:t.method,url:t.query?Fi(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target==="flags"&&t.compression==="best-available"?kr.Base64:void 0,timestampMode:t.sentAt};return t.transport==="sendBeacon"?(s.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,s.instance._send_request(o)})})()}dispose(){this.Os||(this.Os=!0,this.Sl.dispose())}},ki={},fr=0,As=()=>{}
2,ya='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',di="Surveys module not available",ba="sanitize_properties is deprecated. Use before_send instead",ku="Invalid value for property_denylist config: ",Hc=["token","distinct_id",$l],Mt="posthog",Tu=!Cc&&(Ie==null?void 0:Ie.indexOf("MSIE"))===-1&&(Ie==null?void 0:Ie.indexOf("Mozilla"))===-1,Bc=i=>{var e={};return i&&i!=="unset"&&("2025-11-30">i||(e.strictMinimumDuration=!0),"2026-05-30">i||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">i||(e.streamNetworkBody=!0),"2026-08-30">i||(e.captureJsonLd=!0)),e},_r=i=>{var e;return E({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Xh(S==null?void 0:S.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:As,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i!=null?i:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ne&&j(ne==null?void 0:ne.search)&&ne.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(m==null||(e=m.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){k.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:ln,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Tn},error_tracking:{},_onCapture:As},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:ac,ignore_text_selection:!0}
2:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Bc(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||t==="unset"||"2026-08-29">t)}))(i))},qc=[["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"]],wa=i=>{var e={};for(var t of qc){var s=t[0],r=t[1];b(i[s])||(e[r]=i[s])}var n=J({},e,i),o=i.__preview_external_dependency_versioned_paths;return b(o)||(b(i.strict_script_versioning)&&(n.strict_script_versioning=!!o),j(o)&&b(i.asset_host)&&(n.asset_host=o)),L(i.property_blacklist)&&(b(i.property_denylist)?n.property_denylist=i.property_blacklist:L(i.property_denylist)?n.property_denylist=[...i.property_blacklist,...i.property_denylist]:k.error(ku+i.property_denylist)),n},Mn=class{constructor(){this.__forceAllowLocalhost=!1}get Cl(){return this.__forceAllowLocalhost}set Cl(e){k.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Te=class{Tl(e){if(e){var t=this.yl.indexOf(e);t!==-1&&this.yl.splice(t,1)}}Ml(e,t){return this.Tl(e),this.yl.push(t),t.initialize==null||t.initialize(),t}El(){return this.config.cookieless_mode===it||this.config.cookieless_mode===ut&&this.consent.isRejected()}Il(){if(!this.Rl&&!this.config.segment&&!this.El()){var e,t,s,r=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(r||this.config.disable_persistence)&&(this.Pl||(r?(e="persistence is set to '"+this.config.persistence+"'",t=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",s="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Rl=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+s)))}}Al(){if(!this.El()&&this.get_distinct_id()===Ct){var e=this.persistence;if(e){this.Fl()||e.load(!0);var t=this.get_distinct_id();if(!t||t===Ct){var s=this.config.get_device_id(Ve());this.register({distinct_id:s,$device_id:s}),e.set_property(H,he)}this.Ol()}}}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Mn,this.Ll=!1,this.version=Q.LIB_VERSION,this.Dl=new Set,this.$l="",this.kl=new ei,this.yl=[],this.Nl=[],this.Pl=!1,this.Rl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=_r(),this.SentryIntegration=mn,this.sentryIntegration=s=>function(r,n){var o=Jl(r,n);return{name:Ql,processEvent:a=>o(a)}}(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ql=!1,this.jl=null,this.Bl=null,this.Hl=null,this.scrollManager=new An(this),this.pageViewManager=new bs(this),this.rateLimiter=new bn(this),this.requestRouter=new On(this),this.consent=new vn(this),this.externalIntegrations=new Fn(this);var t=(e=Te.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(s,r,n)=>{var o=j(s)?{[s]:r}:s;this.setPersonProperties(o),n==null||n({})},set_once:(s,r,n)=>{var o=j(s)?{[s]:r}:s;this.setPersonProperties(void 0,o),n==null||n({})}}
2,this.on("eventCaptured",s=>k.info('send "'+(s==null?void 0:s.event)+'"',s))}init(e,t,s){if(s&&s!==Mt){var r,n=(r=ki[s])!==null&&r!==void 0?r:new Te;return n._init(e,t,s),ki[s]=n,ki[Mt][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n,o;t===void 0&&(t={});var a,l=j(e)?e.trim():"";if(!l)return k.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 l!==((a=this.config)==null?void 0:a.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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=_r(t.defaults),t.debug=this.zl(t.debug),this.Ul=t,this.Wl=[],t.person_profiles?this.Bl=t.person_profiles:t.process_person&&(this.Bl=t.process_person);var u=_r(t.defaults),h=wa(t),c=J({},u,h,{name:s,token:l});z(u.rageclick)&&z(h.rageclick)&&(c.rageclick=J({},u.rageclick,h.rageclick)),z(u.session_recording)&&z(h.session_recording)&&(c.session_recording=J({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&k.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Le.GZipJS;var d=this.Fl();if(this.persistence=new xi(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xi(E({},this.config,{persistence:"sessionStorage"}),d,!1),this.$l="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&K.ii()){var g=K.ui(this.$l);L(g)&&g.forEach(P=>{j(P)&&this.Dl.add(P)})}else K.oi(this.$l);var p=E({},this.persistence.props),v=E({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Vl=new Pn(P=>this.Gl(P),this.config.request_queue_config),this.Zl=new Cn(this),this.__request_queue=[];var f=this.El();f||(this.sessionManager=new Ps(this),this.sessionPropsManager=new Ts(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((P,O,A)=>{(A!=null&&A.activityTimeout||A!=null&&A.sessionPastMaximumLength||A!=null&&A.crossTabAdoption)&&this.Ql()})),this.Jl(),this.config.__preview_deferred_init_extensions?(k.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Kl(f)},0)):(k.info("Initializing extensions synchronously"),this.Kl(f)),Q.DEBUG=Q.DEBUG||this.config.debug,Q.DEBUG&&k.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p,s:v}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=E({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var _=(n=t.bootstrap)==null?void 0:n.distinctID;if(this.Pl=!!_&&!yi(_),((o=t.bootstrap)==null?void 0:o.distinctID)!==void 0){var y=t.bootstrap.distinctID,w=this.get_distinct_id(),T=this.persistence.get_property(H);if(t.bootstrap.isIdentifiedID&&w!=null&&w!==y&&T===he)this.identify(y);else if(t.bootstrap.isIdentifiedID&&w!=null&&w!==y&&T===we)k.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 x=this.config.get_device_id(Ve()),M=t.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(H,t.bootstrap.isIdentifiedID?we:he),this.register({distinct_id:y,$device_id:M})}}if(f)this.register_once({distinct_id:Ct,$device_id:null},"");else if(!this.get_distinct_id()){var N=this.config.get_device_id(Ve());this.register_once({distinct_id:N,$device_id:N},""),this.persistence.set_property(H,he)}return Z(m,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(P,O){var A=P.config.segment;if(!A)return O();(function($,I){var C=$.config.segment;if(!C)return I();var U=B=>{var Y=()=>B.anonymousId()||Ve();$.config.get_device_id=Y,B.id()&&($.register({distinct_id:B.id(),$device_id:Y()}),$.persistence.set_property(H,we)),I()},V=C.user();"then"in V&&xe(V.then)?V.then(U):U(V)})(P,()=>{A.register(($=>{typeof Promise!="undefined"&&Promise.resolve||lr.warn("This browser does not have Promise support, and can not use the segment integration");var I=(C,U)=>{if(!U)return C;C.event.userId||C.event.anonymousId===$.get_distinct_id()||(lr.info("No userId set, resetting PostHog"),$.reset()),C.event.userId&&C.event.userId!==$.get_distinct_id()&&(lr.info("UserId set, identifying with PostHog"),$.identify(C.event.userId)
2);var V=$.calculateEventProperties(U,C.event.properties);return C.event.properties=Object.assign({},V,C.event.properties),C};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:C=>I(C,C.event.event),page:C=>I(C,Rt),identify:C=>I(C,ir),screen:C=>I(C,"$screen")}})(P)).then(()=>{O()})})}(this,()=>this.Yl()):this.Yl(),xe(this.config._onCapture)&&this.config._onCapture!==As&&(k.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",P=>this.config._onCapture(P.event,P))),this.config.ip&&k.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 yu.apply(this,arguments)}().then(P=>{P&&this.register({[er]:P})}).catch(As),this}Xl(e){var t=e;return j(t.name)&&xe(t.setup)}tu(e,t){this.Xl(e)?t.push(()=>{this.eu().add(e).catch(()=>
2e.dispose==null?void 0:e.dispose()).catch(s=>{k.error('Failed to dispose browser extension "'+e.name+'"',s)})}):this.yl.push(e)}Jl(){var e,t,s,r,n,o,a=(e=(t=this.config.__extensionClasses)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:(s=Te.__defaultExtensionClasses)==null?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||((r=this.iu)==null||r.call(this),this.iu=void 0,this.featureFlags=new a(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)?this.iu||(this.iu=this.featureFlags.onReloading(()=>{this.kl.emit("featureFlagsReloading",!0)}),this.eu().add(this.featureFlags)):(n=(o=this.featureFlags).initialize)==null||n.call(o))}Kl(e){var t,s,r,n,o,a,l,u=performance.now(),h=E({},Te.__defaultExtensionClasses,this.config.__extensionClasses),c=[];h.exceptions&&this.yl.push(this.exceptions=(t=this.exceptions)!==null&&t!==void 0?t:new h.exceptions(this)),h.historyAutocapture&&this.yl.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.yl.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.yl.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.yl.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.tu(this.autocapture=new h.autocapture(this),c),h.surveys&&this.tu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new h.surveys(this),c),h.logs&&this.tu(this.logs=(r=this.logs)!==null&&r!==void 0?r:new h.logs(this),c),h.metrics&&this.yl.push(this.metrics=(n=this.metrics)!==null&&n!==void 0?n:new h.metrics(this)),h.conversations&&this.yl.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new h.conversations(this)),h.productTours&&this.yl.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.yl.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.yl.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.yl.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.yl.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,vc)),h.toolbar&&this.yl.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new h.toolbar(this)),h.experiments&&this.yl.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new h.experiments(this)),this.yl.forEach(d=>{d.initialize&&c.push(()=>{d.initialize==null||d.initialize()})}),c.push(()=>{if(this.ru){var d=this.ru;this.ru=void 0,this.yl.forEach(g=>g.onRemoteConfig==null?void 0:g.onRemoteConfig(d))}}),this.nu(c,u)}nu(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.nu(e,t)},0);var s=e.shift();if(s)try{s()}catch(n){k.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[Rl]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ml]:r}),this.config.__preview_deferred_init_extensions&&k.info("PostHog extensions initialized ("+r+"ms)")}ho(e){var t;if(!S||!S.body)return k.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.ho(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.ru=e),this.wl=e,this.compression=void 0,e.ok){var s,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=R(r.supportedCompression,Le.GZipJS)?Le.GZipJS:R(r.supportedCompression,Le.Base64)?Le.Base64:void 0),(s=r.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Bl?this.Bl:ln}),(t=this.su)==null||t.handleRemoteConfig(e),this.yl.forEach(n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e))}Yl(){try{this.config.loaded(this)}catch(s){k.critical("`loaded` function failed",s)}if(this.au(),this.config.internal_or_test_user_hostname&&ne!=null&&ne.hostname){var e=ne.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.El())&&this.ou()},1),this.lu=new xs(this),this.lu.load()}au(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Vl)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Di(this.__request_queue,e=>this.Gl(e)),this.__request_queue=[],this.au()}_handle_unload(){var e,t,s,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.uu()&&this.capture(tr),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.Vl)==null||r.unload(),(n=this.Zl)==null||n.unload()):this.uu()&&this.capture(tr,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?Tu?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=E({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?(t=this.compression)!==null&&t!==void 0?t:e.compressionFallback:e.compression,(b(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,
2(s=>{var r,n,o,a=E({},s);a.timeout=a.timeout||6e4;var l,u,h,c,d,g=(r=a.transport)!==null&&r!==void 0?r:"fetch";g==="sendBeacon"&&b(a.compression)&&a.data&&(a.compression=Le.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(u=(d=(c=(L(l=a.data)?l:[l]).map(_=>E({},_,_.timestamp instanceof Date&&!isNaN(_.timestamp.getTime())?{timestamp:_.timestamp.toISOString()}:{})))[0])==null||(h=d.properties)==null?void 0:h.token)!==null&&u!==void 0?u:d==null?void 0:d.token,batch:c,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=function(_,y){return y===void 0&&(y=new Date().toISOString()),L(_)?_.map(w=>E({},w,{sent_at:y})):E({},_,{sent_at:y})}(a.data))),a.url=ga(a.url,a.method,a.compression,a.timestampMode);var p=Xi.filter(_=>!a.disableTransport||!_.transport||!a.disableTransport.includes(_.transport)),v=(n=(o=function(_,y){for(var w=0;_.length>w;w++)if(_[w].transport===g)return _[w]}(p))==null?void 0:o.method)!==null&&n!==void 0?n:p[0].method;if(!v)throw new Error("No available transport method");var f=_=>{try{v(_)}catch(y){fu(y)?k.warn(y):k.error(y),a.callback==null||a.callback({statusCode:0,error:y})}};g!=="sendBeacon"&&a.data&&a.compression===Le.GZipJS&&nh&&typeof Promise!="undefined"&&!Ji?Ac(a).then(_=>{f(_)}).catch(_=>{if(Ho(_))return Ji=!0,void f(E({},a,{compression:void 0,url:ga(s.url,s.method,void 0,s.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;var w="name"in y?String(y.name):"";return Ho(y)||w===ml})(_)&&(Ji=!0),f(a)}):v(a)})(E({},e,{callback:s=>{var r,n;this.rateLimiter.checkForLimiting(s),400>s.statusCode||(r=(n=this.config).on_request_error)==null||r.call(n,s),e.callback==null||e.callback(s)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Gl(e){this.Zl?this.Zl.retriableRequest(e):this._send_request(e)}_execute_array(e){fr++;try{var t,s=[],r=[],n=[];Di(e,a=>{if(a)if(L(t=a[0]))n.push(a);else if(xe(a))try{a.call(this)}catch(l){k.error("Error executing queued PostHog call",a,l)}else L(a)&&t==="alias"?s.push(a):L(a)&&t.indexOf("capture")!==-1&&xe(this[t])?n.push(a):r.push(a)});var o=function(a,l){Di(a,function(u){try{if(L(u[0])){var h=l;G(u,function(c){h=h[c[0]].apply(h,c.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){k.error("Error executing queued PostHog call",u,c)}})};o(s,this),o(r,this),o(n,this)}finally{fr--}}push(e){if(fr>0&&L(e)&&j(e[0])){var t=Te.prototype[e[0]];xe(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Vl){if(this.is_capturing())if(!b(e)&&j(e)){this.Al();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h==null||!h.isRateLimited){t!=null&&t.$current_url&&!j(t==null?void 0:t.$current_url)&&(k.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.hu||k.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,d=(s==null?void 0:s.timestamp)||c,g=Mo(s==null?void 0:s.uuid,Ve),p={uuid:g,event:e,properties:this.calculateEventProperties(e,t||{},d,g)};e===Rt&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var v=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(Ut)===!0;s!=null&&s.$set&&!v&&(p.$set=s==null?void 0:s.$set);var f=s==null?void 0:s.$unset;f&&(p.$unset=f);var _,y,w,T=v?void 0:this.du(s==null?void 0:s.$set_once,e!==Go,e===ir);if(T&&(p.$set_once=T),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=I=>j(I)?I.slice(0,n):I,l=new Set,p=function I(C,U){if(C!==Object(C))return a?a(C):C;if(!l.has(C)){var V;if(l.add(C),L(C))V=[],Di(C,Y=>{V.push(I(Y))});else{var B={};G(C,(Y,ee)=>{l.has(Y)||(B[ee]=I(Y,ee))}),V=B}return V}}(o)),p.timestamp=d,b(s==null?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),v&&(p.properties=function(I,C){C===void 0&&(C=[]);var U={},V=B=>{I[B]!==void 0&&(U[B]=I[B])};
2return oh.forEach(V),C.forEach(V),U}(p.properties,Hc)),e===st.DISMISSED||e===st.SENT){var x=t==null?void 0:t[cr.SURVEY_ID],M=t==null?void 0:t[cr.SURVEY_ITERATION];Su({id:x,current_iteration:M}),p.$set=E({},p.$set,{[(_={id:x,current_iteration:M},y=e===st.SENT?"responded":"dismissed",w="$survey_"+y+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(w="$survey_"+y+"/"+_.id+"/"+_.current_iteration),w)]:!0})}else e===st.SHOWN&&(p.$set=E({},p.$set,{[cr.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Ec.SHOWN){var N=t==null?void 0:t[ha.TOUR_TYPE];N&&(p.$set=E({},p.$set,{[ha.TOUR_LAST_SEEN_DATE+"/"+N]:new Date().toISOString()}))}var P=E({},p.properties.$set,p.$set);if(De(P)||this.setPersonPropertiesForFlags(P),!D(this.config.before_send)){var O=this.ts(p);if(!O)return;(p=O).uuid=Mo(p.uuid,Ve)}this.kl.emit("eventCaptured",p);var A=(r=s==null?void 0:s._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),$={method:"POST",url:A,data:p,compression:"best-available",timestampMode:(s==null?void 0:s._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(A)?"body":"capture-body",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Gl($):this.Vl.enqueue($),p}k.critical("This capture call is ignored due to client rate limiting.")}}else k.error("No event name provided to posthog.capture")}else k.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return(t=this.su)==null?void 0:t.getExtension(e)}eu(){var e;return(e=this.su)!==null&&e!==void 0?e:this.su=new Rn(this)}xl(e){this.Nl.push(e);var t=!0;return()=>{if(t){t=!1;var s=this.Nl.indexOf(e);s!==-1&&this.Nl.splice(s,1)}}}vu(e){var t,s,r;return e===void 0&&(e=!0),!((t=this.persistence)==null||!t.consumeCookieIdentityChange())&&(this.Hl=null,this.persistence.get_property(H)===he&&((r=this.sessionPersistence)==null||r.clear(),this.Dl.clear(),this.cu()),(s=this.featureFlags)==null||s.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.vu();var o=n?void 0:this.persistence.remove_event_timer(e),a=E({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.El()&&(a[$l]=!0),e==="$snapshot"){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!j(a.distinct_id)&&!ue(a.distinct_id)||yi(a.distinct_id))&&k.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=function(x,M,N,P){var O,A,$,I;if(P===void 0&&(P=!1),!Ie)return{};var C,U=x?[...Jt,...M||[]]:[],V=gl(Ie),B=V[0],Y=V[1],ee=(C=typeof navigator!="undefined"?navigator:void 0)!=null&&C.brave?{brave:!0}:{},pe={};b(N)||(pe.detectGoogleSearchApp=N);var fe={},Ee=(O=navigator)==null||(O=O.userAgentData)==null?void 0:O.platform,Oe=(A=navigator)==null?void 0:A.maxTouchPoints,oe=m==null||($=m.screen)==null?void 0:$.width,_e=m==null||(I=m.screen)==null?void 0:I.height,ve=m==null?void 0:m.devicePixelRatio;b(Ee)||(fe.userAgentDataPlatform=Ee),b(Oe)||(fe.maxTouchPoints=Oe),b(oe)||(fe.screenWidth=oe),b(_e)||(fe.screenHeight=_e),b(ve)||(fe.devicePixelRatio=ve);var ze,vt,ae,qe,ot,si,Me,Ae,Ri=J(oo({$os:B,$os_version:Y,$browser:vl(Ie,navigator.vendor,ee,pe),$device:Ro(Ie),$device_type:(vt=Ie,ae=fe,Ae=Ro(vt),Ae===Za||Ae===Ka||Ae==="Kobo"||Ae==="Kindle Fire"||Ae===ul?zt:Ae===Ti||Ae===jt||Ae===Pi||Ae===Ir?"Console":Ae===Ja?"Wearable":Ae?Re:(ae==null?void 0:ae.userAgentDataPlatform)==="Android"&&((qe=ae==null?void 0:ae.maxTouchPoints)!==null&&qe!==void 0?qe:0)>0?600>Math.min((ot=ae==null?void 0:ae.screenWidth)!==null&&ot!==void 0?ot:0,(si=ae==null?void 0:ae.screenHeight)!==null&&si!==void 0?si:0)/((Me=ae==null?void 0:ae.devicePixelRatio)!==null&&Me!==void 0?Me:1)?Re:zt:"Desktop"),$timezone:au(),$timezone_offset:yc()}),{$current_url:Ii(P?dt(ne==null?void 0:ne.href):ne==null?void 0:ne.href,U,Oi),$host:ne==null?void 0:ne.host,$pathname:ne==null?void 0:ne.pathname,$raw_user_agent:Ie.length>1e3?Ie.substring(0,997)+"...":Ie,$browser_version:Ph(Ie,navigator.vendor,ee,pe),$browser_language:la(),$browser_language_prefix:(ze=la(),typeof ze=="string"?ze.split("-")[0]:void 0),$screen_height:m==null?void 0:m.screen.height,$screen_width:m==null?void 0:m.screen.width,$viewport_height:m==null?void 0:m.innerHe
2ight,$viewport_width:m==null?void 0:m.innerWidth,$lib:Q.LIB_NAME,$lib_version:Q.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Q.SDK_DIST_CHANNEL&&(Ri.$sdk_dist_channel=Q.SDK_DIST_CHANNEL),Ri}(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 c=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0),d=c.windowId;a.$session_id=c.sessionId,a.$window_id=d}this.sessionPropsManager&&J(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&J(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.Zl)==null?void 0:g.length}catch(x){a.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===In&&(a.$lib_custom_api_host=this.config.api_host),u=e!==Rt||n?e!==tr||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),a=J(a,u),e===Rt&&S&&(a.title=S.title),!b(o)){var p=s.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Ie&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),f=this.sessionPersistence.properties();G(["$referrer","$referring_domain"],x=>{x in v&&delete f[x]});var _={};if(this.Nl.length>0)for(var y of this.Nl.slice())try{J(_,y())}catch(x){k.error("Failed to produce browser extension event properties",x)}(a=J({},h,v,f,E({},_,a))).$is_identified=this._isIdentified(),L(this.config.property_denylist)?G(this.config.property_denylist,function(x){delete a[x]}):k.error(ku+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var w=this.config.sanitize_properties;w&&(k.error(ba),a=w(a,e));var T=this.fu();return a.$process_person_profile=T,T&&!n&&this.pu("_calculate_event_properties"),a}du(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.fu()||this.Ll&&!s)return e;var n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),a=J({},n,o||{},e||{}),l=this.config.sanitize_properties;return l&&(k.error(ba),a=l(a,"$set_once")),t&&(this.Ll=!0),De(a)?void 0:a}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t,s;(t=this.persistence)==null||t.syncCookieProperties(),this.vu(),(s=this.sessionPersistence)==null||s.register(e),Object.keys(e).forEach(r=>this.Dl.add(r)),this.cu()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.Dl.delete(e),this.cu()}gu(e,t){this.register({[e]:t})}Ql(){this.Dl.forEach(e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)}),this.Dl.clear(),this.cu()}cu(){var e;if(this.$l)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.Ca||!K.ii())K.oi(this.$l);else{var t=[];this.Dl.forEach(s=>t.push(s)),t.length>0?K.ni(this.$l,t):K.oi(this.$l)}}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,t){var s,r;return(s=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))!==null&&s!==void 0?s:t==null?void 0:t.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.kl.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:di}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:di})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:di})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;
2t===void 0&&(t=Mc),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:di}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:di})}mu(e){return!e||yi(e)?(k.critical("Unique user id has not been set in posthog.identify"),!1):e===Ct?(k.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(k.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return k.uninitializedWarning("posthog.identify");if(ue(e)&&(e=e.toString(),k.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.mu(e)&&this.pu("posthog.identify")){this.Al();var r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.vu(!1),a=this.persistence.Ua(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Ci)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property(Nt)&&(this.unregister(Nt),this.register({distinct_id:e}));var h,c=(this.persistence.get_property(H)||he)===he,d=e!==u,g=!d&&c;if(d&&c)this.persistence.set_property(H,we),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Wa(),this.capture(ir,{distinct_id:e,$anon_distinct_id:u},{$set:t||{},$set_once:s||{}}),this.Hl=gr(e,t,s),(h=this.featureFlags)==null||h.setAnonymousDistinctId(u);else if(g){this.persistence.set_property(H,we);var p=t||{},v=s||{};this.setPersonPropertiesForFlags({$set:p,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence.Wa(),this.capture("$set",{$set:p,$set_once:v}),this.Hl=gr(e,t,s)}else(t||s)&&this.setPersonProperties(t,s);d||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(tt)):g&&(t||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Za(l)}}}setPersonProperties(e,t){if((e||t)&&this.pu("posthog.setPersonProperties")){var s=gr(this.get_distinct_id(),e,t);this.Hl!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Hl=s):k.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,s=(L(e)?e:[e]).filter(r=>j(r)&&r.length>0);s.length!==0&&this.pu("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Hl=null)}group(e,t,s){var r;if(e&&t){(r=this.persistence)==null||r.syncCookieProperties(),this.vu();var n=this.getGroups(),o=n[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},n,{[e]:t})}),o||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(Go,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else k.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.pu("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t=Pe(e)?e:e==null?void 0:e.resetDeviceID,s=Pe(e)||e==null?void 0:e.bootstrap;this.yu(t,!1,s)}yu(e,t,s){var r,n,o;if(t===void 0&&(t=!1),k.info("reset"),!this.__loaded)return k.uninitializedWarning("posthog.reset");var a=s==null?void 0:s.sessionID;this.config.bootstrap=s||((r=this.Ul)==null?void 0:r.bootstrap)||{},(n=this.featureFlags)==null||n.updateConfig==null||n.updateConfig(this.config,this.do());var l=this.get_property(Ci),u=this.get_property(er),h=this.get_property(St),c=this.is_capturing();this.consent.reset(),t||!c||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=(o=this.persistence)==null||o.Ua==null?void 0:o.Ua(),g=!1;try{var p,v,f,_,y,w,T,x,M,N,P,O,A;if((p=this.persistence)==null||p.clear(),(v=this.sessionPersistence)==null||v.clear(),this.Dl.clear(),this.cu(),b(h)||(N=this.persistence)==null||N.register({[St]:h}),(f=this.surveys)==null||f.reset(),(_=this.featureFlags)==null||_.reset(),(y=this.conversations)==null||y.reset(),(w=this.logs)==null||w.reset(),(T=this.metrics)==null||T.reset(),(x=this.persistence)==null||x.set_property(H,he),(M=this.sessionManager)==null||M.resetSessionId(),this.Hl=null,this.config.cookieless_mode===it)this.register_once({distinct_id:Ct,$device_id:null},"");else{var $=this.config.get_device_id(Ve());this.register_once({distinct_id:$,$device_id:e?$:l},""),e||b(u)||this.register({[er]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID===void 0||this.El()||((A=this.persistence)==null||A.set_property(H,s.isIdentifiedID?we:he),this.register({distinct_id:s.distinctID})),(P=this.featureFlags)==null||P.initialize(),!(b(a)||(O=this.sessionManager)!=null&&O.setBootstrapSessionId(a,!0)))){var I=E({},s);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var C;d&&((C=this.persistence)==null||C.Za==null||C.Za(g))}this.reloadFeatureFlags()}shutdown(e){var t=this;return X(function*(){var s,r,n,o,a,l,u;if(t.__loaded){t.eu().dispose(),(s=t.sessionRecording)==null||s.dispose(),(r=t.logs)==null||r.flushLogs("sendBeacon"),(n=t.metrics)==null||n.flush("sendBeacon"),(o=t.Vl)==null||o.unload(),(a=t.Zl)==null||a.unload();try{var h;(h=t.featureFlags)==null||h.destroy()}catch(c){k.error("Error while destroying feature flags",c)}(l=t.persistence)==null||l.destroy(),(u=t.sessionPersistence)==null||u.destroy()}else k.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var s;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.bu()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)==null||e._u()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&s){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(Pl)?(k.critical("Attempting to create alias for existing People user - aborting."),-2):this.pu("posthog.alias")?(b(t)&&(t=this.get_distinct_id()),e!==t?(this.gu(Nt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(k.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(z(e)){var s,r,n,o,a,l,u,h,c,d,g,p;J(this.config,wa(e));var v=this.Fl();(s=this.persistence)==null||s.update_config(this.config,t,v),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xi(E({},this.config,{persistence:"sessionStorage"}),v,!1);var f,_=this.zl(this.config.debug);Pe(_)&&(this.config.debug=_),Pe(this.config.debug)&&(this.config.debug?(Q.DEBUG=!0,q.ii()&&q.ni("ph_debug",!0),k.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(Q.DEBUG=!1,q.ii()&&q.oi("ph_debug"))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.do()),(n=this.exceptionObserver)==null||n.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(h=this.heatmaps)==null||h.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((f=this.historyAutocapture)==null||f.startIfEnabledOrStop()),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(g=this.surveys)==null||g.loadIfEnabled(),this.Ol(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){Q.LIB_NAME=e,Q.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(E({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:Te.wu}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Mt;return t!==Mt&&(t=Mt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(H))===we||((t=this.sessionPersistence)==null?void 0:t.get_property(H))===we}fu(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===ln&&!this._isIdentified()&&De(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Nt])&&((t=this.persistence)==null||(t=t.props)==null||!t[gs]))}uu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.fu()||this.pu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.pu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}pu(e){return this.config.person_profiles==="never"?(k.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Il(),this.gu(gs,!0),!0)}
2Fl(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ut)}Ol(){var e,t,s,r,n,o=this.Fl();return this.is_capturing()||(s=this.logs)==null||s.ku(),((e=this.persistence)==null?void 0:e.Ca)!==o&&((r=this.persistence)==null||r.set_disabled(o)),((t=this.sessionPersistence)==null?void 0:t.Ca)!==o&&((n=this.sessionPersistence)==null||n.set_disabled(o)),o&&(this.Dl.clear(),this.cu()),o}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==it){if(this.El()){var s,r,n,o,a,l;(s=this.sessionRecording)==null||s.dispose({discardBufferedEvents:!0}),this.yu(!0,!0),(r=this.sessionManager)==null||r.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=new Ps(this),this.pageViewManager=new bs(this),this.persistence&&(this.sessionPropsManager=new Ts(this,this.sessionManager,this.persistence));var u,h=(o=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=Te.__defaultExtensionClasses)==null?void 0:l.sessionRecording;h&&(this.sessionRecording=this.Ml(this.sessionRecording,new h(this)),this.wl&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.wl)))}var c,d;this.consent.optInOut(!0),this.Ol(),this.au(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==ut&&((c=this.surveys)==null||c.loadIfEnabled()),(b(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e==null?void 0:e.captureEventName)!==null&&d!==void 0?d:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ou()}else k.warn(ya)}opt_out_capturing(){if(this.config.cookieless_mode!==it){var e,t,s=this.config.cookieless_mode===ut?this.sessionRecording:void 0;s==null||s.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ut&&this.consent.isOptedIn()&&this.yu(!0,!0),this.consent.optInOut(!1),this.Ol(),this.config.cookieless_mode===ut&&(this.register({distinct_id:Ct,$device_id:null}),this.Tl(s),this.sessionRecording=void 0,(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.ou(),this.au())}else k.warn(ya)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===it||(this.config.cookieless_mode===ut?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ol()}_is_bot(){return ge?mu(ge,this.config.custom_blocked_useragents):void 0}ou(){S&&(S.visibilityState==="visible"?this.ql||(this.ql=!0,this.capture(Rt,{title:S.title},{send_instantly:!0}),this.jl&&(S.removeEventListener(Yt,this.jl),this.jl=null)):this.jl||(this.jl=this.ou.bind(this),Z(S,Yt,this.jl)))}debug(e){e===!1?(m==null||m.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(m==null||m.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}))}do(){var e=this.Ul||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(k.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,s,r,n,o){var a=s in t&&!D(t[s]),l=r in t&&!D(t[r]);return a?t[s]:!!l&&(o&&o.warn("Config field '"+r+"' is deprecated. Please use '"+s+"' instead. The old field will be removed in a future major version."),t[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,k)}ts(e){var t;if(D(this.config.before_send))return e;var s=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(fh),r=L(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var o of r)try{if(n=o(n),D(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return gh(e.event)?k.warn(a+". This can cause unexpected behavior."):k.info(a),null}n.properties&&!De(n.properties)||k.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(u){return k.error("Error in beforeSend function for event '"+e.event+"':",u),null}for(var l of s)if(n.properties&&D(n.properties[l]))return k.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;
2return(e=this.pageViewManager.ea)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}zl(e){var t=Pe(e)&&!e,s=q.ii()&&q.ai("ph_debug")==="true";return!t&&(!!s||e)}};Te.__defaultExtensionClasses={},Te.wu=(()=>{var i=()=>{};return{trace:i,debug:i,info:i,warn:i,error:i,fatal:i}})(),function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=Qh(i.prototype[e[t]])}(Te,["identify"]);var Is=class{constructor(e){this.disabled=e===!1;var t=z(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}},mr="$copy_autocapture",Vi=ie("[AutoCapture]");function yr(i,e){return e.length>i?e.slice(0,i)+"...":e}function jc(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!pt(e));return e}function Uc(i,e){var t,s,r=e.e,n=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!pt(i))return{props:{}};for(var h=[i],c=new Set([i]),d=i;d.parentNode&&!$e(d,"body")&&Ul>h.length;)if(jl(d.parentNode)){var g=d.parentNode.host;if(c.has(g))break;c.add(g),h.push(g),d=g}else{if(!pt(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}var p,v,f=[],_={},y=!1,w=!1;if(G(h,P=>{var O=_n(P);if($e(P,"a")){var A=P.getAttribute("href");y=!!(O&&A&&Ei(A))&&(u?dt(A):A)}R(ms(P),"ph-no-capture")&&(w=!0),f.push(function(I,C,U,V,B){B===void 0&&(B=!1);var Y=I.tagName.toLowerCase(),ee={tag_name:Y};lo.indexOf(Y)>-1&&!U&&(ee.$el_text=Y.toLowerCase()==="a"||Y.toLowerCase()==="button"?yr(1024,oa(I)):yr(1024,Ai(I)));var pe=ms(I);pe.length>0&&(ee.classes=pe.filter(function(oe){return oe!==""})),G(I.attributes,function(oe){var _e;if((!Kl(I)||["name","id","class","aria-label"].indexOf(oe.name)!==-1)&&(V==null||!V.includes(oe.name))&&!C&&Ei(oe.value)&&(!j(_e=oe.name)||_e.substring(0,10)!=="_ngcontent"&&_e.substring(0,7)!=="_nghost")){var ve=oe.value;oe.name==="class"&&(ve=ao(ve).join(" ")),ee["attr__"+oe.name]=yr(1024,oe.name==="href"&&B?dt(ve):ve)}});for(var fe=1,Ee=1,Oe=I;Oe=jc(Oe);)fe++,Oe.tagName===I.tagName&&Ee++;return ee.nth_child=fe,ee.nth_of_type=Ee,ee}(P,n,o,a,u));var $=function(I){if(!_n(I))return{};var C={};return G(I.attributes,function(U){if(U.name&&U.name.indexOf("data-ph-capture-attribute")===0){var V=U.name.replace("data-ph-capture-attribute-",""),B=U.value;V&&B&&Ei(B)&&(C[V]=B)}}),C}(P);G($,(I,C)=>{({}).hasOwnProperty.call(_,C)||(_[C]=I)})}),w)return{props:{},explicitNoCapture:w};if(o||(f[0].$el_text=$e(i,"a")||$e(i,"button")?oa(i):Ai(i)),y){var T,x;f[0].attr__href=y;var M=(T=Zt(y))==null?void 0:T.host,N=m==null||(x=m.location)==null?void 0:x.host;M&&N&&M!==N&&(p=y)}return{props:J({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:(v=f,L(v)?function(P){return P.map(O=>{var A,$,I="";if(O.tag_name&&(I+=O.tag_name),O.attr_class)for(var C of(O.attr_class.sort(),O.attr_class))I+="."+C.replace(/"/g,"");var U=E({},O.text?{text:O.text}:{},{"nth-child":(A=O.nth_child)!==null&&A!==void 0?A:0,"nth-of-type":($=O.nth_of_type)!==null&&$!==void 0?$:0},O.href?{href:O.href}:{},O.attr_id?{attr_id:O.attr_id}:{},O.attributes),V={};return Qi(U).sort((B,Y)=>{return(pe=Y[0])>(ee=B[0])?-1:ee>pe?1:0;var ee,pe}).forEach(B=>{var Y=B[1];return V[aa(B[0].toString())]=aa(Y.toString())}),(I+=":")+Qi(V).map(B=>B[0]+'="'+B[1]+'"').join("")}).join(";")}(function(P){return P.map(O=>{var A,$,I={text:(A=O.$el_text)==null?void 0:A.slice(0,400),tag_name:O.tag_name,href:($=O.attr__href)==null?void 0:$.slice(0,2048),attr_class:dc(O),attr_id:O.attr__id,nth_child:O.nth_child,nth_of_type:O.nth_of_type,attributes:{}};return Qi(O).filter(C=>
2C[0].indexOf("attr__")===0).forEach(C=>I.attributes[C[0]]=C[1]),I})}(v)):"")},(t=f[0])!=null&&t.$el_text?{$el_text:(s=f[0])==null?void 0:s.$el_text}:{},p&&r.type==="click"?{$external_click_url:p}:{},_)}}var Nn=class{constructor(e){this.name="autocapture",this.Rs=!1,this.Ps=null,this.As=!1,this.Fs=!1,this.mn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Os=!1,this.Ls=e,this.Ls.refresh(this.mn),this.rageclicks=new Is(this.mn.rageclick),this.Ds=null}setup(e){this.$s(),this.Ns=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?t.dispose():(this.qs=t,this.startIfEnabled())}dispose(){var e;this.Os||(this.Os=!0,this.Ns=void 0,(e=this.qs)==null||e.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var e,t;return this.Bs(),this.mn.url_allowlist=(e=this.mn.url_allowlist)==null?void 0:e.map(s=>new RegExp(s)),this.mn.url_ignorelist=(t=this.mn.url_ignorelist)==null?void 0:t.map(s=>new RegExp(s)),this.mn}Hs(){if(this.isBrowserSupported()){if(m&&S){var e=this.zs=s=>{s=s||(m==null?void 0:m.event);try{this.Us(s)}catch(r){Vi.error("Failed to capture event",r)}};if(Z(S,"submit",e,{capture:!0}),Z(S,"change",e,{capture:!0}),Z(S,"click",e,{capture:!0}),this.Bs().capture_copied_text){var t=this.Ws=s=>{s=s||(m==null?void 0:m.event);try{this.Us(s,mr)}catch(r){Vi.error("Failed to capture clipboard event",r)}};Z(S,"copy",t,{capture:!0}),Z(S,"cut",t,{capture:!0}),Z(S,"paste",t,{capture:!0})}}}else Vi.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(S==null||S.removeEventListener("submit",this.zs,!0),S==null||S.removeEventListener("change",this.zs,!0),S==null||S.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(S==null||S.removeEventListener("copy",this.Ws,!0),S==null||S.removeEventListener("cut",this.Ws,!0),S==null||S.removeEventListener("paste",this.Ws,!0),this.Ws=void 0),this.Rs=!1}startIfEnabled(){!this.Os&&this.Ns&&this.isEnabled&&!this.Rs&&(this.Hs(),this.Rs=!0)}onRemoteConfig(e){if(!this.Os)if(this.As=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Fs=t.elementsChainAsString);var s,r=t.autocapture_opt_out;Pe(r)&&((s=this.Ns)==null||s.kv.set(Wr,r),this.Ps=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Ds=e}getElementSelectors(e){var t,s=[];return(t=this.Ds)==null||t.forEach(r=>{var n=S==null?void 0:S.querySelectorAll(r);n==null||n.forEach(o=>{e===o&&s.push(r)})}),s}get isEnabled(){var e,t;if(this.Os)return!1;var s=(e=this.Ns)==null?void 0:e.kv.get(Wr),r=this.Ps,n=this.Bs(),o=n.remoteRequestsDisabled&&!this.As;if(le(r)&&!Pe(s)&&!o)return!1;var a=(t=this.Ps)!==null&&t!==void 0?t:!!s;return!!n.enabled&&!a}Us(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var s=gn(e);ql(s)&&(s=s.parentNode||null);var r,n=this.$s();t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Gl(s,n.rageclick)&&this.Us(e,"$rageclick");var o=t===mr,a=o?E({},n,{dom_event_allowlist:void 0}):n;if(s&&function(_,y,w,T,x,M){var N;if(!m||uo(_)||w!=null&&w.url_allowlist&&!Xo(w.url_allowlist,M)||w!=null&&w.url_ignorelist&&Xo(w.url_ignorelist,M))return!1;if(w!=null&&w.dom_event_allowlist){var P=w.dom_event_allowlist;if(P&&!P.some(U=>y.type===U))return!1}var O=Yl(_,T),A=O.parentIsUsefulElement,$=O.targetElementList;if(!function(U,V){var B=V==null?void 0:V.element_allowlist;if(b(B))return!0;var Y,ee=function(fe){if(B.some(Ee=>fe.tagName.toLowerCase()===Ee))return{v:!0}};for(var pe of U)if(Y=ee(pe))return Y.v;return!1}($,w)||!fn($,w==null?void 0:w.css_selector_allowlist)||fn($,(N=w==null?void 0:w.css_selector_ignorelist)!==null&&N!==void 0?N:oc))return!1;try{var I=m.getComputedStyle(_);if(I&&I.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0}catch(U){}var C=_.tagName.toLowerCase();switch(C){case"html":return!1;case"form":return(x||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(y.type)>=0;default:return A?(x||["click"]).indexOf(y.type)>=0:(x||["click"]).indexOf(y.type)>=0&&(lo.indexOf(C)>-1||_.getAttribute("contenteditable")==="true")}}(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,u=Uc(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsC
2hainAsString:this.Fs,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),h=u.props;if(u.explicitNoCapture)return!1;var c=this.getElementSelectors(s);if(c&&c.length>0&&(h.$element_selectors=c),t===mr){var d=e.type||"clipboard";if(d!=="paste"){var g,p,v=m==null||(g=m.getSelection())==null?void 0:g.toString(),f=Vl(v);if(!f)return!1;h.$selected_content=f,h.$clipboard_text_length=(p=v==null?void 0:v.length)!==null&&p!==void 0?p:0}h.$copy_type=d}return(l=this.Ns)==null||l.capture(t,h).catch(_=>Vi.error("Failed to capture event",_)),!0}}}isBrowserSupported(){return xe(S==null?void 0:S.querySelectorAll)}},Dn=class{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,s=z(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.do(),e.url_allowlist=s==null?void 0:s.url_allowlist,e.url_ignorelist=s==null?void 0:s.url_ignorelist,e.dom_event_allowlist=s==null?void 0:s.dom_event_allowlist,e.element_allowlist=s==null?void 0:s.element_allowlist,e.css_selector_allowlist=s==null?void 0:s.css_selector_allowlist,e.css_selector_ignorelist=s==null?void 0:s.css_selector_ignorelist,e.element_attribute_ignorelist=s==null?void 0:s.element_attribute_ignorelist,e.capture_copied_text=s==null?void 0:s.capture_copied_text}},pi=ie("[ExceptionAutocapture]"),Ea=()=>{},xa=i=>{var e;if(xe(i))return(e=i.__posthog_layer__)!==null&&e!==void 0?e:i.__rrweb_layer__};function Pu(i,e,t){try{if(!(e in i))return Ea;var s={next:i[e]},r=t(function(){for(var n=arguments.length,o=new Array(n),a=0;n>a;a++)o[a]=arguments[a];return s.next.apply(this,o)});return xe(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),i[e]=r,()=>{if(i[e]!==r)for(var n=i[e],o=xa(n);o;){if(o.next===r)return void(o.next=s.next);o=xa(n=o.next)}else i[e]=s.next}}catch(n){return Ea}}var Vc=ie("[TracingHeaders]"),mt=ie("[Web Vitals]"),Sa=9e5,ka=["CLS","FCP","INP","LCP"],zc=["INP","LCP"],Wc=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],zi="disabled",Ta="lazy_loading",vi="awaiting_config",Wi="missing_config";ie("[SessionRecording]"),ie("[SessionRecording]");var Hn="[SessionRecording]",Je=ie(Hn),Gc=ie("[Heatmaps]");function br(i){return z(i)&&"clientX"in i&&"clientY"in i&&ue(i.clientX)&&ue(i.clientY)}var Gi=ie("[Product Tours]"),wr=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(so))},Yc=["$set_once","$set"],We=ie("[SiteApps]"),Pa="Error while initializing PostHog app with config id ",Cu=(i,e)=>i!=null&&i.then?i.then(e):e(i),Lt="SDK is not enabled or survey functionality is not yet loaded",Ca="Disabled. Not loading surveys.",Bn=class{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Su=!1,this.xu=[],this.Cu=null,this.Tu=null,this.Os=!1,this.Mu=new Set,this.onRemoteConfig=s=>{if(!this.Os&&!this.mn.disableSurveys){if(!s.ok)return W.warn("Remote config unavailable. Not loading surveys.");var r=s.config.surveys;if(D(r))return W.warn("Flags not loaded yet. Not loading surveys.");this.Eu=Pe(r)?r:r.length>0,W.info("flags response received, isSurveysEnabled: "+this.Eu),this.loadIfEnabled()}},this.Ls=e,this.Iu=t}setup(e){if(!this.Os)return this.Ru=e,Cu(e.kv.initialize(),()=>{if(this.Ru===e&&!this.Os){this.Ru=void 0,this.Ns=e;var t=e.onRemoteConfig(this.onRemoteConfig);this.Os?t.dispose():(this.qs=t,this.loadIfEnabled())}})}dispose(){var e,t,s;this.Os||(this.Os=!0,this.Ru=void 0,this.Ns=void 0,(e=this.qs)==null||e.dispose(),this.qs=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(s=this._surveyManager)==null||s.dispose==null||s.dispose(),this._surveyManager=null,this.xu=[],this.Cu=null,this.Mu.forEach(r=>clearTimeout(r)),this.Mu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],s=0;s<localStorage.length;s++){var r=localStorage.key(s);(r!=null&&r.startsWith(xu)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach(n=>localStorage.removeItem(n))}catch(n){}}loadIfEnabled(){if(!this.Os&&this.Ns){var e=this.mn;
2if(!this._surveyManager)if(this.Su)W.info("Already initializing surveys, skipping...");else if(e.disableSurveys)W.info(Ca);else if(e.cookielessMode&&this.Ls.isOptedOut())W.info("Not loading surveys in cookieless mode without consent.");else{var t=this.Ls.getExtensions();if(t){if(!b(this.Eu)||e.advancedEnableSurveys){var s=this.Eu||e.advancedEnableSurveys;this.Su=!0;try{var r=t.generateSurveys;if(r)return this.Pu(r,s),void(this.Su=!1);var n=t.loadExternalDependency;if(!n)return this.Au(no),void(this.Su=!1);n(o=>{try{if(this.Os)return;var a=this.Ls.getExtensions();o||a==null||!a.generateSurveys?this.Au("Could not load surveys script",o):this.Pu(a.generateSurveys,s)}finally{this.Su=!1}})}catch(o){throw this.Su=!1,this.Au("Error initializing surveys",o),o}}}else W.error("PostHog Extensions not found.")}}}Pu(e,t){this.Os||(this._surveyManager=e(t),this._surveyEventReceiver=this.Ls.createEventReceiver(),W.info("Surveys loaded successfully"),this.Fu({isLoaded:!0}))}Au(e,t){W.error(e,t),this.Fu({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.xu.push(e),this._surveyManager&&this.Fu({isLoaded:!0}),()=>{this.xu=this.xu.filter(t=>t!==e)}}getSurveys(e,t){var s;t===void 0&&(t=!1);var r=(s=this.Ns)!==null&&s!==void 0?s:this.Iu;if(r&&!this.Os){if(this.mn.disableSurveys)return W.info(Ca),e([]);var n=r.kv.get(en);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Ou()&&this.getSurveys(()=>{},!0));if(this.Cu)this.Cu.then(l=>{this.Os||e(l.surveys,l.context)}).catch(l=>W.error("Error in survey callback",l));else{var o=this.Lu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then(l=>{try{return this.Du(r,l)}catch(u){return W.error("Error processing surveys response",u),this.Du(r,{statusCode:0,error:u})}},l=>this.Du(r,{statusCode:0,error:l}));this.Cu=o;var a=()=>{this.Cu===o&&(this.Cu=null)};o.then(l=>{a(),this.Os||e(l.surveys,l.context)},a).catch(l=>W.error("Error in survey callback",l))}}}Lu(e,t){var s=this.Ns;return s?s.sendRequest(e,t):new Promise(r=>r({statusCode:0,error:new Error(Lt)}))}Du(e,t){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:Lt}};var s=t.statusCode;if(s!==200||!t.json){var r="Surveys API could not be loaded, status: "+s;return s!==0?W.error(r):t.error||W.warn(r),this.Tu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Tu=null;var n,o=t.json.surveys||[],a=o.filter(l=>function(u){return!(!u.start_date||u.end_date)}(l)&&(bu(l)||function(u){var h;return!((h=u.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(l)));return a.length>0&&((n=this._surveyEventReceiver)==null||n.register(a)),e.kv.set({[en]:o,[ps]:Date.now()}),{surveys:o,context:{isLoaded:!0}}}Ou(){return this.$u()&&!this.Cu&&!this.Nu()}$u(){var e,t,s=(e=(t=this.Ns)!==null&&t!==void 0?t:this.Iu)==null?void 0:e.kv.get(ps);return ue(s)&&Date.now()-s>3e5}Nu(){return ue(this.Tu)&&3e5>Date.now()-this.Tu}markSurveyAsSeen(e,t){var s,r={id:e,current_iteration:(s=t==null?void 0:t.iteration)!==null&&s!==void 0?s:null};Su(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch(n){}}Fu(e){for(var t of this.xu)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(s){W.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);W.warn("init was not called")}qu(e){var t=null;return this.getSurveys(s=>{var r;t=(r=s.find(n=>n.id===e))!==null&&r!==void 0?r:null}),t}ju(e){if(D(this._surveyManager))return{eligible:!1,reason:Lt};var t=typeof e=="string"?this.qu(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Bu(e){if(D(this._surveyManager))return{eligible:!1,reason:Lt};var t=typeof e=="string"?this.qu(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(D(this._surveyManager))return W.warn("init was not called"),{visible:!1,disabledReason:Lt};var t=this.Bu(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return D(this._surveyManager)?(W.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Lt})):new Promise(s=>
2{this.getSurveys(r=>{var n,o=(n=r.find(l=>l.id===e))!==null&&n!==void 0?n:null;if(o){var a=this.Bu(o);s({visible:a.eligible,disabledReason:a.reason})}else s({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,s){var r;if(D(this._surveyManager))W.warn("init was not called");else{var n=typeof e=="string"?this.qu(e):e;if(n!=null&&n.id)if(Rc.includes(n.type)){var o=S==null?void 0:S.querySelector(t);if(o)if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds){W.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout(()=>{var l,u;this.Mu.delete(a),this.Os||(W.info("Rendering survey "+n.id+" with delay of "+((l=n.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(n,o,s),W.info("Survey "+n.id+" rendered"))},1e3*n.appearance.surveyPopupDelaySeconds);this.Mu.add(a)}else this._surveyManager.renderSurvey(n,o,s);else W.warn("Survey element not found")}else W.warn("Surveys of type "+n.type+" cannot be rendered in the app");else W.warn("Survey not found")}}displaySurvey(e,t){var s;if(D(this._surveyManager))W.warn("init was not called");else{var r=this.qu(e);if(r){var n=r;if((s=r.appearance)!=null&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=E({},r,{appearance:E({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==yn.Popover&&t.initialResponses&&W.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.ju(r);if(!o.eligible)return void W.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==yn.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else W.warn("Survey not found")}}cancelPendingSurvey(e){D(this._surveyManager)?W.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}};function $t(i,e,t){if(D(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch(r){return!1}default:return!1}}var qn=class{constructor(e){this.Hu=new Set,this.zu=new Set,this.Uu=new ei,this.Wu=(t,s)=>this.Vu(t,s)&&this.Gu(t,s)&&this.Zu(t,s)&&this.Qu(t,s),this.Vu=(t,s)=>s==null||!s.event||(t==null?void 0:t.event)===(s==null?void 0:s.event),this._instance=e}init(){var e,t;b((e=this._instance)==null?void 0:e._addCaptureHook)||(this.Ju=(t=this._instance)==null?void 0:t._addCaptureHook((s,r)=>{this.on(s,r)}))}dispose(){var e;(e=this.Ju)==null||e.call(this),this.Ju=void 0,this.Uu=new ei}register(e){var t,s;if(!b((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach(n=>{var o;this.Hu.add(n),(o=n.steps)==null||o.forEach(a=>{this.zu.add((a==null?void 0:a.event)||"")})}),(s=this._instance)!=null&&s.autocapture)){var r=new Set;this.Hu.forEach(n=>{var o;(o=n.steps)==null||o.forEach(a=>{a!=null&&a.selector&&r.add(a.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(e){this.Hu.clear(),this.zu.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.zu.has(e)||this.zu.has(t.event))&&this.Hu.forEach(s=>{this.Ku(t,s)&&this.Uu.emit("actionCaptured",s.name)})}Yu(e){this.onAction("actionCaptured",t=>e(t))}Ku(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var s of t.steps)if(this.Wu(e,s))return!0;return!1}onAction(e,t){return this.Uu.on(e,t)}Gu(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!$t(r,t.url,t.url_matching||"contains"))return!1}return!0}Zu(e,t){return!!this.Xu(e,t)&&!!this.th(e,t)&&!!this.eh(e,t)}Xu(e,t){var s;if(t==null||!t.href)return!0;var r=this.ih(e);if(r.length>0)return r.some(a=>$t(a.href,t.href,t.href_matching||"exact"));var n,o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!o&&$t((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}th(e,t){var s;if(t==null||!t.text)return!0;var r=this.ih(e);if(r.length>0)return r.some(u=>$t(u.text,t.text,t.text_matching||"exact")||$t(u.$el_text,t.text,t.text_matching||"exact"));var n,o,a,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=function(u){for(var h,c=[],d=/(?::|")text="(.*?)"/g;!D(h=d.exec(u));)c.includes(h[1])||c.push(h[1]);return c}(l),o=t.text,a=t.text_matching||"exact",n.some(u=>$t(u,o,a)))}eh(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch(a){return!1}return!1}ih(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}Qu(e,t){return t==null||!t.properties||t.properties.length===0||Eu(t.properties.reduce((s,r)=>{var n=L(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s},{}),e==null?void 0:e.properties)}},jn=class{constructor(e){var t;this.rh=[],this._instance=e,this.nh=new Map,this.sh=new Map,this.ah=new Map,this.oh=(t=this._instance)==null||t.onSessionId==null?void 0:t.onSessionId(s=>this.lh(s))}uh(e){return!1}hh(){return null}dh(e){}fh(){}ph(e,t){return!!e&&Eu(e.propertyFilters,t==null?void 0:t.properties)}gh(e,t){var s=new Map;return e.forEach(r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEac
2h(o=>{if(o!=null&&o.name){var a=s.get(o.name)||[];a.push(r.id),s.set(o.name,a)}})}),s}mh(e,t,s){var r=(s===ui.Activation?this.nh:this.sh).get(e),n=[];return this.yh(o=>{n=o.filter(a=>r==null?void 0:r.includes(a.id))}),n.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[s])==null||(a=a.values)==null?void 0:a.find(u=>u.name===e);return this.ph(l,t)})}register(e){this.bh(e,!1)}replace(e){this.bh(e,!0)}bh(e,t){var s;b((s=this._instance)==null?void 0:s._addCaptureHook)||(this._h(e,t),this.wh(e,t))}wh(e,t){var s=e.filter(o=>{var a;return(a=o.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length});if(t&&this.ah.clear(),s.length!==0){this.kh||(this.kh=new qn(this._instance),this.kh.init(),this.kh.Yu(o=>this.onAction(o)));var r=[];s.forEach(o=>{var a;(a=o.conditions)==null||(a=a.actions)==null||a.values.forEach(l=>{if(r.push(l),l.name){var u,h=(u=this.ah.get(l.name))!==null&&u!==void 0?u:[];h.includes(o.id)||h.push(o.id),this.ah.set(l.name,h)}})}),t?this.kh.replace(r):this.kh.register(r)}else{var n;t&&((n=this.kh)==null||n.replace([]))}}Sh(e,t){t.forEach((s,r)=>{var n,o=(n=e.get(r))!==null&&n!==void 0?n:[];s.forEach(a=>{o.includes(a)||o.push(a)}),e.set(r,o)})}_h(e,t){var s,r,n=e.filter(u=>{var h,c;return((h=u.conditions)==null?void 0:h.events)&&((c=u.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0}),o=e.filter(u=>{var h,c;return((h=u.conditions)==null?void 0:h.cancelEvents)&&((c=u.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}),a=this.gh(e,ui.Activation),l=this.gh(e,ui.Cancellation);t?(this.nh=a,this.sh=l):(this.Sh(this.nh,a),this.Sh(this.sh,l)),(n.length!==0||o.length!==0)&&((s=this.Ju)!==null&&s!==void 0||(this.Ju=(r=this._instance)==null?void 0:r._addCaptureHook((u,h)=>{this.onEvent(u,h)})))}onEvent(e,t){var s,r,n=this.xh(),o=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.Ch(e,o);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.Th([o]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.Mh(o),void this.Eh([o])}if(this.sh.has(e)){var l=this.mh(e,t,ui.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map(h=>h.id)}),this.Th(l.map(h=>h.id)),l.forEach(h=>this.Ih(h.id)))}if(this.nh.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.nh.get(e)});var u=this.mh(e,t,ui.Activation);this.Rh(u.map(h=>h.id))}}onAction(e){this.ah.has(e)&&this.Rh(this.ah.get(e)||[])}Rh(e){var t;if(e.length!==0){var s=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),r=[];for(var n of e)s&&this.uh(n)?this.Mh(n)&&this.Ph(n):r.push(n);r.length>0&&(this.rh=[...new Set([...this.rh,...r])]),this.xh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Mh(e){this.rh=this.rh.filter(s=>s!==e);var t=this.Ah();return!t.includes(e)&&(this.Fh([...t,e]),this.Oh(),!0)}Th(e){var t=new Set(e);this.rh=this.rh.filter(n=>!t.has(n));var s=this.Lh(),r=s.filter(n=>!t.has(n));r.length!==s.length&&(this.Fh(r),r.length===0&&this.Dh()),this.Eh(e)}$h(){var e,t=this.hh();if(!t)return{};var s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return s&&typeof s=="object"?s:{}}Ph(e){if(this.hh()){var t=this.$h();this.dh(E({},t,{[e]:Date.now()}))}}Eh(e){if(this.hh()){var t=this.$h(),s={},r=!1;for(var n of Object.entries(t)){var o=n[0],a=n[1];e.includes(o)?r=!0:s[o]=a}r&&(De(s)?this.fh():this.dh(s))}}Nh(){this.hh()&&this.fh()}getActivationTimestamp(e){if(this.Ah().includes(e)){var t=this.$h()[e];return ue(t)?t:void 0}}Lh(){var e,t=this.qh();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Ah(){var e,t,s=this.Lh();if(s.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.jh()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?s:[]}Oh(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.Bh(t)}Dh(){this.Hh()}lh(e){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.jh()];if(s&&s!==e){var r=this.Lh(),n=this.$h();r.length>0&&(this.Fh([]),r.filter(o=>
2ue(n[o])).forEach(o=>this.Ih(o))),this.Dh(),this.Nh()}}getActivatedIds(){return[...new Set([...this.Ah(),...this.rh])].filter(e=>!this.zh(e))}dispose(){var e,t,s;(e=this.oh)==null||e.call(this),this.oh=void 0,(t=this.Ju)==null||t.call(this),this.Ju=void 0,(s=this.kh)==null||s.dispose(),this.kh=void 0}reset(){this.rh=[],this.Lh().length>0&&this.Fh([]),this.Dh(),this.Nh()}getEventToItemsMap(){return this.nh}Uh(){return this.kh}},Un=class extends jn{constructor(e){super(e)}qh(){return tn}jh(){return Ki}hh(){return Zi}dh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Zi]:e})}fh(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Zi)}uh(e){var t,s;this.yh(n=>{s=n.find(o=>o.id===e)});var r=(t=s)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return ue(r)&&r>0}Wh(){return st.SHOWN}yh(e){var t;(t=this._instance)==null||t.getSurveys(e)}Ih(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}xh(){return W}Fh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[tn]:e})}Bh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ki]:e})}Hh(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Ki)}zh(){return!1}Ch(e,t){var s;this.yh(n=>{s=n.find(o=>o.id===t)});var r=!s||function(n){var o;return bu(n)&&!((o=n.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||n.schedule==="always"}(s);return r?e===st.SHOWN?"consume":"ignore":e===st.SHOWN?"persist":e===st.DISMISSED||e===st.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Vn=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);var t={};for(var s of e){var r=this._instance.get_property(s);b(r)||(t[s]=r)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},zn=class{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=F==null?void 0:F.__PosthogExtensions__;if(e){var t=e.generateSurveys,s=e.loadExternalDependency;return{generateSurveys:t?r=>t(this._instance,r):void 0,loadExternalDependency:s?r=>s(this._instance,"surveys",r):void 0}}}createEventReceiver(){return new Un(this._instance)}},Kc=m!=null&&m.location?ws(m.location.hash,"__posthog")||ws(location.hash,"state"):null,Aa="_postHogToolbarParams",Ia=ie("[Toolbar]"),Oa=ie("[FeatureFlags]"),Wn=class{constructor(e,t){t===void 0&&(t=!1),this.Vh=!1,this.update(e,t)}update(e,t){this.Gh=((s,r)=>{var n,o,a,l,u;return{bootstrap:{featureFlags:(n=s.bootstrap)==null?void 0:n.featureFlags,featureFlagPayloads:(o=s.bootstrap)==null?void 0:o.featureFlagPayloads},remoteRequestsDisabled:r,featureFlagsDisabled:!!s.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!s.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!s.advanced_feature_flags_dedup_per_session,cacheTtlMs:s.feature_flag_cache_ttl_ms,refreshIntervalMs:(a=s.remote_config_refresh_interval_ms)!==null&&a!==void 0?a:3e5,requestTimeoutMs:s.feature_flag_request_timeout_ms,compression:s.disable_compression?void 0:"best-available",evaluationContexts:(l=(u=s.evaluation_contexts)!==null&&u!==void 0?u:s.evaluation_environments)!==null&&l!==void 0?l:[],flagKeys:L(s.flag_keys)?s.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vh||(Oa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Vh=!0),b(e.flag_keys)||L(e.flag_keys)||Oa.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Gh}},Fa=ie("[FeatureFlags]"),yt=ie("[FeatureFlags]",{debugEnabled:!0}
2),Er=`" failed. Feature flags didn't load in time.`,La="connection_error",$a=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},Ra=i=>{var e={};for(var t of Qi(i||{})){var s=t[1];s&&(e[t[0]]=s)}return e},je=ie("[Error tracking]"),Gn="webkit-masked-url:",Zc=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Gn],Qc=["__firefox__","__gCrWeb"],Ma="Refusing to render web experiment since the viewer is a likely bot",Jc={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>Cs(e,i),not_regex:(i,e)=>!Cs(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i},be=class{get mn(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments(r=>{be.Zh("retrieved web experiments from the server"),t.Qh=new Map,r.forEach(n=>{if(n.feature_flag_key){var o;t.Qh&&(be.Zh("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Qh)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);j(a)&&n.variants[a]&&t.Jh(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];be.Kh(u,t._instance)&&t.Jh(n.name,l,u.transforms)}})},s)},this._instance=e,this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}initialize(){}onFeatureFlags(e){if(this._is_bot())be.Zh(Ma);else if(!this.mn.disable_web_experiments){if(D(this.Qh))return this.Qh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();be.Zh("applying feature flags",e),e.forEach(t=>{var s;if(this.Qh&&(s=this.Qh)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),o=(r=this.Qh)==null?void 0:r.get(t);n&&o!=null&&o.variants[n]&&this.Jh(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){var e=be.getWindowLocation();if(e!=null&&e.search){var t=Qt(e==null?void 0:e.search,"__experiment_id"),s=Qt(e==null?void 0:e.search,"__experiment_variant");t&&s&&(be.Zh("previewing web experiments "+t+" && "+s),this.getWebExperiments(r=>{this.Yh(parseInt(t),s,r)},!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.mn.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.mn.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Yh(e,t,s){var r=s.filter(n=>n.id===e);r&&r.length>0&&(be.Zh("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Jh(r[0].name,t,r[0].variants[t].transforms))}static Kh(e,t){return!D(e.conditions)&&be.Xh(e,t)&&be.td(e)}static Xh(e,t){var s;if(D(e.conditions)||D((s=e.conditions)==null?void 0:s.url))return!0;var r=be.getWindowLocation();if(r){var n,o,a,l=Hl(t,r.href);return(n=e.conditions)==null||!n.url||Jc[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,l)}return!1}
2static getWindowLocation(){return m==null?void 0:m.location}static td(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.utm))return!0;var s=tu();if(s.utm_source){var r,n,o,a,l,u,h,c,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,g=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==s.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,v=(h=e.conditions)==null||(h=h.utm)==null||!h.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==s.utm_term;return d&&p&&v&&g}return!1}static Zh(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];k.info("[WebExperiments] "+e,s)}Jh(e,t,s){this._is_bot()?be.Zh(Ma):t!=="control"?s.forEach(r=>{if(r.selector){var n;be.Zh("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(n=document)==null?void 0:n.querySelectorAll(r.selector);o==null||o.forEach(a=>{var l=a;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):be.Zh("Control variants leave the page unmodified.")}_is_bot(){return ge&&this._instance?mu(ge,this.mn.custom_blocked_useragents):void 0}},Ne=ie("[Conversations]"),bt="Conversations not available yet.";function Na(i,e){var t,s,r,n,o,a,l,u=(t=i==null?void 0:i.flushIntervalMs)!==null&&t!==void 0?t:3e3,h=(s=i==null?void 0:i.maxBufferSize)!==null&&s!==void 0?s:100,c=e!=null&&e.consoleCapture?void 0:(r=i==null?void 0:i.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,d=b(c)?Math.max(h,2048):Math.max(h,c),g=E({},function(){var p="",v="";try{var f=ge==null?void 0:ge.userAgent;if(f){var _=gl(f);p=_[0],v=_[1]}}catch(y){}return function(y,w){var T=function(x){if(x)return{}.hasOwnProperty.call(qo,x)?qo[x]:x}(y);return E({},T?{"os.name":T}:{},w?{"os.version":w}:{})}(p,v)}(),i==null?void 0:i.resourceAttributes);return{serviceName:(n=(o=g==null?void 0:g["service.name"])!==null&&o!==void 0?o:i==null?void 0:i.serviceName)!==null&&n!==void 0?n:e==null?void 0:e.serviceNameDefault,serviceVersion:(a=g==null?void 0:g["service.version"])!==null&&a!==void 0?a:i==null?void 0:i.serviceVersion,environment:(l=g==null?void 0:g["deployment.environment"])!==null&&l!==void 0?l:i==null?void 0:i.environment,resourceAttributes:g,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Xc=["debug","log","warn","error","info"],Da="console",Au="__posthogHandledLogsRequestError",xr=(i,e)=>{var t=i instanceof Error?i:new Error(e);return t[Au]=!0,t},Ha=i=>!!i&&typeof i=="object"&&i[Au]===!0,$s={featureFlags:class{constructor(i){this.name="featureFlags",this.ed=!1,this.featureFlagEventHandlers=[],this.A=Fa,this.rd={},this.nd={},this.sd=[],this.ad=!1,this.od=!1,this.ld=0,this.ud=!1,this.hd=!1,this.dd=!1,this.vd=!1,this.fd=0,this.Wt=()=>{var e=this.pd();this.fd=0,e&&this.reloadFeatureFlags()},this.gd=()=>{var e,t=this.md;b(t)||this.mn.remoteRequestsDisabled||!S||S.visibilityState==="hidden"||Date.now()-((e=this.yd)!==null&&e!==void 0?e:0)<t||(this.reloadFeatureFlags(),this.bd())},this.Vt=()=>{(S==null?void 0:S.visibilityState)==="visible"&&this.gd()},"get"in i?this.Ls=i:(this._instance=i,this._d=new Wn(i.config,i.do()),this.Ls=this._d)}updateConfig(i,e){var t;(t=this._d)==null||t.update(i,e),this.Ns&&this.wd()}setup(i){return this.Ru=i,this.A=i.logger.createLogger("[FeatureFlags]"),Cu(i.kv.initialize(),()=>{this.Ru===i&&(this.Ru=void 0,this.Ns=i,this.kd(i))})}kd(i){var e;if(this.Ns===i)return m&&Z(m,"online",this.Wt),this.wd(),this.Sd=i.registerDynamicEventProperties(()=>this.xd()?this.rd:this.nd),this.Cd=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Md()}),this.Td(),this.initialize()}wd(){var i=this.mn.refreshIntervalMs,e=!this.mn.remoteRequestsDisabled&&S&&!b(i)&&i>0?i:void 0;e!==this.md&&(this.Ed(),b(e)||(this.md=e,this.bd(),S!=null&&S.addEventListener&&Z(S,Yt,this.Vt)))}bd(){b(this.md)||(b(this.Id)||clearInterval(this.Id),this.yd=Date.now(),this.Id=setInterval(this.gd,this.md))}Ed(){b(this.Id)||(clearInterval(this.Id),this.Id=void 0,S==null||S.removeEventListener==null||S.removeEventListener(Yt,this.Vt)),this.md=void 0,this.yd=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var i,e;this.Ed(),this.ld++,this.hd=!1,this.Ru=void 0,this.Ns&&(this.Pd(),(i=this.Sd)==null||i.dispose(),this.Sd=void 0,(e=this.Cd)==null||e.call(this),this.Cd=void 0,this.sd=[],m==null||m.removeEventListener("online",this.Wt),this.Ns=void 0)}get mn(){return this.Ls.get()}Ad(i){var e;return(e=this.Ns)==null?void 0:e.kv.get(i)}ni(i){this.Fd(()=>{var e;return(e=this.Ns)==null?void 0:e.kv.set(i)})}Od(i,e,t){var s;if((s=this._instance)!=null&&s.persistence&&i[ke]){var r=this.Ad(ke)||{},n=i[ke]||{},o=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(_=>{var y=_[1];return!(y!=null&&y.failed)}).map(_=>_[0]):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,u=l?a:t&&!L(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),h=this.Ad(Ue)||{},c=i[Ue]||{},d=l||t?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),g=!l&&!t,p=!!g||u,v={[He]:p,[ke]:p,[Ue]:!!g||d};for(var f of(i[ht]&&(v[ht]=p),[ct,nt,Ut]))b(i[f])||(v[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}}oi(i){this.Fd(()=>{var e;return(e=this.Ns)==null?void 0:e.kv.remove(i)})}Fd(i){try{i()}catch(e){this.A.error("Failed to update feature flag persistence",e)}}Td(){var i={};for(var e of[He,Ue,ct,Ge]){var t=this.Ad(e);b(t)||(i[e]=t)}this.rd=i;var s=E({},i),r=this.Ad(ke);if(r)for(var n of Object.entries(r))s["$feature/"+n[0]]=n[1];this.nd=s}xd(){var i=this.mn.cacheTtlMs;
2if(!i||0>=i)return!1;var e=this.Ad(nt);return typeof e!="number"||Date.now()-e>i}Ld(){return!!this.xd()&&(this.vd||this.od||(this.vd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Dd(){var i=this.mn.evaluationContexts;return i!=null&&i.length?i.filter(e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.A.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}$d(){var i=this.mn.flagKeys;if(!b(i))return i.filter(e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.A.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var i,e,t=this.mn,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,o=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(s).filter(u=>!!s[u]).reduce((u,h)=>(u[h]=s[h]||!1,u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,h)=>(u[h]=o[h],u),{});return this.Nd({featureFlags:a,featureFlagPayloads:l})}}updateFlags(i,e,t){var s,r,n=t!=null&&t.merge&&(s=this.Ad(ke))!==null&&s!==void 0?s:{},o=t!=null&&t.merge&&(r=this.Ad(Ue))!==null&&r!==void 0?r:{},a=E({},n,i),l=E({},o,e),u={};for(var h of Object.entries(a)){var c=h[0],d=h[1];u[c]={key:c,enabled:Io(d),variant:Oo(d),reason:void 0,metadata:b(l==null?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.Nd({flags:u})}get hasLoadedFlags(){return this.ad}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.Ad(ht),e=this.Ad(Ge),t=this.Ad(Et);if(!t&&!e)return i||{};var s=J({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var o,a,l=s[n],u=e==null?void 0:e[n],h=b(u)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!u,c=b(u)?l==null?void 0:l.variant:typeof u=="string"?u:void 0,d=t==null?void 0:t[n],g=E({},l,{enabled:h,variant:h?c!=null?c:l==null?void 0:l.variant:void 0});h!==(l==null?void 0:l.enabled)&&(g.original_enabled=l==null?void 0:l.enabled),c!==(l==null?void 0:l.variant)&&(g.original_variant=l==null?void 0:l.variant),d&&(g.metadata=E({},l==null?void 0:l.metadata,{payload:d,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),s[n]=g}return this.ed||(this.A.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.ed=!0),s}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map(t=>{var s=i[t];return{key:t,enabled:Io(s),variant:Oo(s),payload:Ao(e[t])}})}getFlagVariants(){var i=this.Ad(ke),e=this.Ad(Ge);if(!e)return i||{};for(var t=J({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.ed||(this.A.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.ed=!0),t}getFlagPayloads(){var i=this.Ad(Ue),e=this.Ad(Et);if(!e)return i||{};for(var t=J({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.ed||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.ed=!0),t}reloadFeatureFlags(){this.ud||this.mn.featureFlagsDisabled||this.pd()||this.qd||(this.sd.slice().forEach(i=>{try{i()}catch(e){this.A.error("Error while running feature flags reloading callback",e)}}),this.qd=setTimeout(()=>{this.jd()},5))}Pd(){clearTimeout(this.qd),this.qd=void 0}onReloading(i){return this.sd.push(i),()=>{this.sd=this.sd.filter(e=>e!==i)}}ensureFlagsLoaded(){this.ad||this.od||this.qd||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.ud=i}resetFlagCallReported(){this.oi(tt)}jd(i){this.Pd();var e=this.Ns;if(e&&!this.mn.remoteRequestsDisabled&&!this.pd())if(this.od)this.hd=!0;else{var t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},e.initialPersonProperties,this.Ad(Fe)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Ad(Ke),timezone:au()};b(e.deviceId)||(t.$device_id=e.deviceId),(i!=null&&i.disableFlags||this.mn.featureFlagsDisabled)&&(t.disable_flags=!0);var s=this.Dd();s.length&&(t.evaluation_contexts=s);var r=this.$d();b(r)||(t.flag_keys=r);var n=this.mn.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.ld;this.od=!0;var l=()=>{this.hd&&(this.hd=!1,this.jd())},u=h=>{this.od=!1,a===this.ld&&(this.ni({[Vt]:[La]}),this.A.error("Feature flag request failed",h)),l()};try{e.sendRequest(o,{target:"flags",method:"POST",body:t,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then(h=>{var c,d,g=(c=h.json)!==null&&c!==void 0?c:{},p=h.statusCode!==200;if(this.od=!1,a===this.ld){if(this.Bd(h.statusCode),p||this.hd||(this.$anon_distinct_id=void 0),!t.disable_flags||this.hd){this.dd=!p;var v=[];h.error?v.push(h.error instanceof Error&&h.error.name==="AbortError"?"timeout":h.error instanceof Error?La:"unknown_error"):h.statusCode!==200&&v.push("api_error_"+h.statusCode),g.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");var f=!((d=g.quotaLimited)==null||!d.includes("feature_flags"));f&&v.push("quota_limited"),this.ni({[Vt]:v}),f?this.A.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."):t.disable_flags||this.Nd(g,p,{partialResponse:n}),l()}}else l()}).catch(u)}catch(h){u(h)}}}pd(){return Xl(this.fd,3)}Bd(i){this.fd=eu(i,this.fd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.dd)if(this.ad||this.getFlags()&&this.getFlags().length>0){if(!this.Ld()){var s=this.getFeatureFlagResult(i,e);return(t=s==null?void 0:s.variant)!==null&&t!==void 0?t:s==null?void 0:s.enabled}}else this.A.warn('getFeatureFlag for key "'+i+Er)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.dd)if(this.ad||this.getFlags()&&this.getFlags().length>0){if(!this.Ld()){var t,s=this.getFlagVariants(),r=i in s,n=s[i],o=this.getFlagPayloads()[i],a=String(n),l=this.Ad(ct)||void 0,u=this.Ad(nt)||void 0,h=this.Ad(tt)||{};if(this.mn.deduplicateCallsPerSession){var c,d=(c=this.Ns)==null?void 0:c.session.sessionId,g=this.Ad(mi);d&&d!==g&&(h={},t=d)}if(e.send_event||!("send_event"in e))if(i in h&&h[i].includes(a))t&&this.ni({[tt]:h,[mi]:t});else{var p,v,f,_,y,w,T,x,M,N,P,O;L(h[i])?h[i].push(a):h[i]=[a],this.ni(E({[tt]:h},t?{[mi]:t}:{}));var A=this.getFeatureFlagDetails(i),$=[...(p=this.Ad(Vt))!==null&&p!==void 0?p:[]];b(n)&&$.push("flag_missing");var I={$feature_flag:i,$feature_flag_response:n,$feature_flag_payload:o!=null?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:(v=(f=this.mn.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[i])!==null&&v!==void 0?v:null,$feature_flag_bootstrapped_payload:(_=(y=this.mn.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[i])!==null&&_!==void 0?_:null,$used_bootstrap_value:!this.dd};b(A==null||(w=A.metadata)==null?void 0:w.has_experiment)||(I.$feature_flag_has_experiment=A.metadata.has_experiment),b(A==null||(T=A.metadata)==null?void 0:T.version)||(I.$feature_flag_version=A.metadata.version);var C,U=(x=A==null||(M=A.reason)==null?void 0:M.description)!==null&&x!==void 0?x:A==null||(N=A.reason)==null?void 0:N.co
2de;U&&(I.$feature_flag_reason=U),A!=null&&(P=A.metadata)!=null&&P.id&&(I.$feature_flag_id=A.metadata.id),b(A==null?void 0:A.original_variant)&&b(A==null?void 0:A.original_enabled)||(I.$feature_flag_original_response=b(A.original_variant)?A.original_enabled:A.original_variant),A!=null&&(O=A.metadata)!=null&&O.original_payload&&(I.$feature_flag_original_payload=A==null||(C=A.metadata)==null?void 0:C.original_payload),$.length&&(I.$feature_flag_error=$.join(",")),this.Hd(I)}else t&&this.ni({[tt]:h,[mi]:t});if(r)return{key:i,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:Ao(o)}}}else this.A.warn('getFeatureFlagResult for key "'+i+Er)}Hd(i){try{var e;(e=this.Ns)==null||e.capture("$feature_flag_called",i).catch(t=>{this.A.error("Failed to capture feature flag call",t)})}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(i,e){this.zd(i,e)}zd(i,e){var t=this;return X(function*(){var s=t.Ns;if(s){var r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=t.Dd();n.length&&(r.evaluation_contexts=n);var o,a=t.$d();b(a)||(r.flag_keys=a);try{var l,u=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:t.mn.compression,sentAt:"body",timeoutMs:t.mn.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;o=(u==null?void 0:u[i])||void 0}catch(h){return void t.A.error("Remote config feature flag request failed",h)}try{e(o)}catch(h){t.A.error("Remote config feature flag callback failed",h)}}})()}isFeatureEnabled(i,e){if(e===void 0&&(e={}),e.fresh&&!this.dd)return e.defaultValue;if(!(this.ad||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+i+Er),e.defaultValue;var t=this.getFeatureFlag(i,e);return b(t)?e.defaultValue:!!t}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==i)}receivedFeatureFlags(i,e,t){this.Nd(i,e,t)}Nd(i,e,t){if(this.Ns){this.ad=!0;var s=function(r,n,o,a,l,u){n===void 0&&(n={}),o===void 0&&(o={}),a===void 0&&(a={}),u===void 0&&(u=Fa);var h=((O,A)=>{var $=O.flags;return $?E({},O,{featureFlags:Object.fromEntries(Object.keys($).map(I=>{var C;return[I,(C=$[I].variant)!==null&&C!==void 0?C:$[I].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys($).filter(I=>$[I].enabled).filter(I=>{var C;return!b((C=$[I].metadata)==null?void 0:C.payload)}).map(I=>{var C;return[I,(C=$[I].metadata)==null?void 0:C.payload]}))}):(O.featureFlags&&A.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),O)})(r,u),c=h.flags,d=h.featureFlags,g=h.featureFlagPayloads;if(d){var p=r.requestId,v=r.evaluatedAt;if(L(d)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f={};if(d)for(var _=0;d.length>_;_++)f[d[_]]=!0;return{[He]:d,[ke]:f,[Ut]:!1}}var y=d,w=g,T=c;if(l!=null&&l.partialResponse){var x=Object.keys(y),M=w||{};y=E({},n,y),w=E({},o,M),x.forEach(O=>{var A;O in M||(A=w)==null||delete A[O]}),T=E({},a,T)}else if(r.errorsWhileComputingFlags)if(c){var N=new Set(Object.keys(c).filter(O=>{var A;return!((A=c[O])!=null&&A.failed)}));y=E({},n,Object.fromEntries(Object.entries(y).filter(O=>N.has(O[0]))));var P=Object.fromEntries(Object.entries(w||{}).filter(O=>N.has(O[0])));w=E({}
2,o,P),N.forEach(O=>{var A;O in P||(A=w)==null||delete A[O]}),T=E({},a,Object.fromEntries(Object.entries(T||{}).filter(O=>N.has(O[0]))))}else y=E({},n,y),w=E({},o,w),T=E({},a,T);return E({[He]:Object.keys(Ra(y)),[ke]:y||{},[Ue]:w||{},[ht]:T||{},[Ut]:r.minimalFlagCalledEvents===!0},p?{[ct]:p}:{},v?{[nt]:v}:{})}}(i,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),t,this.A);s&&(this.Od(s,i,!(t==null||!t.partialResponse)),this.ni(s)),e||(this.vd=!1),this.Md(e)}}override(i,e){e===void 0&&(e=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){this.Ud(i)}Ud(i){if(this.Ns){if(i===!1)return this.oi([Ge,Et]),this.Md(),void yt.info("All overrides cleared");if(L(i))return this.ni({[Ge]:$a(i)}),this.Md(),void yt.info("Flag overrides set",{flags:i});if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var e,t=i;this.ed=!!((e=t.suppressWarning)!==null&&e!==void 0&&e);var s={},r=t.flags,n=t.payloads;return r&&(s[Ge]=L(r)?$a(r):r),n&&(s[Et]=n),Object.keys(s).length&&this.ni(s),r===!1&&n===!1?this.oi([Ge,Et]):r===!1?this.oi(Ge):n===!1&&this.oi(Et),this.Md(),r===!1?yt.info("Flag overrides cleared"):r&&yt.info("Flag overrides set",{flags:r}),void(n===!1?yt.info("Payload overrides cleared"):n&&yt.info("Payload overrides set",{payloads:n}))}if(i&&typeof i=="object")return this.ni({[Ge]:i}),this.Md(),void yt.info("Flag overrides set",{flags:i});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}
2onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.ad){var e=this.Wd(),t=e.flags,s=e.flagVariants;try{i(t,s)}catch(r){this.A.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.Ad(Yi)||[]).find(u=>u.flagKey===i),n={["$feature_enrollment/"+i]:e},o={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(o.$early_access_feature_name=r.name),t&&(o.$feature_enrollment_stage=t);var a=E({},this.getFlagVariants(),{[i]:e});(s=this._instance)==null||(s=s.persistence)==null||s.markCrossTabFeatureFlagChanges({[He]:[i],[ke]:[i],[Fe]:Object.keys(n)}),this.ni({[He]:Object.keys(Ra(a)),[ke]:a,[Fe]:E({},this.Ad(Fe)||{},n)}),this.Md();try{var l;(l=this.Ns)==null||l.capture("$feature_enrollment_update",o).catch(u=>{this.A.error("Failed to capture early access feature enrollment",u)})}catch(u){this.A.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.Ad(Yi);!s||e?this.Vd(i,t):i(s)}Vd(i,e){var t=this;return X(function*(){var s=t.Ns;if(s){var r,n=e?"&"+e.map(a=>"stage="+a).join("&"):"";try{var o=yield s.sendRequest("/api/early_access_features/?token="+s.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;t.ni({[Yi]:r=o.json.earlyAccessFeatures})}catch(a){return void t.A.error("Early access feature request failed",a)}try{i(r)}catch(a){t.A.error("Early access feature callback failed",a)}}})()}Wd(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,s)=>(t[s]=e[s],t),{})}}Md(i){this.Td();var e=this.Wd(),t=e.flags,s=e.flagVariants;this.featureFlagEventHandlers.forEach(r=>{try{r(t,s,{errorsLoading:i})}catch(n){this.A.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0),this.Gd(i,e)}Gd(i,e){e===void 0&&(e=!0);var t=this.Ad(Fe)||{},s=(i==null?void 0:i.$set)||(i!=null&&i.$set_once?{}:i),r=i==null?void 0:i.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in t||(n[o]=r[o]));this.ni({[Fe]:E({},t,n,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=E({},this.Ad(Fe)||{});i.forEach(s=>{delete t[s]}),this.ni({[Fe]:t}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this.oi(Fe),i&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Ad(Ke)||{},s=E({},t);for(var r of Object.keys(i))s[r]=E({},t[r],i[r]);this.ni({[Ke]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.Ad(Ke)||{};this.ni({[Ke]:E({},e,{[i]:{}})})}else this.oi(Ke)}reset(){this.ld++,this.hd=!1,this.rd={},this.nd={},this.ad=!1,this.ud=!1,this.dd=!1,this.$anon_distinct_id=void 0,this.Pd(),this.ed=!1,this.fd=0}}},ed={sessionRecording:class{get mn(){return this._instance.config}get No(){return this._instance.persistence}get started(){var i;return!((i=this.Zd)==null||!i.isStarted)}get status(){var i,e;return this.Qd===vi||this.Qd===Wi?this.Qd:(i=(e=this.Zd)==null?void 0:e.status)!==null&&i!==void 0?i:this.Qd}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Qd=zi,this.Jd=void 0,this.Kd=!1,this.jt=(()=>{var e;if(S==null||!S.visibilityState||S.visibilityState==="visible")return!0;var t=m==null||(e=m.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(t!=null&&t.length)||t.some(s=>s.name==="visible")})(),this.Vt=()=>{var e;(S==null?void 0:S.visibilityState)==="visible"&&(this.jt=!0,(e=this.Zd)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw Je.error("started without valid sessionManager"),new Error(Hn+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===it)throw new Error(Hn+' cannot be used with cookieless_mode="always"');S!=null&&S.addEventListener&&Z(S,"visibilitychange",this.Vt)}initialize(){this.startIfEnabledOrStop()}dispose(i){var e=(i===void 0?{}:i).discardBufferedEvents,t=e!==void 0&&e;this.Kd=!0,S==null||S.removeEventListener==null||S.removeEventListener("visibilitychange",this.Vt),t?this.Yd(!0):this.stopRecording()}get Xd(){var i,e=!((i=this._instance.get_property(St))==null||!i.enabled),t=!this.mn.disable_session_recording,s=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return m&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!(this.Kd||this.Xd&&(e=this.Zd)!=null&&e.isStarted)){var t=!b(Object.assign)&&!b(Array.from);this.Xd&&t?(this.tv(i),Je.info("starting")):(this.Qd=zi,this.stopRecording())}}tv(i){var e,t;if(this.Xd)if(this.Qd!==vi&&this.Qd!==Wi&&(this.Qd=Ta),F!=null&&(e=F.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=F.__PosthogExtensions__)!=null&&t.initSessionRecording)this.ev(i);else{var s,r=this._instance.sessionManager;(s=F.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.iv,n=>{if(!this.Kd&&this.Xd&&this._instance.sessionManager===r)return n?(this._instance.register_for_session({[an]:!0}),Je.error("could not load recorder",n)):void this.ev(i);this.Qd=zi})}}stopRecording(){var i,e;(i=this.Jd)==null||i.call(this),this.Jd=void 0,(e=this.Zd)==null||e.stop()}Yd(i){var e,t;i===void 0&&(i=!1),(e=this.Jd)==null||e.call(this),this.Jd=void 0,(t=this.Zd)==null||t.discard({discardProducerEvents:i})}rv(){var i,e;(i=this.No)==null||i.unregister(ro),(e=this.No)==null||e.unregister(Cl)}nv(i,e){if(D(i))return null;var t,s=ue(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(Je.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}sv(i){if(this.No){var e,t,s=this.No,r=()=>{var n,o=i.sessionRecording===!1?void 0:i.sessionRecording,a=this.nv((n=this.mn.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.nv(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=a!=null?a:l;D(u)&&this.rv();var h=o==null?void 0:o.minimumDurationMilliseconds;s.register({[St]:E({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:E({capturePerformance:i.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:u,minimumDurationMilliseconds:b(h)?null:h,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};r(),(e=this.Jd)==null||e.call(this),this.Jd=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){var e=i.ok?i.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.sv(e),void this.Yd()):(this.sv(e),void this.startIfEnabledOrStop()):(this.Qd===vi&&(this.Qd=Wi,Je.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.Zd)!=null&&t.log?this.Zd.log(i,e):Je.warn("log called before recorder was ready")}get iv(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(St);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}av(){var i,e=this._instance.get_property(St);if(!e)return!1;try{i=typeof e=="object"?e:JSON.parse(e)}catch(t){return Je.warn("persisted remote config for session recording is invali
2d and will be ignored",t),!1}return!D(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}ev(i){var e,t,s;if(!this.Kd&&this.Xd&&this._instance.sessionManager){if((e=F.__PosthogExtensions__)==null||!e.initSessionRecording)return Je.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[an]:!0});var r;if(this.Zd||(this.Zd=(r=F.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance,this.jt),this.Zd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.av())return this.Qd===Wi||this.Qd===vi?void 0:(this.Qd=vi,Je.info("persisted remote config is stale, requesting fresh config before starting"),void new xs(this._instance).load());this.Qd=Ta,(t=(s=this.Zd).setDocumentWasEverVisible)==null||t.call(s,this.jt),this.Zd.start(i)}else this.Qd=zi}onRRwebEmit(i){var e;(e=this.Zd)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.Zd||(e=this.No)==null||e.register({[Il]:!0}),(i=this.Zd)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.Zd||(e=this.No)==null||e.register({[Al]:!0}),(i=this.Zd)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.Zd||(t=this.No)==null||t.register({[i==="url"?Ol:Fl]:!0}),(e=this.Zd)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.Zd)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.Zd)==null||!t.tryAddCustomEvent(i,e))}}},td={autocapture:class extends Nn{constructor(i){super(new Dn(i)),this.instance=i}},historyAutocapture:class{constructor(i){this._instance=i,this.ov=this.lv()}initialize(){this.startIfEnabled()}get isEnabled(){var i=this.uv();return!!(i.path||i.search||this.hv(i))}startIfEnabled(){this.isEnabled&&(k.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ov=this.lv(),this.startIfEnabled()}stop(){this.dv&&this.dv(),this.dv=void 0,this.vv&&this.vv(),this.vv=void 0,k.info("History API monitoring stopped")}monitorHistoryChanges(){m&&m.history&&(this.fv("pushState"),this.fv("replaceState"),this.pv(),this.hv()&&this.gv())}fv(i){var e;if(m&&((e=m.history[i])==null||!e.__posthog_wrapped__)){var t=this;Pu(m.history,i,s=>function(r,n,o){s.call(this,r,n,o),t.mv(i)})}}lv(){var i=m==null?void 0:m.location;if(i!=null&&i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}uv(){var i=this._instance.config.capture_pageview;return i==="history_change"?{path:!0}:z(i)?i:{}}hv(i){return i===void 0&&(i=this.uv()),!!i.hash&&!this._instance.config.disable_capture_url_hashes}yv(i){var e=this.uv(),t=this.ov;return!(!t||!(e.path&&i.pathname!==t.pathname||e.search&&i.search!==t.search||this.hv(e)&&i.hash!==t.hash))}mv(i){try{var e=this.lv();if(!e)return;this.yv(e)&&this._instance.capture(Rt,{navigation_type:i}),this.ov=e}catch(t){k.error("Error capturing "+i+" pageview",t)}}pv(){if(!this.dv){var i=()=>{this.mv("popstate")};Z(m,"popstate",i),this.dv=()=>{m&&m.removeEventListener("popstate",i)}}}gv(){if(!this.vv){var i=()=>{this.mv("hashchange")};Z(m,"hashchange",i),this.vv=()=>{m&&m.removeEventListener("hashchange",i)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(i){var e;this.bv=!1,this.Rs=!1,this._v=null,this.instance=i,this.bv=!((e=this.instance.persistence)==null||!e.props[Gr]),this.rageclicks=new Is(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return z(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(i=this.mn.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return D(this.mn.capture_heatmaps)?D(this.mn.enable_heatmaps)?this.bv:this.mn.enable_heatmaps:this.mn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Gc.info("starting..."),this.wv(),this.Vt()}else{var i;clearInterval((i=this._v)!==null&&i!==void 0?i:void 0),this.Sv(),this.getAndClearBuffer()}}onRemoteConfig(i){if(i.ok){var e=i.config;if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Gr]:t}),this.bv=t,this.startIfEnabled()}}}getAndClearBuffer(){var i=this.Pt;return this.Pt=void 0,i}xv(i){br(i.originalEvent)&&this.Xi(i.originalEvent,"deadclick")}Vt(){this._v&&clearInterval(this._v),this._v=(S==null?void 0:S.visibilityState)==="visible"?setInterval(this.Eo.bind(this),this.flushIntervalMilliseconds):null}wv(){m&&S&&(this.Cv=this.Eo.bind(this),Z(m,fs,this.Cv),this.Tv=i=>
2this.Xi(i||(m==null?void 0:m.event)),Z(S,"click",this.Tv,{capture:!0}),this.Mv=i=>this.Ev(i||(m==null?void 0:m.event)),Z(S,"mousemove",this.Mv,{capture:!0}),this.Iv=new ys(this.instance,pc,this.xv.bind(this)),this.Iv.startIfEnabledOrStop(),this.Rv=this.Vt.bind(this),Z(S,Yt,this.Rv),this.Rs=!0)}Sv(){var i;m&&S&&(this.Cv&&m.removeEventListener(fs,this.Cv),this.Tv&&S.removeEventListener("click",this.Tv,{capture:!0}),this.Mv&&S.removeEventListener("mousemove",this.Mv,{capture:!0}),this.Rv&&S.removeEventListener(Yt,this.Rv),clearTimeout(this.Pv),(i=this.Iv)==null||i.stop(),this.Rs=!1)}Av(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(o,a,l){for(var u=o;u&&pt(u)&&!$e(u,"body");){if(u===l)return!1;var h=void 0;try{var c,d,g;h=(c=(d=(g=u.ownerDocument)==null?void 0:g.defaultView)!==null&&d!==void 0?d:m)==null?void 0:c.getComputedStyle(u).position}catch(p){return!1}if(R(a,h))return!0;u=zl(u)}return!1}(gn(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}Xi(i,e){var t;if(e===void 0&&(e="click"),!Jo(i.target)&&br(i)){var s=this.Av(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&Gl(gn(i),this.instance.config.rageclick)&&this.bs(E({},s,{type:"rageclick"})),this.bs(s)}}Ev(i){!Jo(i.target)&&br(i)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.bs(this.Av(i,"mousemove"))},500))}bs(i){if(m){var e=this.mn.disable_capture_url_hashes?dt(m.location.href):m.location.href,t=this.mn.custom_personal_data_properties,s=this.mn.mask_personal_data_properties?[...Jt,...t||[]]:[],r=Ii(e,s,Oi);this.Pt=this.Pt||{},this.Pt[r]||(this.Pt[r]=[]),this.Pt[r].push(i)}}Eo(){this.Pt&&!De(this.Pt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ys,webVitalsAutocapture:class{constructor(i){var e;this.bv=!1,this.Rs=!1,this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Fv=()=>{clearTimeout(this.Ov),this.Ov=void 0,this.Pt.metrics.length!==0&&(this._instance.capture("$web_vitals",E({$current_url:this.Pt.url},this.Pt.metrics.reduce((t,s)=>E({},t,{["$web_vitals_"+s.name+"_event"]:E({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{}))),this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Lv=t=>{var s;if(this.Pt=this.Pt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},D(t==null?void 0:t.name)||D(t==null?void 0:t.value))mt.error("Invalid metric received",t);else{var r=typeof t.navigationURL=="string"?t.navigationURL:void 0,n=this.Dv(r);if(!b(n)){var o=ue(t.navigationId)||typeof t.navigationId=="string"?"navigation:"+t.navigationId:"url:"+n;if(!this.$v||this.$v>t.value){this.Pt.navigationKey!==o&&(this.Fv(),this.Ov=setTimeout(this.Fv,this.flushToCaptureTimeoutMs)),b(this.Pt.navigationKey)&&(this.Pt.navigationKey=o,this.Pt.url=n),this.Pt.firstMetricTimestamp=b(this.Pt.firstMetricTimestamp)?Date.now():this.Pt.firstMetricTimestamp;var a=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),l=E({},t,r?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,z(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var u={};for(var h of Wc){var c=h==="url"&&typeof t.attribution[h]=="string"?this.Dv(t.attribution[h]):t.attribution[h];b(c)||(u[h]=c)}l.attribution=u}else delete l.attribution;b(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Pt.metrics.push(l),this.Pt.metrics.length===this.allowedMetrics.length&&this.Fv()}else mt.error("Ignoring metric with value >= "+this.$v,t)}}},this.Nv=()=>{if(!this.Rs){var t,s,r,n,o=!1,a=F.__PosthogExtensions__,l=a==null?void 0:a.postHogWebVitalsCallbacksByFlavor,u=(l==null?void 0:l[this.qv])||(this.qv==="web-vitals"&&b(l)?a==null?void 0:a.postHogWebVitalsCallbacks:void 0);if(!b(u)){var h=u.withoutAttribution,c=this.attributionMetrics;o=!b(h),t=c.indexOf("LCP")>-1?u.onLCP:(h==null?void 0:h.onLCP)||u.onLCP,s=c.indexOf("CLS")>-1?u.onCLS:(h==null?void 0:h.onCLS)||u.onCLS,r=c.indexOf("FCP")>-1?u.onFCP:(h==null?void 0:h.onFCP)||u.onFCP,n=c.indexOf("INP")>-1?u.onINP:(h==null?void 0:h.onINP)||u.onINP}if(t&&s&&r&&n){var d={reportSoftNavs:this.useSoftNavs},g=o&&this.attributionMetrics.indexOf("INP")>
2-1?E({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Lv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Lv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Lv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&n(this.Lv.bind(this),g),this.Rs=!0}else mt.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.bv=!((e=this._instance.persistence)==null||!e.props[Qr]),this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=z(this.jv)?(i=this.jv)==null?void 0:i.web_vitals_allowed_metrics:void 0;return D(t)?((e=this._instance.persistence)==null?void 0:e.props[Xr])||ka:t}get flushToCaptureTimeoutMs(){return(z(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var i=z(this.jv)?this.jv.web_vitals_attribution:void 0;return Pe(i)?i?ka:[]:L(i)?i:zc}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var i=z(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return i!=null&&i}get $v(){var i=z(this.jv)&&ue(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Sa;return i>0&&6e4>=i?Sa:i}get isEnabled(){var i=ne==null?void 0:ne.protocol;if(i!=="http:"&&i!=="https:")return mt.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=z(this.jv)?this.jv.web_vitals:Pe(this.jv)?this.jv:void 0;return Pe(e)?e:this.bv}startIfEnabled(){this.isEnabled&&!this.Rs&&(mt.info("enabled, starting..."),this.Ys(this.Nv))}onRemoteConfig(i){if(i.ok){var e=i.config;if("capturePerformance"in e){var t=z(e.capturePerformance)&&!!e.capturePerformance.web_vitals,s=z(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Qr]:t}),this._instance.persistence.register({[Xr]:s})),this.bv=t,this.startIfEnabled()}}}get qv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(i){var e=F.__PosthogExtensions__,t=this.qv,s=e==null?void 0:e.postHogWebVitalsCallbacksByFlavor;s!=null&&s[t]||t==="web-vitals"&&b(s)&&e!=null&&e.postHogWebVitalsCallbacks?i():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,t,r=>{r?mt.error("failed to load script",r):i()})}Dv(i){var e=i||(m==null?void 0:m.location.href);if(e){var t=this._instance.config.disable_capture_url_hashes?dt(e):e,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Jt,...s||[]]:[];return Ii(t,r,Oi)}mt.error("Could not determine current URL")}}},id={exceptionObserver:class{constructor(i){var e;this.Nv=()=>{var t;if(m&&this.isEnabled&&(t=F.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var s=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Bv&&this.mn.capture_unhandled_errors&&(this.Bv=s(this.captureException.bind(this))),!this.Hv&&this.mn.capture_unhandled_rejections&&(this.Hv=r(this.captureException.bind(this))),!this.zv&&this.mn.capture_console_errors&&(this.zv=n(this.captureException.bind(this)))}catch(o){pi.error("failed to start",o),this.Uv()}}},this._instance=i,this.Wv=!((e=this._instance.persistence)==null||!e.props[Yr]),this.pe=new Cr(E({},function(t){var s,r,n,o;return t===void 0&&(t={}),{refillRate:(s=(r=t.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:t.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(n=(o=t.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:t.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:pi})),this.mn=this.Vv(),this.startIfEnabledOrStop()}Vv(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return z(i)?e=E({},e,i):(b(i)?this.Wv:i)&&(e=E({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(pi.info("enabled"),this.Uv(),this.Ys(this.Nv)):this.Uv()}Ys(i){var e,t;(e=F.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=F.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return pi.error("failed to load script",s);i()})}Uv(){var i,e,t;(i=this.Bv)==null||i.call(this),this.Bv=void 0,(e=this.Hv)==null||e.call(this),this.Hv=void 0,(t=this.zv)==null||t.call(this),this.zv=void 0}onRemoteConfig(i){if(i.ok){var e=i.config;"autocaptureExceptions"in e&&(this.Wv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Yr]:this.Wv}),this.mn=this.Vv(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.Vv()}
2captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.pe.consumeRateLimit(r)?pi.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.Gv=[],this.Zv=new Rr([new Nr,new Vr,new Hr,new Dr,new jr,new qr,new Br,new Ur],function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var u=[],h=a.split(`
3`),c=l;h.length>c;c++){var d=h[c];if(1024>=d.length){var g=zo.test(d)?d.replace(zo,"$1"):d;if(!g.match(/\S*Error: /)){for(var p of n){var v=p(g,s);if(v){u.push(v);break}}if(u.length>=50)break}}}return function(f){if(!f.length)return[];var _=Array.from(f);return _.reverse(),_.slice(0,50).map(y=>{return E({},y,{filename:y.filename||(w=_,w[w.length-1]||{}).filename,function:y.function||Gt});var w})}(u)}}("web:javascript",jh,zh)),this._instance=i,this.Gv=(e=(t=this._instance.persistence)==null?void 0:t.get_property(Kr))!==null&&e!==void 0?e:[],this.Qv=cs(this.Jv()),this.Kv=new zr(this.Qv)}onConfigChange(){this.Qv=cs(this.Jv()),this.Kv.setConfig(this.Qv)}onRemoteConfig(i){var e,t,s;if(i.ok){var r=i.config;if("errorTracking"in r){var n=(e=(t=r.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],o=(s=r.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Gv=n,this._instance.persistence&&this._instance.persistence.register({[Kr]:this.Gv,[Zr]:o})}}}get Yv(){var i,e=!!this._instance.get_property(Zr),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t!=null?t:e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.Zv.buildFromUnknown(i,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(i,e){if(this.Qv.enabled)try{if(!j(i)||i.trim().length===0)return void je.warn("Ignoring exception step because message must be a non-empty string");var t=function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(n).reduce((a,l)=>Yh.has(l)?(o.push(l),a):(a[l]=n[l],a),{}),droppedKeys:o}}(this.Xv(e)),s=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&je.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Kv.add(E({[us]:i,[hs]:new Date().toISOString()},s))}catch(n){je.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.tc(e)){if(this.ec(e))return this.ic("Exception dropped: matched a suppression rule"),void je.info("Skipping exception capture because a suppression rule matched");if(!this.Yv&&this.rc(e))return this.ic("Exception dropped: thrown by a browser extension"),void je.info("Skipping exception capture because it was thrown by an extension");if(!this.Yv&&this.nc(e))return this.ic("Exception dropped: thrown by an injected browser script"),void je.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.sc(e))return this.ic("Exception dropped: thrown by the PostHog SDK"),void je.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.Qv.enabled&&D(i.$exception_steps)?this.ac(i):i,s=typeof(n=globalThis._posthogReleaseId)=="string"&&n.length>0?n:void 0;s&&(t.$release_id=s);try{var r=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",hu:!0});return r&&this.Kv.clear(),r}catch(o){return je.error("Failed to capture exception event. Dropping this exception.",o),void this.Kv.clear()}}catch(o){return void je.error("Failed to process exception event. Ignoring this exception.",o)}var n}ac(i){try{var e=this.Kv.getAttachable();return e.length===0?i:E({},i,{$exception_steps:e})}catch(t){return je.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}ic(i){this.Qv.enabled&&this.Kv.add({[us]:i,[hs]:new Date().toISOString()})}Xv(i){return z(i)?E({},i):{}}Jv(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}ec(i){if(i.length===0)return!1;try{var e=i.reduce((t,s)=>{var r=s.type,n=s.value;return j(r)&&r.length>0&&t.$exception_types.push(r),j(n)&&n.length>0&&t.$exception_values.push(n),t},{$exception_types:[],$exception_values:[]});return this.Gv.some(t=>{var s=t.values.map(r=>{var n=wu[r.operator],o=e[r.key];if(!n||!o)return!1;var a=L(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return t.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return je.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}rc(i){var e=i.flatMap(s=>{var r,n;return(r=(n=s.stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[]}),t=e.filter(s=>{var r=s.filename;return!!r&&Zc.some(n=>r.startsWith(n))});return t.length!==0&&(!t.every(s=>{var r=s.filename;return!!r&&r.startsWith(Gn)})||i.some(s=>{var r=s.value;return j(r)&&r.includes("isolatedAPI.contexts.topHostname")}
3)&&!e.some(s=>{var r=s.filename;return s.in_app&&!(r!=null&&r.startsWith(Gn))}))}nc(i){return i.some(e=>{var t=e.value;return j(t)&&Qc.some(s=>t.includes(s))})}sc(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(s=o==null||(r=o.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}tc(i){return!D(i)&&L(i)}}},sd=E({productTours:class{get No(){return this._instance.persistence}constructor(i){this.oc=null,this.lc=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(i.ok){var e=i.config;if("productTours"in e){var t,s;if(this.No&&this.No.register({[so]:!!e.productTours}),!wr(this._instance))return!this.oc&&D((t=this.No)==null?void 0:t.props[_i])||Gi.info("product tours disabled; stopping and clearing cached tours"),(s=this.oc)==null||s.stop(),this.oc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.oc&&wr(this._instance)&&this.Ys(()=>this.uc())}Ys(i){var e,t;(e=F.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=F.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",s=>{s?Gi.error("Could not load product tours script",s):i()})}uc(){var i;!this.oc&&(i=F.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.oc=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!L(this.lc)||e){var t=this.No;if(t){var s=t.props[_i];if(L(s)&&!e)return this.lc=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:r=>{if(wr(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var o="Product Tours API could not be loaded, status: "+n;return n===0?r.error||Gi.warn(o):Gi.error(o),void i([],{isLoaded:!1,error:o})}var a=L(r.json.product_tours)?r.json.product_tours:[];this.lc=a,t&&t.register({[_i]:a}),i(a,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.lc,{isLoaded:!0})}getActiveProductTours(i){D(this.oc)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.oc.getActiveProductTours(i)}showProductTour(i){var e;(e=this.oc)==null||e.showTourById(i)}previewTour(i){this.oc?this.oc.previewTour(i):this.Ys(()=>{var e;this.uc(),(e=this.oc)==null||e.previewTour(i)})}dismissProductTour(){var i;(i=this.oc)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.oc)==null||i.nextStep()}previousStep(){var i;(i=this.oc)==null||i.previousStep()}clearCache(){var i;this.lc=null,(i=this.No)==null||i.unregister(_i)}resetTour(i){var e;(e=this.oc)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.oc)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.oc)==null||e.cancelPendingTour(i)}}},$s),rd={siteApps:class{constructor(i){this.hc=0,this._instance=i,this.dc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}vc(i,e){if(e){var t=this.globalsForEvent(e);this.dc.push(t),this.dc.length>1e3&&(this.dc=this.dc.slice(10))}}get siteAppLoaders(){var i;return(i=F._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.vc.bind(this));this.cc=()=>{i(),this.dc=[],this.cc=void 0}}}globalsForEvent(i){var e,t,s,r,n,o,a;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(h)){var d=c[0];l[d]={id:u[d],type:d,properties:c[1]}}var g=i.$set_once,p=i.$set;return{event:E({},qa(i,Yc),{properties:E({},i.properties,p?{$set:E({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},p)}:{},g?{$set_once:E({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}fc(i){var e,t=(e=i.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(i)||(We.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(i)||(We.error("prepare_external_dependency_script returned null"),null):i}gc(){var i,e,t,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=S==null?void 0:S.defaultView,u=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!u)return()=>{};if(this.hc++,this.mc)return this.yc();var h=[],c=this,d=new WeakSet,g=(f,_,y)=>{if(f!=null&&f[_]){var w=f[_];f[_]=y(w),h.push(()=>{f[_]=w})}},p=f=>{if(d.has(f))return f;var _=c.fc(f);return _&&d.add(_),_},v=f=>f.map(_=>typeof _=="string"?_:p(_)).filter(_=>!le(_));return g(u,"appendChild",f=>function(_){var y=p(_);return y?f.call(this,y):_}),g(u,"insertBefore",f=>function(_,y){var w=p(_);return w?f.call(this,w,y):_}),g(u,"replaceChild",f=>function(_,y){var w=p(_);return w?f.call(this,w,y):y}),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(s=l.DocumentFragment)==null?void 0:s.prototype].forEach(f=>{g(f,"append",_=>function(){for(var y=arguments.length,w=new Array(y),T=0;y>T;T++)w[T]=arguments[T];return _.apply(this,v(w))}
3),g(f,"prepend",_=>function(){for(var y=arguments.length,w=new Array(y),T=0;y>T;T++)w[T]=arguments[T];return _.apply(this,v(w))})}),[(r=l.Element)==null?void 0:r.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(o=l.DocumentType)==null?void 0:o.prototype].forEach(f=>{g(f,"before",_=>function(){for(var y=arguments.length,w=new Array(y),T=0;y>T;T++)w[T]=arguments[T];return _.apply(this,v(w))}),g(f,"after",_=>function(){for(var y=arguments.length,w=new Array(y),T=0;y>T;T++)w[T]=arguments[T];return _.apply(this,v(w))}),g(f,"replaceWith",_=>function(){for(var y=arguments.length,w=new Array(y),T=0;y>T;T++)w[T]=arguments[T];var x=v(w);return w.length&&!x.length?void 0:_.apply(this,x)})}),g((a=l.Element)==null?void 0:a.prototype,"insertAdjacentElement",f=>function(_,y){var w=p(y);return w?f.call(this,_,w):null}),this.mc=()=>{h.forEach(f=>f()),this.mc=void 0},this.yc()}yc(){var i=!1;return()=>{var e;i||(i=!0,this.hc--,this.hc===0&&((e=this.mc)==null||e.call(this)))}}bc(i,e){e===void 0&&(e=!0);var t=this.gc();try{var s=i(t);return e&&t(),s}catch(r){throw t(),r}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.dc.length&&(We.info("Processing "+this.dc.length+" events for site app with id "+i.id),this.dc.forEach(a=>this.bc(()=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.cc)==null||o.call(this))},s=!1,r=o=>{e.errored=!o,e.loaded=!0,We.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),s&&t()};try{var n=this.bc(o=>i.init({posthog:this._instance,callback(a){o(),r(a)}}),!1).processEvent;n&&(e.processEvent=n),s=!0}catch(o){We.error(Pa+i.id,o),r(!1)}if(s&&e.loaded)try{t()}catch(o){We.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}_c(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}wc(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),s=function(n){try{e.bc(()=>n.processEvent==null?void 0:n.processEvent(t))}catch(o){We.error("Error while processing event "+i.event+" for site app "+n.id,o)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this._c(),void this._instance.on("eventCaptured",l=>this.wc(l))):void We.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.cc)==null||t.call(this),i.ok){var n=i.config;if((s=n.siteApps)!=null&&s.length)if(this.isEnabled){var o=function(){var l,u=a.id,h=a.url;F["__$$ph_site_app_"+u]=r._instance,(l=F.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,h,c=>{if(c)return We.error(Pa+u,c)})};for(var a of n.siteApps)o()}else We.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},nd={tracingHeaders:class{constructor(i){this.kc=void 0,this.Sc=void 0,this.xc=void 0,this.Nv=()=>{var e,t,s=this.Cc();s?(b(this.kc)&&(this.kc=(e=F.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),b(this.Sc)&&(this.Sc=(t=F.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Uv()},this._instance=i}initialize(){this.startIfEnabledOrStop()}Ys(i){var e,t;(e=F.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=F.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return Vc.error("failed to load script",s);i()})}Tc(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}Cc(){var i=this.Tc();return L(i)?(L(this.xc)?this.xc.splice(0,this.xc.length,...i):this.xc=[...i],i.length>0?this.xc:void 0):(L(this.xc)&&this.xc.splice(0),this.xc=i||void 0,this.xc)}Uv(){var i,e;(i=this.kc)==null||i.call(this),(e=this.Sc)==null||e.call(this),this.kc=void 0,this.Sc=void 0}startIfEnabledOrStop(){this.Cc()?this.Ys(this.Nv):this.Uv()}}},od=E({surveys:class extends Bn{constructor(i){var e;super(new zn(i),{get projectToken(){return e.config.token},kv:new Vn(e=i)}),this._instance=i}Lu(i,e){var t=e.query?Fi(i,e.query):i;return new Promise(s=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((r=e.target)!==null&&r!==void 0?r:"api",t),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:s})})}}},$s),ad={toolbar:class{constructor(i){this.instance=i}Mc(i){F.ph_toolbar_state=i}Ec(){var i;return(i=F.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),un(this.instance.config)||!m||!S)return!1;i=i!=null?i:m.location,t=t!=null?t:m.history;try{if(!e){try{m.localStorage.setItem("test","test"),m.localStorage.removeItem("test")}catch(o){return!1}e=m==null?void 0:m.localStorage}var s,r=Kc||ws(i.hash,"__posthog")||ws(i.hash,"state"),n=r?Yo(()=>JSON.parse(atob(decodeURIComponent(r))))||Yo(()=>JSON.parse(decodeURIComponent(r))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Aa)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(o){return!1}}Ic(i){var e=F.ph_load_toolbar||F.ph_load_editor;!D(e)&&xe(e)?e(i,this.instance):Ia.warn("No toolbar load function found")}loadToolbar(i){var e=!(S==null||!S.getElementById(Bl));if(!m||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=E({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(m.localStorage.setItem(Aa,JSON.stringify(E({},s,{source:void 0}))),this.Ec()===2)this.Ic(s);else if(this.Ec()===0){var r;this.Mc(1),(r=F.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",n=>{if(n)return Ia.error("[Toolbar] Failed to load",n),void this.Mc(0);this.Mc(2),this.Ic(s)}),Z(m,"turbolinks:load",()=>{this.Mc(0),this.loadToolbar(s)})}return!0}Rc(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},ld=E({experiments:be},$s),ud={conversations:class{constructor(i){this.Pc=void 0,this._conversationsManager=null,this.Ac=!1,this.je=null,this.Fc=!1,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations&&(this.Oc=i.ok,i.ok)){var e=i.config.conversations;D(e)||(Pe(e)?this.Pc=e:(this.Pc=e.enabled,this.je=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Pc=void 0,this.je=null,this.Oc=void 0,this.Fc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Ac||this._instance.config.disable_conversations||un(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=F==null?void 0:F.__PosthogExtensions__;if(i&&!b(this.Pc)&&this.Pc)if(this.je&&this.je.token){this.Ac=!0;try{var e=i.initConversations;if(e)return this.Lc(e),void(this.Ac=!1);var t=i.loadExternalDependency;if(!t)return void this.Dc(no);t(this._instance,"conversations",s=>{s||!i.initConversations?this.Dc("Could not load conversations script",s):this.Lc(i.initConversations),this.Ac=!1})}catch(s){this.Dc("Error initializing conversations",s),this.Ac=!1}}else Ne.error("Conversations enabled but missing token in remote config.")}}Lc(i){if(this.je)try{this._conversationsManager=i(this.je,this._instance),this.Fc=!1,Ne.info("Conversations loaded successfully")}catch(e){this.Dc("Error completing conversations initialization",e)}else Ne.error("Cannot complete initialization: remote config is null")}Dc(i,e){Ne.error(i,e),this._conversationsManager=null,this.Ac=!1,this.Fc=!0}show(){this._conversationsManager?this._conversationsManager.show():Ne.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Pc===!0&&!le(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":un(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Oc===!1?"remote_config_failed":b(this.Pc)?this.Oc?"disabled_in_project":"remote_config_pending":this.Pc?D(this.je)||!this.je.token?"missing_token":F!=null&&F.__PosthogExtensions__?this.Ac?"initializing":this.Fc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return X(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(Ne.warn(bt),null)})()}getMessages(i,e){var t=this;return X(function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(Ne.warn(bt),null)})()}markAsRead(i){var e=this;return X(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(Ne.warn(bt),null)})()}getTickets(i){var e=this;return X(function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(Ne.warn(bt),null)})()}requestRestoreLink(i){var e=this;return X(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(Ne.warn(bt),null)})()}restoreFromToken(i){var e=this;return X(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(Ne.warn(bt),null)})()}restoreFromUrlToken(){var i=this;return X(function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(Ne.warn(bt),null)})()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}bu(){var i;(i=this._conversationsManager)==null||i.setIdentity()}_u(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},hd={logs:class{constructor(i){var e,t=this;this.name="logs",this.$c=!1,this.Nc=!1,this.qc=!1,this.A=ie("[logs]"),this.jc=E({},this.A,{error(){for(var s=arguments.length,r=new Array(s),n=0;s>n;n++)r[n]=arguments[n];r.some(Ha)||t.A.error(...r)}}),this.po=[],this.Bc=[],this.fd=0,this.Os=!1,this.Hc=[],this.zc=[],this.Uc=!1,this.Wc=!1,this.Vc=()=>{var s,r;this.Os||(this.fd=0,(s=this.Gc)==null||s.onReconnect(),(r=this.Zc)==null||r.onReconnect())},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.$c=!0),m&&Z(m,"online",this.Vc)}Qc(i,e,t,s){var r,n=Na((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Mh(this.Jc(i,e),n,this.jc,()=>this.Kc(),o=>o(),void 0,s),n]}Yc(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.Gc||this.Xc!==e){var t;(t=this.Gc)==null||t.reset(),this.Xc=e;var s=this.Qc(()=>this.po,r=>{this.po=r});this.Gc=s[0],this.tf=s[1]}return this.Gc}ef(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.Zc||this.if!==e){var t;(t=this.Zc)==null||t.reset(),this.if=e;var s=this.Qc(()=>this.Bc,r=>{this.Bc=r},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Da);this.Zc=s[0],this.rf=s[1]}return this.Zc}setup(i){var e;if(!this.Os){this.Ns=i,(e=this._instance)!=null&&(e=e.config)!=null&&(e=e.logs)!=null&&e.captureConsoleLogs&&(this.$c=!0),(this.$c||this.nf()&&this.sf())&&this.af();var t=!1,s=i.onRemoteConfig(r=>{var n;t=r.ok&&((n=r.config.logs)==null?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.Os?s.dispose():(this.qs=s,t||this.loadIfEnabled())}}dispose(){var i,e,t,s;this.Os||(this.Os=!0,this.lf(),(i=this.qs)==null||i.dispose(),this.qs=void 0,this.Ns=void 0,this.qc=!1,m==null||m.removeEventListener("online",this.Vc),(e=this.uf)==null||e.call(this),this.uf=void 0,(t=this.Gc)==null||t.reset(),(s=this.Zc)==null||s.reset())}onRemoteConfig(i){var e,t;if(!this.Os){var s=i.ok?(e=i.config.logs)==null?void 0:e.captureConsoleLogs:void 0;D(s)?this.hf():((t=this._instance)==null||(t=t.persistence)==null||t.register({[Jr]:!!s}),s?(this.$c=!0,this.Nc||this.af(),this.loadIfEnabled()):this.hf())}}reset(){var i,e,t,s;this.lf(),(i=this.Gc)==null||i.clearQueue(),this.po=[],(e=this.Gc)==null||e.reset(),(t=this.Zc)==null||t.clearQueue(),this.Bc=[],(s=this.Zc)==null||s.reset(),this.fd=0}captureLog(i){this.Os||this.Yc().captureLog(i)}captureConsoleLog(i){this.Os||this.ef().captureLog(i)}captureBufferedConsoleLog(i,e,t){this.Os||this.ef().captureLog(i,{context:e,occurredAtMs:t})}sf(){var i;return!((i=this._instance)==null||(i=i.persistence)==null||(i=i.props)==null||!i[Jr])}nf(){var i,e;return(i=this._instance)==null||i.do==null||!i.do()||!((e=F._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null||!e.config)}ku(){var i;this.lf(),(i=this.Zc)==null||i.clearQueue(),this.Bc=[]}hf(){this.$c||this.lf()}af(){var i,e=this;if(!this.Uc&&F!=null&&F.console){var t=Na((i=this._instance)==null||(i=i.config)==null?void 0:i.logs).maxBufferSize,s=function(n){var o;try{o=(a=>{for(;(l=a)!=null&&l.__rrweb_original__;){var l;a=a.__rrweb_original__}return a})(F.console[n])}catch(a){return 0}if(!o)return 0;e.zc.push(Pu(F.console,n,a=>{var l=function(){for(var u=arguments.length,h=new Array(u),c=0;u>c;c++)h[c]=arguments[c];try{e.df(n,h,t)}catch(d){}return a.apply(F.console,h)};return l.__rrweb_original__=o,l}))};for(var r of Xc)s(r);this.Uc=!0,this.vf=setTimeout(()=>{this.lf()},3e4)}}df(i,e,t){var s;if(this.Uc&&!this.Wc&&e.length!==0)if((s=this._instance)!=null&&s.is_capturing()){if(t>this.Hc.length){this.Wc=!0;try{this.Hc.push({level:i,args:e,occurredAtMs:Date.now(),context:this.Kc()})}finally{this.Wc=!1}}}else this.lf()}lf(){if(this.Hc=[],this.Uc){for(var i of(this.Uc=!1,this.vf&&(clearTimeout(this.vf),this.vf=void 0),this.zc))i();this.zc=[]}}cf(){var i=this.Hc;return this.lf(),i}get logger(){return this.ff||(this.ff={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.ff}flushLogs(i){i?this.pf(i):(this.Gc&&this.Gc.flush().catch(e=>this.gf(e)),this.Zc&&this.Zc.flush().catch(e=>this.gf(e)))}gf(i){Ha(i)||this.A.error("PostHog logs flush failed:",i)}loadIfEnabled(){if(!this.Os&&this.$c&&!this.Nc&&!this.qc){var i=F==null?void 0:F.__PosthogExtensions__;if(!i)return this.A.error("PostHog Extensions not found."),void this.lf();var e=i.loadExternalDependency;if(!e)return this.A.error(no),void this.lf();this.qc=!0;try{e(this._instance,"logs",t=>{if(this.qc=!1,!this.Os&&this.$c){var s=i.logs;if(t||s==null||!s.initializeLogs)this.A.error("Could not load logs script",t),this.lf();else{var r,n,o=this.cf();this.uf=s.initializeLogs((r=this.Ns)!==null&&r!==void 0?r:this._instance),this.Nc=!0,o.length>0&&(s.replayConsoleBuffer==null||s.replayConsoleBuffer((n=this.Ns)!==null&&n!==void 0?n:this._instance,o))}}})}catch(t){throw this.qc=!1,t}}}Jc(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:s=>s===Ye.LogsQueue?i():void 0,setPersistedProperty(s,r){var n;s===Ye.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},os:s=>this.os(s),getLibraryId:()=>Q.LIB_NAME,getLibraryVersion:()=>Q.LIB_VERSION}}os(i){return new Promise(e=>{if(Xl(this.fd,3))e({kind:"fatal",error:xr(void 0,"logs
3 endpoint is unreachable, dropping batch")});else{var t=!1,s=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:xr(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.mf(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var o=n.statusCode;if(this.yf(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;o===0?(n.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:xr(n.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}})}yf(i){(i!==0||this._instance.__loaded)&&(this.fd=eu(i,this.fd,3,()=>this.A.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.")))}pf(i){this.po.length>0&&this.bf(i,this.po,this.tf,Q.LIB_NAME,e=>{this.po=e}),this.Bc.length>0&&this.bf(i,this.Bc,this.rf,Da,e=>{this.Bc=e})}bf(i,e,t,s,r){if(e.length!==0){var n=e.map(a=>a.record);r([]);var o=xl(n,El(t,Q.LIB_NAME,Q.LIB_VERSION),s,Q.LIB_VERSION);this._instance._send_request({method:"POST",url:this.mf(),data:o,compression:"best-available",batchKey:"logs",transport:i})}}mf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Kc(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=t.windowId,r=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=s,D(r)||(e.sessionStartTimestamp=r),D(n)||(e.lastActivityTimestamp=n)}if(F!=null&&(i=F.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?dt(F.location.href):F.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},cd={metrics:class{constructor(i){this.A=ie("[metrics]"),this._instance=i}initialize(){}Yc(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.Gc&&this.Xc===t||((e=this.Gc)==null||e.reset(),this.Xc=t,this.Gc=new Nh(this.Jc(),function(s){var r,n,o,a,l,u=s==null?void 0:s.resourceAttributes;return{serviceName:(r=u==null?void 0:u["service.name"])!==null&&r!==void 0?r:s==null?void 0:s.serviceName,serviceVersion:(n=u==null?void 0:u["service.version"])!==null&&n!==void 0?n:s==null?void 0:s.serviceVersion,environment:(o=u==null?void 0:u["deployment.environment"])!==null&&o!==void 0?o:s==null?void 0:s.environment,resourceAttributes:u,beforeSend:s==null?void 0:s.beforeSend,flushIntervalMs:(a=s==null?void 0:s.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s==null?void 0:s.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}}(t),this.A)),this.Gc}count(i,e,t){e===void 0&&(e=1),this.Yc().count(i,e,t)}gauge(i,e,t){this.Yc().gauge(i,e,t)}histogram(i,e,t){this.Yc().histogram(i,e,t)}flush(i){if(!this.Gc)return Promise.resolve();if(i){var e=this.Gc.drainWindow();return e&&this.xs(e,i),Promise.resolve()}return this.Gc.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var i;(i=this.Gc)==null||i.reset()}Jc(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},xs:t=>e.xs(t),getLibraryId:()=>Q.LIB_NAME,getLibraryVersion:()=>Q.LIB_VERSION}}xs(i,e){return new Promise(t=>{var s=!1,r=o=>{s||(s=!0,clearTimeout(n),t(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(E({method:"POST",url:this._f(),data:i,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+a)})}}}))})}_f(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},dd=E({},$s,ed,td,id,sd,rd,od,nd,ad,ld,ud,hd,cd);Te.__defaultExtensionClasses=E({},dd);var Pt=function(){Q.SDK_DIST_CHANNEL="npm";var i=ki[Mt]=new Te;return function(){function e(){e.done||(e.done=!0,Tu=!1,G(ki,function(t){t._dom_loaded()}))}S!=null&&S.addEventListener?S.readyState==="complete"?e():Z(S,"DOMContentLoaded",e,{capture:!1}):m&&k.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),i}();var Li=i=>{var e;return(e=document.querySelector(`meta[name="${i}"]`))==null?void 0:e.getAttribute("content")},Iu=!1,pd=(...i)=>{let e=window.sa_event.q||[];e.push(i),window.sa_event.q=e};window.sa_event=window.sa_event||pd;var ti=(i,e={})=>i?(Iu&&Pt.capture(i,e),new Promise(t=>{try{let s=setTimeout(t,2e3);window.sa_event(i,e,()=>{clearTimeout(s),t()})}catch(s){t()}})):Promise.resolve(),vd=()=>{let i=Li("posthog-token");if(!i)return;Pt.init(i,ri({api_host:Li("posthog-api-host")||"https://us.i.posthog.com",ui_host:Li("posthog-ui-host")||"https://us.posthog.com",defaults:"2026-05-30"},Li("posthog-session-recording-disabled")==="true"&&{disable_session_recording:!0})),window.posthog=Pt,Iu=!0;let e=Li("posthog-user-id");e?Pt.identify(e):Pt.get_property("$user_state")==="identified"&&Pt.reset()},gd=()=>{let i=[25,50,75,100],e=new Set,t=()=>{let s=document.documentElement;if(s.scrollHeight-window.innerHeight<=0){e.has(100)||(e.add(100),ti("scroll-depth",{depth:100}));return}let n=(window.scrollY+window.innerHeight)/s.scrollHeight*100;
3i.forEach(o=>{!e.has(o)&&n>=o&&(e.add(o),ti("scroll-depth",{depth:o}))})};window.addEventListener("scroll",t,{passive:!0}),t()},fd=()=>{let i=document.querySelectorAll("[data-analytics-section]");if(!i.length||!("IntersectionObserver"in window))return;let e=new IntersectionObserver(t=>{t.forEach(s=>{s.isIntersecting&&(ti("section-viewed",{section:s.target.dataset.analyticsSection}),e.unobserve(s.target))})},{threshold:.25});i.forEach(t=>{e.observe(t)})},_d=()=>{let i=document.querySelector("[data-public-hero-search]");if(!i)return;let e=()=>{i.removeEventListener("input",e),ti("landing-demo-search")};i.addEventListener("input",e)},md=()=>{let i=window.location.pathname;i==="/users/register"&&ti("register-page-viewed"),i==="/"&&(gd(),fd(),_d())},Ou=()=>{vd(),md(),window.mhevent=ti};var yd="#fbbf24";var Rs=i=>!i||(i.type||"highlight")!=="highlight"||i.standalone===!0||i.standalone==="true"?!1:Number.isFinite(i.startOffset)&&Number.isFinite(i.endOffset)&&i.endOffset>i.startOffset,bd=(i,e)=>{let t=i.textContent,s=(e.text||"").trim(),{startOffset:r,endOffset:n}=e,o=Number.isFinite(r)&&Number.isFinite(n);if(o&&s&&t.slice(r,n).trim()===s)return{start:r,end:n};if(s){let a=o?r:0,l=-1,u=1/0,h=0;for(;;){let c=t.indexOf(s,h);if(c<0)break;let d=Math.abs(c-a);d<u&&(u=d,l=c),h=c+1}if(l>=0)return{start:l,end:l+s.length}}return{start:r,end:n}};var Fu=(i,e,t={})=>{let s=Ed(i,e);if(!s||s.length===0)return null;let r=null;for(let n=s.length-1;n>=0;n-=1){let o=xd(s[n],e,t);n===0&&(r=o)}return r},Lu=(i,{color:e=yd,durationMs:t=2500}={})=>{var r;if(!i)return;let s=(r=i.dataset.highlightRestoreColor)!=null?r:i.style.backgroundColor;i.dataset.highlightRestoreColor=s,clearTimeout(i._highlightFlashTimer),i.style.backgroundColor=e,i._highlightFlashTimer=setTimeout(()=>{i.style.backgroundColor=i.dataset.highlightRestoreColor||"",delete i.dataset.highlightRestoreColor,i._highlightFlashTimer=null},t)},$u=(i,e,t)=>{let s=document.createTreeWalker(i,NodeFilter.SHOW_TEXT,null),r=0,n=!1;for(;s.nextNode();){let o=s.currentNode;if(o===e)return r+t;if(e.nodeType===Node.ELEMENT_NODE){if(e.contains(o)){if(wd(e,o)>=t)return r}else if(n)return r}e.nodeType===Node.ELEMENT_NODE&&e.contains(o)&&(n=!0),r+=o.length}return r},wd=(i,e)=>{let t=e;for(;t&&t.parentNode!==i;)t=t.parentNode;return t?Array.prototype.indexOf.call(i.childNodes,t):-1},Ed=(i,e)=>{let{start:t,end:s}=bd(i,e);if(!Number.isFinite(t)||!Number.isFinite(s)||s<=t)return null;let r=document.createTreeWalker(i,NodeFilter.SHOW_TEXT,null),n=[],o=0;for(;r.nextNode();){let a=r.currentNode,l=a.length,u=o,h=o+l;if(h<=t){o=h;continue}if(u>=s)break;let c=Math.max(0,t-u),d=Math.min(l,s-u),g=a.data.slice(c,d);d>c&&/\S/.test(g)&&n.push({node:a,startOffset:c,endOffset:d}),o=h}return o>=s?n:null},xd=(i,e,t)=>{let s=document.createRange();s.setStart(i.node,i.startOffset),s.setEnd(i.node,i.endOffset);let r=Sd(e,t);return s.surroundContents(r),r},Sd=(i,e)=>{let t=document.createElement("mark");return t.setAttribute("data-highlight-id",i.id),t.style.backgroundColor=i.color||"#fef08a",t.style.cursor="pointer",t.title=i.note?i.note:"Open highlight options",e.onClick&&t.addEventListener("click",s=>e.onClick(s,t,i)),t};Ou();window.Alpine=ii;ii.plugin(To);ii.plugin(kd);ii.data("captureActionsMenu",()=>({openId:null,triggerEl:null,pendingAnchor:null,positions:{},isOpen(i){return this.openId===i},menuStyle(i){if(!this.isOpen(i)||!this.positions[i])return{};let{left:e,top:t}=this.positions[i];return{position:"fixed",left:`${e}px`,top:`${t}px`,right:"auto",bottom:"auto"}},toggle(i,e){this.isOpen(i)?this.close(i):this.open(i,e)},open(i,e,t="first"){this.openId=i,window.dispatchEvent(new CustomEvent("capture-actions-menu-opened",{detail:{id:i}})),this.triggerEl=e||this.triggerEl,this.pendingAnchor={type:"element",value:this.triggerEl},this.positions[i]={left:-9999,top:-9999},this.$nextTick(()=>{this.positionMenu(i,this.pendingAnchor),this.focusMenuItem(i,t)})},close(i=this.openId,e=!0){if(!i||this.openId!==i)return;let t=this.triggerEl;this.openId=null,this.pendingAnchor=null,delete this.positions[i],e&&(t!=null&&t.isConnected)&&this.$nextTick(()=>t.focus({preventScroll:!0}))},reposition(){this.openId&&this.pendingAnchor&&this.positionMenu(this.openId,this.pendingAnchor)},positionMenu(i,e){var h;let t=this.menuEl(i);if(!t||!e)return;let s=t.getBoundingClientRect(),r=8,n=8,o,a;
3if(e.type==="point")o=e.x,a=e.y;else if((h=e.value)!=null&&h.isConnected){let c=e.value.getBoundingClientRect();o=c.right-s.width,a=c.bottom+r,a+s.height+n>window.innerHeight&&c.top-s.height-r>=n&&(a=c.top-s.height-r)}else return;let l=Math.max(n,window.innerWidth-s.width-n),u=Math.max(n,window.innerHeight-s.height-n);o=Math.min(Math.max(o,n),l),a=Math.min(Math.max(a,n),u),this.positions[i]={left:o,top:a}},menuEl(i){return document.getElementById(`${i}-actions-menu`)},menuItems(i){return Array.from(i.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'))},focusMenuItem(i,e="first"){let t=this.menuEl(i);if(!t)return;let s=this.menuItems(t),r=e==="last"?s[s.length-1]:s[0];r==null||r.focus({preventScroll:!0})},focusFirst(i){var e;(e=this.menuItems(i)[0])==null||e.focus({preventScroll:!0})},focusLast(i){var t;let e=this.menuItems(i);(t=e[e.length-1])==null||t.focus({preventScroll:!0})},focusNext(i){let e=this.menuItems(i);if(e.length===0)return;let t=e.indexOf(document.activeElement);e[(t+1)%e.length].focus({preventScroll:!0})},focusPrevious(i){let e=this.menuItems(i);if(e.length===0)return;let t=e.indexOf(document.activeElement);e[(t<=0?e.length:t)-1].focus({preventScroll:!0})}}));var qu=window.matchMedia("(prefers-color-scheme: dark)"),Ad=()=>qu.matches?"dark":"light";qu.addEventListener("change",()=>{document.documentElement.setAttribute("data-theme",Ad())});var Ru=()=>{let i=window.location.pathname;document.querySelectorAll("[data-nav-path]").forEach(e=>{let t=e.getAttribute("data-nav-path"),s=i===t||i.startsWith(`${t}/`);e.setAttribute("data-active",s?"true":"false")})},ju=()=>document.querySelectorAll("[data-shell-top-nav]"),Id=i=>{let e=Number.parseFloat(i.dataset.shellNavUnfixAfter||"96");return Number.isFinite(e)?Math.max(0,e):96},Od=(i=window.location.pathname)=>i.startsWith("/archive/"),Fd=i=>{let e=document.getElementById("share-header-panel");if(e){if(i){e.classList.contains("hidden")||(e.dataset.shellImmersiveHidden="true",e.classList.add("hidden"));return}e.dataset.shellImmersiveHidden==="true"&&(e.classList.remove("hidden"),delete e.dataset.shellImmersiveHidden)}},Ds=(i,e)=>{i.dataset.shellImmersiveCollapsed=e?"true":"false",Fd(e),i.querySelectorAll("[data-shell-immersive-toggle]").forEach(t=>{t.setAttribute("aria-expanded",e?"false":"true"),t.setAttribute("aria-label",e?"Expand navigation":"Collapse navigation")})},Hs=new WeakMap,mo=i=>{let e=Hs.get(i);e!==void 0&&(window.clearTimeout(e),Hs.delete(i))},Ld=i=>{if(mo(i),i.dataset.shellImmersiveAvailable!=="true"||i.dataset.shellImmersiveCollapsed==="true"||!i.querySelector("[data-shell-immersive-toggle]"))return;let e=window.setTimeout(()=>{Hs.delete(i),!(i.dataset.shellImmersiveAvailable!=="true"||i.dataset.shellImmersiveCollapsed==="true")&&(Ds(i,!0),$i())},7e3);Hs.set(i,e)},Mu=()=>{let i=Od();ju().forEach(e=>{if(e.dataset.shellImmersiveAvailable=i?"true":"false",!i){mo(e),Ds(e,!1);return}Ds(e,e.dataset.shellImmersiveCollapsed==="true"),Ld(e)})},po=null,Uu=()=>{let i=window.scrollY||document.documentElement.scrollTop||0;ju().forEach(e=>{let t=e.getBoundingClientRect().height,s=Id(e),r=Math.max(0,i-s),n=-Math.min(t,r);e.style.transform=`translate3d(0, ${n}px, 0)`,e.style.pointerEvents=Math.abs(n)>=t?"none":"",e.dataset.navUnfixed=n<0?"true":"false"})},$i=()=>{po===null&&(po=window.requestAnimationFrame(()=>{po=null,Uu()}))},Vu=i=>{let e=document.getElementById("user-dropdown-menu"),t=document.getElementById("user-dropdown-chevron"),s=document.getElementById("user-dropdown-toggle");e==null||e.classList.toggle("hidden",!i),t==null||t.classList.toggle("rotate-180",i),s==null||s.setAttribute("aria-expanded",i?"true":"false")},zu=()=>{Vu(!1)},$d=()=>{let i=document.getElementById("user-dropdown-menu");Vu((i==null?void 0:i.classList.contains("hidden"))!==!1)},Wu=i=>{let e=document.getElementById("mobile-drawer"),t=document.getElementById("mobile-backdrop");e==null||e.classList.toggle("translate-x-full",!i),t==null||t.classList.toggle("opacity-0",!i),t==null||t.classList.toggle("invisible",!i),t==null||t.classList.toggle("opacity-100",i),document.body.style.overflow=i?"hidden":""},Rd=()=>{Wu(!0)},Md=()=>{Wu(!1)},Nd=i=>{let{target:e}=i;return e instanceof Element?e:e==null?void 0:e.parentElement},Dd=(i,e)=>{let t=e.closest(".email");if(!t)return;i.preventDefault();let s=document.createRange();s.selectNodeContents(t);let r=window.getSelection();r.removeAllRanges(),r.addRange(s)},Hd=i=>{let e=Nd(i);if(!e)return;let t=e.closest("[data-shell-immersive-toggle]");if(t){let r=t.closest("[data-shell-top-nav]");(r==null?void 0:r.dataset.shellImmersiveAvailable)==="true"&&(mo(r),Ds(r,r.dataset.shellImmersiveCollapsed!=="true"),$i());return}e.closest("[data-shell-user-toggle]")&&$d(),e.closest("[data-shell-mobile-open]")&&Rd(),e.closest("[data-shell-mobile-close]")&&Md();let s=document.getElementById("user-dropdown");s&&!s.contains(e)&&zu(),Dd(i,e)},Bd=i=>{i.key==="Escape"&&zu()},Nu=()=>{Ru(),Mu(),Uu(),document.addEventListener("click",Hd),document.addEventListener("keydown",Bd),window.addEventListener("scroll",$i,{passive:!0}),window.addEventListener("resize",$i),window.addEventListener("phx:navigate",()=>{Ru(),Mu(),$i()})},qd=()=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Nu,{once:!0}):Nu()},Du=()=>{let i=Array.from(document.querySelectorAll("[data-faq-target-highlights]"));if(i.length===0||window._faqTargetHighlightsInitialized)return;window._faqTargetHighlightsInitialized=!0;let e="faq-target-highlight",t=n=>{if(!n)return null;try{return document.getElementById(decodeURIComponent(n.slice(1)))}catch(o){return null}},s=n=>i.some(o=>o===n||o.contains(n)),r=()=>{document.querySelectorAll(`.${e}`).forEach(o=>{o.classList.remove(e)});let n=t(window.location.hash);!n||!s(n)||(n.classList.add(e),window.setTimeout(()=>n.classList.remove(e),2200))};window.addEventListener("hashchange",r),window.setTimeout(r,50)},jd=()=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Du,{once:!0}):Du()},vo="";Intl!=null&&Intl.DateTimeFormat&&(vo=Intl.DateTimeFormat().resolvedOptions().timeZone,document.cookie=`tz=${vo}; path=/; SameSite=Lax`);var Ms=()=>{document.querySelectorAll("[data-docs-page]").forEach(i=>
3{if(i.dataset.docsNavigationInitialized==="true")return;let e=Array.from(i.querySelectorAll("main > section[id]")),t=Array.from(i.querySelectorAll("[data-docs-toc-link]")),s=i.querySelector("[data-docs-pagination]"),r=s==null?void 0:s.querySelector("[data-docs-prev]"),n=s==null?void 0:s.querySelector("[data-docs-next]");if(e.length===0||t.length===0)return;let o=[];t.forEach(p=>{let v=p.dataset.docsTarget;v&&!o.some(f=>f.id===v)&&o.push({id:v,label:p.textContent.trim()})});let a=p=>{if(!s)return;let v=o.findIndex(y=>y.id===p),f=v>=0?o[v]:null,_=(y,w,T,x,M)=>{if(y&&(y.hidden=M,!M)){y.href=w;let N=y.querySelector("span.font-semibold.text-base-content")||y;N.textContent=T,y.setAttribute("aria-label",x)}};_(r,v>0?`#${o[v-1].id}`:"",v>0?`\u2190 ${o[v-1].label}`:"",v>0?`Previous section: ${o[v-1].label}`:"",!f||v===0),!f||v===o.length-1?_(n,"/faq","Read the FAQ","Next resource: Read the FAQ",!1):_(n,`#${o[v+1].id}`,`\u2192 ${o[v+1].label}`,`Next section: ${o[v+1].label}`,!1)},l=p=>{t.forEach(v=>{let f=v.dataset.docsTarget===p;v.dataset.active=f?"true":"false",f?v.setAttribute("aria-current","location"):v.removeAttribute("aria-current")}),a(p)},u=window.location.hash.slice(1);l(e.some(p=>p.id===u)?u:e[0].id);let h=null,c=()=>{let p=i.querySelector("main"),v=i.querySelector("[data-docs-progress]");if(!p||!v)return;let f=Math.max(1,p.getBoundingClientRect().top+window.scrollY+p.offsetHeight-window.innerHeight),_=Math.min(100,Math.max(0,window.scrollY/f*100));v.style.width=`${_}%`},d=()=>{let p=e.reduce((v,f)=>f.getBoundingClientRect().top<=120?f:v,e[0]);l(p.id),c()},g=()=>{h===null&&(h=window.setTimeout(()=>{h=null,d()},0))};window.addEventListener("scroll",g,{passive:!0}),u||window.setTimeout(d,0),c(),window.addEventListener("hashchange",g),i.addEventListener("click",p=>{let v=p.target.closest('a[href^="#"]'),f=i.querySelector("[data-docs-mobile-toc]");!v||!i.contains(v)||(window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{let _=window.location.hash.slice(1);e.some(y=>y.id===_)&&l(_),c()})}),f!=null&&f.contains(v)&&(f.open=!1))}),window.addEventListener("hashchange",()=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{let p=window.location.hash.slice(1);e.some(v=>v.id===p)&&l(p),c()})})}),i.dataset.docsNavigationInitialized="true"})},Ud=()=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ms,{once:!0}):Ms(),window.addEventListener("pageshow",Ms),window.addEventListener("phx:navigate",Ms)},Ns=()=>{document.querySelectorAll("[data-docs-copy]").forEach(i=>{i.dataset.docsCopyInitialized!=="true"&&(i.addEventListener("click",async()=>{var s,r,n,o;let e=(n=(r=(s=i.closest("[data-docs-code-block]"))==null?void 0:s.querySelector("[data-docs-code]"))==null?void 0:r.textContent)==null?void 0:n.trim(),t=i.textContent.trim()||"Copy";if(e)try{if((o=navigator.clipboard)!=null&&o.writeText)await navigator.clipboard.writeText(e);else{let a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),a.remove()}i.textContent="Copied",window.setTimeout(()=>{i.textContent=t},1800)}catch(a){i.textContent="Copy failed",window.setTimeout(()=>{i.textContent=t},1800)}}),i.dataset.docsCopyInitialized="true")})},Vd=()=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ns,{once:!0}):Ns(),window.addEventListener("pageshow",Ns),window.addEventListener("phx:navigate",Ns)},de={};de.CapturePagination={mounted(){this.loading=!1,this.eventName=this.el.dataset.event||"load_more",this.observer=new IntersectionObserver(i=>{this.loading||i.some(e=>e.isIntersecting)&&(this.loading=!0,this.pushEvent(this.eventName,{},()=>{this.loading=!1}))},{rootMargin:"400px 0px",threshold:.1}),this.observer.observe(this.el)},destroyed(){this.observer.disconnect()}};de.CaptureWorkspaceScroll={_measureArchiveCard(){var e;let i=(e=this._container)==null?void 0:e.querySelector("#capture-archive-card");i!==this._archiveCard&&(this._archiveCard=i,i&&(i.style.removeProperty("width"),i.style.removeProperty("margin-left"),this._archiveBaseWidth=i.getBoundingClientRect().width,this._archiveBaseLeft=i.getBoundingClientRect().left))},_sync(){this._animationFrame=null,this._measureArchiveCard();let i=this._reduceMotion.matches?0:Math.min(window.scrollY/280,1),e=(l,u)=>`${l+(u-l)*i}rem`,t=window.innerWidth>=640,s=window.innerWidth>=768;if(this._container.style.setProperty("--capture-title-margin",e(1.5,.75)),this._container.style.setProperty("--capture-metadata-gap",e(1,.5)),this._container.style.setProperty("--capture-metadata-margin",e(1.5,.75)),this._container.style.setProperty("--capture-tags-margin",e(2,0)),this._container.style.setProperty("--capture-headline-size",e(t?2.25:1.5,t?1.5:1.25)),this._container.style.setProperty("--capture-headline-leading",e(t?2.5:2,1.75)),this._container.style.setProperty("--capture-summary-padding",e(s?1.5:0,s?.5:0)),this._container.style.setProperty("--capture-header-bottom-margin",e(t?2:0,t?.5:0)),this._container.style.setProperty("--capture-header-bottom-padding",e(t?2:0,t?.5:0)),this._container.style.setProperty("--capture-scroll-progress",i.toFixed(3)),!this._archiveCard)return;if(i===0){this._archiveCard.style.removeProperty("width"),this._archiveCard.style.removeProperty("margin-left");return}let r=16,n=document.documentElement.clientWidth-r*2,o=this._archiveBaseWidth+(n-this._archiveBaseWidth)*i,a=(r-this._archiveBaseLeft)*i;this._archiveCard.style.width=`${o}px`,this._archiveCard.style.marginLeft=`${a}px`},_scheduleSync(){this._animationFrame===null&&(this._animationFrame=requestAnimationFrame(()=>this._sync()))},mounted(){this._container=this.el.parentElement,this._animationFrame=null,this._reduceMotion=window.matchMedia("(prefers-reduced-motion: reduce)"),this._onScroll=()=>this._scheduleSync(),this._onResize=()=>{this._archiveCard=null,this._scheduleSync()},this._onMotionChange=()=>this._scheduleSync(),window.addEventListener("scroll",this._onScroll,{passive:!0}),window.addEventListener("resize",this._onResize),this._reduceMotion.addEventListener("change",this._onMotionChange),this._scheduleSync()},updated(){this._archiveCard=null,this._scheduleSync()},destroyed(){window.removeEventListener("scroll",this._onScroll),window.removeEventListener("resize",this._onResize),this._reduceMotion.removeEventListener("change",this._onMotionChange),this._animationFrame!==null&&cancelAnimationFrame(this._animationFrame)}};de.MaximizeIframe={_updateSize(){this.el.height=`${Math.max(window.innerHeight,this._originalHeight)}px`,this.el.width=`${Math.max(window.innerWidth,this._originalWidth)}px`},mounted(){this._originalHeight=parseInt(this.el.height,10),this._originalWidth=parseInt(this.el.width,10),this._updateSize(),window.addEventListener("resize",()=>this._updateSize())}};de.LocalTime={mounted(){this.render()},updated(){this.render()},render(){let i=this.el.getAttribute("datetime");if(!i)return;let e=new Date(i);
3Number.isNaN(e.getTime())||(this.el.textContent=e.toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}};var zd=i=>i.standalone===!0||i.standalone==="true"||i.startOffset===null||i.startOffset===void 0||i.endOffset===null||i.endOffset===void 0,Bs=()=>window.location.pathname,Wd=()=>window.location.pathname.startsWith("/captures/"),Gu=()=>new URLSearchParams(window.location.search).get("highlight"),go="capture_sidebar_visible",Gd=()=>{try{return localStorage.getItem(go)==="false"?"false":"true"}catch(i){return"true"}},fo=()=>window._captureAnnotationsPath!==Bs()?{highlights:[],notes:[]}:{highlights:window._captureHighlights||[],notes:window._captureNotes||[]},Yu=(i=[])=>{let e=[],t=[];for(let s of i)if(s.type==="highlight"){let r=s.startOffset===null||s.startOffset===void 0?null:Number(s.startOffset),n=s.endOffset===null||s.endOffset===void 0?null:Number(s.endOffset);e.push({id:s.id,type:"highlight",text:s.text,startOffset:r,endOffset:n,color:s.color||"#fef08a",note:s.note||"",createdAt:s.createdAt,standalone:zd(s)})}else t.push({id:s.id,type:"note",text:s.note||s.text,createdAt:s.createdAt});return{highlights:e,notes:t}},Yd=(i=[])=>{let e=Yu(i);return window._captureAnnotationsPath=Bs(),window._captureHighlights=e.highlights,window._captureNotes=e.notes,window.dispatchEvent(new CustomEvent("highlights-updated",{detail:e})),e},qs=i=>{if(!i)return;window._pendingHighlightScroll=i;let e=window._readerviewHook;e!=null&&e.scrollToHighlight&&setTimeout(()=>{e.scrollToHighlight(i)&&(window._pendingHighlightScroll=null)},250)},Kd=document.querySelector("meta[name='csrf-token']").getAttribute("content"),Ku=new Cd("/live",Pd,{longPollFallbackMs:2500,params:()=>({_csrf_token:Kd,tz:vo,capture_sidebar_visible:Gd()}),hooks:de,metadata:{keydown:i=>({key:i.key,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey,altKey:i.altKey})},dom:{onBeforeElUpdated(i,e){i._x_dataStack&&window.Alpine.clone(i,e)}}});de.LoadReaderview={highlights:[],notes:[],captureId:null,_annotationsLoaded:!1,async loadContent(){let i=this.el.getAttribute("data-url"),e=await fetch(i);this.el.innerHTML=await e.text();let t=document.getElementById("readerview-loading");t&&(t.style.display="none"),this.renderHighlights()},renderHighlights(){this.el.querySelectorAll("mark[data-highlight-id]").forEach(e=>{let t=e.parentNode,s=document.createTextNode(e.textContent);t.replaceChild(s,e),t.normalize()}),this.highlights.filter(Rs).forEach(e=>{this.applyHighlight(e)});let i=Gu();i&&qs(i)},applyHighlight(i){try{i.element=Fu(this.el,i,{onClick:(e,t)=>{let s=t.getBoundingClientRect();this.showNotePopup(i.id,s.left,s.bottom,i.text,!0)}})}catch(e){console.warn("Could not apply highlight:",e)}},_clearSelectionTimer(){this._mouseUpTimer&&(clearTimeout(this._mouseUpTimer),this._mouseUpTimer=null)},scheduleSelectionProcess(){this._clearSelectionTimer(),this._mouseUpTimer=setTimeout(()=>{this._mouseUpTimer=null,this._processSelection()},250)},handleSelectionChange(){this.scheduleSelectionProcess()},handlePointerDown(){this._clearSelectionTimer(),this.hideSelectionToolbar()},handlePointerUp(){this.scheduleSelectionProcess()},selectionRect(i){let e=Array.from(i.getClientRects()).filter(t=>t.width>0||t.height>0);return e[e.length-1]||i.getBoundingClientRect()},showSelectionToolbar(i){let e=document.getElementById("selection-toolbar");if(!e)return;this._pendingSelection=i,this.selectionToolbar=e,e.classList.remove("hidden"),e.style.display="flex",e.style.visibility="hidden";let t=e.offsetWidth,s=e.offsetHeight,r=i.rect,n=r.left+r.width/2-t/2,o=r.top-s-8;o<8&&(o=r.bottom+8),n=Math.max(8,Math.min(n,window.innerWidth-t-8)),e.style.left=`${n}px`,e.style.top=`${o}px`,e.style.visibility=""},hideSelectionToolbar({clearNativeSelection:i=!1}={}){let e=this.selectionToolbar||document.getElementById("selection-toolbar");if(e&&(e.classList.add("hidden"),e.style.display=""),this._pendingSelection=null,i){let t=window.getSelection();t&&t.removeAllRanges()}},setupSelectionToolbar(){var e,t,s;let i=document.getElementById("selection-toolbar");i&&(this.selectionToolbar=i,this.selectionToolbarHighlightButton=document.getElementById("highlight-selection-btn"),this.selectionToolbarNoteButton=document.getElementById("note-selection-btn"),this.selectionToolbarCancelButton=document.getElementById("cancel-selection-btn"),this.boundSelectionToolbarPointerDown=r=>r.preventDefault(),this.boundSelectionToolbarMouseDown=r=>r.preventDefault(),this.boundHighlightSelectionClick=r=>{r.preventDefault(),this.createHighlightFromPendingSelection()},this.boundNoteSelectionClick=r=>{r.preventDefault(),this.createHighlightFromPendingSelection({openNote:!0})},this.boundCancelSelectionClick=r=>{r.preventDefault(),this.hideSelectionToolbar({clearNativeSelection:!0}
3)},this.boundSelectionDocumentMouseDown=r=>{!i.classList.contains("hidden")&&!i.contains(r.target)&&!this.el.contains(r.target)&&this.hideSelectionToolbar({clearNativeSelection:!0})},this.boundSelectionKeyDown=r=>{r.key==="Escape"&&this.hideSelectionToolbar({clearNativeSelection:!0})},i.addEventListener("pointerdown",this.boundSelectionToolbarPointerDown,!0),i.addEventListener("mousedown",this.boundSelectionToolbarMouseDown,!0),(e=this.selectionToolbarHighlightButton)==null||e.addEventListener("click",this.boundHighlightSelectionClick),(t=this.selectionToolbarNoteButton)==null||t.addEventListener("click",this.boundNoteSelectionClick),(s=this.selectionToolbarCancelButton)==null||s.addEventListener("click",this.boundCancelSelectionClick),document.addEventListener("mousedown",this.boundSelectionDocumentMouseDown),document.addEventListener("keydown",this.boundSelectionKeyDown))},teardownSelectionToolbar(){var e,t,s;let i=this.selectionToolbar;i&&this.boundSelectionToolbarPointerDown&&i.removeEventListener("pointerdown",this.boundSelectionToolbarPointerDown,!0),i&&this.boundSelectionToolbarMouseDown&&i.removeEventListener("mousedown",this.boundSelectionToolbarMouseDown,!0),(e=this.selectionToolbarHighlightButton)==null||e.removeEventListener("click",this.boundHighlightSelectionClick),(t=this.selectionToolbarNoteButton)==null||t.removeEventListener("click",this.boundNoteSelectionClick),(s=this.selectionToolbarCancelButton)==null||s.removeEventListener("click",this.boundCancelSelectionClick),this.boundSelectionDocumentMouseDown&&document.removeEventListener("mousedown",this.boundSelectionDocumentMouseDown),this.boundSelectionKeyDown&&document.removeEventListener("keydown",this.boundSelectionKeyDown)},createHighlightFromPendingSelection({openNote:i=!1}={}){var n;let e=this._pendingSelection;if(!e)return;let s={id:`highlight-${Date.now()}`,type:"highlight",text:e.text,startOffset:e.startOffset,endOffset:e.endOffset,color:"#fef08a",note:"",createdAt:new Date().toISOString(),standalone:!1};this.highlights.push(s),this.applyHighlight(s),this.pushEvent("save_annotation",{text:e.text,startOffset:e.startOffset,endOffset:e.endOffset,color:"#fef08a",type:"highlight"},o=>{o.id&&(s.id=o.id,o.createdAt&&(s.createdAt=o.createdAt),this.updateNotesList())});let r=((n=s.element)==null?void 0:n.getBoundingClientRect())||e.rect;this.hideSelectionToolbar({clearNativeSelection:!0}
3),i&&this.showNotePopup(s.id,r.left,r.bottom,e.text)},_processSelection(){let i=window.getSelection();if(!i||i.rangeCount===0){this.hideSelectionToolbar();return}let e=i.toString().trim();if(e.length===0||!this.el.contains(i.anchorNode)||!this.el.contains(i.focusNode)){this.hideSelectionToolbar();return}let t=i.getRangeAt(0).cloneRange(),s=this.getCharOffset(t.startContainer,t.startOffset),r=this.getCharOffset(t.endContainer,t.endOffset);if(r<=s){this.hideSelectionToolbar();return}this.showSelectionToolbar({text:e,startOffset:s,endOffset:r,rect:this.selectionRect(t)})},getCharOffset(i,e){return $u(this.el,i,e)},showNotePopup(i,e,t,s=null,r=!1){this.hideSelectionToolbar();let n=document.getElementById("note-popup"),o=document.getElementById("note-textarea"),a=document.getElementById("save-note-btn"),l=document.getElementById("cancel-note-btn"),u=document.getElementById("delete-note-btn"),h=document.getElementById("note-popup-title"),c=document.getElementById("highlighted-text-preview"),d=c.querySelector("p");if(!n)return;let g=i?this.highlights.find(x=>x.id===i):null;s?(r||(h.textContent="Add a note to this highlight"),c.classList.remove("hidden"),d.textContent=`"${s}"`):(h.textContent="Add a note",c.classList.add("hidden")),r&&g?u.classList.remove("hidden"):u.classList.add("hidden"),r&&g&&(o.value=g.note||""),n.classList.remove("hidden");let p=n.offsetWidth,v=n.offsetHeight,f=e+10,_=t;f+p>window.innerWidth-20&&(f=e-p-10,f<20&&(f=window.innerWidth-p-20)),_<8&&(_=8),_+v>window.innerHeight-8&&(_=Math.max(8,t-v-8)),n.style.left=`${f}px`,n.style.top=`${_}px`,r||(o.value=""),o.focus();let y=()=>{let x=o.value.trim();if(g)g.note=x,this.renderHighlights(),this.pushEvent("save_annotation",{id:g.id,note:x,color:g.color},()=>{});else if(x){let N={id:`note-${Date.now()}`,text:x,createdAt:new Date().toISOString()};this.notes.push(N),this.pushEvent("save_annotation",{text:x,type:"note"},P=>{P.id&&(N.id=P.id,P.createdAt&&(N.createdAt=P.createdAt),this.updateNotesList())})}this.updateNotesList(),n.classList.add("hidden")},w=()=>{g&&confirm("Delete this highlight? This can\u2019t be undone.")&&(this.deleteHighlight(g.id),n.classList.add("hidden"))},T=()=>{n.classList.add("hidden")};a.onclick=y,l.onclick=T,u.onclick=w,o.onkeydown=x=>{x.key==="Escape"?T():x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&y()}},scrollToHighlight(i){let e=this.highlights.find(t=>t.id===i);return!Rs(e)||!e.element?!1:(e.element.scrollIntoView({behavior:"smooth",block:"center"}),Lu(e.element),!0)},scrollToPendingHighlight(){let i=window._pendingHighlightScroll;i&&this.scrollToHighlight(i)&&(window._pendingHighlightScroll=null)},deleteHighlight(i){let e=this.highlights.findIndex(t=>t.id===i);e>-1&&(this.highlights.splice(e,1),this.renderHighlights(),this.updateNotesList(),this.pushEvent("delete_annotation",{id:i}))},deleteNote(i){let e=this.notes.findIndex(t=>t.id===i);e>-1&&(this.notes.splice(e,1),this.updateNotesList(),this.pushEvent("delete_annotation",{id:i}))},updateNotesList(){window._captureAnnotationsPath=Bs(),window._captureHighlights=this.highlights,window._captureNotes=this.notes;let i=new CustomEvent("highlights-updated",{detail:{highlights:this.highlights,notes:this.notes}});window.dispatchEvent(i)},async mounted(){if(this.readonly=this.el.getAttribute("data-readonly")==="true",this.readonly){await this.loadContent();return}let i=window.location.pathname.split("/"),e=i.indexOf("captures");if(e!==-1&&i[e+1]&&(this.captureId=i[e+1]),window._captureAnnotationsPath===Bs()){let t=fo();this.highlights=t.highlights,this.notes=t.notes,this._annotationsLoaded=!0}this.handleEvent("load_annotations",({annotations:t})=>{let{highlights:s,notes:r}=Yu(t);this.highlights=s,this.notes=r,this._annotationsLoaded=!0,this.el.innerHTML.trim()&&(this.renderHighlights(),this.updateNotesList(),this.scrollToPendingHighlight())}),this.boundHandleSelectionChange=this.handleSelectionChange.bind(this),this.boundHandlePointerDown=this.handlePointerDown.bind(this),this.boundHandlePointerUp=this.handlePointerUp.bind(this),window._readerviewHook=this,this.el.addEventListener("pointerdown",this.boundHandlePointerDown),this.el.addEventListener("pointerup",this.boundHandlePointerUp),this.el.addEventListener("pointercancel",this.boundHandlePointerUp),document.addEventListener("selectionchange",this.boundHandleSelectionChange),this.setupSelectionToolbar(),await this.loadContent(),this.updateNotesList(),this.scrollToPendingHighlight()},destroyed(){window._readerviewHook===this&&(window._readerviewHook=null),this._clearSelectionTimer(),this.teardownSelectionToolbar(),this.boundHandlePointerDown&&this.el.removeEventListener("pointerdown",this.boundHandlePointerDown),this.boundHandlePointerUp&&(this.el.removeEventListener("pointerup",this.boundHandlePointerUp),this.el.removeEventListener("pointercancel",this.boundHandlePointerUp)),this.boundHandleSelectionChange&&document.removeEventListener("selectionchange",this.boundHandleSelectionChange)},async updated(){await this.loadContent(),this.scrollToPendingHighlight()}};de.FocusOnMount={mounted(){this.el.focus(),this.el.select()}};de.TagForm={mounted(){this.button=this.el.querySelector("#add-tag-button"),this.form=this.el.querySelector("#add-tag-form"),this.input=this.el.querySelector("#tag-input"),this.button.addEventListener("click",()=>{this.button.classList.add("hidden"),this.form.classList.remove("hidden"),this.input.focus()}),this.input.addEventListener("blur",()=>{setTimeout(()=>{this.form.contains(document.activeElement)||(this.button.classList.remove("hidden"),this.form.classList.add("hidden"))},100)}),this.input.addEventListener("keydown",i=>{i.key==="Escape"&&(this.button.classList.remove("hidden"),this.form.classList.add("hidden"),i.preventDefault())}),this.form.addEventListener("submit",()=>{this.button.classList.remove("hidden"),this.form.classList.add("hidden")})}};de.NormalizeTagInput={mounted(){this.normalize=()=>{let i=this.el.value.replace(/\s+/g,"-");this.el.value!==i&&(this.el.value=i)},this.el.addEventListener("input",this.normalize)},destroyed(){this.el.removeEventListener("input",this.normalize)}};de.CapturePreviews={mounted(){this.initializeAlpine=i=>{i instanceof Element&&ii.initTree(i)},this.alpineObserver=new MutationObserver(i=>{for(let e of i)for(let t of e.addedNodes)this.initializeAlpine(t)}),this.alpineObserver.observe(this.el,{childList:!0,subtree:!0}),this.initializeAlpine(this.el),requestAnimationFrame(()=>this.initializeAlpine(this.el)),this.renderBlurhash=i=>{if(!(!i||i.dataset.blurhashRendered==="true"))try{let e=i.width||32,t=i.height||24,s=Td(i.dataset.blurhash,e,t),r=i.getContext("2d"),n=r.createImageData(e,t);n.data.set(s),r.putImageData(n,0,0),i.dataset.blurhashRendered="true"}catch(e){i.dataset.blurhashRendered="true"}},this.loadDeferredScreenshot=i=>{if(window.matchMedia("(min-width: 768px)").matches===!1)return;let e=i instanceof Element?i:i instanceof Node?i.parentElement:null;if(!e)return;let t=e.closest("[data-capture-preview-trigger]");if(!t||!this.el.contains(t))return;let s=t.closest("li[data-capture-id]");if(!s||!this.el.contains(s))return;let r=s.querySelector("canvas[data-blurhash]");this.renderBlurhash(r);let n=s.querySelector("img[data-capture-image][data-src]");n&&(n.src=n.dataset.src,delete n.dataset.src)},this.handleDeferredScreenshotTrigger=i=>{this.loadDeferredScreenshot(i.target)},this.el.addEventListener("mouseover",this.handleDeferredScreenshotTrigger,!0),this.el.addEventListener("focusin",this.handleDeferredScreenshotTrigger,!0)},destroyed(){this.alpineObserver.disconnect(),this.el.removeEventListener("mouseover",this.handleDeferredScreenshotTrigger,!0),this.el.removeEventListener("focusin",this.handleDeferredScreenshotTrigger,!0)}};de.HighlightsPanel={mounted(){this.renderList=({highlights:i=[],notes:e=[]}={})=>{let t=this.el.querySelector("[data-highlights-list]");if(!t)return;if(i.length===0&&e.length===0){let r=!!this.el.querySelector("[data-add-note-btn]");t.innerHTML=`
4          <p class="text-xs text-base-content/50 italic">
5            ${r?"Select some text to add a highlight":"No highlights yet"}
6          </p>
7        `;return}let s=[...i.map(r=>Ws(ri({},r),{type:"highlight"})),...e.map(r=>Ws(ri({},r),{type:"note"}))].sort((r,n)=>new Date(n.createdAt)-new Date(r.createdAt));t.innerHTML=s.map(r=>{if(r.type==="highlight"){let n=Rs(r);return`
8            <div class="border-l-4 border-warning pl-2 py-1 group relative ${n?"cursor-pointer hover:bg-base-200":""}"
9                 data-item-id="${r.id}"
10                 data-item-type="highlight"
11                 data-can-scroll="${n}"
12                 ${n?'title="Open highlight in reader view"':""}>
13              <button
14                class="delete-item absolute top-1 right-1 opacity-0 group-hover:opacity-100 text-base-content/40 hover:text-error transition-opacity"
15                data-item-id="${r.id}"
16                data-item-type="highlight"
17                title="Remove highlight"
18              >
19                <svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
20                  <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
21                </svg>
22              </button>
23              <p class="text-xs text-base-content font-medium line-clamp-2">
24                "${r.text||""}"
25              </p>
26              ${r.note?`
27                <p class="text-xs text-base-content/60 mt-1 italic">
28                  ${r.note}
29                </p>
30              `:""}
31              <p class="text-[10px] text-base-content/25 mt-1 opacity-0 group-hover:opacity-100 transition-opacity text-right">
32                ${new Date(r.createdAt).toLocaleString()}
33              </p>
34            </div>
35          `}else return`
36            <div class="border-l-4 border-accent-700 pl-2 py-1 group relative">
37              <div class="flex items-start justify-between gap-1 mb-1">
38                <span class="text-xs font-semibold text-accent-700">NOTE</span>
39                <button
40                  class="delete-item opacity-0 group-hover:opacity-100 text-base-content/40 hover:text-error transition-opacity"
41                  data-item-id="${r.id}"
42                  data-item-type="note"
43                  title="Remove note"
44                >
45                  <svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
46                    <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
47                  </svg>
48                </button>
49              </div>
50              <p class="text-xs text-base-content/70">
51                ${r.text||""}
52              </p>
53              <p class="text-xs text-base-content/40 mt-1">
54                ${new Date(r.createdAt).toLocaleString()}
55              </p>
56            </div>
57          `}).join(""),t.querySelectorAll('[data-item-type="highlight"][data-can-scroll="true"]').forEach(r=>{r.addEventListener("click",n=>{var l;if(n.target.closest(".delete-item"))return;let o=r.dataset.itemId,a=window._readerviewHook;(l=a==null?void 0:a.scrollToHighlight)!=null&&l.call(a,o)||(qs(o),this.pushEvent("show_highlight",{id:o}))})}),t.querySelectorAll(".delete-item").forEach(r=>{r.addEventListener("click",n=>{n.stopPropagation();let o=r.dataset.itemId,a=r.dataset.itemType,l=window._readerviewHook;l&&(a==="highlight"?l.deleteHighlight(o):l.deleteNote(o))})})},this.updateList=i=>this.renderList(i.detail||{}),this.handleAddNote=()=>{let i=window._readerviewHook;if(i!=null&&i.showNotePopup){let e=window.innerWidth/2-160,t=100;i.showNotePopup(null,e,t,null)}},this.bindAddNoteButton=()=>{let i=this.el.querySelector("[data-add-note-btn]");this.addNoteBtn!==i&&(this.addNoteBtn&&this.handleAddNote&&this.addNoteBtn.removeEventListener("click",this.handleAddNote),this.addNoteBtn=i,this.addNoteBtn&&this.addNoteBtn.addEventListener("click",this.handleAddNote))},this.bindAddNoteButton(),window.addEventListener("highlights-updated",this.updateList),this.renderList(fo())},updated(){this.bindAddNoteButton&&this.bindAddNoteButton(),this.renderList&&this.renderList(fo())},destroyed(){this.updateList&&window.removeEventListener("highlights-updated",this.updateList),this.addNoteBtn&&this.handleAddNote&&this.addNoteBtn.removeEventListener("click",this.handleAddNote)}};de.SidebarDismiss={mounted(){this.onDocumentClick=i=>{this.el.inert||!this.isDisplayed()||this.el.contains(i.target)||this.pushEvent("toggle_sidebar",{})},document.addEventListener("click",this.onDocumentClick)},isDisplayed(){return typeof this.el.checkVisibility=="function"?this.el.checkVisibility():this.el.offsetParent!==null},destroyed(){document.removeEventListener("click",this.onDocumentClick)}};de.SelectOnClick={mounted(){this.el.addEventListener("click",()=>{this.el.select(),navigator.clipboard.writeText(this.el.value).then(()=>{})})}};de.ScrollToBottom={mounted(){this.scrollToBottom()},updated(){this.scrollToBottom()},scrollToBottom(){this.el.scrollTop=this.el.scrollHeight}};de.CtrlEnterSubmit={mounted(){this.el.addEventListener("keydown",i=>{if((i.ctrlKey||i.metaKey)&&i.key==="Enter"){i.preventDefault();let e=this.el.closest("form");e&&e.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}}),this.handleEvent("clear-textarea",({id:i})=>{this.el.id===i&&(this.el.value="")}
57)}};de.NavbarIdentity={mounted(){this.handleEvent("update_navbar_identity",({value:i})=>{let e=this.el;e.style.transition="opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 1, 1)",e.style.opacity="0",e.style.transform="translateY(-20px) scale(0.8)",setTimeout(()=>{e.textContent=i,e.style.transition="none",e.style.transform="translateY(30px) scale(0.7)",e.style.opacity="0",requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition="opacity 0.5s ease, transform 0.9s cubic-bezier(0.34, 1.9, 0.64, 1), color 0.1s ease",e.style.opacity="1",e.style.transform="translateY(0) scale(1)",e.style.color="#fb923c",setTimeout(()=>{e.style.transition+=", color 0.8s ease",e.style.color=""},400)})})},350)})}};de.CopyToClipboard={mounted(){this.el.addEventListener("click",()=>{let i=this.el.dataset.copy;i&&navigator.clipboard.writeText(i).then(()=>{this.el.textContent="\u2705"})})}};var js=new WeakMap,Us=new WeakMap,Zd=i=>{let e=i.getAttribute("datetime");if(!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},Qd=i=>{let e=Zd(i);if(e===null)return;let t=e-Date.now();if(t<=0){i.textContent="expired";return}let s=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);i.textContent=s>0?`in ${s}h ${r}m`:`in ${r}m`},Jd=i=>{if(js.has(i))return;let e=()=>Qd(i);e(),js.set(i,setInterval(e,6e4))},Xd=i=>{let e=js.get(i);e&&(clearInterval(e),js.delete(i))},Hu=i=>{typeof i.select=="function"&&i.select(),typeof i.setSelectionRange=="function"&&i.setSelectionRange(0,i.value.length)},ep=i=>{var t;if(!i)return Promise.resolve();if((t=navigator.clipboard)!=null&&t.writeText)return navigator.clipboard.writeText(i);let e=document.createElement("textarea");e.value=i,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")}finally{e.remove()}return Promise.resolve()},tp=(i,e)=>{let t=e.target instanceof Element?e.target:null;if(!t)return;let s=t.closest("[data-share-dismiss-target]");if(s&&i.contains(s)){let o=document.getElementById(s.dataset.shareDismissTarget);o&&o.classList.add("hidden");return}let r=t.closest("[data-share-copy-target]");if(r&&i.contains(r)){let o=document.getElementById(r.dataset.shareCopyTarget);if(!o)return;Hu(o),ep(o.value).catch(()=>{});return}let n=t.closest("[data-share-select]");n&&i.contains(n)&&Hu(n)},Zu=i=>{if(Us.has(i))return;i.querySelectorAll("[data-share-expiry]").forEach(Jd);let e=t=>tp(i,t);i.addEventListener("click",e),Us.set(i,()=>{i.removeEventListener("click",e),i.querySelectorAll("[data-share-expiry]").forEach(Xd)})},ip=i=>{let e=Us.get(i);e&&(e(),Us.delete(i))},Bu=()=>{document.querySelectorAll("[data-archive-share-viewer]").forEach(Zu)},sp=()=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bu,{once:!0}):Bu()};de.ArchiveShareViewer={mounted(){Zu(this.el)},destroyed(){ip(this.el)}};var rp=i=>{let t=new DOMParser().parseFromString(i,"text/html"),s=r=>{var a;if(r.nodeType===Node.TEXT_NODE)return r.textContent;if(r.nodeType!==Node.ELEMENT_NODE)return"";let n=r.tagName.toLowerCase(),o=Array.from(r.childNodes).map(s).join("");switch(n){case"h1":return`# ${o}
58
59`;case"h2":return`## ${o}
60
61`;case"h3":return`### ${o}
62
63`;case"h4":return`#### ${o}
64
65`;case"h5":return`##### ${o}
66
67`;case"h6":return`###### ${o}
68
69`;case"p":return`${o}
70
71`;case"br":return`
72`;case"strong":case"b":return`**${o}**`;case"em":case"i":return`*${o}*`;case"code":return`\`${o}\``;case"pre":return`\`\`\`
73${o}
74\`\`\`
75
76`;case"a":{let l=r.getAttribute("href")||"";return o===l?l:`[${o}](${l})`}case"img":{let l=r.getAttribute("alt")||"",u=r.getAttribute("src")||"";return`![${l}](${u})`}case"ul":case"ol":return o;case"li":return`${((a=r.parentNode)==null?void 0:a.tagName.toLowerCase())==="ol"?"1.":"-"} ${o}
77`;case"blockquote":return`> ${o.replace(/\n/g,"> ")}
78
79`;case"hr":return`---
80
81`;case"table":return o;case"tr":return o;case"td":case"th":return`${o} | `;case"div":case"span":case"section":case"article":case"main":return o;case"mark":return`**${o}**`;default:return o}};return Array.from(t.body.childNodes).map(s).join("").trim()};de.ExportMarkdown={mounted(){this.el.addEventListener("click",i=>{i.preventDefault();let e=this.el.getAttribute("data-readerview-url"),t=this.el.getAttribute("data-capture-title")||"capture";if(!e){console.error("No readerview URL found");return}fetch(e).then(s=>{if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.text()}).then(s=>{let r=rp(s),n=`${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,o=new Blob([r],{type:"text/markdown;charset=utf-8"}),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=n,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}).catch(s=>{console.error("Error exporting markdown:",s)})})}};de.RootHook={mounted(){let i=Wd(),e=i?Gu():null;if(e&&qs(e),i)if(localStorage.getItem(go)==="false"&&this.pushEvent("set_sidebar_visibility",{visible:!1}),e)this.pushEvent("show_highlight",{id:e});else{let s=localStorage.getItem("capture_mode");(s==="archive"||s==="text")&&this.pushEvent("set_capture_mode",{mode:s})}this.handleEvent("capture_mode_changed",({mode:t})=>{localStorage.setItem("capture_mode",t),localStorage.setItem(go,visible?"true":"false")}),this.handleEvent("load_annotations",({annotations:t})=>{Yd(t)}),this.handleEvent("scroll_to_highlight",({id:t})=>{qs(t)}),this.handleEvent("scroll_after_delete",({next_dom_id:t})=>{setTimeout(t?()=>{let s=document.getElementById(t);if(s){let n=s.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:n-20,behavior:"smooth"}),document.activeElement&&document.activeElement.blur()}}:()=>{let s=document.querySelector(".text-center.text-gray-500");if(s){let n=s.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:n-20,behavior:"smooth"}),document.activeElement&&document.activeElement.blur()}},100)})},destroyed(){document.body.classList.remove("overflow-hidden")}};qd();jd();sp();Ud();Vd();ii.start();_o.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",i=>_o.show(700));window.addEventListener("phx:page-loading-stop",i=>_o.hide());Ku.connect();window.liveSocket=Ku;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.