posthog-js 1.386.1 → 1.386.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var r="1.386.1",n={DEBUG:!1,LIB_VERSION:r,LIB_NAME:"web",JS_SDK_VERSION:r},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",c="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",_="$exception_capture_enabled_server_side",h="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",v="$dead_clicks_enabled_server_side",f="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",S="$replay_override_url_trigger",E="$replay_override_event_trigger",k="$sesid",P="$session_is_sampled",I="$enabled_feature_flags",C="$active_feature_flags",F="$early_access_features",T="$feature_flag_details",R="$feature_flag_payloads",L="$feature_flag_request_id",M="$override_feature_flags",O="$override_feature_flag_payloads",A="$stored_person_properties",D="$stored_group_properties",q="$surveys",H="$surveys_loaded_at",z="$surveys_activated",N="ph_product_tours",j="$flag_call_reported",B="$flag_call_reported_session_id",U="$feature_flag_errors",W="$feature_flag_evaluated_at",V="$user_state",G="$client_session_props",K="$capture_rate_limit",J="$initial_campaign_params",Y="$initial_referrer_info",X="$initial_person_info",Q="$epp",Z="__POSTHOG_TOOLBAR__",ee="$posthog_cookieless",te="$sdk_debug_extensions_init_method",ie="$sdk_debug_extensions_init_time_ms",se="$sdk_debug_recording_script_not_loaded",re="PostHog loadExternalDependency extension not found.",ne="on_reject",oe="always",ae="anonymous",le="identified",ue="identified_only",ce="visibilitychange",de="beforeunload",_e="$pageview",he="$pageleave",pe="$identify",ge="$groupidentify",ve="undefined"!=typeof window?window:void 0,fe="undefined"!=typeof globalThis?globalThis:ve;"undefined"==typeof self&&(fe.self=fe),"undefined"==typeof File&&(fe.File=function(){});var me,ye=null==fe?void 0:fe.navigator,be=null==fe?void 0:fe.document,we=null==fe?void 0:fe.location,xe=null==fe?void 0:fe.fetch,Se=null!=fe&&fe.XMLHttpRequest&&"withCredentials"in new fe.XMLHttpRequest?fe.XMLHttpRequest:void 0,Ee=null==fe?void 0:fe.AbortController,ke=null==fe?void 0:fe.CompressionStream,Pe=null==ye?void 0:ye.userAgent,Ie=null!=ve?ve:{},Ce=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Fe=["$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"],Te="NativeGzipValidationError",Re=e=>e.length>=2&&31===e[0]&&139===e[1],Le=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),$e=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Te,t},Me=function(){var e=t((function*(e,t){18>e.size&&$e("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Re(i)&&8===i[2]||$e("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(me)return me;me=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;me[e]=t>>>0}return me})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&$e("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&$e("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function Oe(){return Oe=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield Me(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),Oe.apply(this,arguments)}var Ae=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],De=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Ae.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function qe(e,t){return-1!==e.indexOf(t)}var He=function(e){return e.trim()},ze=function(e){return e.replace(/^\$/,"")},Ne=Object.prototype,je=Ne.hasOwnProperty,Be=Ne.toString,Ue=Array.isArray||function(e){return"[object Array]"===Be.call(e)},We=e=>"function"==typeof e,Ve=e=>e===Object(e)&&!Ue(e),Ge=e=>{if(Ve(e)){for(var t in e)if(je.call(e,t))return!1;return!0}return!1},Ke=e=>void 0===e,Je=e=>"[object String]"==Be.call(e),Ye=e=>Je(e)&&0===e.trim().length,Xe=e=>null===e,Qe=e=>Ke(e)||Xe(e),Ze=e=>"[object Number]"==Be.call(e)&&e==e,et=e=>Ze(e)&&e>0,tt=e=>"[object Boolean]"===Be.call(e),it=e=>e instanceof FormData,st=e=>qe(Fe,e);function rt(e){return null===e||"object"!=typeof e}function nt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function ot(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var at=[!0,"true",1,"1","yes"],lt=e=>qe(at,e),ut=[!1,"false",0,"0","no"];function ct(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ze(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ct(r||i,t,i,s))}class dt{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ct(e.bucketSize,0,100,e._logger),this._refillRate=ct(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ct(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this._buckets[s];return r?this._applyRefill(r,i):this._buckets[s]=r={tokens:this._bucketSize,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===r.tokens)}stop(){this._buckets={}}}var _t,ht,pt,gt="Mobile",vt="iOS",ft="Android",mt="Tablet",yt=ft+" "+mt,bt="iPad",wt="Apple",xt=wt+" Watch",St="Safari",Et="BlackBerry",kt="Samsung",Pt=kt+"Browser",It=kt+" Internet",Ct="Chrome",Ft=Ct+" OS",Tt=Ct+" "+vt,Rt="Internet Explorer",Lt=Rt+" "+gt,$t="Opera",Mt=$t+" Mini",Ot="Edge",At="Microsoft "+Ot,Dt="Firefox",qt=Dt+" "+vt,Ht="Nintendo",zt="PlayStation",Nt="Xbox",jt=ft+" "+gt,Bt=gt+" "+St,Ut="Windows",Wt=Ut+" Phone",Vt="Nokia",Gt="Ouya",Kt="Generic",Jt=Kt+" "+gt.toLowerCase(),Yt=Kt+" "+mt.toLowerCase(),Xt="Konqueror",Qt="Oculus Browser",Zt="Vivaldi",ei="Yandex",ti="Whale",ii="DuckDuckGo",si="Pale Moon",ri="Waterfox",ni="Brave",oi="Google Search App",ai="(\\d+(\\.\\d+)?)",li=new RegExp("Version/"+ai),ui=new RegExp(Nt,"i"),ci=new RegExp(zt+" \\w+","i"),di=new RegExp(Ht+" \\w+","i"),_i=new RegExp(Et+"|PlayBook|BB10","i"),hi={"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"},pi=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?ni:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&qe(e,"GSA/")?oi:qe(e," OPR/")&&qe(e,"Mini")?Mt:qe(e," OPR/")?$t:_i.test(e)?Et:qe(e,"IE"+gt)||qe(e,"WPDesktop")?Lt:qe(e,"OculusBrowser")?Qt:qe(e,Pt)?It:qe(e,Ot)||qe(e,"Edg/")?At:qe(e,Zt+"/")?Zt:qe(e,"YaBrowser/")?ei:qe(e,ti+"/")?ti:qe(e,ii+"/")||qe(e,"Ddg/")?ii:qe(e,"FBIOS")?"Facebook "+gt:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?Tt:qe(e,"CrMo")||qe(e,Ct)?Ct:qe(e,ft)&&qe(e,St)?jt:qe(e,"FxiOS")?qt:qe(e.toLowerCase(),Xt.toLowerCase())?Xt:qe(e,ni+"/")?ni:((e,t)=>t&&qe(t,wt)||function(e){return qe(e,St)&&!qe(e,Ct)&&!qe(e,ft)}(e))(e,t)?qe(e,gt)?Bt:St:qe(e,"PaleMoon/")?si:qe(e,ri+"/")?ri:qe(e,Dt)?Dt:qe(e,"MSIE")||qe(e,"Trident/")?Rt:qe(e,"Gecko")?Dt:"")},gi={[Lt]:[new RegExp("rv:"+ai)],[At]:[new RegExp(Ot+"?\\/"+ai)],[Ct]:[new RegExp("("+Ct+"|CrMo)\\/"+ai)],[Tt]:[new RegExp("CriOS\\/"+ai)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ai)],[St]:[li],[Bt]:[li],[$t]:[new RegExp("(Opera|OPR)\\/"+ai)],[Dt]:[new RegExp(Dt+"\\/"+ai)],[qt]:[new RegExp("FxiOS\\/"+ai)],[Xt]:[new RegExp("Konqueror[:/]?"+ai,"i")],[Et]:[new RegExp(Et+" "+ai),li],[jt]:[new RegExp("android\\s"+ai,"i")],[It]:[new RegExp(Pt+"\\/"+ai)],[Qt]:[new RegExp("OculusBrowser\\/"+ai)],[Zt]:[new RegExp(Zt+"\\/"+ai)],[ei]:[new RegExp("YaBrowser\\/"+ai)],[ti]:[new RegExp(ti+"\\/"+ai)],[ni]:[new RegExp(ni+"\\/"+ai)],[ii]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ai)],[si]:[new RegExp("PaleMoon\\/"+ai)],[ri]:[new RegExp(ri+"\\/"+ai)],[oi]:[new RegExp("GSA\\/"+ai)],[Rt]:[new RegExp("(rv:|MSIE )"+ai)],Mozilla:[new RegExp("rv:"+ai)]},vi=function(e,t,i,s){var r=pi(e,t,i,s),n=gi[r];if(Ke(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},fi=[[new RegExp(Nt+"; "+Nt+" (.*?)[);]","i"),e=>[Nt,e&&e[1]||""]],[new RegExp(Ht,"i"),[Ht,""]],[new RegExp(zt,"i"),[zt,""]],[_i,[Et,""]],[new RegExp(Ut,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Wt,""];if(new RegExp(gt).test(t)&&!/IEMobile\b/.test(t))return[Ut+" "+gt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=hi[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Ut,s]}return[Ut,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[vt,[e[3],e[4],e[5]||"0"].join(".")]:[vt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ke(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ft+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ft+")","i"),e=>e&&e[2]?[ft,[e[2],e[3],e[4]||"0"].join(".")]:[ft,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ft,""]],[/Linux|debian/i,["Linux",""]]],mi=function(e){return di.test(e)?Ht:ci.test(e)?zt:ui.test(e)?Nt:new RegExp(Gt,"i").test(e)?Gt:new RegExp("("+Wt+"|WPDesktop)","i").test(e)?Wt:/iPad/.test(e)?bt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?xt:_i.test(e)?Et:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Vt,"i").test(e)?Vt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(gt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ft:yt:new RegExp("(pda|"+gt+")","i").test(e)?Jt:new RegExp(mt,"i").test(e)&&!new RegExp(mt+" pc","i").test(e)?Yt:""},yi=e=>e instanceof Error,bi={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}},wi=bi.info;function xi(e){if(tt(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Ue(e))return{arrayValue:{values:e.map((e=>xi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function Si(e){var t=[];for(var i in e){var s=e[i];Xe(s)||Ke(s)||t.push({key:i,value:xi(s)})}return t}function Ei(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return pt&&i.length===ht||(ht=i.length,pt=i.reduce(((i,s)=>{_t||(_t={});var r=_t[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,_t[s]=[l,u];break}}return i}),{})),pt}}class ki{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Ue(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var i=this;return t((function*(){var t=e;for(var s of i.modifiers)t=yield s(t);return t}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:null!==(s=t.type)&&void 0!==s?s:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Ei(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,s){void 0===s&&(s=0);var r=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return i({},t,{syntheticException:0==s?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,s),next:e=>r(e,s+1)})}}var Pi="?";function Ii(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Pi:i,in_app:!0};return Ke(s)||(n.lineno=s),Ke(r)||(n.colno=r),n}var Ci=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:Pi,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Fi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ti=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ri=/\((\S*)(?::(\d+))(?::(\d+))\)/,Li=(e,t)=>{var i=Fi.exec(e);if(i){var[,s,r,n]=i;return Ii(t,s,Pi,+r,+n)}var o=Ti.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Ri.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Ci(o[1]||Pi,o[2]);return Ii(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},$i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Mi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oi=(e,t)=>{var i=$i.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Mi.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||Pi;return[n,r]=Ci(n,r),Ii(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ai=/\(error: (.*)\)/;class Di{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Je(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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 nt(e,"DOMException")}isDOMError(e){return nt(e,"DOMError")}}class qi{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class Hi{constructor(){}match(e){return nt(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ni{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(zi);return s&&(t=s[1],i=s[2]),[t,i]}}var ji=["fatal","error","warning","log","info","debug"];function Bi(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class Ui{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ot(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Bi(e)}isSeverityLevel(e){return Je(e)&&!Ye(e)&&ji.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(yi(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Wi{match(e){return ot(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Bi(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Vi{match(e){return rt(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Gi{match(e){return nt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ot(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return rt(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Ki="$message",Ji="$timestamp",Yi=new Set([Ki,Ji]),Xi={enabled:!0,max_bytes:32768};function Qi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Xi.enabled,max_bytes:es(e.max_bytes,Xi.max_bytes)}:i({},Xi)}class Zi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Qi(e)}setConfig(e){this._config=Qi(e),this._trimToMaxBytes()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(t.has(i))return"[Circular]";t.add(i)}return i}}))}catch(e){return}}(e);if(t)try{var i=JSON.parse(t);if(!Ve(i))return;var s=i,r=s[Ki],n=s[Ji];if(!Je(r)||0===r.trim().length)return;if(!Je(n)&&!Ze(n))return;return{step:s,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function es(e,t){if(!Ze(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var ts=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(ve&&(n.DEBUG||Ie.POSTHOG_DEBUG||i)&&!Ke(ve.console)&&ve.console){for(var s=("__rrweb_original__"in ve.console[t]?ve.console[t].__rrweb_original__:ve.console[t]),r=arguments.length,o=new Array(r>1?r-1:0),a=1;r>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ts(e+" "+t,i)};return s},is=ts("[PostHog.js]"),ss=is.createLogger;function rs(e,t){Ue(e)&&e.forEach(t)}function ns(e,t){if(!Qe(e))if(Ue(e))e.forEach(t);else if(it(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)je.call(e,i)&&t(e[i],i)}var os=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function as(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ls=function(e){try{return e()}catch(e){return}},us=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){is.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),is.critical(e)}}},cs=function(e){var t={};return ns(e,(function(e,i){(Je(e)&&e.length>0||Ze(e))&&(t[i]=e)})),t};var ds=["herokuapp.com","vercel.app","netlify.app"];function _s(e){var t=null==e?void 0:e.hostname;if(!Je(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ds)if(i===s)return!1;return!0}function hs(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function ps(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ze(e)&&isFinite(e)&&Math.floor(e)===e});class gs{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new gs(r)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gs(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class vs{constructor(){this._timestamp=0,this._counter=0,this._random=new ys}generate(){var e=this.generateOrAbort();if(Ke(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ke(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return gs.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var fs,ms=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ve&&!Ke(ve.crypto)&&crypto.getRandomValues&&(ms=e=>crypto.getRandomValues(e));class ys{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(ms(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var bs=()=>ws().toString(),ws=()=>(fs||(fs=new vs)).generate(),xs="",Ss=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Es={_is_supported:()=>!!be,_error(e){is.error("cookieStore error: "+e)},_get(e){if(be){try{for(var t=e+"=",i=be.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(Es._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!be)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=be),xs)return xs;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+bs();!xs&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",xs=n)}return xs}(e);if(!i){var s=(e=>{var t=e.match(Ss);return t?t[0]:""})(e);s!==i&&is.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(be.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&is.warn("cookieStore warning: large cookie, len="+u.length),be.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=be&&be.cookie)try{Es._set(e,"",-1,t)}catch(e){return}}},ks=null,Ps={_is_supported(){if(!Xe(ks))return ks;var e=!0;if(Ke(ve))e=!1;else try{var t="__mplssupport__";Ps._set(t,"xyz"),'"xyz"'!==Ps._get(t)&&(e=!1),Ps._remove(t)}catch(t){e=!1}return e||is.error("localStorage unsupported; falling back to cookie store"),ks=e,e},_error(e){is.error("localStorage error: "+e)},_get(e){try{return null==ve?void 0:ve.localStorage.getItem(e)}catch(e){Ps._error(e)}return null},_parse(e){try{return JSON.parse(Ps._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ve||ve.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ps._error(e)}return!1},_remove(e){try{null==ve||ve.localStorage.removeItem(e)}catch(e){Ps._error(e)}}},Is=[a,"distinct_id",k,P,Q,X,V],Cs={},Fs={_is_supported:()=>!0,_error(e){is.error("memoryStorage error: "+e)},_get:e=>Cs[e]||null,_parse:e=>Cs[e]||null,_set:(e,t)=>(Cs[e]=t,!0),_remove(e){delete Cs[e]}},Ts=null,Rs={_is_supported(){if(!Xe(Ts))return Ts;if(Ts=!0,Ke(ve))Ts=!1;else try{var e="__support__";Rs._set(e,"xyz"),'"xyz"'!==Rs._get(e)&&(Ts=!1),Rs._remove(e)}catch(e){Ts=!1}return Ts},_error(e){is.error("sessionStorage error: ",e)},_get(e){try{return null==ve?void 0:ve.sessionStorage.getItem(e)}catch(e){Rs._error(e)}return null},_parse(e){try{return JSON.parse(Rs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ve||ve.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Rs._error(e)}return!1},_remove(e){try{null==ve||ve.sessionStorage.removeItem(e)}catch(e){Rs._error(e)}}};class Ls{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===oe||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===ne}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return lt(e)?1:qe(ut,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ps:Es;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?Es:Ps;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(lt(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==ye?void 0:ye.doNotTrack,null==ye?void 0:ye.msDoNotTrack,Ie.doNotTrack].some((e=>lt(e)))}}var $s=1,Ms=3,Os=11;function As(e){return e instanceof Element&&(e.id===Z||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ds(e){return!!e&&e.nodeType===$s}function qs(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Hs(e){return!!e&&e.nodeType===Ms}function zs(e){return!!e&&e.nodeType===Os&&Ds(e.host)}function Ns(e){return e?He(e).split(/\s+/):[]}function js(e){var t=null==ve?void 0:ve.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Bs(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ns(t)}function Us(e){return Qe(e)?null:He(e).split(/(\s+)/).filter((e=>_r(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ws(e){var t="";return rr(e)&&!nr(e)&&e.childNodes&&e.childNodes.length&&ns(e.childNodes,(function(e){var i;Hs(e)&&e.textContent&&(t+=null!==(i=Us(e.textContent))&&void 0!==i?i:"")})),He(t)}function Vs(e){return Ke(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Gs=["a","button","form","input","select","textarea","label"];function Ks(e,t){if(Ke(t))return!0;var i,s=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function Js(e){var t=e.parentNode;return!(!t||!Ds(t))&&t}var Ys=["next","previous","prev",">","<"],Xs=[...Ys,"+","-","−","–"],Qs=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Zs=[".ph-no-rageclick",".ph-no-capture"],er=["","text","search","email","password","url","tel","number"];function tr(e,t){if(!ve||ir(e))return!1;var i,s,r,n,o;if(tt(t)?(i=!!t&&Zs,s=void 0,r=!1):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Zs,s=null==t?void 0:t.content_ignorelist,r=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(r&&function(e){return!(!e||!Ds(e))&&(!!qs(e,"textarea")||(qs(e,"input")?qe(er,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var{targetElementList:a}=sr(e,!1);return!function(e,t){if(!1===e||Ke(e))return!1;var i;if(!0===e)i=Ys;else{if(!Ue(e))return!1;if(e.length>10)return is.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:s}=e;return i.some((e=>Qs(t,e)||Qs(s,e)))}))}(s,a.map((e=>{var t;return{safeText:Ws(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Ks(a,i)}var ir=e=>!e||qs(e,"html")||!Ds(e),sr=(e,t)=>{if(!ve||ir(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!qs(r,"body");)if(zs(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Js(r);if(!n)break;if(t||Gs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=ve.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function rr(e){for(var t=e;t.parentNode&&!qs(t,"body");t=t.parentNode){var i=Bs(t);if(qe(i,"ph-sensitive")||qe(i,"ph-no-capture"))return!1}if(qe(Bs(e),"ph-include"))return!0;var s=e.type||"";if(Je(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Je(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function nr(e){return!!(qs(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||qs(e,"select")||qs(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var or="(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})",ar=new RegExp("^(?:"+or+")$"),lr=new RegExp(or),ur="\\d{3}-?\\d{2}-?\\d{4}",cr=new RegExp("^("+ur+")$"),dr=new RegExp("("+ur+")");function _r(e,t){if(void 0===t&&(t=!0),Qe(e))return!1;if(Je(e)){if(e=He(e),(t?ar:lr).test((e||"").replace(/[- ]/g,"")))return!1;if((t?cr:dr).test(e))return!1}return!0}function hr(e){var t=Ws(e);return _r(t=(t+" "+pr(e)).trim())?t:""}function pr(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ns(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Ws(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+pr(e)).trim())}catch(e){is.error("[AutoCapture]",e)}})),t}function gr(e){return e.replace(/"|\\"/g,'\\"')}function vr(e){var t=e.attr__class;return t?Ue(t)?t:Ns(t):void 0}var fr=ss("[Dead Clicks]"),mr=()=>!0,yr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return tt(s)?s:!!Ve(s)||i};class br{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[v]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?fr.error("failed to load script",t):e()}))}_start(){var e;if(be){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Ie.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Ve(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ie.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(be),fr.info("starting...")}}else fr.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,fr.info("stopping..."))}}var wr=ss("[SegmentIntegration]");var xr="posthog-js";function Sr(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,_;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=g[0])?void 0:_.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Er{constructor(e,t,i,s,r,n){this.name=xr,this.setupOnce=function(o){o(Sr(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class kr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(is.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==ve?void 0:ve.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Ke(n)||Ke(o)||Ke(a)||Ke(l)||Ke(u)||Ke(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ct(o/n,0,1,is):1,_=n>1?ct(a/n,0,1,is):1,h=l>1?ct(u/l,0,1,is):1,p=l>1?ct(c/l,0,1,is):1;s=os(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var Pr=["flags","surveys"],Ir={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[c]:{exposure:"event"},[d]:{exposure:"hidden"},[_]:{exposure:"event"},[h]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[v]:{exposure:"event"},[f]:{exposure:"hidden"},[m]:{exposure:"event"},[y]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[P]:{exposure:"event"},[b]:{exposure:"event",shouldSkipFromEventProperties:e=>Xe(e)},$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"},[I]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ve(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[C]:{exposure:"event",storageGroup:"flags"},[F]:{exposure:"hidden"},[T]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"event",storageGroup:"flags"},[L]:{exposure:"event",storageGroup:"flags"},[M]:{exposure:"event"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys"},[z]:{exposure:"event"},[N]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[j]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[te]:{exposure:"event"},[ie]:{exposure:"event"},[se]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Cr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Fr=e=>{var t=Ir[e];if(t)return t;for(var[i,s]of Cr)if(0===e.indexOf(i))return s},Tr=e=>{var t=null==be?void 0:be.createElement("a");return Ke(t)?null:(t.href=e,t)},Rr=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!Ue(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){is.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Lr=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ue(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},$r=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Mr="https?://(.*)",Or=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Or],Dr="<masked>",qr=["li_fat_id"];function Hr(e,t,i){if(!be)return{};var s,r=t?[...Or,...i||[]]:[],n=zr(Lr(be.URL,r,Dr),e),o=(s={},ns(qr,(function(e){var t=Es._get(e);s[e]=t||null})),s);return os(o,n)}function zr(e,t){var i=Ar.concat(t||[]),s={};return ns(i,(function(t){var i=Rr(e,t);s[t]=i||null})),s}function Nr(e){var t=function(e){return e?0===e.search(Mr+"google.([^/?]*)")?"google":0===e.search(Mr+"bing.com")?"bing":0===e.search(Mr+"yahoo.com")?"yahoo":0===e.search(Mr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Xe(t)){s.$search_engine=t;var r=be?Rr(be.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function jr(){return navigator.language||navigator.userLanguage}var Br="$direct";function Ur(){return(null==be?void 0:be.referrer)||Br}function Wr(e,t){var i=e?[...Or,...t||[]]:[],s=null==we?void 0:we.href.substring(0,1e3);return{r:Ur().substring(0,1e3),u:s?Lr(s,i,Dr):void 0}}function Vr(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Br?Br:null==(t=Tr(i))?void 0:t.host};if(s){r.$current_url=s;var n=Tr(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=zr(s);os(r,o)}if(i){var a=Nr(i);os(r,a)}return r}function Gr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Kr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Jr={flags:W,surveys:H},Yr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Xr="main";class Qr{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&is.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),ve){var r=()=>this.flush();hs(ve,"beforeunload",r,{capture:!1}),hs(ve,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ze(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Yr.indexOf(e.persistence.toLowerCase())&&(is.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...Is,...e];return i({},Ps,{_parse(e){try{var i={};try{i=Es._parse(e)||{}}catch(e){}var s,r=JSON.parse(Ps._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Xe(a)||""===a||(n[o]=a)}s=os(r,n)}else s=os(i,r);return Ps._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=Ps._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&Es._set(e,l,i,r,n,o)}catch(e){Ps._error(e)}return a},_remove(e,t){try{null==ve||ve.localStorage.removeItem(e),Es._remove(e,t)}catch(e){Ps._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ps._is_supported()?(t=Ps,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&Rs._is_supported()?t=Rs:"memory"===n?t=Fs:"cookie"===n?t=Es:s._is_supported()?(t=s,r=!0):t=Es,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[W];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return ns(this.props,((t,i)=>{var s=Fr(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===I?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&os(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=os({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Pr){var t=Ps._parse(this._groupEntryName(e));if(t&&!Ge(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||os(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Fr(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Jr[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ze(s)&&Ze(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Fr(e))?void 0:t.storageGroup:void 0,s=i?Ps._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Ke(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Ke(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Xr))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Xr),Pr)){var s,r=t[i];(!Ge(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(Ps,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of Pr)t[i]={};return ns(this.props,((i,s)=>{var r,n=null==(r=Fr(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){var i=JSON.stringify(e);return t===Xr?i+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure:i}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Xr||r.dirty||Ke(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Xr&&(r.persisted=!0),Ke(n)||(r.fingerprint=n)):this._config.debug&&is.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(Ke(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of Pr)Ps._remove(this._groupEntryName(i));t?delete this._slotState[Xr]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Ve(e)){Ke(t)&&(t="None"),this._expire_days=Ke(i)?this._default_expiry:i;var s=!1;if(ns(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(Ve(e)){this._expire_days=Ke(t)?this._default_expiry:t;var i=!1;if(ns(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=Hr(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ge(cs(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==be?void 0:be.referrer)?Nr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ur(),$referring_domain:null!=be&&be.referrer&&(null==(e=Tr(be.referrer))?void 0:e.host)||Br},void 0)}set_initial_person_info(){this.props[J]||this.props[Y]||this.register_once({[X]:Wr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ns([Y,J],(t=>{var i=this.props[t];i&&ns(i,(function(t,i){e["$initial_"+ze(i)]=t}))}));var t,i,s=this.props[X];if(s){var r=(t=Vr(s),i={},ns(t,(function(e,t){i["$initial_"+ze(t)]=e})),i);os(e,r)}return e}safe_merge(e){return ns(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[u]||{};i[e]=t,this._setProp(u,i),this.save()}remove_event_timer(e){var t=this.props[u]||{},i=t[e];return Ke(i)||(delete t[e],this._setProp(u,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){this.props[e]=t,this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Fr(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Zr="events",en="cancelEvents",tn="survey shown",sn="survey sent",rn="popover",nn=ss("[RateLimiter]");class on{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{nn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void nn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(K))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(K,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var an=ss("[RemoteConfig]");class ln{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Ie._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return an.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void an.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return an.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){an.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&be&&"hidden"!==be.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||an.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var un="gzip-js",cn="base64",dn=Uint8Array,_n=Uint16Array,hn=Uint32Array,pn=new dn([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]),gn=new dn([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]),vn=new dn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fn=function(e,t){for(var i=new _n(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new hn(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},mn=fn(pn,2),yn=mn[1];mn[0][28]=258,yn[258]=28;for(var bn=fn(gn,0)[1],wn=new _n(32768),xn=0;32768>xn;++xn){var Sn=(43690&xn)>>>1|(21845&xn)<<1;wn[xn]=((65280&(Sn=(61680&(Sn=(52428&Sn)>>>2|(13107&Sn)<<2))>>>4|(3855&Sn)<<4))>>>8|(255&Sn)<<8)>>>1}var En=function(e,t,i){for(var s=e.length,r=0,n=new _n(t);s>r;++r)++n[e[r]-1];var o,a=new _n(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new _n(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[wn[d]>>>l]=u}else for(o=new _n(s),r=0;s>r;++r)o[r]=wn[a[e[r]-1]++]>>>15-e[r];return o},kn=new dn(288);for(xn=0;144>xn;++xn)kn[xn]=8;for(xn=144;256>xn;++xn)kn[xn]=9;for(xn=256;280>xn;++xn)kn[xn]=7;for(xn=280;288>xn;++xn)kn[xn]=8;var Pn=new dn(32);for(xn=0;32>xn;++xn)Pn[xn]=5;var In=En(kn,9,0),Cn=En(Pn,5,0),Fn=function(e){return(e/8>>0)+(7&e&&1)},Tn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof _n?_n:e instanceof hn?hn:dn)(i-t);return s.set(e.subarray(t,i)),s},Rn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Ln=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},$n=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new dn(0),0];if(1==r){var o=new dn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=c&&i[d].f>i[u].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var _=n[0].s;for(s=1;r>s;++s)n[s].s>_&&(_=n[s].s);var h=new _n(_+1),p=Mn(i[c-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new dn(h),p]},Mn=function(e,t,i){return-1==e.s?Math.max(Mn(e.l,t,i+1),Mn(e.r,t,i+1)):t[e.s]=i},On=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new _n(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++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=e[a]}return[i.subarray(0,s),t]},An=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Dn=function(e,t,i){var s=i.length,r=Fn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},qn=function(e,t,i,s,r,n,o,a,l,u,c){Rn(t,c++,i),++r[256];for(var d=$n(r,15),_=d[0],h=d[1],p=$n(n,15),g=p[0],v=p[1],f=On(_),m=f[0],y=f[1],b=On(g),w=b[0],x=b[1],S=new _n(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=$n(S,7),P=k[0],I=k[1],C=19;C>4&&!P[vn[C-1]];--C);var F,T,R,L,M=u+5<<3,O=An(r,kn)+An(n,Pn)+o,A=An(r,_)+An(n,g)+o+14+3*C+An(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=M&&A>=M)return Dn(t,c,e.subarray(l,l+u));if(Rn(t,c,1+(O>A)),c+=2,O>A){F=En(_,h,0),T=_,R=En(g,v,0),L=g;var D=En(P,I,0);for(Rn(t,c,y-257),Rn(t,c+5,x-1),Rn(t,c+10,C-4),c+=14,E=0;C>E;++E)Rn(t,c+3*E,P[vn[E]]);c+=3*C;for(var q=[m,w],H=0;2>H;++H){var z=q[H];for(E=0;z.length>E;++E)Rn(t,c,D[N=31&z[E]]),c+=P[N],N>15&&(Rn(t,c,z[E]>>>5&127),c+=z[E]>>>12)}}else F=In,T=kn,R=Cn,L=Pn;for(E=0;a>E;++E)if(s[E]>255){var N;Ln(t,c,F[257+(N=s[E]>>>18&31)]),c+=T[N+257],N>7&&(Rn(t,c,s[E]>>>23&31),c+=pn[N]);var j=31&s[E];Ln(t,c,R[j]),c+=L[j],j>3&&(Ln(t,c,s[E]>>>5&8191),c+=gn[j])}else Ln(t,c,F[s[E]]),c+=T[s[E]];return Ln(t,c,F[256]),c+T[256]},Hn=new hn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zn=function(){for(var e=new hn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Nn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function jn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=zn[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new dn(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=Dn(l,u,e.subarray(c,d)):(l[c]=!0,u=Dn(l,u,e.subarray(c,o)))}else{for(var _=Hn[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new _n(32768),f=new _n(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new hn(25e3),x=new _n(288),S=new _n(32),E=0,k=0,P=(c=0,0),I=0,C=0;o>c;++c){var F=b(c),T=32767&c,R=f[F];if(v[T]=R,f[F]=T,c>=I){var L=o-c;if((E>7e3||P>24576)&&L>423){u=qn(e,l,0,w,x,S,k,P,C,c-C,u),P=E=k=0,C=c;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var O=2,A=0,D=p,q=T-R&32767;if(L>2&&F==b(c-q))for(var H=Math.min(h,L)-1,z=Math.min(32767,c),N=Math.min(258,L);z>=q&&--D&&T!=R;){if(e[c+O]==e[c+O-q]){for(var j=0;N>j&&e[c+j]==e[c+j-q];++j);if(j>O){if(O=j,A=q,j>H)break;var B=Math.min(q,j-2),U=0;for(M=0;B>M;++M){var W=c-q+M+32768&32767,V=W-v[W]+32768&32767;V>U&&(U=V,R=W)}}}q+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|yn[O]<<18|bn[A];var G=31&yn[O],K=31&bn[A];k+=pn[G]+gn[K],++x[257+G],++S[K],I=c+O,++E}else w[P++]=e[c],++x[e[c]]}}u=qn(e,l,!0,w,x,S,k,P,C,c-C,u)}return Tn(a,0,s+Fn(u)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),c=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Nn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),Nn(u,c-8,i.d()),Nn(u,c-4,s),u}var Bn=!!Se||!!xe,Un="text/plain",Wn=!1,Vn=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Gn=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return ns(e,(function(e,t){Ke(e)||Ke(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Kn=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Jn=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===un){var s=jn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new dn(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new dn(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Tn(s,0,r)}(Kn(t)),{mtime:0});return{contentType:Un,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===cn){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Kn(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Kn(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Kn(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Yn=e=>{var t,s,r,n=Jn(e);return!n||(s=e.compression,r=Rr(e.url,"compression"),s!==Ce.GZipJS&&r!==Ce.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?Re(new Uint8Array(t)):ArrayBuffer.isView(t)&&Re(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Wn=!0,{url:Vn(e.url,"compression"),encodedBody:Jn(i({},e,{compression:void 0,_encodedBody:void 0}))})},Xn=function(){var e=t((function*(e){var t=Kn(e.data),s=yield function(e,t,i){return Oe.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:Un,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Qn=(e,t)=>Gn(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),Zn=[];xe&&Zn.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Yn(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;ns(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(Ee){var c=new Ee;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}xe(s,i({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(a||0),body:o,signal:null==(t=u)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){is.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{is.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),Se&&Zn.push({transport:"XHR",method(e){var t=new Se,{url:i,encodedBody:s}=Yn(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};ns(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=ye&&ye.sendBeacon&&Zn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Yn(e),s=Gn(t,{beacon:"1"}),{contentType:r,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:r});ye.sendBeacon(s,o)}catch(e){}}});var eo=3e3;class to{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ct((null==t?void 0:t.flush_interval_ms)||eo,250,5e3,is.createLogger("flush interval"),eo),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&Ue(i.data)&&ns(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return ns(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ke(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var io=["retriesPerformedSoFar"];class so{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ke(ve)&&"onLine"in ve.navigator&&(this._areWeOnline=ve.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},hs(ve,"online",this._onlineListener),hs(ve,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,io);et(t)&&(r.url=Gn(r.url,{retry_count:t})),this._instance._send_request(i({},r,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==r.callback||r.callback(e):this._enqueue(i({retriesPerformedSoFar:t},r))}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),is.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Ke(ve)||(this._onlineListener&&(ve.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ve.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){is.error(e)}this._queue=[]}}class ro{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){hs(ve,"scroll",this._updateScrollData,{capture:!0}),hs(ve,"scrollend",this._updateScrollData,{capture:!0}),hs(ve,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ve?void 0:ve.document.documentElement;var e=Ue(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==ve?void 0:ve.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return ve?"y"===e?ve.scrollY||ve.pageYOffset||ve.document.documentElement.scrollTop||0:ve.scrollX||ve.pageXOffset||ve.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var no=e=>Wr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class oo{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[G]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||no,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[G]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Vr(t):{$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 ns(cs(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+ze(i)]=t})),e}}class ao{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var lo=ss("[SessionId]");class uo{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new ao,this._sessionHasBeenIdleTooLong=(e,t)=>!(!et(e)||!et(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===oe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||bs,this._windowIdGenerator=i||bs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ct(this._config.session_idle_timeout_seconds||1800,60,36e3,lo.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Rs._parse(this._window_id_storage_key),o=Rs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Rs._remove(this._window_id_storage_key),Rs._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){lo.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ke(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Rs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Rs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Rs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Xe(t)&&!Xe(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[k]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return et(t)&&t>0}_flushPendingActivityTimestamp(){var e;if(!Xe(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(k):(this._persistence.flush(),this._persistence.load());var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[k]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=et(e)?e:0,i=et(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_getSessionId(){var e=this._persistence.props[k];return Ue(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&ve&&(ve.removeEventListener(de,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Rs._remove(this._primary_window_exists_storage_key)},hs(ve,de,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===oe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=et(r)&&Math.abs(i-r)>864e5,l=!1,u=!s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),lo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=et(n)&&e&&!a?n:i,_=et(r)?r:(new Date).getTime();return this._setWindowId(o),this._setSessionId(s,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var e=this._freshestActivityTimestamp();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var co=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&De(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>De(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},_o=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function ho(e,t,i){return Kn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var po={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>_o(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!_o(t,e))))),icontains:(e,t)=>t.map(go).some((t=>e.map(go).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(go).every((t=>e.map(go).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var i=parseFloat(t);return!isNaN(i)&&e.some((e=>i>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var i=parseFloat(t);return!isNaN(i)&&e.some((e=>i<parseFloat(e)))}))},go=e=>e.toLowerCase();function vo(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ke(r)||Xe(r))return!1;var n=[String(r)],o=po[s.operator];return!!o&&o(s.values,n)}))}var fo="custom",mo="i.posthog.com",yo=/^\/static\//;class bo{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+mo,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":fo),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(yo.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===fo)return this.apiHost+t;var s=mo+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var wo=ss("[Surveys]"),xo="seenSurvey_",So=["popover","widget","api"],Eo={ignoreConditions:!1,ignoreDelay:!1,displayType:rn},ko=ss("[PostHog ExternalIntegrations]"),Po={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Io{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return ko.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Ie.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Po[t],(()=>{var i;null==(i=Ie.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Ie.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Ie.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var Co,Fo={},To=0,Ro=()=>{},Lo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$o="Surveys module not available",Mo="sanitize_properties is deprecated. Use before_send instead",Oo="Invalid value for property_denylist config: ",Ao="posthog",Do=!Bn&&-1===(null==Pe?void 0:Pe.indexOf("MSIE"))&&-1===(null==Pe?void 0:Pe.indexOf("Mozilla")),qo=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:_s(null==be?void 0:be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ro,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:we&&Je(null==we?void 0:we.search)&&-1!==we.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ve||null==(t=ve.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){is.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ue,before_send:void 0,request_queue_config:{flush_interval_ms:eo},error_tracking:{},_onCapture:Ro},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Xs,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e)}))(e))},Ho=[["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"]],zo=e=>{var t={};for(var[i,s]of Ho)Ke(e[i])||(t[s]=e[i]);var r=os({},t,e),n=e.__preview_external_dependency_versioned_paths;return Ke(n)||(Ke(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),Je(n)&&Ke(e.asset_host)&&(r.asset_host=n)),Ue(e.property_blacklist)&&(Ke(e.property_denylist)?r.property_denylist=e.property_blacklist:Ue(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:is.error(Oo+e.property_denylist)),r};class No{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){is.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class jo{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===oe||this.config.cookieless_mode===ne&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new No,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new ao,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=qo(),this.SentryIntegration=Er,this.sentryIntegration=e=>function(e,t){var i=Sr(e,t);return{name:xr,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new ro(this),this.pageViewManager=new kr(this),this.rateLimiter=new on(this),this.requestRouter=new bo(this),this.consent=new Ls(this),this.externalIntegrations=new Io(this);var t=null!==(e=jo.__defaultExtensionClasses)&&void 0!==e?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.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=Je(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Je(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>is.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Ao){var s,r=null!==(s=Fo[i])&&void 0!==s?s:new jo;return r._init(e,t,i),Fo[i]=r,Fo[Ao][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;void 0===t&&(t={});var a=Je(e)?e.trim():"";if(!a)return is.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=qo(t.defaults),u=zo(t),c=os({},l,u,{name:s,token:a});Ve(l.rageclick)&&Ve(u.rageclick)&&(c.rageclick=os({},l.rageclick,u.rageclick)),this.set_config(c),this.config.on_xhr_error&&is.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:un;var d=this._is_persistence_disabled();this.persistence=new Qr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Qr(i({},this.config,{persistence:"sessionStorage"}),d,!1);var _=i({},this.persistence.props),h=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new to((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new so(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new uo(this),this.sessionPropsManager=new oo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(is.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(is.info("Initializing extensions synchronously"),this._initExtensions(p)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&is.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:_,s:h}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),f=this.persistence.get_property(V);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===ae)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===le)is.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 m=this.config.get_device_id(bs()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(V,t.bootstrap.isIdentifiedID?le:ae),this.register({distinct_id:g,$device_id:y})}}if(p)this.register_once({distinct_id:ee,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(bs());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(V,ae)}return hs(ve,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||bs();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(V,le)),t()},r=i.user();"then"in r&&We(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||wr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(wr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(wr.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,_e),identify:e=>t(e,pe),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),We(this.config._onCapture)&&this.config._onCapture!==Ro&&(is.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&is.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}_initExtensions(e){var t,s,r,n,o,a,l,u=performance.now(),c=i({},jo.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,yr)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){is.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[te]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ie]:s}),this.config.__preview_deferred_init_extensions&&is.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!be||!be.body)return is.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(e.supportedCompression,un)?un:qe(e.supportedCompression,cn)?cn:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:ue}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){is.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=we&&we.hostname){var e=we.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ln(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&rs(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(he),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(he,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Do?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Gn(e.url,{ip:this.config.ip?1:0}),e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Ke(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=Qn(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Zn.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===un&&ke&&!Wn?Xn(n).then((e=>{l(e)})).catch((t=>{if(Le(t))return Wn=!0,void l(i({},n,{compression:void 0,url:Qn(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Le(e)||t===Te})(t)&&(Wn=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){To++;try{var t,i=[],s=[],r=[];rs(e,(e=>{if(e)if(Ue(t=e[0]))r.push(e);else if(We(e))try{e.call(this)}catch(t){is.error("Error executing queued PostHog call",e,t)}else Ue(e)&&"alias"===t?i.push(e):Ue(e)&&-1!==t.indexOf("capture")&&We(this[t])?r.push(e):s.push(e)}));var n=function(e,t){rs(e,(function(e){try{if(Ue(e[0])){var i=t;ns(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){is.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{To--}}push(e){if(To>0&&Ue(e)&&Je(e[0])){var t=jo.prototype[e[0]];We(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._requestQueue){if(this.is_capturing())if(!Ke(e)&&Je(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Je(null==t?void 0:t.$current_url)&&(is.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||is.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,_=(null==s?void 0:s.timestamp)||d,h=(null==s?void 0:s.uuid)||bs(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===_e&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g,v,f,m=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ge,e===pe);if(m&&(p.$set_once=m),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Je(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),Ue(t)?(s=[],rs(t,(t=>{s.push(e(t))}))):(s={},ns(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ke(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),"survey dismissed"===e||e===sn){var y=null==t?void 0:t.$survey_id,b=null==t?void 0:t.$survey_iteration;(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(xo,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){wo.error("Failed to persist survey seen state",e)}})({id:y,current_iteration:b}),p.$set=i({},p.$set,{[(g={id:y,current_iteration:b},v=e===sn?"responded":"dismissed",f="$survey_"+v+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(f="$survey_"+v+"/"+g.id+"/"+g.current_iteration),f)]:!0})}else e===tn&&(p.$set=i({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var w=null==t?void 0:t.$product_tour_type;w&&(p.$set=i({},p.$set,{["$product_tour_last_seen_date/"+w]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(Ge(x)||this.setPersonPropertiesForFlags(x),!Qe(this.config.before_send)){var S=this._runBeforeSend(p);if(!S)return;p=S}this._internalEventEmitter.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}is.critical("This capture call is ignored due to client rate limiting.")}}else is.error("No event name provided to posthog.capture")}else is.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!Je(l.distinct_id)&&!Ze(l.distinct_id)||Ye(l.distinct_id))&&is.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t,i){var s,r,o,a;if(!Pe)return{};var l,u,c,d,_,h,p,g,v,f=e?[...Or,...t||[]]:[],[m,y]=function(e){for(var t=0;fi.length>t;t++){var[i,s]=fi[t],r=i.exec(e),n=r&&(We(s)?s(r,e):s);if(n)return n}return["",""]}(Pe),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},x=os(cs({$os:m,$os_version:y,$browser:pi(Pe,navigator.vendor,b,w),$device:mi(Pe),$device_type:(c=Pe,d={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==ve||null==(o=ve.screen)?void 0:o.width,screenHeight:null==ve||null==(a=ve.screen)?void 0:a.height,devicePixelRatio:null==ve?void 0:ve.devicePixelRatio},v=mi(c),v===bt||v===yt||"Kobo"===v||"Kindle Fire"===v||v===Yt?mt:v===Ht||v===Nt||v===zt||v===Gt?"Console":v===xt?"Wearable":v?gt:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(_=null==d?void 0:d.maxTouchPoints)&&void 0!==_?_:0)>0?600>Math.min(null!==(h=null==d?void 0:d.screenWidth)&&void 0!==h?h:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?gt:mt:"Desktop"),$timezone:Gr(),$timezone_offset:Kr()}),{$current_url:Lr(null==we?void 0:we.href,f,Dr),$host:null==we?void 0:we.host,$pathname:null==we?void 0:we.pathname,$raw_user_agent:Pe.length>1e3?Pe.substring(0,997)+"...":Pe,$browser_version:vi(Pe,navigator.vendor,b,w),$browser_language:jr(),$browser_language_prefix:(u=jr(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==ve?void 0:ve.screen.height,$screen_width:null==ve?void 0:ve.screen.width,$viewport_height:null==ve?void 0:ve.innerHeight,$viewport_width:null==ve?void 0:ve.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return n.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=n.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&os(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&os(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===fo&&(l.$lib_custom_api_host=this.config.api_host),c=e!==_e||o?e!==he||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=os(l,c),e===_e&&be&&(l.title=be.title),!Ke(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Pe&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=os({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ue(this.config.property_denylist)?ns(this.config.property_denylist,(function(e){delete l[e]})):is.error(Oo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(is.error(Mo),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=os({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(is.error(Mo),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ge(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.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:$o}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:$o})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:$o})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=Eo),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:$o}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:$o})}_validateIdentifyId(e){return!e||Ye(e)?(is.critical("Unique user id has not been set in posthog.identify"),!1):e===ee?(is.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())||(is.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,i){if(!this.__loaded||!this.persistence)return is.uninitializedWarning("posthog.identify");if(Ze(e)&&(e=e.toString(),is.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(V)||ae)===ae;e!==s&&n?(this.persistence.set_property(V,le),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(pe,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=ho(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(j))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=ho(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):is.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(ge,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else is.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,l,u;if(is.info("reset"),!this.__loaded)return is.uninitializedWarning("posthog.reset");var c,d=this.get_property(a),_=this.get_property(y);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),Ke(_)||null==(c=this.persistence)||c.register({[y]:_}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(V,ae),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===oe)this.register_once({distinct_id:ee,$device_id:null},"");else{var h=this.config.get_device_id(bs());this.register_once({distinct_id:h,$device_id:e?h:d},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(o)?(is.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ke(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(is.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(Ve(e)){var s,r,o,a,l,u,c,d,_,h,p;os(this.config,zo(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Qr(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);tt(v)&&(this.config.debug=v),tt(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Ps._is_supported()&&Ps._set("ph_debug",!0),is.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Ps._is_supported()&&Ps._remove("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!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(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:jo._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Ao;return t!==Ao&&(t=Ao+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(V))===le||(null==(t=this.sessionPersistence)?void 0:t.get_property(V))===le}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ue&&!this._isIdentified()&&Ge(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Q]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(is.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Q,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ne)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==oe){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new uo(this),this.pageViewManager=new kr(this),this.persistence&&(this.sessionPropsManager=new oo(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=jo.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==ne&&(null==(u=this.surveys)||u.loadIfEnabled()),(Ke(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else is.warn(Lo)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==oe?(this.config.cookieless_mode===ne&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===ne&&(this.register({distinct_id:ee,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):is.warn(Lo)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===oe||(this.config.cookieless_mode===ne?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return ye?co(ye,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){be&&("visible"===be.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(_e,{title:be.title},{send_instantly:!0}),this._visibilityStateListener&&(be.removeEventListener(ce,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),hs(be,ce,this._visibilityStateListener)))}debug(e){!1===e?(null==ve||ve.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ve||ve.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(is.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):(i="advanced_disable_decide",!1,s=is,r=(t="advanced_disable_flags")in(e=o)&&!Qe(e[t]),n=i in e&&!Qe(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){if(Qe(this.config.before_send))return e;var t=Ue(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Qe(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return st(e.event)?is.warn(r+". This can cause unexpected behavior."):is.info(r),null}i.properties&&!Ge(i.properties)||is.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=tt(e)&&!e,i=Ps._is_supported()&&"true"===Ps._get("ph_debug");return!t&&(!!i||e)}}jo.__defaultExtensionClasses={},jo._noopLogger={trace:Co=()=>{},debug:Co,info:Co,warn:Co,error:Co,fatal:Co},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=us(e.prototype[t[i]])}(jo,["identify"]);class Bo{constructor(e){this.disabled=!1===e;var t=Ve(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,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Uo="$copy_autocapture",Wo=ss("[AutoCapture]");function Vo(e,t){return t.length>e?t.slice(0,e)+"...":t}function Go(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ds(t));return t}function Ko(e,t){var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Ds(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!qs(d,"body");)if(zs(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Ds(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(ns(c,(e=>{var t=rr(e);if(qs(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&_r(i)&&i}qe(Bs(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Gs.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Vo(1024,hr(e)):Vo(1024,Ws(e)));var o=Bs(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),ns(e.attributes,(function(i){var r;if((!nr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&_r(i.value)&&(!Je(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=Ns(o).join(" ")),n["attr__"+i.name]=Vo(1024,o)}}));for(var a=1,l=1,u=e;u=Go(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var s=function(e){if(!rr(e))return{};var t={};return ns(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&_r(s)&&(t[i]=s)}})),t}(e);os(g,s)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=qs(e,"a")||qs(e,"button")?hr(e):Ws(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Tr(v))?void 0:m.host,w=null==ve||null==(y=ve.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:os({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,s,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(s=e.nth_of_type)&&void 0!==s?s:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return as(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[gr(t.toString())]=gr(i.toString())})),(r+=":")+as(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:vr(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return as(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return s.attributes[t]=i})),s}))}(h)))},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Jo=ss("[ExceptionAutocapture]"),Yo=ss("[TracingHeaders]"),Xo=ss("[Web Vitals]"),Qo=9e5,Zo="disabled",ea="lazy_loading",ta="awaiting_config",ia="missing_config";ss("[SessionRecording]"),ss("[SessionRecording]");var sa="[SessionRecording]",ra=ss(sa),na=ss("[Heatmaps]");function oa(e){return Ve(e)&&"clientX"in e&&"clientY"in e&&Ze(e.clientX)&&Ze(e.clientY)}var aa=ss("[Product Tours]"),la=["$set_once","$set"],ua=ss("[SiteApps]"),ca="Error while initializing PostHog app with config id ";function da(e,t,i){if(Qe(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class _a{constructor(e){this._debugEventEmitter=new ao,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this._actionEvents=new Set,this._actionRegistry=new Set}init(){var e,t;Ke(null==(e=this._instance)?void 0:e._addCaptureHook)||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)})))}register(e){var t,i;if(!Ke(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)}))})),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(null==t?void 0:t.event))&&this._actionRegistry&&(null==(i=this._actionRegistry)?void 0:i.size)>0&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!da(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>da(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&da((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>da(e.text,t.text,t.text_matching||"exact")||da(e.$el_text,t.text,t.text_matching||"exact")));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Qe(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some((e=>da(e,n,o))))}_checkStepSelector(e,t){var i,s;if(null==t||!t.selector)return!0;var r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||vo(t.properties.reduce(((e,t)=>{var i=Ue(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class ha{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&vo(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var i=new Map;return e.forEach((e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach((t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}}))})),i}_getMatchingItems(e,t,i){var s=(i===Zr?this._eventToItems:this._cancelEventToItems).get(e),r=[];return this._getItems((e=>{r=e.filter((e=>null==s?void 0:s.includes(e.id)))})),r.filter((s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;Ke(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(e){var t=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==t.length&&(null==this._actionMatcher&&(this._actionMatcher=new _a(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this._actionMatcher)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((t=>{if(t&&t.name){var i=this._actionToItems.get(t.name);i&&i.push(e.id),this._actionToItems.set(t.name,i||[e.id])}})))})))}_setupEventBasedItems(e){var t,i=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),s=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,Zr),this._cancelEventToItems=this._buildEventToItemMap(e,en))}onEvent(e,t){var i,s=this._getLogger(),r=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this._updateActivatedItems(o))}}else{if(this._cancelEventToItems.has(e)){var d=this._getMatchingItems(e,t,en);d.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this._cancelPendingItem(e.id)})),this._updateActivatedItems(o))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,Zr);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(s.concat(this._actionToItems.get(e)||[]))}_updateActivatedItems(e){var t=this._getLogger(),i=[...new Set(e)].filter((e=>!this._isItemPermanentlyIneligible(e)));t.info("updating activated items",{activatedItems:i}),this._setActivatedItems(i)}getActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class pa extends ha{constructor(e){super(e)}_getActivatedKey(){return z}_getShownEventName(){return tn}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return wo}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[z]:e})}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ga="SDK is not enabled or survey functionality is not yet loaded",va="Disabled. Not loading surveys.",fa=null!=ve&&ve.location?$r(ve.location.hash,"__posthog")||$r(location.hash,"state"):null,ma="_postHogToolbarParams",ya=ss("[Toolbar]"),ba=ss("[FeatureFlags]"),wa=ss("[FeatureFlags]",{debugEnabled:!0}),xa="\" failed. Feature flags didn't load in time.",Sa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},Ea=e=>{var t={};for(var[i,s]of as(e||{}))s&&(t[i]=s);return t},ka=ss("[Error tracking]"),Pa="Refusing to render web experiment since the viewer is a likely bot",Ia={icontains:(e,t)=>!!ve&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ve&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!ve&&_o(t.href,e),not_regex:(e,t)=>!!ve&&!_o(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Ca{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Ca._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Ca._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var s=t._instance.getFeatureFlag(e.feature_flag_key);Je(s)&&e.variants[s]&&t._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];Ca._matchesTestVariant(n)&&t._applyTransforms(e.name,r,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Ca._logInfo(Pa);else if(!this._config.disable_web_experiments){if(Qe(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ca._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this._flagToExperiments)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this._applyTransforms(r.name,s,r.variants[s].transforms)}}))}}previewWebExperiment(){var e=Ca.getWindowLocation();if(null!=e&&e.search){var t=Rr(null==e?void 0:e.search,"__experiment_id"),i=Rr(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Ca._logInfo("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var s=i.filter((t=>t.id===e));s&&s.length>0&&(Ca._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this._applyTransforms(s[0].name,t,s[0].variants[t].transforms))}static _matchesTestVariant(e){return!Qe(e.conditions)&&Ca._matchUrlConditions(e)&&Ca._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Qe(e.conditions)||Qe(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Ca.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||Ia[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==ve?void 0:ve.location}static _matchUTMConditions(e){var t;if(Qe(e.conditions)||Qe(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Hr();if(i.utm_source){var s,r,n,o,a,l,u,c,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];is.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Ca._logInfo(Pa):"control"!==t?i.forEach((i=>{if(i.selector){var s;Ca._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Ca._logInfo("Control variants leave the page unmodified.")}_is_bot(){return ye&&this._instance?co(ye,this._config.custom_blocked_useragents):void 0}}var Fa=ss("[Conversations]"),Ta="Conversations not available yet.",Ra={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._instance=e,this.featureFlagEventHandlers=[]}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,ba.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(ba.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ba.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}_getValidFlagKeys(){var e=this._config.flag_keys;if(!Ke(e)){if(Ue(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ba.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ba.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter((e=>!!s[e])).reduce(((e,t)=>(e[t]=s[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,s){var r=null!=s&&s.merge?this.getFlagVariants():{},n=null!=s&&s.merge?this.getFlagPayloads():{},o=i({},r,e),a=i({},n,t),l={};for(var[u,c]of Object.entries(o)){var d="string"==typeof c;l[u]={key:u,enabled:!!d||Boolean(c),variant:d?c:void 0,reason:void 0,metadata:Ke(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(T),t=this._prop(M),s=this._prop(O);if(!s&&!t)return e||{};var r=os({},e||{}),n=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=r[o],c=null==t?void 0:t[o],d=Ke(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ke(c)?u.variant:"string"==typeof c?c:void 0,h=null==s?void 0:s[o],p=i({},u,{enabled:d,variant:d?null!=_?_:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),_!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),h&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:h,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),r[o]=p}return this._override_warning||(ba.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(I),t=this._prop(M);if(!t)return e||{};for(var i=os({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ba.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(R),t=this._prop(O);if(!t)return e||{};for(var i=os({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ba.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s=this._config.token,r=this._prop(a),n={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(A)||{}),group_properties:this._prop(D),timezone:Gr()};Xe(r)||Ke(r)||(n.$device_id=r),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(n.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._getValidFlagKeys();Ke(o)||(n.flag_keys=o);var l=!!this._config.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._config.disable_compression?void 0:cn,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,r=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),r=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!r;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(s=this._persistence)||s.register({[U]:o}),u)ba.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=e.json)&&void 0!==a?a:{},r,{partialResponse:l}),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else ba.warn('getFeatureFlag for key "'+e+xa)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this._prop(L)||void 0,l=this._prop(W)||void 0,u=this._prop(j)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(B);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[j]:u,[B]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var h,p,g,v,f,m,y,b,w,x;Ue(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[j]:u});var S=this.getFeatureFlagDetails(e),E=[...null!==(p=this._prop(U))&&void 0!==p?p:[]];Ke(r)&&E.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Ke(null==S||null==(f=S.metadata)?void 0:f.version)||(k.$feature_flag_version=S.metadata.version);var P,I=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;I&&(k.$feature_flag_reason=I),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Ke(null==S?void 0:S.original_variant)&&Ke(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ke(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(s){var C=n;if(!Ke(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:C}}}}else ba.warn('getFeatureFlagResult for key "'+e+xa)}getRemoteConfigPayload(e,t){var i=this._config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments());var r=this._getValidFlagKeys();Ke(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._config.disable_compression?void 0:cn,timeout:this._config.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Ke(i)?void 0:!!i}ba.warn('isFeatureEnabled for key "'+e+xa)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,s){if(this._persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,s,r,n,o){void 0===s&&(s={}),void 0===r&&(r={}),void 0===n&&(n={});var a=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):ba.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var d=e.requestId,_=e.evaluatedAt;if(Ue(u)){ba.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(u)for(var p=0;u.length>p;p++)h[u[p]]=!0;t&&t.register({[C]:u,[I]:h})}else{var g=u,v=c,f=l;if(null!=o&&o.partialResponse)g=i({},s,g),v=i({},r,v),f=i({},n,f);else if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((e=>{var t;return!(null!=(t=l[e])&&t.failed)})));g=i({},s,Object.fromEntries(Object.entries(g).filter((e=>{var[t]=e;return m.has(t)})))),v=i({},r,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return m.has(t)})))),f=i({},n,Object.fromEntries(Object.entries(f||{}).filter((e=>{var[t]=e;return m.has(t)}))))}else g=i({},s,g),v=i({},r,v),f=i({},n,f);t&&t.register(i({[C]:Object.keys(Ea(g)),[I]:g||{},[R]:v||{},[T]:f||{}},d?{[L]:d}:{},_?{[W]:_}:{}))}}}(e,this._persistence,r,n,o,s),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ba.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ba.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(M),this._persistence.unregister(O),this._fireFeatureFlagsCallbacks(),wa.info("All overrides cleared");if(Ue(e)){var t=Sa(e);return this._persistence.register({[M]:t}),this._fireFeatureFlagsCallbacks(),wa.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this._override_warning=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this._persistence.unregister(M),wa.info("Flag overrides cleared");else if(s.flags){if(Ue(s.flags)){var r=Sa(s.flags);this._persistence.register({[M]:r})}else this._persistence.register({[M]:s.flags});wa.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(O),wa.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[O]:s.payloads}),wa.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[M]:e}),this._fireFeatureFlagsCallbacks(),wa.info("Flag overrides set",{flags:e});ba.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var r,n=(this._prop(F)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),s&&(a.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(r=this._persistence)||r.register({[C]:Object.keys(Ea(l)),[I]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(F),r=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(F),null==(s=this._persistence)||s.register({[F]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(A)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in s||(o[a]=n[a]));this._instance.register({[A]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(A),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(D)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[D]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(D)||{};this._instance.register({[D]:i({},t,{[e]:{}})})}else this._instance.unregister(D)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}},La={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===ta||this._recordingStatus===ia?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=Zo,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw ra.error("started without valid sessionManager"),new Error(sa+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===oe)throw new Error(sa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(y))||!e.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return ve&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ke(Object.assign)&&!Ke(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),ra.info("starting")):(this._recordingStatus=Zo,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==ta&&this._recordingStatus!==ia&&(this._recordingStatus=ea),null!=Ie&&null!=(t=Ie.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=Ie.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=Ie.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return ra.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(P),null==(t=this._persistence)||t.unregister(b)}_validateSampleRate(e,t){if(Qe(e))return null;var i,s=Ze(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(ra.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}_persistRemoteConfig(e){if(this._persistence){var t,s,r=this._persistence,n=()=>{var t,s=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==s?void 0:s.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Qe(a)&&this._resetSampling();var l=null==s?void 0:s.minimumDurationMilliseconds;r.register({[y]:i({cache_timestamp:Date.now(),enabled:!!s},s,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==s?void 0:s.networkPayloadCapture),canvasRecording:{enabled:null==s?void 0:s.recordCanvas,fps:null==s?void 0:s.canvasFps,quality:null==s?void 0:s.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ke(l)?null:l,endpoint:null==s?void 0:s.endpoint,triggerMatchType:null==s?void 0:s.triggerMatchType,masking:null==s?void 0:s.masking,urlTriggers:null==s?void 0:s.urlTriggers,version:null==s?void 0:s.version,triggerGroups:null==s?void 0:s.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(s=this._instance.sessionManager)?void 0:s.onSessionId(n)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===ta&&(this._recordingStatus=ia,ra.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):ra.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(y);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,i=this._instance.get_property(y);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(e){return ra.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var s=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-s}_onScriptLoaded(e){var t,i;if(null==(t=Ie.__PosthogExtensions__)||!t.initSessionRecording)return ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[se]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=Ie.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ia||this._recordingStatus===ta)return;return this._recordingStatus=ta,ra.info("persisted remote config is stale, requesting fresh config before starting"),void new ln(this._instance).load()}this._recordingStatus=ea,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[x]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[w]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?S:E]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},$a={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Bo(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=Ve(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ve&&be){var e=e=>{e=e||(null==ve?void 0:ve.event);try{this._captureEvent(e)}catch(e){Wo.error("Failed to capture event",e)}};if(hs(be,"submit",e,{capture:!0}),hs(be,"change",e,{capture:!0}),hs(be,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ve?void 0:ve.event);try{this._captureEvent(e,Uo)}catch(e){Wo.error("Failed to capture copy/cut event",e)}};hs(be,"copy",t,{capture:!0}),hs(be,"cut",t,{capture:!0})}}}else Wo.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var s=null==be?void 0:be.querySelectorAll(t);null==s||s.forEach((s=>{e===s&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[c];if(Xe(this._isDisabledServerSide)&&!tt(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=Vs(e);Hs(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&tr(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===Uo;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!ve||ir(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!js(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&js(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:c,targetElementList:d}=sr(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ke(i))return!0;var s,r=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,i))return!1;if(!Ks(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=ve.getComputedStyle(e);if(_&&"pointer"===_.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(Gs.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Ko(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===Uo){var l,u=Us(null==ve||null==(l=ve.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return We(null==be?void 0:be.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ve||null==(t=ve.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(is.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,is.info("History API monitoring stopped")}monitorHistoryChanges(){ve&&ve.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ve&&(null==(t=ve.history[e])||!t.__posthog_wrapped__)){var i=this;!function(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return We(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]===r&&(e[t]=s)}}catch(e){return()=>{}}}(ve.history,e,(t=>function(s,r,n){t.call(this,s,r,n),i._capturePageview(e)}))}}_capturePageview(e){try{var t,i=null==ve||null==(t=ve.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(_e,{navigation_type:e}),this._lastPathname=i}catch(t){is.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};hs(ve,"popstate",e),this._popstateListener=()=>{ve&&ve.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[d]),this.rageclicks=new Bo(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ve(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Qe(this._config.capture_heatmaps)?Qe(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;na.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(be)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ve&&be&&(this._flushHandler=this._flush.bind(this),hs(ve,de,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ve?void 0:ve.event)),hs(be,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ve?void 0:ve.event)),hs(be,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new br(this.instance,mr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),hs(be,ce,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ve&&be&&(this._flushHandler&&ve.removeEventListener(de,this._flushHandler),this._onClickHandler&&be.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&be.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&be.removeEventListener(ce,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&Ds(s)&&!qs(s,"body");){if(s===i)return!1;if(qe(t,null==ve?void 0:ve.getComputedStyle(s).position))return!0;s=Js(s)}return!1}(Vs(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var s;if(void 0===t&&(t="click"),!As(e.target)&&oa(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&tr(Vs(e),this.instance.config.rageclick)&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!As(e.target)&&oa(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ve){var t=ve.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...Or,...i||[]]:[],r=Lr(t,s,Dr);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!Ge(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:br,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();if(!Ke(s))if(Qe(null==e?void 0:e.name)||Qe(null==e?void 0:e.value))Xo.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Ke(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=Ke(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),n=i({},e,{$current_url:s,timestamp:Date.now()});Ke(r)||(n.$session_id=r.sessionId,n.$window_id=r.windowId),this._buffer.metrics.push(n),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Xo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=Ie.__PosthogExtensions__;Ke(r)||Ke(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):Xo.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[g]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=Ve(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Qe(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Ve(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ve(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Ve(this._perfConfig)&&Ze(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Qo;return e>0&&6e4>=e?Qo:e}get isEnabled(){var e=null==we?void 0:we.protocol;if("http:"!==e&&"https:"!==e)return Xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ve(this._perfConfig)?this._perfConfig.web_vitals:tt(this._perfConfig)?this._perfConfig:void 0;return tt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Xo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ve(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Ve(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:t}),this._instance.persistence.register({[m]:i})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Xo.error("failed to load script",t):e()}))}_currentURL(){var e=ve?ve.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Or,...t||[]]:[];return Lr(e,i,Dr)}Xo.error("Could not determine current URL")}}},Ma={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(ve&&this.isEnabled&&null!=(e=Ie.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){Jo.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new dt({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,_logger:Jo}),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ve(e)?t=i({},t,e):(Ke(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Jo.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Jo.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Jo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,s;this._suppressionRules=[],this._errorPropertiesBuilder=new ki([new Di,new Gi,new Hi,new qi,new Wi,new Ui,new Ni,new Vi],function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var n=[],o=t.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Ai.test(l)?l.replace(Ai,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of s){var d=c(u,e);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return i({},e,{filename:e.filename||(s=t,s[s.length-1]||{}).filename,function:e.function||Pi});var s}))}(n)}}("web:javascript",Li,Oi)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Qi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Zi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Qi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[h]:this._suppressionRules,[p]:n})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Je(e)||0===e.trim().length)return void ka.warn("Ignoring exception step because message must be a non-empty string");var s=this._coerceExceptionStepProperties(t),{sanitizedProperties:r,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((i,s)=>Yi.has(s)?(t.push(s),i):(i[s]=e[s],i)),{}),droppedKeys:t}}(s);n.length>0&&ka.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[Ki]:e,[Ji]:(new Date).toISOString()},r))}catch(e){ka.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void ka.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void ka.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void ka.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Qe(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return ka.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void ka.error("Failed to process exception event. Ignoring this exception.",e)}}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:i({},e,{$exception_steps:t})}catch(t){return ka.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ki]:e,[Ji]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Ve(e)?i({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:s}=t;return Je(i)&&i.length>0&&e.$exception_types.push(i),Je(s)&&s.length>0&&e.$exception_values.push(s),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,s=po[e.operator],r=Ue(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Qe(e)&&Ue(e)}}},Oa=i({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._persistence&&this._persistence.register({[f]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this._productTourManager||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(f)||this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?aa.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Ie.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Ie.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ue(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[N];if(Ue(s)&&!t)return this._cachedTours=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return aa.error(r),void e([],{isLoaded:!1,error:r})}var n=Ue(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[N]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Qe(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(N)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},Ra),Aa={siteApps:class{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=Ie._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,n,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))c[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},s(e,la),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ua.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this._stopBuffering)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,ua.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){ua.error(ca+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){ua.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}_onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){ua.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ua.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;Ie["__$$ph_site_app_"+e]=r._instance,null==(t=Ie.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return ua.error(ca+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else ua.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Da={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,i=this._syncHostnamesForPatch();i?(Ke(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Ie.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Ke(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Ie.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Yo.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Ue(e)?(Ue(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Ue(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},qa=i({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Qe(t))return wo.warn("Flags not loaded yet. Not loading surveys.");var i=Ue(t);this._isSurveysEnabled=i?t.length>0:t,wo.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(xo)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)wo.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)wo.info(va);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())wo.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e){if(!Ke(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var s=e.loadExternalDependency;if(!s)return void this._handleSurveyLoadError(re);s(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else wo.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new pa(this._instance),wo.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){wo.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return wo.info(va),e([]);var i,s=this._instance.get_property(q);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:s}=t;return e(i,s)})):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{i=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var s;this._getSurveysInFlightPromise=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;wo.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[q]:l,[H]:Date.now()});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){wo.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);wo.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var s;t=null!==(s=i.find((t=>t.id===e)))&&void 0!==s?s:null})),t}_checkSurveyEligibility(e){if(Qe(this._surveyManager))return{eligible:!1,reason:ga};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Qe(this._surveyManager))return wo.warn("init was not called"),{visible:!1,disabledReason:ga};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Qe(this._surveyManager)?(wo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ga})):new Promise((i=>{this.getSurveys((t=>{var s,r=null!==(s=t.find((t=>t.id===e)))&&void 0!==s?s:null;if(r){var n=this._checkSurveyEligibility(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(Qe(this._surveyManager))wo.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(So.includes(r.type)){var n=null==be?void 0:be.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(wo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;wo.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),wo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);wo.warn("Survey element not found")}else wo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else wo.warn("Survey not found")}}displaySurvey(e,t){var s;if(Qe(this._surveyManager))wo.warn("init was not called");else{var r=this._getSurveyById(e);if(r){var n=r;if(null!=(s=r.appearance)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},r,{appearance:i({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==rn&&t.initialResponses&&wo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(r);if(!o.visible)return void wo.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else wo.warn("Survey not found")}}cancelPendingSurvey(e){Qe(this._surveyManager)?wo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Ra),Ha={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Ie.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Ie.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),ps(this.instance.config))return!1;if(!ve||!be)return!1;e=null!=e?e:ve.location,i=null!=i?i:ve.history;try{if(!t){try{ve.localStorage.setItem("test","test"),ve.localStorage.removeItem("test")}catch(e){return!1}t=null==ve?void 0:ve.localStorage}var s,r=fa||$r(e.hash,"__posthog")||$r(e.hash,"state"),n=r?ls((()=>JSON.parse(atob(decodeURIComponent(r)))))||ls((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(ma)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=Ie.ph_load_toolbar||Ie.ph_load_editor;!Qe(t)&&We(t)?t(e,this.instance):ya.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==be||!be.getElementById(Z));if(!ve||t)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(ve.localStorage.setItem(ma,JSON.stringify(i({},r,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=Ie.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ya.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),hs(ve,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(r)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},za=i({experiments:Ca},Ra),Na={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Qe(t)||(tt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||ps(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e&&!Ke(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var i=e.loadExternalDependency;if(!i)return void this._handleLoadError(re);i(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else Fa.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),Fa.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Fa.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Fa.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():Fa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Xe(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,s){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,i,s):(Fa.warn(Ta),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(Fa.warn(Ta),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(Fa.warn(Ta),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(Fa.warn(Ta),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(Fa.warn(Ta),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(Fa.warn(Ta),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Fa.warn(Ta),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},ja={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ss("[logs]"),this._logBuffer=[],this._intervalLogCount=0,this._intervalWindowStart=0,this._droppedWarned=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Qe(i)&&i&&(this._isLogsEnabled=!0,this.loadIfEnabled())}reset(){this._logBuffer=[],this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0),this._intervalLogCount=0,this._intervalWindowStart=0,this._droppedWarned=!1}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this._logger.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this._isLoaded=!0)})):this._logger.error(re)}else this._logger.error("PostHog Extensions not found.")}}captureLog(e){var t,s,r,n,o,a;if(this._instance.is_capturing())if(e&&e.body){var l=null!==(t=null==(s=this._instance.config.logs)?void 0:s.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(r=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==r?r:1e3,c=Date.now();if(l>c-this._intervalWindowStart||(this._intervalWindowStart=c,this._intervalLogCount=0,this._droppedWarned=!1),u>this._intervalLogCount){this._intervalLogCount++;var d=function(e,t){var s=e.level||"info",{text:r,number:n}=bi[s]||wi,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=i({},a,e.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:r,body:{stringValue:e.body},attributes:Si(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Ke(e.trace_flags)||(u.flags=e.trace_flags),u}(e,this._getSdkContext());this._logBuffer.push({record:d}),(null!==(o=null==(a=this._instance.config.logs)?void 0:a.maxBufferSize)&&void 0!==o?o:100)>this._logBuffer.length?this._scheduleFlush():this.flushLogs()}else this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this._droppedWarned=!0)}else this._logger.warn("captureLog requires a body")}get logger(){return this._logger_instance||(this._logger_instance={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._logger_instance}flushLogs(e){if(this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0),0!==this._logBuffer.length){var t=this._logBuffer;this._logBuffer=[];var s=this._instance.config.logs,r=i({"service.name":(null==s?void 0:s.serviceName)||"unknown_service"},(null==s?void 0:s.environment)&&{"deployment.environment":s.environment},(null==s?void 0:s.serviceVersion)&&{"service.version":s.serviceVersion},null==s?void 0:s.resourceAttributes),o=function(e,t,i,s){return{resourceLogs:[{resource:{attributes:Si(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}(t.map((e=>e.record)),r,n.LIB_NAME,n.LIB_VERSION),a=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance._send_retriable_request({method:"POST",url:a,data:o,compression:"best-available",batchKey:"logs",transport:e})}}_scheduleFlush(){var e,t;this._flushTimeout||(this._flushTimeout=setTimeout((()=>{this._flushTimeout=void 0,this.flushLogs()}),null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=Ie&&null!=(e=Ie.location)&&e.href&&(t.currentUrl=Ie.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},Ba=i({},Ra,La,$a,Ma,Oa,Aa,qa,Da,Ha,za,Na,ja);jo.__defaultExtensionClasses=i({},Ba),function(){n.SDK_DIST_CHANNEL="cdn";var e=Fo[Ao]=new jo,t=Ie.posthog;t&&ns(t._i,(function(i){if(i&&Ue(i)){var s=e.init(i[0],i[1],i[2]),r=t[i[2]]||t;s&&(s._execute_array.call(s.people,r.people),s._execute_array(r))}})),Ie.posthog=e,function(){function e(){e.done||(e.done=!0,Do=!1,ns(Fo,(function(e){e._dom_loaded()})))}null!=be&&be.addEventListener?"complete"===be.readyState?e():hs(be,"DOMContentLoaded",e,{capture:!1}):ve&&is.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
1
+ !function(){"use strict";function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var r="1.386.2",n={DEBUG:!1,LIB_VERSION:r,LIB_NAME:"web",JS_SDK_VERSION:r},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",c="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",_="$exception_capture_enabled_server_side",h="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",v="$dead_clicks_enabled_server_side",f="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",S="$replay_override_url_trigger",E="$replay_override_event_trigger",k="$sesid",P="$session_is_sampled",I="$enabled_feature_flags",C="$active_feature_flags",F="$early_access_features",T="$feature_flag_details",R="$feature_flag_payloads",L="$feature_flag_request_id",M="$override_feature_flags",O="$override_feature_flag_payloads",A="$stored_person_properties",D="$stored_group_properties",q="$surveys",H="$surveys_loaded_at",z="$surveys_activated",N="ph_product_tours",j="$flag_call_reported",B="$flag_call_reported_session_id",U="$feature_flag_errors",W="$feature_flag_evaluated_at",V="$user_state",G="$client_session_props",K="$capture_rate_limit",J="$initial_campaign_params",Y="$initial_referrer_info",X="$initial_person_info",Q="$epp",Z="__POSTHOG_TOOLBAR__",ee="$posthog_cookieless",te="$sdk_debug_extensions_init_method",ie="$sdk_debug_extensions_init_time_ms",se="$sdk_debug_recording_script_not_loaded",re="PostHog loadExternalDependency extension not found.",ne="on_reject",oe="always",ae="anonymous",le="identified",ue="identified_only",ce="visibilitychange",de="beforeunload",_e="$pageview",he="$pageleave",pe="$identify",ge="$groupidentify",ve="undefined"!=typeof window?window:void 0,fe="undefined"!=typeof globalThis?globalThis:ve;"undefined"==typeof self&&(fe.self=fe),"undefined"==typeof File&&(fe.File=function(){});var me,ye=null==fe?void 0:fe.navigator,be=null==fe?void 0:fe.document,we=null==fe?void 0:fe.location,xe=null==fe?void 0:fe.fetch,Se=null!=fe&&fe.XMLHttpRequest&&"withCredentials"in new fe.XMLHttpRequest?fe.XMLHttpRequest:void 0,Ee=null==fe?void 0:fe.AbortController,ke=null==fe?void 0:fe.CompressionStream,Pe=null==ye?void 0:ye.userAgent,Ie=null!=ve?ve:{},Ce=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Fe=["$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"],Te="NativeGzipValidationError",Re=e=>e.length>=2&&31===e[0]&&139===e[1],Le=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),$e=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Te,t},Me=function(){var e=t((function*(e,t){18>e.size&&$e("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Re(i)&&8===i[2]||$e("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(me)return me;me=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;me[e]=t>>>0}return me})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&$e("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&$e("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function Oe(){return Oe=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield Me(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),Oe.apply(this,arguments)}var Ae=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],De=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Ae.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function qe(e,t){return-1!==e.indexOf(t)}var He=function(e){return e.trim()},ze=function(e){return e.replace(/^\$/,"")},Ne=Object.prototype,je=Ne.hasOwnProperty,Be=Ne.toString,Ue=Array.isArray||function(e){return"[object Array]"===Be.call(e)},We=e=>"function"==typeof e,Ve=e=>e===Object(e)&&!Ue(e),Ge=e=>{if(Ve(e)){for(var t in e)if(je.call(e,t))return!1;return!0}return!1},Ke=e=>void 0===e,Je=e=>"[object String]"==Be.call(e),Ye=e=>Je(e)&&0===e.trim().length,Xe=e=>null===e,Qe=e=>Ke(e)||Xe(e),Ze=e=>"[object Number]"==Be.call(e)&&e==e,et=e=>Ze(e)&&e>0,tt=e=>"[object Boolean]"===Be.call(e),it=e=>e instanceof FormData,st=e=>qe(Fe,e);function rt(e){return null===e||"object"!=typeof e}function nt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function ot(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var at=[!0,"true",1,"1","yes"],lt=e=>qe(at,e),ut=[!1,"false",0,"0","no"];function ct(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ze(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ct(r||i,t,i,s))}class dt{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ct(e.bucketSize,0,100,e._logger),this._refillRate=ct(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ct(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this._buckets[s];return r?this._applyRefill(r,i):this._buckets[s]=r={tokens:this._bucketSize,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===r.tokens)}stop(){this._buckets={}}}var _t,ht,pt,gt="Mobile",vt="iOS",ft="Android",mt="Tablet",yt=ft+" "+mt,bt="iPad",wt="Apple",xt=wt+" Watch",St="Safari",Et="BlackBerry",kt="Samsung",Pt=kt+"Browser",It=kt+" Internet",Ct="Chrome",Ft=Ct+" OS",Tt=Ct+" "+vt,Rt="Internet Explorer",Lt=Rt+" "+gt,$t="Opera",Mt=$t+" Mini",Ot="Edge",At="Microsoft "+Ot,Dt="Firefox",qt=Dt+" "+vt,Ht="Nintendo",zt="PlayStation",Nt="Xbox",jt=ft+" "+gt,Bt=gt+" "+St,Ut="Windows",Wt=Ut+" Phone",Vt="Nokia",Gt="Ouya",Kt="Generic",Jt=Kt+" "+gt.toLowerCase(),Yt=Kt+" "+mt.toLowerCase(),Xt="Konqueror",Qt="Oculus Browser",Zt="Vivaldi",ei="Yandex",ti="Whale",ii="DuckDuckGo",si="Pale Moon",ri="Waterfox",ni="Brave",oi="Google Search App",ai="(\\d+(\\.\\d+)?)",li=new RegExp("Version/"+ai),ui=new RegExp(Nt,"i"),ci=new RegExp(zt+" \\w+","i"),di=new RegExp(Ht+" \\w+","i"),_i=new RegExp(Et+"|PlayBook|BB10","i"),hi={"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"},pi=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?ni:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&qe(e,"GSA/")?oi:qe(e," OPR/")&&qe(e,"Mini")?Mt:qe(e," OPR/")?$t:_i.test(e)?Et:qe(e,"IE"+gt)||qe(e,"WPDesktop")?Lt:qe(e,"OculusBrowser")?Qt:qe(e,Pt)?It:qe(e,Ot)||qe(e,"Edg/")?At:qe(e,Zt+"/")?Zt:qe(e,"YaBrowser/")?ei:qe(e,ti+"/")?ti:qe(e,ii+"/")||qe(e,"Ddg/")?ii:qe(e,"FBIOS")?"Facebook "+gt:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?Tt:qe(e,"CrMo")||qe(e,Ct)?Ct:qe(e,ft)&&qe(e,St)?jt:qe(e,"FxiOS")?qt:qe(e.toLowerCase(),Xt.toLowerCase())?Xt:qe(e,ni+"/")?ni:((e,t)=>t&&qe(t,wt)||function(e){return qe(e,St)&&!qe(e,Ct)&&!qe(e,ft)}(e))(e,t)?qe(e,gt)?Bt:St:qe(e,"PaleMoon/")?si:qe(e,ri+"/")?ri:qe(e,Dt)?Dt:qe(e,"MSIE")||qe(e,"Trident/")?Rt:qe(e,"Gecko")?Dt:"")},gi={[Lt]:[new RegExp("rv:"+ai)],[At]:[new RegExp(Ot+"?\\/"+ai)],[Ct]:[new RegExp("("+Ct+"|CrMo)\\/"+ai)],[Tt]:[new RegExp("CriOS\\/"+ai)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ai)],[St]:[li],[Bt]:[li],[$t]:[new RegExp("(Opera|OPR)\\/"+ai)],[Dt]:[new RegExp(Dt+"\\/"+ai)],[qt]:[new RegExp("FxiOS\\/"+ai)],[Xt]:[new RegExp("Konqueror[:/]?"+ai,"i")],[Et]:[new RegExp(Et+" "+ai),li],[jt]:[new RegExp("android\\s"+ai,"i")],[It]:[new RegExp(Pt+"\\/"+ai)],[Qt]:[new RegExp("OculusBrowser\\/"+ai)],[Zt]:[new RegExp(Zt+"\\/"+ai)],[ei]:[new RegExp("YaBrowser\\/"+ai)],[ti]:[new RegExp(ti+"\\/"+ai)],[ni]:[new RegExp(ni+"\\/"+ai)],[ii]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ai)],[si]:[new RegExp("PaleMoon\\/"+ai)],[ri]:[new RegExp(ri+"\\/"+ai)],[oi]:[new RegExp("GSA\\/"+ai)],[Rt]:[new RegExp("(rv:|MSIE )"+ai)],Mozilla:[new RegExp("rv:"+ai)]},vi=function(e,t,i,s){var r=pi(e,t,i,s),n=gi[r];if(Ke(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},fi=[[new RegExp(Nt+"; "+Nt+" (.*?)[);]","i"),e=>[Nt,e&&e[1]||""]],[new RegExp(Ht,"i"),[Ht,""]],[new RegExp(zt,"i"),[zt,""]],[_i,[Et,""]],[new RegExp(Ut,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Wt,""];if(new RegExp(gt).test(t)&&!/IEMobile\b/.test(t))return[Ut+" "+gt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=hi[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Ut,s]}return[Ut,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[vt,[e[3],e[4],e[5]||"0"].join(".")]:[vt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ke(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ft+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ft+")","i"),e=>e&&e[2]?[ft,[e[2],e[3],e[4]||"0"].join(".")]:[ft,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ft,""]],[/Linux|debian/i,["Linux",""]]],mi=function(e){return di.test(e)?Ht:ci.test(e)?zt:ui.test(e)?Nt:new RegExp(Gt,"i").test(e)?Gt:new RegExp("("+Wt+"|WPDesktop)","i").test(e)?Wt:/iPad/.test(e)?bt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?xt:_i.test(e)?Et:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Vt,"i").test(e)?Vt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(gt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ft:yt:new RegExp("(pda|"+gt+")","i").test(e)?Jt:new RegExp(mt,"i").test(e)&&!new RegExp(mt+" pc","i").test(e)?Yt:""},yi=e=>e instanceof Error,bi={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}},wi=bi.info;function xi(e){if(tt(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Ue(e))return{arrayValue:{values:e.map((e=>xi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function Si(e){var t=[];for(var i in e){var s=e[i];Xe(s)||Ke(s)||t.push({key:i,value:xi(s)})}return t}function Ei(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return pt&&i.length===ht||(ht=i.length,pt=i.reduce(((i,s)=>{_t||(_t={});var r=_t[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,_t[s]=[l,u];break}}return i}),{})),pt}}class ki{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Ue(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var i=this;return t((function*(){var t=e;for(var s of i.modifiers)t=yield s(t);return t}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:null!==(s=t.type)&&void 0!==s?s:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Ei(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,s){void 0===s&&(s=0);var r=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return i({},t,{syntheticException:0==s?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,s),next:e=>r(e,s+1)})}}var Pi="?";function Ii(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Pi:i,in_app:!0};return Ke(s)||(n.lineno=s),Ke(r)||(n.colno=r),n}var Ci=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:Pi,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Fi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ti=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ri=/\((\S*)(?::(\d+))(?::(\d+))\)/,Li=(e,t)=>{var i=Fi.exec(e);if(i){var[,s,r,n]=i;return Ii(t,s,Pi,+r,+n)}var o=Ti.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Ri.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Ci(o[1]||Pi,o[2]);return Ii(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},$i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Mi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oi=(e,t)=>{var i=$i.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Mi.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||Pi;return[n,r]=Ci(n,r),Ii(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ai=/\(error: (.*)\)/;class Di{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Je(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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 nt(e,"DOMException")}isDOMError(e){return nt(e,"DOMError")}}class qi{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class Hi{constructor(){}match(e){return nt(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ni{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(zi);return s&&(t=s[1],i=s[2]),[t,i]}}var ji=["fatal","error","warning","log","info","debug"];function Bi(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class Ui{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ot(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Bi(e)}isSeverityLevel(e){return Je(e)&&!Ye(e)&&ji.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(yi(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Wi{match(e){return ot(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Bi(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Vi{match(e){return rt(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Gi{match(e){return nt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ot(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return rt(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Ki="$message",Ji="$timestamp",Yi=new Set([Ki,Ji]),Xi={enabled:!0,max_bytes:32768};function Qi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Xi.enabled,max_bytes:es(e.max_bytes,Xi.max_bytes)}:i({},Xi)}class Zi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Qi(e)}setConfig(e){this._config=Qi(e),this._trimToMaxBytes()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,((e,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(t.has(i))return"[Circular]";t.add(i)}return i}}))}catch(e){return}}(e);if(t)try{var i=JSON.parse(t);if(!Ve(i))return;var s=i,r=s[Ki],n=s[Ji];if(!Je(r)||0===r.trim().length)return;if(!Je(n)&&!Ze(n))return;return{step:s,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function es(e,t){if(!Ze(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var ts=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(ve&&(n.DEBUG||Ie.POSTHOG_DEBUG||i)&&!Ke(ve.console)&&ve.console){for(var s=("__rrweb_original__"in ve.console[t]?ve.console[t].__rrweb_original__:ve.console[t]),r=arguments.length,o=new Array(r>1?r-1:0),a=1;r>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ts(e+" "+t,i)};return s},is=ts("[PostHog.js]"),ss=is.createLogger;function rs(e,t){Ue(e)&&e.forEach(t)}function ns(e,t){if(!Qe(e))if(Ue(e))e.forEach(t);else if(it(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)je.call(e,i)&&t(e[i],i)}var os=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function as(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ls=function(e){try{return e()}catch(e){return}},us=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){is.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),is.critical(e)}}},cs=function(e){var t={};return ns(e,(function(e,i){(Je(e)&&e.length>0||Ze(e))&&(t[i]=e)})),t};var ds=["herokuapp.com","vercel.app","netlify.app"];function _s(e){var t=null==e?void 0:e.hostname;if(!Je(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ds)if(i===s)return!1;return!0}function hs(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function ps(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ze(e)&&isFinite(e)&&Math.floor(e)===e});class gs{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new gs(r)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gs(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class vs{constructor(){this._timestamp=0,this._counter=0,this._random=new ys}generate(){var e=this.generateOrAbort();if(Ke(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ke(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return gs.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var fs,ms=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ve&&!Ke(ve.crypto)&&crypto.getRandomValues&&(ms=e=>crypto.getRandomValues(e));class ys{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(ms(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var bs=()=>ws().toString(),ws=()=>(fs||(fs=new vs)).generate(),xs="",Ss=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Es={_is_supported:()=>!!be,_error(e){is.error("cookieStore error: "+e)},_get(e){if(be){try{for(var t=e+"=",i=be.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(Es._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!be)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=be),xs)return xs;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+bs();!xs&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",xs=n)}return xs}(e);if(!i){var s=(e=>{var t=e.match(Ss);return t?t[0]:""})(e);s!==i&&is.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(be.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&is.warn("cookieStore warning: large cookie, len="+u.length),be.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=be&&be.cookie)try{Es._set(e,"",-1,t)}catch(e){return}}},ks=null,Ps={_is_supported(){if(!Xe(ks))return ks;var e=!0;if(Ke(ve))e=!1;else try{var t="__mplssupport__";Ps._set(t,"xyz"),'"xyz"'!==Ps._get(t)&&(e=!1),Ps._remove(t)}catch(t){e=!1}return e||is.error("localStorage unsupported; falling back to cookie store"),ks=e,e},_error(e){is.error("localStorage error: "+e)},_get(e){try{return null==ve?void 0:ve.localStorage.getItem(e)}catch(e){Ps._error(e)}return null},_parse(e){try{return JSON.parse(Ps._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ve||ve.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ps._error(e)}return!1},_remove(e){try{null==ve||ve.localStorage.removeItem(e)}catch(e){Ps._error(e)}}},Is=[a,"distinct_id",k,P,Q,X,V],Cs={},Fs={_is_supported:()=>!0,_error(e){is.error("memoryStorage error: "+e)},_get:e=>Cs[e]||null,_parse:e=>Cs[e]||null,_set:(e,t)=>(Cs[e]=t,!0),_remove(e){delete Cs[e]}},Ts=null,Rs={_is_supported(){if(!Xe(Ts))return Ts;if(Ts=!0,Ke(ve))Ts=!1;else try{var e="__support__";Rs._set(e,"xyz"),'"xyz"'!==Rs._get(e)&&(Ts=!1),Rs._remove(e)}catch(e){Ts=!1}return Ts},_error(e){is.error("sessionStorage error: ",e)},_get(e){try{return null==ve?void 0:ve.sessionStorage.getItem(e)}catch(e){Rs._error(e)}return null},_parse(e){try{return JSON.parse(Rs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ve||ve.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Rs._error(e)}return!1},_remove(e){try{null==ve||ve.sessionStorage.removeItem(e)}catch(e){Rs._error(e)}}};class Ls{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===oe||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===ne}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return lt(e)?1:qe(ut,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ps:Es;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?Es:Ps;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(lt(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==ye?void 0:ye.doNotTrack,null==ye?void 0:ye.msDoNotTrack,Ie.doNotTrack].some((e=>lt(e)))}}var $s=1,Ms=3,Os=11;function As(e){return e instanceof Element&&(e.id===Z||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ds(e){return!!e&&e.nodeType===$s}function qs(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Hs(e){return!!e&&e.nodeType===Ms}function zs(e){return!!e&&e.nodeType===Os&&Ds(e.host)}function Ns(e){return e?He(e).split(/\s+/):[]}function js(e){var t=null==ve?void 0:ve.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Bs(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ns(t)}function Us(e){return Qe(e)?null:He(e).split(/(\s+)/).filter((e=>_r(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ws(e){var t="";return rr(e)&&!nr(e)&&e.childNodes&&e.childNodes.length&&ns(e.childNodes,(function(e){var i;Hs(e)&&e.textContent&&(t+=null!==(i=Us(e.textContent))&&void 0!==i?i:"")})),He(t)}function Vs(e){return Ke(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Gs=["a","button","form","input","select","textarea","label"];function Ks(e,t){if(Ke(t))return!0;var i,s=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function Js(e){var t=e.parentNode;return!(!t||!Ds(t))&&t}var Ys=["next","previous","prev",">","<"],Xs=[...Ys,"+","-","−","–"],Qs=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Zs=[".ph-no-rageclick",".ph-no-capture"],er=["","text","search","email","password","url","tel","number"];function tr(e,t){if(!ve||ir(e))return!1;var i,s,r,n,o;if(tt(t)?(i=!!t&&Zs,s=void 0,r=!1):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Zs,s=null==t?void 0:t.content_ignorelist,r=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(r&&function(e){return!(!e||!Ds(e))&&(!!qs(e,"textarea")||(qs(e,"input")?qe(er,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var{targetElementList:a}=sr(e,!1);return!function(e,t){if(!1===e||Ke(e))return!1;var i;if(!0===e)i=Ys;else{if(!Ue(e))return!1;if(e.length>10)return is.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:s}=e;return i.some((e=>Qs(t,e)||Qs(s,e)))}))}(s,a.map((e=>{var t;return{safeText:Ws(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Ks(a,i)}var ir=e=>!e||qs(e,"html")||!Ds(e),sr=(e,t)=>{if(!ve||ir(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!qs(r,"body");)if(zs(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Js(r);if(!n)break;if(t||Gs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=ve.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function rr(e){for(var t=e;t.parentNode&&!qs(t,"body");t=t.parentNode){var i=Bs(t);if(qe(i,"ph-sensitive")||qe(i,"ph-no-capture"))return!1}if(qe(Bs(e),"ph-include"))return!0;var s=e.type||"";if(Je(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Je(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function nr(e){return!!(qs(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||qs(e,"select")||qs(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var or="(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})",ar=new RegExp("^(?:"+or+")$"),lr=new RegExp(or),ur="\\d{3}-?\\d{2}-?\\d{4}",cr=new RegExp("^("+ur+")$"),dr=new RegExp("("+ur+")");function _r(e,t){if(void 0===t&&(t=!0),Qe(e))return!1;if(Je(e)){if(e=He(e),(t?ar:lr).test((e||"").replace(/[- ]/g,"")))return!1;if((t?cr:dr).test(e))return!1}return!0}function hr(e){var t=Ws(e);return _r(t=(t+" "+pr(e)).trim())?t:""}function pr(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ns(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Ws(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+pr(e)).trim())}catch(e){is.error("[AutoCapture]",e)}})),t}function gr(e){return e.replace(/"|\\"/g,'\\"')}function vr(e){var t=e.attr__class;return t?Ue(t)?t:Ns(t):void 0}var fr=ss("[Dead Clicks]"),mr=()=>!0,yr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return tt(s)?s:!!Ve(s)||i};class br{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[v]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?fr.error("failed to load script",t):e()}))}_start(){var e;if(be){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Ie.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Ve(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ie.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(be),fr.info("starting...")}}else fr.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,fr.info("stopping..."))}}var wr=ss("[SegmentIntegration]");var xr="posthog-js";function Sr(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,_;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=g[0])?void 0:_.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Er{constructor(e,t,i,s,r,n){this.name=xr,this.setupOnce=function(o){o(Sr(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class kr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(is.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==ve?void 0:ve.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Ke(n)||Ke(o)||Ke(a)||Ke(l)||Ke(u)||Ke(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ct(o/n,0,1,is):1,_=n>1?ct(a/n,0,1,is):1,h=l>1?ct(u/l,0,1,is):1,p=l>1?ct(c/l,0,1,is):1;s=os(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var Pr=["flags","surveys"],Ir={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[c]:{exposure:"event"},[d]:{exposure:"hidden"},[_]:{exposure:"event"},[h]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[v]:{exposure:"event"},[f]:{exposure:"hidden"},[m]:{exposure:"event"},[y]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[P]:{exposure:"event"},[b]:{exposure:"event",shouldSkipFromEventProperties:e=>Xe(e)},$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"},[I]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ve(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[C]:{exposure:"event",storageGroup:"flags"},[F]:{exposure:"hidden"},[T]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"event",storageGroup:"flags"},[L]:{exposure:"event",storageGroup:"flags"},[M]:{exposure:"event"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys"},[z]:{exposure:"event"},[N]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[j]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[te]:{exposure:"event"},[ie]:{exposure:"event"},[se]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Cr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Fr=e=>{var t=Ir[e];if(t)return t;for(var[i,s]of Cr)if(0===e.indexOf(i))return s},Tr=e=>{var t=null==be?void 0:be.createElement("a");return Ke(t)?null:(t.href=e,t)},Rr=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!Ue(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){is.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Lr=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ue(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},$r=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Mr="https?://(.*)",Or=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Or],Dr="<masked>",qr=["li_fat_id"];function Hr(e,t,i){if(!be)return{};var s,r=t?[...Or,...i||[]]:[],n=zr(Lr(be.URL,r,Dr),e),o=(s={},ns(qr,(function(e){var t=Es._get(e);s[e]=t||null})),s);return os(o,n)}function zr(e,t){var i=Ar.concat(t||[]),s={};return ns(i,(function(t){var i=Rr(e,t);s[t]=i||null})),s}function Nr(e){var t=function(e){return e?0===e.search(Mr+"google.([^/?]*)")?"google":0===e.search(Mr+"bing.com")?"bing":0===e.search(Mr+"yahoo.com")?"yahoo":0===e.search(Mr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Xe(t)){s.$search_engine=t;var r=be?Rr(be.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function jr(){return navigator.language||navigator.userLanguage}var Br="$direct";function Ur(){return(null==be?void 0:be.referrer)||Br}function Wr(e,t){var i=e?[...Or,...t||[]]:[],s=null==we?void 0:we.href.substring(0,1e3);return{r:Ur().substring(0,1e3),u:s?Lr(s,i,Dr):void 0}}function Vr(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Br?Br:null==(t=Tr(i))?void 0:t.host};if(s){r.$current_url=s;var n=Tr(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=zr(s);os(r,o)}if(i){var a=Nr(i);os(r,a)}return r}function Gr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Kr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Jr={flags:W,surveys:H},Yr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Xr="main";class Qr{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&is.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),ve){var r=()=>this.flush();hs(ve,"beforeunload",r,{capture:!1}),hs(ve,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ze(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Yr.indexOf(e.persistence.toLowerCase())&&(is.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...Is,...e];return i({},Ps,{_parse(e){try{var i={};try{i=Es._parse(e)||{}}catch(e){}var s,r=JSON.parse(Ps._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Xe(a)||""===a||(n[o]=a)}s=os(r,n)}else s=os(i,r);return Ps._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=Ps._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&Es._set(e,l,i,r,n,o)}catch(e){Ps._error(e)}return a},_remove(e,t){try{null==ve||ve.localStorage.removeItem(e),Es._remove(e,t)}catch(e){Ps._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ps._is_supported()?(t=Ps,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&Rs._is_supported()?t=Rs:"memory"===n?t=Fs:"cookie"===n?t=Es:s._is_supported()?(t=s,r=!0):t=Es,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[W];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return ns(this.props,((t,i)=>{var s=Fr(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===I?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&os(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=os({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Pr){var t=Ps._parse(this._groupEntryName(e));if(t&&!Ge(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||os(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Fr(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Jr[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ze(s)&&Ze(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Fr(e))?void 0:t.storageGroup:void 0,s=i?Ps._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Ke(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Ke(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Xr))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Xr),Pr)){var s,r=t[i];(!Ge(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(Ps,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of Pr)t[i]={};return ns(this.props,((i,s)=>{var r,n=null==(r=Fr(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){var i=JSON.stringify(e);return t===Xr?i+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure:i}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Xr||r.dirty||Ke(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Xr&&(r.persisted=!0),Ke(n)||(r.fingerprint=n)):this._config.debug&&is.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(Ke(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of Pr)Ps._remove(this._groupEntryName(i));t?delete this._slotState[Xr]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Ve(e)){Ke(t)&&(t="None"),this._expire_days=Ke(i)?this._default_expiry:i;var s=!1;if(ns(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(Ve(e)){this._expire_days=Ke(t)?this._default_expiry:t;var i=!1;if(ns(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=Hr(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ge(cs(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==be?void 0:be.referrer)?Nr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ur(),$referring_domain:null!=be&&be.referrer&&(null==(e=Tr(be.referrer))?void 0:e.host)||Br},void 0)}set_initial_person_info(){this.props[J]||this.props[Y]||this.register_once({[X]:Wr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ns([Y,J],(t=>{var i=this.props[t];i&&ns(i,(function(t,i){e["$initial_"+ze(i)]=t}))}));var t,i,s=this.props[X];if(s){var r=(t=Vr(s),i={},ns(t,(function(e,t){i["$initial_"+ze(t)]=e})),i);os(e,r)}return e}safe_merge(e){return ns(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[u]||{};i[e]=t,this._setProp(u,i),this.save()}remove_event_timer(e){var t=this.props[u]||{},i=t[e];return Ke(i)||(delete t[e],this._setProp(u,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){this.props[e]=t,this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Fr(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Zr="events",en="cancelEvents",tn="survey shown",sn="survey sent",rn="popover",nn=ss("[RateLimiter]");class on{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{nn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void nn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(K))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(K,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var an=ss("[RemoteConfig]");class ln{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Ie._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return an.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void an.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return an.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){an.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&be&&"hidden"!==be.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||an.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var un="gzip-js",cn="base64",dn=Uint8Array,_n=Uint16Array,hn=Uint32Array,pn=new dn([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]),gn=new dn([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]),vn=new dn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fn=function(e,t){for(var i=new _n(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new hn(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},mn=fn(pn,2),yn=mn[1];mn[0][28]=258,yn[258]=28;for(var bn=fn(gn,0)[1],wn=new _n(32768),xn=0;32768>xn;++xn){var Sn=(43690&xn)>>>1|(21845&xn)<<1;wn[xn]=((65280&(Sn=(61680&(Sn=(52428&Sn)>>>2|(13107&Sn)<<2))>>>4|(3855&Sn)<<4))>>>8|(255&Sn)<<8)>>>1}var En=function(e,t,i){for(var s=e.length,r=0,n=new _n(t);s>r;++r)++n[e[r]-1];var o,a=new _n(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new _n(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[wn[d]>>>l]=u}else for(o=new _n(s),r=0;s>r;++r)o[r]=wn[a[e[r]-1]++]>>>15-e[r];return o},kn=new dn(288);for(xn=0;144>xn;++xn)kn[xn]=8;for(xn=144;256>xn;++xn)kn[xn]=9;for(xn=256;280>xn;++xn)kn[xn]=7;for(xn=280;288>xn;++xn)kn[xn]=8;var Pn=new dn(32);for(xn=0;32>xn;++xn)Pn[xn]=5;var In=En(kn,9,0),Cn=En(Pn,5,0),Fn=function(e){return(e/8>>0)+(7&e&&1)},Tn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof _n?_n:e instanceof hn?hn:dn)(i-t);return s.set(e.subarray(t,i)),s},Rn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Ln=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},$n=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new dn(0),0];if(1==r){var o=new dn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=c&&i[d].f>i[u].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var _=n[0].s;for(s=1;r>s;++s)n[s].s>_&&(_=n[s].s);var h=new _n(_+1),p=Mn(i[c-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new dn(h),p]},Mn=function(e,t,i){return-1==e.s?Math.max(Mn(e.l,t,i+1),Mn(e.r,t,i+1)):t[e.s]=i},On=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new _n(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++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=e[a]}return[i.subarray(0,s),t]},An=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Dn=function(e,t,i){var s=i.length,r=Fn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},qn=function(e,t,i,s,r,n,o,a,l,u,c){Rn(t,c++,i),++r[256];for(var d=$n(r,15),_=d[0],h=d[1],p=$n(n,15),g=p[0],v=p[1],f=On(_),m=f[0],y=f[1],b=On(g),w=b[0],x=b[1],S=new _n(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=$n(S,7),P=k[0],I=k[1],C=19;C>4&&!P[vn[C-1]];--C);var F,T,R,L,M=u+5<<3,O=An(r,kn)+An(n,Pn)+o,A=An(r,_)+An(n,g)+o+14+3*C+An(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=M&&A>=M)return Dn(t,c,e.subarray(l,l+u));if(Rn(t,c,1+(O>A)),c+=2,O>A){F=En(_,h,0),T=_,R=En(g,v,0),L=g;var D=En(P,I,0);for(Rn(t,c,y-257),Rn(t,c+5,x-1),Rn(t,c+10,C-4),c+=14,E=0;C>E;++E)Rn(t,c+3*E,P[vn[E]]);c+=3*C;for(var q=[m,w],H=0;2>H;++H){var z=q[H];for(E=0;z.length>E;++E)Rn(t,c,D[N=31&z[E]]),c+=P[N],N>15&&(Rn(t,c,z[E]>>>5&127),c+=z[E]>>>12)}}else F=In,T=kn,R=Cn,L=Pn;for(E=0;a>E;++E)if(s[E]>255){var N;Ln(t,c,F[257+(N=s[E]>>>18&31)]),c+=T[N+257],N>7&&(Rn(t,c,s[E]>>>23&31),c+=pn[N]);var j=31&s[E];Ln(t,c,R[j]),c+=L[j],j>3&&(Ln(t,c,s[E]>>>5&8191),c+=gn[j])}else Ln(t,c,F[s[E]]),c+=T[s[E]];return Ln(t,c,F[256]),c+T[256]},Hn=new hn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zn=function(){for(var e=new hn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Nn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function jn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=zn[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new dn(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=Dn(l,u,e.subarray(c,d)):(l[c]=!0,u=Dn(l,u,e.subarray(c,o)))}else{for(var _=Hn[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new _n(32768),f=new _n(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new hn(25e3),x=new _n(288),S=new _n(32),E=0,k=0,P=(c=0,0),I=0,C=0;o>c;++c){var F=b(c),T=32767&c,R=f[F];if(v[T]=R,f[F]=T,c>=I){var L=o-c;if((E>7e3||P>24576)&&L>423){u=qn(e,l,0,w,x,S,k,P,C,c-C,u),P=E=k=0,C=c;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var O=2,A=0,D=p,q=T-R&32767;if(L>2&&F==b(c-q))for(var H=Math.min(h,L)-1,z=Math.min(32767,c),N=Math.min(258,L);z>=q&&--D&&T!=R;){if(e[c+O]==e[c+O-q]){for(var j=0;N>j&&e[c+j]==e[c+j-q];++j);if(j>O){if(O=j,A=q,j>H)break;var B=Math.min(q,j-2),U=0;for(M=0;B>M;++M){var W=c-q+M+32768&32767,V=W-v[W]+32768&32767;V>U&&(U=V,R=W)}}}q+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|yn[O]<<18|bn[A];var G=31&yn[O],K=31&bn[A];k+=pn[G]+gn[K],++x[257+G],++S[K],I=c+O,++E}else w[P++]=e[c],++x[e[c]]}}u=qn(e,l,!0,w,x,S,k,P,C,c-C,u)}return Tn(a,0,s+Fn(u)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),c=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Nn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),Nn(u,c-8,i.d()),Nn(u,c-4,s),u}var Bn=!!Se||!!xe,Un="text/plain",Wn=!1,Vn=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Gn=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return ns(e,(function(e,t){Ke(e)||Ke(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Kn=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Jn=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===un){var s=jn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new dn(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new dn(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Tn(s,0,r)}(Kn(t)),{mtime:0});return{contentType:Un,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===cn){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Kn(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Kn(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Kn(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Yn=e=>{var t,s,r,n=Jn(e);return!n||(s=e.compression,r=Rr(e.url,"compression"),s!==Ce.GZipJS&&r!==Ce.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?Re(new Uint8Array(t)):ArrayBuffer.isView(t)&&Re(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Wn=!0,{url:Vn(e.url,"compression"),encodedBody:Jn(i({},e,{compression:void 0,_encodedBody:void 0}))})},Xn=function(){var e=t((function*(e){var t=Kn(e.data),s=yield function(e,t,i){return Oe.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:Un,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Qn=(e,t)=>Gn(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),Zn=[];xe&&Zn.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Yn(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;ns(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(Ee){var c=new Ee;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}xe(s,i({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(a||0),body:o,signal:null==(t=u)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){is.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{is.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),Se&&Zn.push({transport:"XHR",method(e){var t=new Se,{url:i,encodedBody:s}=Yn(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};ns(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=ye&&ye.sendBeacon&&Zn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Yn(e),s=Gn(t,{beacon:"1"}),{contentType:r,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:r});ye.sendBeacon(s,o)}catch(e){}}});var eo=3e3;class to{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ct((null==t?void 0:t.flush_interval_ms)||eo,250,5e3,is.createLogger("flush interval"),eo),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&Ue(i.data)&&ns(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return ns(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ke(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var io=["retriesPerformedSoFar"];class so{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ke(ve)&&"onLine"in ve.navigator&&(this._areWeOnline=ve.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},hs(ve,"online",this._onlineListener),hs(ve,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,io);et(t)&&(r.url=Gn(r.url,{retry_count:t})),this._instance._send_request(i({},r,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==r.callback||r.callback(e):this._enqueue(i({retriesPerformedSoFar:t},r))}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),is.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Ke(ve)||(this._onlineListener&&(ve.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ve.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){is.error(e)}this._queue=[]}}class ro{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){hs(ve,"scroll",this._updateScrollData,{capture:!0}),hs(ve,"scrollend",this._updateScrollData,{capture:!0}),hs(ve,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ve?void 0:ve.document.documentElement;var e=Ue(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==ve?void 0:ve.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return ve?"y"===e?ve.scrollY||ve.pageYOffset||ve.document.documentElement.scrollTop||0:ve.scrollX||ve.pageXOffset||ve.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var no=e=>Wr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class oo{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[G]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||no,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[G]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Vr(t):{$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 ns(cs(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+ze(i)]=t})),e}}class ao{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var lo=ss("[SessionId]");class uo{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new ao,this._sessionHasBeenIdleTooLong=(e,t)=>!(!et(e)||!et(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===oe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||bs,this._windowIdGenerator=i||bs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ct(this._config.session_idle_timeout_seconds||1800,60,36e3,lo.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Rs._parse(this._window_id_storage_key),o=Rs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Rs._remove(this._window_id_storage_key),Rs._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){lo.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ke(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Rs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Rs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Rs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Xe(t)&&!Xe(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[k]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return et(t)&&t>0}_flushPendingActivityTimestamp(){var e;if(!Xe(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(k):(this._persistence.flush(),this._persistence.load());var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[k]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=et(e)?e:0,i=et(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_getSessionId(){var e=this._persistence.props[k];return Ue(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&ve&&(ve.removeEventListener(de,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Rs._remove(this._primary_window_exists_storage_key)},hs(ve,de,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===oe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=et(r)&&Math.abs(i-r)>864e5,l=!1,u=!s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),lo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=et(n)&&e&&!a?n:i,_=et(r)?r:(new Date).getTime();return this._setWindowId(o),this._setSessionId(s,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var e=this._freshestActivityTimestamp();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var co=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&De(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>De(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},_o=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function ho(e,t,i){return Kn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var po={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>_o(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!_o(t,e))))),icontains:(e,t)=>t.map(go).some((t=>e.map(go).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(go).every((t=>e.map(go).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var i=parseFloat(t);return!isNaN(i)&&e.some((e=>i>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var i=parseFloat(t);return!isNaN(i)&&e.some((e=>i<parseFloat(e)))}))},go=e=>e.toLowerCase();function vo(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ke(r)||Xe(r))return!1;var n=[String(r)],o=po[s.operator];return!!o&&o(s.values,n)}))}var fo="custom",mo="i.posthog.com",yo=/^\/static\//;class bo{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+mo,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":fo),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(yo.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===fo)return this.apiHost+t;var s=mo+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var wo=ss("[Surveys]"),xo="seenSurvey_",So=["popover","widget","api"],Eo={ignoreConditions:!1,ignoreDelay:!1,displayType:rn},ko=ss("[PostHog ExternalIntegrations]"),Po={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Io{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return ko.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Ie.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Po[t],(()=>{var i;null==(i=Ie.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Ie.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Ie.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var Co,Fo={},To=0,Ro=()=>{},Lo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$o="Surveys module not available",Mo="sanitize_properties is deprecated. Use before_send instead",Oo="Invalid value for property_denylist config: ",Ao="posthog",Do=!Bn&&-1===(null==Pe?void 0:Pe.indexOf("MSIE"))&&-1===(null==Pe?void 0:Pe.indexOf("Mozilla")),qo=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:_s(null==be?void 0:be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ro,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:we&&Je(null==we?void 0:we.search)&&-1!==we.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ve||null==(t=ve.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){is.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ue,before_send:void 0,request_queue_config:{flush_interval_ms:eo},error_tracking:{},_onCapture:Ro},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Xs,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e)}))(e))},Ho=[["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"]],zo=e=>{var t={};for(var[i,s]of Ho)Ke(e[i])||(t[s]=e[i]);var r=os({},t,e),n=e.__preview_external_dependency_versioned_paths;return Ke(n)||(Ke(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),Je(n)&&Ke(e.asset_host)&&(r.asset_host=n)),Ue(e.property_blacklist)&&(Ke(e.property_denylist)?r.property_denylist=e.property_blacklist:Ue(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:is.error(Oo+e.property_denylist)),r};class No{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){is.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class jo{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===oe||this.config.cookieless_mode===ne&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new No,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new ao,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=qo(),this.SentryIntegration=Er,this.sentryIntegration=e=>function(e,t){var i=Sr(e,t);return{name:xr,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new ro(this),this.pageViewManager=new kr(this),this.rateLimiter=new on(this),this.requestRouter=new bo(this),this.consent=new Ls(this),this.externalIntegrations=new Io(this);var t=null!==(e=jo.__defaultExtensionClasses)&&void 0!==e?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.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=Je(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Je(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>is.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Ao){var s,r=null!==(s=Fo[i])&&void 0!==s?s:new jo;return r._init(e,t,i),Fo[i]=r,Fo[Ao][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;void 0===t&&(t={});var a=Je(e)?e.trim():"";if(!a)return is.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=qo(t.defaults),u=zo(t),c=os({},l,u,{name:s,token:a});Ve(l.rageclick)&&Ve(u.rageclick)&&(c.rageclick=os({},l.rageclick,u.rageclick)),this.set_config(c),this.config.on_xhr_error&&is.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:un;var d=this._is_persistence_disabled();this.persistence=new Qr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Qr(i({},this.config,{persistence:"sessionStorage"}),d,!1);var _=i({},this.persistence.props),h=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new to((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new so(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new uo(this),this.sessionPropsManager=new oo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(is.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(is.info("Initializing extensions synchronously"),this._initExtensions(p)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&is.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:_,s:h}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),f=this.persistence.get_property(V);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===ae)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===le)is.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 m=this.config.get_device_id(bs()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(V,t.bootstrap.isIdentifiedID?le:ae),this.register({distinct_id:g,$device_id:y})}}if(p)this.register_once({distinct_id:ee,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(bs());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(V,ae)}return hs(ve,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||bs();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(V,le)),t()},r=i.user();"then"in r&&We(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||wr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(wr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(wr.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,_e),identify:e=>t(e,pe),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),We(this.config._onCapture)&&this.config._onCapture!==Ro&&(is.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&is.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}_initExtensions(e){var t,s,r,n,o,a,l,u=performance.now(),c=i({},jo.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,yr)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){is.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[te]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ie]:s}),this.config.__preview_deferred_init_extensions&&is.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!be||!be.body)return is.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(e.supportedCompression,un)?un:qe(e.supportedCompression,cn)?cn:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:ue}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){is.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=we&&we.hostname){var e=we.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ln(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&rs(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(he),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(he,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Do?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Gn(e.url,{ip:this.config.ip?1:0}),e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Ke(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=Qn(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Zn.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===un&&ke&&!Wn?Xn(n).then((e=>{l(e)})).catch((t=>{if(Le(t))return Wn=!0,void l(i({},n,{compression:void 0,url:Qn(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Le(e)||t===Te})(t)&&(Wn=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){To++;try{var t,i=[],s=[],r=[];rs(e,(e=>{if(e)if(Ue(t=e[0]))r.push(e);else if(We(e))try{e.call(this)}catch(t){is.error("Error executing queued PostHog call",e,t)}else Ue(e)&&"alias"===t?i.push(e):Ue(e)&&-1!==t.indexOf("capture")&&We(this[t])?r.push(e):s.push(e)}));var n=function(e,t){rs(e,(function(e){try{if(Ue(e[0])){var i=t;ns(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){is.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{To--}}push(e){if(To>0&&Ue(e)&&Je(e[0])){var t=jo.prototype[e[0]];We(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._requestQueue){if(this.is_capturing())if(!Ke(e)&&Je(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Je(null==t?void 0:t.$current_url)&&(is.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||is.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,_=(null==s?void 0:s.timestamp)||d,h=(null==s?void 0:s.uuid)||bs(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===_e&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g,v,f,m=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ge,e===pe);if(m&&(p.$set_once=m),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Je(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),Ue(t)?(s=[],rs(t,(t=>{s.push(e(t))}))):(s={},ns(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ke(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),"survey dismissed"===e||e===sn){var y=null==t?void 0:t.$survey_id,b=null==t?void 0:t.$survey_iteration;(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(xo,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){wo.error("Failed to persist survey seen state",e)}})({id:y,current_iteration:b}),p.$set=i({},p.$set,{[(g={id:y,current_iteration:b},v=e===sn?"responded":"dismissed",f="$survey_"+v+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(f="$survey_"+v+"/"+g.id+"/"+g.current_iteration),f)]:!0})}else e===tn&&(p.$set=i({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var w=null==t?void 0:t.$product_tour_type;w&&(p.$set=i({},p.$set,{["$product_tour_last_seen_date/"+w]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(Ge(x)||this.setPersonPropertiesForFlags(x),!Qe(this.config.before_send)){var S=this._runBeforeSend(p);if(!S)return;p=S}this._internalEventEmitter.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}is.critical("This capture call is ignored due to client rate limiting.")}}else is.error("No event name provided to posthog.capture")}else is.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!Je(l.distinct_id)&&!Ze(l.distinct_id)||Ye(l.distinct_id))&&is.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t,i){var s,r,o,a;if(!Pe)return{};var l,u,c,d,_,h,p,g,v,f=e?[...Or,...t||[]]:[],[m,y]=function(e){for(var t=0;fi.length>t;t++){var[i,s]=fi[t],r=i.exec(e),n=r&&(We(s)?s(r,e):s);if(n)return n}return["",""]}(Pe),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},x=os(cs({$os:m,$os_version:y,$browser:pi(Pe,navigator.vendor,b,w),$device:mi(Pe),$device_type:(c=Pe,d={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==ve||null==(o=ve.screen)?void 0:o.width,screenHeight:null==ve||null==(a=ve.screen)?void 0:a.height,devicePixelRatio:null==ve?void 0:ve.devicePixelRatio},v=mi(c),v===bt||v===yt||"Kobo"===v||"Kindle Fire"===v||v===Yt?mt:v===Ht||v===Nt||v===zt||v===Gt?"Console":v===xt?"Wearable":v?gt:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(_=null==d?void 0:d.maxTouchPoints)&&void 0!==_?_:0)>0?600>Math.min(null!==(h=null==d?void 0:d.screenWidth)&&void 0!==h?h:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?gt:mt:"Desktop"),$timezone:Gr(),$timezone_offset:Kr()}),{$current_url:Lr(null==we?void 0:we.href,f,Dr),$host:null==we?void 0:we.host,$pathname:null==we?void 0:we.pathname,$raw_user_agent:Pe.length>1e3?Pe.substring(0,997)+"...":Pe,$browser_version:vi(Pe,navigator.vendor,b,w),$browser_language:jr(),$browser_language_prefix:(u=jr(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==ve?void 0:ve.screen.height,$screen_width:null==ve?void 0:ve.screen.width,$viewport_height:null==ve?void 0:ve.innerHeight,$viewport_width:null==ve?void 0:ve.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return n.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=n.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&os(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&os(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===fo&&(l.$lib_custom_api_host=this.config.api_host),c=e!==_e||o?e!==he||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=os(l,c),e===_e&&be&&(l.title=be.title),!Ke(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Pe&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=os({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ue(this.config.property_denylist)?ns(this.config.property_denylist,(function(e){delete l[e]})):is.error(Oo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(is.error(Mo),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=os({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(is.error(Mo),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ge(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.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:$o}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:$o})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:$o})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=Eo),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:$o}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:$o})}_validateIdentifyId(e){return!e||Ye(e)?(is.critical("Unique user id has not been set in posthog.identify"),!1):e===ee?(is.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())||(is.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,i){if(!this.__loaded||!this.persistence)return is.uninitializedWarning("posthog.identify");if(Ze(e)&&(e=e.toString(),is.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(V)||ae)===ae;e!==s&&n?(this.persistence.set_property(V,le),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(pe,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=ho(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(j))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=ho(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):is.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(ge,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else is.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,l,u;if(is.info("reset"),!this.__loaded)return is.uninitializedWarning("posthog.reset");var c,d=this.get_property(a),_=this.get_property(y);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),Ke(_)||null==(c=this.persistence)||c.register({[y]:_}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(V,ae),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===oe)this.register_once({distinct_id:ee,$device_id:null},"");else{var h=this.config.get_device_id(bs());this.register_once({distinct_id:h,$device_id:e?h:d},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(o)?(is.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ke(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(is.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(Ve(e)){var s,r,o,a,l,u,c,d,_,h,p;os(this.config,zo(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Qr(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);tt(v)&&(this.config.debug=v),tt(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Ps._is_supported()&&Ps._set("ph_debug",!0),is.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Ps._is_supported()&&Ps._remove("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!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(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:jo._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Ao;return t!==Ao&&(t=Ao+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(V))===le||(null==(t=this.sessionPersistence)?void 0:t.get_property(V))===le}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ue&&!this._isIdentified()&&Ge(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Q]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(is.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Q,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ne)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==oe){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new uo(this),this.pageViewManager=new kr(this),this.persistence&&(this.sessionPropsManager=new oo(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=jo.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==ne&&(null==(u=this.surveys)||u.loadIfEnabled()),(Ke(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else is.warn(Lo)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==oe?(this.config.cookieless_mode===ne&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===ne&&(this.register({distinct_id:ee,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):is.warn(Lo)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===oe||(this.config.cookieless_mode===ne?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return ye?co(ye,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){be&&("visible"===be.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(_e,{title:be.title},{send_instantly:!0}),this._visibilityStateListener&&(be.removeEventListener(ce,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),hs(be,ce,this._visibilityStateListener)))}debug(e){!1===e?(null==ve||ve.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ve||ve.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(is.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):(i="advanced_disable_decide",!1,s=is,r=(t="advanced_disable_flags")in(e=o)&&!Qe(e[t]),n=i in e&&!Qe(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){if(Qe(this.config.before_send))return e;var t=Ue(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Qe(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return st(e.event)?is.warn(r+". This can cause unexpected behavior."):is.info(r),null}i.properties&&!Ge(i.properties)||is.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=tt(e)&&!e,i=Ps._is_supported()&&"true"===Ps._get("ph_debug");return!t&&(!!i||e)}}jo.__defaultExtensionClasses={},jo._noopLogger={trace:Co=()=>{},debug:Co,info:Co,warn:Co,error:Co,fatal:Co},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=us(e.prototype[t[i]])}(jo,["identify"]);class Bo{constructor(e){this.disabled=!1===e;var t=Ve(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,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Uo="$copy_autocapture",Wo=ss("[AutoCapture]");function Vo(e,t){return t.length>e?t.slice(0,e)+"...":t}function Go(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ds(t));return t}function Ko(e,t){var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Ds(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!qs(d,"body");)if(zs(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Ds(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(ns(c,(e=>{var t=rr(e);if(qs(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&_r(i)&&i}qe(Bs(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Gs.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Vo(1024,hr(e)):Vo(1024,Ws(e)));var o=Bs(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),ns(e.attributes,(function(i){var r;if((!nr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&_r(i.value)&&(!Je(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=Ns(o).join(" ")),n["attr__"+i.name]=Vo(1024,o)}}));for(var a=1,l=1,u=e;u=Go(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var s=function(e){if(!rr(e))return{};var t={};return ns(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&_r(s)&&(t[i]=s)}})),t}(e);os(g,s)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=qs(e,"a")||qs(e,"button")?hr(e):Ws(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Tr(v))?void 0:m.host,w=null==ve||null==(y=ve.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:os({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,s,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(s=e.nth_of_type)&&void 0!==s?s:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return as(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[gr(t.toString())]=gr(i.toString())})),(r+=":")+as(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:vr(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return as(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return s.attributes[t]=i})),s}))}(h)))},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Jo=ss("[ExceptionAutocapture]"),Yo=ss("[TracingHeaders]"),Xo=ss("[Web Vitals]"),Qo=9e5,Zo="disabled",ea="lazy_loading",ta="awaiting_config",ia="missing_config";ss("[SessionRecording]"),ss("[SessionRecording]");var sa="[SessionRecording]",ra=ss(sa),na=ss("[Heatmaps]");function oa(e){return Ve(e)&&"clientX"in e&&"clientY"in e&&Ze(e.clientX)&&Ze(e.clientY)}var aa=ss("[Product Tours]"),la=["$set_once","$set"],ua=ss("[SiteApps]"),ca="Error while initializing PostHog app with config id ";function da(e,t,i){if(Qe(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class _a{constructor(e){this._debugEventEmitter=new ao,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this._actionEvents=new Set,this._actionRegistry=new Set}init(){var e,t;Ke(null==(e=this._instance)?void 0:e._addCaptureHook)||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)})))}register(e){var t,i;if(!Ke(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)}))})),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(null==t?void 0:t.event))&&this._actionRegistry&&(null==(i=this._actionRegistry)?void 0:i.size)>0&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!da(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>da(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&da((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>da(e.text,t.text,t.text_matching||"exact")||da(e.$el_text,t.text,t.text_matching||"exact")));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Qe(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some((e=>da(e,n,o))))}_checkStepSelector(e,t){var i,s;if(null==t||!t.selector)return!0;var r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||vo(t.properties.reduce(((e,t)=>{var i=Ue(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class ha{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&vo(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var i=new Map;return e.forEach((e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach((t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}}))})),i}_getMatchingItems(e,t,i){var s=(i===Zr?this._eventToItems:this._cancelEventToItems).get(e),r=[];return this._getItems((e=>{r=e.filter((e=>null==s?void 0:s.includes(e.id)))})),r.filter((s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;Ke(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(e){var t=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==t.length&&(null==this._actionMatcher&&(this._actionMatcher=new _a(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this._actionMatcher)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((t=>{if(t&&t.name){var i=this._actionToItems.get(t.name);i&&i.push(e.id),this._actionToItems.set(t.name,i||[e.id])}})))})))}_setupEventBasedItems(e){var t,i=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),s=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,Zr),this._cancelEventToItems=this._buildEventToItemMap(e,en))}onEvent(e,t){var i,s=this._getLogger(),r=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this._updateActivatedItems(o))}}else{if(this._cancelEventToItems.has(e)){var d=this._getMatchingItems(e,t,en);d.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this._cancelPendingItem(e.id)})),this._updateActivatedItems(o))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,Zr);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(s.concat(this._actionToItems.get(e)||[]))}_updateActivatedItems(e){var t=this._getLogger(),i=[...new Set(e)].filter((e=>!this._isItemPermanentlyIneligible(e)));t.info("updating activated items",{activatedItems:i}),this._setActivatedItems(i)}getActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class pa extends ha{constructor(e){super(e)}_getActivatedKey(){return z}_getShownEventName(){return tn}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return wo}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[z]:e})}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ga="SDK is not enabled or survey functionality is not yet loaded",va="Disabled. Not loading surveys.",fa=null!=ve&&ve.location?$r(ve.location.hash,"__posthog")||$r(location.hash,"state"):null,ma="_postHogToolbarParams",ya=ss("[Toolbar]"),ba=ss("[FeatureFlags]"),wa=ss("[FeatureFlags]",{debugEnabled:!0}),xa="\" failed. Feature flags didn't load in time.",Sa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},Ea=e=>{var t={};for(var[i,s]of as(e||{}))s&&(t[i]=s);return t},ka=ss("[Error tracking]"),Pa="Refusing to render web experiment since the viewer is a likely bot",Ia={icontains:(e,t)=>!!ve&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ve&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!ve&&_o(t.href,e),not_regex:(e,t)=>!!ve&&!_o(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Ca{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Ca._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Ca._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var s=t._instance.getFeatureFlag(e.feature_flag_key);Je(s)&&e.variants[s]&&t._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];Ca._matchesTestVariant(n)&&t._applyTransforms(e.name,r,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Ca._logInfo(Pa);else if(!this._config.disable_web_experiments){if(Qe(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ca._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this._flagToExperiments)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this._applyTransforms(r.name,s,r.variants[s].transforms)}}))}}previewWebExperiment(){var e=Ca.getWindowLocation();if(null!=e&&e.search){var t=Rr(null==e?void 0:e.search,"__experiment_id"),i=Rr(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Ca._logInfo("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var s=i.filter((t=>t.id===e));s&&s.length>0&&(Ca._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this._applyTransforms(s[0].name,t,s[0].variants[t].transforms))}static _matchesTestVariant(e){return!Qe(e.conditions)&&Ca._matchUrlConditions(e)&&Ca._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Qe(e.conditions)||Qe(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Ca.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||Ia[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==ve?void 0:ve.location}static _matchUTMConditions(e){var t;if(Qe(e.conditions)||Qe(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Hr();if(i.utm_source){var s,r,n,o,a,l,u,c,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];is.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Ca._logInfo(Pa):"control"!==t?i.forEach((i=>{if(i.selector){var s;Ca._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Ca._logInfo("Control variants leave the page unmodified.")}_is_bot(){return ye&&this._instance?co(ye,this._config.custom_blocked_useragents):void 0}}var Fa=ss("[Conversations]"),Ta="Conversations not available yet.",Ra={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._instance=e,this.featureFlagEventHandlers=[]}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,ba.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(ba.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ba.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}_getValidFlagKeys(){var e=this._config.flag_keys;if(!Ke(e)){if(Ue(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ba.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ba.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter((e=>!!s[e])).reduce(((e,t)=>(e[t]=s[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,s){var r=null!=s&&s.merge?this.getFlagVariants():{},n=null!=s&&s.merge?this.getFlagPayloads():{},o=i({},r,e),a=i({},n,t),l={};for(var[u,c]of Object.entries(o)){var d="string"==typeof c;l[u]={key:u,enabled:!!d||Boolean(c),variant:d?c:void 0,reason:void 0,metadata:Ke(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(T),t=this._prop(M),s=this._prop(O);if(!s&&!t)return e||{};var r=os({},e||{}),n=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=r[o],c=null==t?void 0:t[o],d=Ke(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ke(c)?u.variant:"string"==typeof c?c:void 0,h=null==s?void 0:s[o],p=i({},u,{enabled:d,variant:d?null!=_?_:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),_!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),h&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:h,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),r[o]=p}return this._override_warning||(ba.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(I),t=this._prop(M);if(!t)return e||{};for(var i=os({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ba.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(R),t=this._prop(O);if(!t)return e||{};for(var i=os({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ba.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s=this._config.token,r=this._prop(a),n={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(A)||{}),group_properties:this._prop(D),timezone:Gr()};Xe(r)||Ke(r)||(n.$device_id=r),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(n.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._getValidFlagKeys();Ke(o)||(n.flag_keys=o);var l=!!this._config.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._config.disable_compression?void 0:cn,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,r=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),r=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!r;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(s=this._persistence)||s.register({[U]:o}),u)ba.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=e.json)&&void 0!==a?a:{},r,{partialResponse:l}),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else ba.warn('getFeatureFlag for key "'+e+xa)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this._prop(L)||void 0,l=this._prop(W)||void 0,u=this._prop(j)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(B);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[j]:u,[B]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var h,p,g,v,f,m,y,b,w,x;Ue(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[j]:u});var S=this.getFeatureFlagDetails(e),E=[...null!==(p=this._prop(U))&&void 0!==p?p:[]];Ke(r)&&E.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Ke(null==S||null==(f=S.metadata)?void 0:f.version)||(k.$feature_flag_version=S.metadata.version);var P,I=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;I&&(k.$feature_flag_reason=I),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Ke(null==S?void 0:S.original_variant)&&Ke(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ke(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(s){var C=n;if(!Ke(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:C}}}}else ba.warn('getFeatureFlagResult for key "'+e+xa)}getRemoteConfigPayload(e,t){var i=this._config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments());var r=this._getValidFlagKeys();Ke(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._config.disable_compression?void 0:cn,timeout:this._config.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Ke(i)?void 0:!!i}ba.warn('isFeatureEnabled for key "'+e+xa)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,s){if(this._persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,s,r,n,o){void 0===s&&(s={}),void 0===r&&(r={}),void 0===n&&(n={});var a=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):ba.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var d=e.requestId,_=e.evaluatedAt;if(Ue(u)){ba.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(u)for(var p=0;u.length>p;p++)h[u[p]]=!0;t&&t.register({[C]:u,[I]:h})}else{var g=u,v=c,f=l;if(null!=o&&o.partialResponse)g=i({},s,g),v=i({},r,v),f=i({},n,f);else if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((e=>{var t;return!(null!=(t=l[e])&&t.failed)})));g=i({},s,Object.fromEntries(Object.entries(g).filter((e=>{var[t]=e;return m.has(t)})))),v=i({},r,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return m.has(t)})))),f=i({},n,Object.fromEntries(Object.entries(f||{}).filter((e=>{var[t]=e;return m.has(t)}))))}else g=i({},s,g),v=i({},r,v),f=i({},n,f);t&&t.register(i({[C]:Object.keys(Ea(g)),[I]:g||{},[R]:v||{},[T]:f||{}},d?{[L]:d}:{},_?{[W]:_}:{}))}}}(e,this._persistence,r,n,o,s),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ba.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ba.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(M),this._persistence.unregister(O),this._fireFeatureFlagsCallbacks(),wa.info("All overrides cleared");if(Ue(e)){var t=Sa(e);return this._persistence.register({[M]:t}),this._fireFeatureFlagsCallbacks(),wa.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this._override_warning=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this._persistence.unregister(M),wa.info("Flag overrides cleared");else if(s.flags){if(Ue(s.flags)){var r=Sa(s.flags);this._persistence.register({[M]:r})}else this._persistence.register({[M]:s.flags});wa.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(O),wa.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[O]:s.payloads}),wa.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[M]:e}),this._fireFeatureFlagsCallbacks(),wa.info("Flag overrides set",{flags:e});ba.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var r,n=(this._prop(F)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),s&&(a.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(r=this._persistence)||r.register({[C]:Object.keys(Ea(l)),[I]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(F),r=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(F),null==(s=this._persistence)||s.register({[F]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(A)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in s||(o[a]=n[a]));this._instance.register({[A]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(A),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(D)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[D]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(D)||{};this._instance.register({[D]:i({},t,{[e]:{}})})}else this._instance.unregister(D)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}},La={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===ta||this._recordingStatus===ia?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=Zo,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw ra.error("started without valid sessionManager"),new Error(sa+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===oe)throw new Error(sa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(y))||!e.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return ve&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ke(Object.assign)&&!Ke(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),ra.info("starting")):(this._recordingStatus=Zo,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==ta&&this._recordingStatus!==ia&&(this._recordingStatus=ea),null!=Ie&&null!=(t=Ie.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=Ie.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=Ie.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return ra.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(P),null==(t=this._persistence)||t.unregister(b)}_validateSampleRate(e,t){if(Qe(e))return null;var i,s=Ze(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(ra.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}_persistRemoteConfig(e){if(this._persistence){var t,s,r=this._persistence,n=()=>{var t,s=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==s?void 0:s.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Qe(a)&&this._resetSampling();var l=null==s?void 0:s.minimumDurationMilliseconds;r.register({[y]:i({cache_timestamp:Date.now(),enabled:!!s},s,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==s?void 0:s.networkPayloadCapture),canvasRecording:{enabled:null==s?void 0:s.recordCanvas,fps:null==s?void 0:s.canvasFps,quality:null==s?void 0:s.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ke(l)?null:l,endpoint:null==s?void 0:s.endpoint,triggerMatchType:null==s?void 0:s.triggerMatchType,masking:null==s?void 0:s.masking,urlTriggers:null==s?void 0:s.urlTriggers,version:null==s?void 0:s.version,triggerGroups:null==s?void 0:s.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(s=this._instance.sessionManager)?void 0:s.onSessionId(n)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===ta&&(this._recordingStatus=ia,ra.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):ra.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(y);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t,i=this._instance.get_property(y);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(e){return ra.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var s=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-s}_onScriptLoaded(e){var t,i;if(null==(t=Ie.__PosthogExtensions__)||!t.initSessionRecording)return ra.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[se]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=Ie.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ia||this._recordingStatus===ta)return;return this._recordingStatus=ta,ra.info("persisted remote config is stale, requesting fresh config before starting"),void new ln(this._instance).load()}this._recordingStatus=ea,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[x]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[w]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?S:E]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},$a={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Bo(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=Ve(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ve&&be){var e=e=>{e=e||(null==ve?void 0:ve.event);try{this._captureEvent(e)}catch(e){Wo.error("Failed to capture event",e)}};if(hs(be,"submit",e,{capture:!0}),hs(be,"change",e,{capture:!0}),hs(be,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ve?void 0:ve.event);try{this._captureEvent(e,Uo)}catch(e){Wo.error("Failed to capture copy/cut event",e)}};hs(be,"copy",t,{capture:!0}),hs(be,"cut",t,{capture:!0})}}}else Wo.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var s=null==be?void 0:be.querySelectorAll(t);null==s||s.forEach((s=>{e===s&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[c];if(Xe(this._isDisabledServerSide)&&!tt(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=Vs(e);Hs(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&tr(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===Uo;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!ve||ir(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!js(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&js(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:c,targetElementList:d}=sr(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ke(i))return!0;var s,r=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,i))return!1;if(!Ks(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=ve.getComputedStyle(e);if(_&&"pointer"===_.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(Gs.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Ko(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===Uo){var l,u=Us(null==ve||null==(l=ve.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return We(null==be?void 0:be.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ve||null==(t=ve.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(is.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,is.info("History API monitoring stopped")}monitorHistoryChanges(){ve&&ve.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ve&&(null==(t=ve.history[e])||!t.__posthog_wrapped__)){var i=this;!function(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return We(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]===r&&(e[t]=s)}}catch(e){return()=>{}}}(ve.history,e,(t=>function(s,r,n){t.call(this,s,r,n),i._capturePageview(e)}))}}_capturePageview(e){try{var t,i=null==ve||null==(t=ve.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(_e,{navigation_type:e}),this._lastPathname=i}catch(t){is.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};hs(ve,"popstate",e),this._popstateListener=()=>{ve&&ve.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[d]),this.rageclicks=new Bo(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ve(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Qe(this._config.capture_heatmaps)?Qe(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;na.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(be)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ve&&be&&(this._flushHandler=this._flush.bind(this),hs(ve,de,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ve?void 0:ve.event)),hs(be,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ve?void 0:ve.event)),hs(be,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new br(this.instance,mr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),hs(be,ce,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ve&&be&&(this._flushHandler&&ve.removeEventListener(de,this._flushHandler),this._onClickHandler&&be.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&be.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&be.removeEventListener(ce,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&Ds(s)&&!qs(s,"body");){if(s===i)return!1;if(qe(t,null==ve?void 0:ve.getComputedStyle(s).position))return!0;s=Js(s)}return!1}(Vs(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var s;if(void 0===t&&(t="click"),!As(e.target)&&oa(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&tr(Vs(e),this.instance.config.rageclick)&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!As(e.target)&&oa(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ve){var t=ve.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...Or,...i||[]]:[],r=Lr(t,s,Dr);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!Ge(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:br,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();if(!Ke(s))if(Qe(null==e?void 0:e.name)||Qe(null==e?void 0:e.value))Xo.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Ke(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=Ke(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),n=i({},e,{$current_url:s,timestamp:Date.now()});Ke(r)||(n.$session_id=r.sessionId,n.$window_id=r.windowId),this._buffer.metrics.push(n),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Xo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=Ie.__PosthogExtensions__;Ke(r)||Ke(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):Xo.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[g]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=Ve(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Qe(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Ve(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ve(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Ve(this._perfConfig)&&Ze(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Qo;return e>0&&6e4>=e?Qo:e}get isEnabled(){var e=null==we?void 0:we.protocol;if("http:"!==e&&"https:"!==e)return Xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ve(this._perfConfig)?this._perfConfig.web_vitals:tt(this._perfConfig)?this._perfConfig:void 0;return tt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Xo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ve(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Ve(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:t}),this._instance.persistence.register({[m]:i})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Xo.error("failed to load script",t):e()}))}_currentURL(){var e=ve?ve.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Or,...t||[]]:[];return Lr(e,i,Dr)}Xo.error("Could not determine current URL")}}},Ma={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(ve&&this.isEnabled&&null!=(e=Ie.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){Jo.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new dt({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,_logger:Jo}),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ve(e)?t=i({},t,e):(Ke(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Jo.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Jo.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Jo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,s;this._suppressionRules=[],this._errorPropertiesBuilder=new ki([new Di,new Gi,new Hi,new qi,new Wi,new Ui,new Ni,new Vi],function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var n=[],o=t.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Ai.test(l)?l.replace(Ai,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of s){var d=c(u,e);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return i({},e,{filename:e.filename||(s=t,s[s.length-1]||{}).filename,function:e.function||Pi});var s}))}(n)}}("web:javascript",Li,Oi)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Qi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Zi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Qi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[h]:this._suppressionRules,[p]:n})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Je(e)||0===e.trim().length)return void ka.warn("Ignoring exception step because message must be a non-empty string");var s=this._coerceExceptionStepProperties(t),{sanitizedProperties:r,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((i,s)=>Yi.has(s)?(t.push(s),i):(i[s]=e[s],i)),{}),droppedKeys:t}}(s);n.length>0&&ka.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[Ki]:e,[Ji]:(new Date).toISOString()},r))}catch(e){ka.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void ka.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void ka.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void ka.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Qe(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return ka.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void ka.error("Failed to process exception event. Ignoring this exception.",e)}}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:i({},e,{$exception_steps:t})}catch(t){return ka.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ki]:e,[Ji]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Ve(e)?i({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:s}=t;return Je(i)&&i.length>0&&e.$exception_types.push(i),Je(s)&&s.length>0&&e.$exception_values.push(s),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,s=po[e.operator],r=Ue(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Qe(e)&&Ue(e)}}},Oa=i({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._persistence&&this._persistence.register({[f]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this._productTourManager||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(f)||this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?aa.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Ie.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Ie.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ue(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[N];if(Ue(s)&&!t)return this._cachedTours=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return aa.error(r),void e([],{isLoaded:!1,error:r})}var n=Ue(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[N]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Qe(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(N)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},Ra),Aa={siteApps:class{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=Ie._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,n,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))c[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},s(e,la),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ua.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this._stopBuffering)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,ua.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){ua.error(ca+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){ua.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}_onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){ua.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ua.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;Ie["__$$ph_site_app_"+e]=r._instance,null==(t=Ie.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return ua.error(ca+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else ua.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Da={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,i=this._syncHostnamesForPatch();i?(Ke(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Ie.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Ke(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Ie.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i;null!=(t=Ie.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=Ie.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Yo.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Ue(e)?(Ue(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Ue(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},qa=i({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Qe(t))return wo.warn("Flags not loaded yet. Not loading surveys.");var i=Ue(t);this._isSurveysEnabled=i?t.length>0:t,wo.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(xo)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)wo.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)wo.info(va);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())wo.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e){if(!Ke(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var s=e.loadExternalDependency;if(!s)return void this._handleSurveyLoadError(re);s(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else wo.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new pa(this._instance),wo.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){wo.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return wo.info(va),e([]);var i,s=this._instance.get_property(q);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:s}=t;return e(i,s)})):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{i=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var s;this._getSurveysInFlightPromise=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;wo.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[q]:l,[H]:Date.now()});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){wo.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);wo.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var s;t=null!==(s=i.find((t=>t.id===e)))&&void 0!==s?s:null})),t}_checkSurveyEligibility(e){if(Qe(this._surveyManager))return{eligible:!1,reason:ga};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Qe(this._surveyManager))return wo.warn("init was not called"),{visible:!1,disabledReason:ga};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Qe(this._surveyManager)?(wo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ga})):new Promise((i=>{this.getSurveys((t=>{var s,r=null!==(s=t.find((t=>t.id===e)))&&void 0!==s?s:null;if(r){var n=this._checkSurveyEligibility(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(Qe(this._surveyManager))wo.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(So.includes(r.type)){var n=null==be?void 0:be.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(wo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;wo.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),wo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);wo.warn("Survey element not found")}else wo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else wo.warn("Survey not found")}}displaySurvey(e,t){var s;if(Qe(this._surveyManager))wo.warn("init was not called");else{var r=this._getSurveyById(e);if(r){var n=r;if(null!=(s=r.appearance)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},r,{appearance:i({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==rn&&t.initialResponses&&wo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(r);if(!o.visible)return void wo.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else wo.warn("Survey not found")}}cancelPendingSurvey(e){Qe(this._surveyManager)?wo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Ra),Ha={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Ie.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Ie.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),ps(this.instance.config))return!1;if(!ve||!be)return!1;e=null!=e?e:ve.location,i=null!=i?i:ve.history;try{if(!t){try{ve.localStorage.setItem("test","test"),ve.localStorage.removeItem("test")}catch(e){return!1}t=null==ve?void 0:ve.localStorage}var s,r=fa||$r(e.hash,"__posthog")||$r(e.hash,"state"),n=r?ls((()=>JSON.parse(atob(decodeURIComponent(r)))))||ls((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(ma)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=Ie.ph_load_toolbar||Ie.ph_load_editor;!Qe(t)&&We(t)?t(e,this.instance):ya.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==be||!be.getElementById(Z));if(!ve||t)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(ve.localStorage.setItem(ma,JSON.stringify(i({},r,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=Ie.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ya.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),hs(ve,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(r)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},za=i({experiments:Ca},Ra),Na={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Qe(t)||(tt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||ps(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e&&!Ke(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var i=e.loadExternalDependency;if(!i)return void this._handleLoadError(re);i(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else Fa.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),Fa.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Fa.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Fa.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():Fa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Xe(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,s){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,i,s):(Fa.warn(Ta),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(Fa.warn(Ta),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(Fa.warn(Ta),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(Fa.warn(Ta),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(Fa.warn(Ta),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(Fa.warn(Ta),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Fa.warn(Ta),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},ja={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ss("[logs]"),this._logBuffer=[],this._intervalLogCount=0,this._intervalWindowStart=0,this._droppedWarned=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Qe(i)&&i&&(this._isLogsEnabled=!0,this.loadIfEnabled())}reset(){this._logBuffer=[],this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0),this._intervalLogCount=0,this._intervalWindowStart=0,this._droppedWarned=!1}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=null==Ie?void 0:Ie.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this._logger.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this._isLoaded=!0)})):this._logger.error(re)}else this._logger.error("PostHog Extensions not found.")}}captureLog(e){var t,s,r,n,o,a;if(this._instance.is_capturing())if(e&&e.body){var l=null!==(t=null==(s=this._instance.config.logs)?void 0:s.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(r=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==r?r:1e3,c=Date.now();if(l>c-this._intervalWindowStart||(this._intervalWindowStart=c,this._intervalLogCount=0,this._droppedWarned=!1),u>this._intervalLogCount){this._intervalLogCount++;var d=function(e,t){var s=e.level||"info",{text:r,number:n}=bi[s]||wi,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=i({},a,e.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:r,body:{stringValue:e.body},attributes:Si(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Ke(e.trace_flags)||(u.flags=e.trace_flags),u}(e,this._getSdkContext());this._logBuffer.push({record:d}),(null!==(o=null==(a=this._instance.config.logs)?void 0:a.maxBufferSize)&&void 0!==o?o:100)>this._logBuffer.length?this._scheduleFlush():this.flushLogs()}else this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this._droppedWarned=!0)}else this._logger.warn("captureLog requires a body")}get logger(){return this._logger_instance||(this._logger_instance={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._logger_instance}flushLogs(e){if(this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0),0!==this._logBuffer.length){var t=this._logBuffer;this._logBuffer=[];var s=this._instance.config.logs,r=i({"service.name":(null==s?void 0:s.serviceName)||"unknown_service"},(null==s?void 0:s.environment)&&{"deployment.environment":s.environment},(null==s?void 0:s.serviceVersion)&&{"service.version":s.serviceVersion},null==s?void 0:s.resourceAttributes),o=function(e,t,i,s){return{resourceLogs:[{resource:{attributes:Si(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}(t.map((e=>e.record)),r,n.LIB_NAME,n.LIB_VERSION),a=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance._send_retriable_request({method:"POST",url:a,data:o,compression:"best-available",batchKey:"logs",transport:e})}}_scheduleFlush(){var e,t;this._flushTimeout||(this._flushTimeout=setTimeout((()=>{this._flushTimeout=void 0,this.flushLogs()}),null!==(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3))}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=Ie&&null!=(e=Ie.location)&&e.href&&(t.currentUrl=Ie.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},Ba=i({},Ra,La,$a,Ma,Oa,Aa,qa,Da,Ha,za,Na,ja);jo.__defaultExtensionClasses=i({},Ba),function(){n.SDK_DIST_CHANNEL="cdn";var e=Fo[Ao]=new jo,t=Ie.posthog;t&&ns(t._i,(function(i){if(i&&Ue(i)){var s=e.init(i[0],i[1],i[2]),r=t[i[2]]||t;s&&(s._execute_array.call(s.people,r.people),s._execute_array(r))}})),Ie.posthog=e,function(){function e(){e.done||(e.done=!0,Do=!1,ns(Fo,(function(e){e._dom_loaded()})))}null!=be&&be.addEventListener?"complete"===be.readyState?e():hs(be,"DOMContentLoaded",e,{capture:!1}):ve&&is.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
2
2
  //# sourceMappingURL=array.no-external.js.map