posthog-js 1.383.2 → 1.383.3
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.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
|
@@ -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.383.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_override_sampling",w="$replay_override_linked_flag",x="$replay_override_url_trigger",S="$replay_override_event_trigger",E="$sesid",k="$session_is_sampled",P="$enabled_feature_flags",I="$active_feature_flags",C="$early_access_features",F="$feature_flag_details",T="$feature_flag_payloads",R="$feature_flag_request_id",L="$override_feature_flags",M="$override_feature_flag_payloads",O="$stored_person_properties",A="$stored_group_properties",D="$surveys",H="$surveys_loaded_at",q="$surveys_activated",z="ph_product_tours",N="$flag_call_reported",j="$flag_call_reported_session_id",B="$feature_flag_errors",U="$feature_flag_evaluated_at",W="$user_state",V="$client_session_props",G="$capture_rate_limit",K="$initial_campaign_params",J="$initial_referrer_info",Y="$initial_person_info",X="$epp",Q="__POSTHOG_TOOLBAR__",Z="$posthog_cookieless",ee="$sdk_debug_extensions_init_method",te="$sdk_debug_extensions_init_time_ms",ie="$sdk_debug_recording_script_not_loaded",se="PostHog loadExternalDependency extension not found.",re="on_reject",ne="always",oe="anonymous",ae="identified",le="identified_only",ue="visibilitychange",ce="beforeunload",de="$pageview",_e="$pageleave",he="$identify",pe="$groupidentify",ge="undefined"!=typeof window?window:void 0,ve="undefined"!=typeof globalThis?globalThis:ge;"undefined"==typeof self&&(ve.self=ve),"undefined"==typeof File&&(ve.File=function(){});var fe,me=null==ve?void 0:ve.navigator,ye=null==ve?void 0:ve.document,be=null==ve?void 0:ve.location,we=null==ve?void 0:ve.fetch,xe=null!=ve&&ve.XMLHttpRequest&&"withCredentials"in new ve.XMLHttpRequest?ve.XMLHttpRequest:void 0,Se=null==ve?void 0:ve.AbortController,Ee=null==ve?void 0:ve.CompressionStream,ke=null==me?void 0:me.userAgent,Pe=null!=ge?ge:{},Ie=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Ce=["$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"],Fe="NativeGzipValidationError",Te=e=>e.length>=2&&31===e[0]&&139===e[1],Re=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Le=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Fe,t},$e=function(){var e=t((function*(e,t){18>e.size&&Le("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Te(i)&&8===i[2]||Le("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(fe)return fe;fe=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;fe[e]=t>>>0}return fe})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Le("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Le("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function Me(){return Me=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 $e(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),Me.apply(this,arguments)}var Oe=["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"],Ae=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Oe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function De(e,t){return-1!==e.indexOf(t)}var He=function(e){return e.trim()},qe=function(e){return e.replace(/^\$/,"")},ze=Object.prototype,Ne=ze.hasOwnProperty,je=ze.toString,Be=Array.isArray||function(e){return"[object Array]"===je.call(e)},Ue=e=>"function"==typeof e,We=e=>e===Object(e)&&!Be(e),Ve=e=>{if(We(e)){for(var t in e)if(Ne.call(e,t))return!1;return!0}return!1},Ge=e=>void 0===e,Ke=e=>"[object String]"==je.call(e),Je=e=>Ke(e)&&0===e.trim().length,Ye=e=>null===e,Xe=e=>Ge(e)||Ye(e),Qe=e=>"[object Number]"==je.call(e)&&e==e,Ze=e=>Qe(e)&&e>0,et=e=>"[object Boolean]"===je.call(e),tt=e=>e instanceof FormData,it=e=>De(Ce,e);function st(e){return null===e||"object"!=typeof e}function rt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function nt(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ot=[!0,"true",1,"1","yes"],at=e=>De(ot,e),lt=[!1,"false",0,"0","no"];function ut(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Qe(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),ut(r||i,t,i,s))}class ct{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ut(e.bucketSize,0,100,e._logger),this._refillRate=ut(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ut(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 dt,_t,ht,pt="Mobile",gt="iOS",vt="Android",ft="Tablet",mt=vt+" "+ft,yt="iPad",bt="Apple",wt=bt+" Watch",xt="Safari",St="BlackBerry",Et="Samsung",kt=Et+"Browser",Pt=Et+" Internet",It="Chrome",Ct=It+" OS",Ft=It+" "+gt,Tt="Internet Explorer",Rt=Tt+" "+pt,Lt="Opera",$t=Lt+" Mini",Mt="Edge",Ot="Microsoft "+Mt,At="Firefox",Dt=At+" "+gt,Ht="Nintendo",qt="PlayStation",zt="Xbox",Nt=vt+" "+pt,jt=pt+" "+xt,Bt="Windows",Ut=Bt+" Phone",Wt="Nokia",Vt="Ouya",Gt="Generic",Kt=Gt+" "+pt.toLowerCase(),Jt=Gt+" "+ft.toLowerCase(),Yt="Konqueror",Xt="Oculus Browser",Qt="Vivaldi",Zt="Yandex",ei="Whale",ti="DuckDuckGo",ii="Pale Moon",si="Waterfox",ri="Brave",ni="(\\d+(\\.\\d+)?)",oi=new RegExp("Version/"+ni),ai=new RegExp(zt,"i"),li=new RegExp(qt+" \\w+","i"),ui=new RegExp(Ht+" \\w+","i"),ci=new RegExp(St+"|PlayBook|BB10","i"),di={"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"},_i=function(e,t,i){t=t||"";var s=function(e){return null!=e&&e.brave?ri:null}(i);return s||(De(e," OPR/")&&De(e,"Mini")?$t:De(e," OPR/")?Lt:ci.test(e)?St:De(e,"IE"+pt)||De(e,"WPDesktop")?Rt:De(e,"OculusBrowser")?Xt:De(e,kt)?Pt:De(e,Mt)||De(e,"Edg/")?Ot:De(e,Qt+"/")?Qt:De(e,"YaBrowser/")?Zt:De(e,ei+"/")?ei:De(e,ti+"/")||De(e,"Ddg/")?ti:De(e,"FBIOS")?"Facebook "+pt:De(e,"UCWEB")||De(e,"UCBrowser")?"UC Browser":De(e,"CriOS")?Ft:De(e,"CrMo")||De(e,It)?It:De(e,vt)&&De(e,xt)?Nt:De(e,"FxiOS")?Dt:De(e.toLowerCase(),Yt.toLowerCase())?Yt:De(e,ri+"/")?ri:((e,t)=>t&&De(t,bt)||function(e){return De(e,xt)&&!De(e,It)&&!De(e,vt)}(e))(e,t)?De(e,pt)?jt:xt:De(e,"PaleMoon/")?ii:De(e,si+"/")?si:De(e,At)?At:De(e,"MSIE")||De(e,"Trident/")?Tt:De(e,"Gecko")?At:"")},hi={[Rt]:[new RegExp("rv:"+ni)],[Ot]:[new RegExp(Mt+"?\\/"+ni)],[It]:[new RegExp("("+It+"|CrMo)\\/"+ni)],[Ft]:[new RegExp("CriOS\\/"+ni)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ni)],[xt]:[oi],[jt]:[oi],[Lt]:[new RegExp("(Opera|OPR)\\/"+ni)],[At]:[new RegExp(At+"\\/"+ni)],[Dt]:[new RegExp("FxiOS\\/"+ni)],[Yt]:[new RegExp("Konqueror[:/]?"+ni,"i")],[St]:[new RegExp(St+" "+ni),oi],[Nt]:[new RegExp("android\\s"+ni,"i")],[Pt]:[new RegExp(kt+"\\/"+ni)],[Xt]:[new RegExp("OculusBrowser\\/"+ni)],[Qt]:[new RegExp(Qt+"\\/"+ni)],[Zt]:[new RegExp("YaBrowser\\/"+ni)],[ei]:[new RegExp(ei+"\\/"+ni)],[ri]:[new RegExp(ri+"\\/"+ni)],[ti]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ni)],[ii]:[new RegExp("PaleMoon\\/"+ni)],[si]:[new RegExp(si+"\\/"+ni)],[Tt]:[new RegExp("(rv:|MSIE )"+ni)],Mozilla:[new RegExp("rv:"+ni)]},pi=function(e,t,i){var s=_i(e,t,i),r=hi[s];if(Ge(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},gi=[[new RegExp(zt+"; "+zt+" (.*?)[);]","i"),e=>[zt,e&&e[1]||""]],[new RegExp(Ht,"i"),[Ht,""]],[new RegExp(qt,"i"),[qt,""]],[ci,[St,""]],[new RegExp(Bt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ut,""];if(new RegExp(pt).test(t)&&!/IEMobile\b/.test(t))return[Bt+" "+pt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=di[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Bt,s]}return[Bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[gt,[e[3],e[4],e[5]||"0"].join(".")]:[gt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ge(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+vt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+vt+")","i"),e=>e&&e[2]?[vt,[e[2],e[3],e[4]||"0"].join(".")]:[vt,""]],[/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/,[Ct,""]],[/Linux|debian/i,["Linux",""]]],vi=function(e){return ui.test(e)?Ht:li.test(e)?qt:ai.test(e)?zt:new RegExp(Vt,"i").test(e)?Vt:new RegExp("("+Ut+"|WPDesktop)","i").test(e)?Ut:/iPad/.test(e)?yt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?wt:ci.test(e)?St:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Wt,"i").test(e)?Wt:/(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(pt).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)?vt:mt:new RegExp("(pda|"+pt+")","i").test(e)?Kt:new RegExp(ft,"i").test(e)&&!new RegExp(ft+" pc","i").test(e)?Jt:""},fi=e=>e instanceof Error,mi={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}},yi=mi.info;function bi(e){if(et(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(Be(e))return{arrayValue:{values:e.map((e=>bi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function wi(e){var t=[];for(var i in e){var s=e[i];Ye(s)||Ge(s)||t.push({key:i,value:bi(s)})}return t}function xi(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ht&&i.length===_t||(_t=i.length,ht=i.reduce(((i,s)=>{dt||(dt={});var r=dt[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,dt[s]=[l,u];break}}return i}),{})),ht}}class Si{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&&Be(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:xi(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 Ei="?";function ki(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Ei:i,in_app:!0};return Ge(s)||(n.lineno=s),Ge(r)||(n.colno=r),n}var Pi=(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]:Ei,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Ii=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ci=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ti=(e,t)=>{var i=Ii.exec(e);if(i){var[,s,r,n]=i;return ki(t,s,Ei,+r,+n)}var o=Ci.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Fi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Pi(o[1]||Ei,o[2]);return ki(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ri=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$i=(e,t)=>{var i=Ri.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Li.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]||Ei;return[n,r]=Pi(n,r),ki(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Mi=/\(error: (.*)\)/;class Oi{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Ke(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 rt(e,"DOMException")}isDOMError(e){return rt(e,"DOMError")}}class Ai{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 Di{constructor(){}match(e){return rt(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 Hi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class qi{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(Hi);return s&&(t=s[1],i=s[2]),[t,i]}}var zi=["fatal","error","warning","log","info","debug"];function Ni(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 ji{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 nt(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: "+Ni(e)}isSeverityLevel(e){return Ke(e)&&!Je(e)&&zi.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(fi(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Bi{match(e){return nt(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Ni(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ui{match(e){return st(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 Wi{match(e){return rt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!nt(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 st(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 Vi="$message",Gi="$timestamp",Ki=new Set([Vi,Gi]),Ji={enabled:!0,max_bytes:32768};function Yi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ji.enabled,max_bytes:Qi(e.max_bytes,Ji.max_bytes)}:i({},Ji)}class Xi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Yi(e)}setConfig(e){this._config=Yi(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(!We(i))return;var s=i,r=s[Vi],n=s[Gi];if(!Ke(r)||0===r.trim().length)return;if(!Ke(n)&&!Qe(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 Qi(e,t){if(!Qe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Zi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(ge&&(n.DEBUG||Pe.POSTHOG_DEBUG||i)&&!Ge(ge.console)&&ge.console){for(var s=("__rrweb_original__"in ge.console[t]?ge.console[t].__rrweb_original__:ge.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)=>Zi(e+" "+t,i)};return s},es=Zi("[PostHog.js]"),ts=es.createLogger;function is(e,t){Be(e)&&e.forEach(t)}function ss(e,t){if(!Xe(e))if(Be(e))e.forEach(t);else if(tt(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)Ne.call(e,i)&&t(e[i],i)}var rs=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 ns(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 os=function(e){try{return e()}catch(e){return}},as=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){es.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),es.critical(e)}}},ls=function(e){var t={};return ss(e,(function(e,i){(Ke(e)&&e.length>0||Qe(e))&&(t[i]=e)})),t};var us=["herokuapp.com","vercel.app","netlify.app"];function cs(e){var t=null==e?void 0:e.hostname;if(!Ke(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of us)if(i===s)return!1;return!0}function ds(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 _s(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 Qe(e)&&isFinite(e)&&Math.floor(e)===e});class hs{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 hs(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 hs(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 ps{constructor(){this._timestamp=0,this._counter=0,this._random=new fs}generate(){var e=this.generateOrAbort();if(Ge(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ge(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 hs.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 gs,vs=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};ge&&!Ge(ge.crypto)&&crypto.getRandomValues&&(vs=e=>crypto.getRandomValues(e));class fs{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(vs(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var ms=()=>ys().toString(),ys=()=>(gs||(gs=new ps)).generate(),bs="",ws=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var xs={_is_supported:()=>!!ye,_error(e){es.error("cookieStore error: "+e)},_get(e){if(ye){try{for(var t=e+"=",i=ye.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(xs._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!ye)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=ye),bs)return bs;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_"+ms();!bs&&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",bs=n)}return bs}(e);if(!i){var s=(e=>{var t=e.match(ws);return t?t[0]:""})(e);s!==i&&es.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(ye.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&&es.warn("cookieStore warning: large cookie, len="+u.length),ye.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=ye&&ye.cookie)try{xs._set(e,"",-1,t)}catch(e){return}}},Ss=null,Es={_is_supported(){if(!Ye(Ss))return Ss;var e=!0;if(Ge(ge))e=!1;else try{var t="__mplssupport__";Es._set(t,"xyz"),'"xyz"'!==Es._get(t)&&(e=!1),Es._remove(t)}catch(t){e=!1}return e||es.error("localStorage unsupported; falling back to cookie store"),Ss=e,e},_error(e){es.error("localStorage error: "+e)},_get(e){try{return null==ge?void 0:ge.localStorage.getItem(e)}catch(e){Es._error(e)}return null},_parse(e){try{return JSON.parse(Es._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ge||ge.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Es._error(e)}return!1},_remove(e){try{null==ge||ge.localStorage.removeItem(e)}catch(e){Es._error(e)}}},ks=[a,"distinct_id",E,k,X,Y,W],Ps={},Is={_is_supported:()=>!0,_error(e){es.error("memoryStorage error: "+e)},_get:e=>Ps[e]||null,_parse:e=>Ps[e]||null,_set:(e,t)=>(Ps[e]=t,!0),_remove(e){delete Ps[e]}},Cs=null,Fs={_is_supported(){if(!Ye(Cs))return Cs;if(Cs=!0,Ge(ge))Cs=!1;else try{var e="__support__";Fs._set(e,"xyz"),'"xyz"'!==Fs._get(e)&&(Cs=!1),Fs._remove(e)}catch(e){Cs=!1}return Cs},_error(e){es.error("sessionStorage error: ",e)},_get(e){try{return null==ge?void 0:ge.sessionStorage.getItem(e)}catch(e){Fs._error(e)}return null},_parse(e){try{return JSON.parse(Fs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ge||ge.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Fs._error(e)}return!1},_remove(e){try{null==ge||ge.sessionStorage.removeItem(e)}catch(e){Fs._error(e)}}};class Ts{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===ne||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===re}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 at(e)?1:De(lt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Es:xs;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?xs:Es;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(at(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==me?void 0:me.doNotTrack,null==me?void 0:me.msDoNotTrack,Pe.doNotTrack].some((e=>at(e)))}}var Rs=1,Ls=3,$s=11;function Ms(e){return e instanceof Element&&(e.id===Q||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Os(e){return!!e&&e.nodeType===Rs}function As(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ds(e){return!!e&&e.nodeType===Ls}function Hs(e){return!!e&&e.nodeType===$s&&Os(e.host)}function qs(e){return e?He(e).split(/\s+/):[]}function zs(e){var t=null==ge?void 0:ge.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Ns(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 qs(t)}function js(e){return Xe(e)?null:He(e).split(/(\s+)/).filter((e=>cr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Bs(e){var t="";return ir(e)&&!sr(e)&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(e){var i;Ds(e)&&e.textContent&&(t+=null!==(i=js(e.textContent))&&void 0!==i?i:"")})),He(t)}function Us(e){return Ge(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ws=["a","button","form","input","select","textarea","label"];function Vs(e,t){if(Ge(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 Gs(e){var t=e.parentNode;return!(!t||!Os(t))&&t}var Ks=["next","previous","prev",">","<"],Js=[...Ks,"+","-","−","–"],Ys=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Xs=[".ph-no-rageclick",".ph-no-capture"],Qs=["","text","search","email","password","url","tel","number"];function Zs(e,t){if(!ge||er(e))return!1;var i,s,r,n,o;if(et(t)?(i=!!t&&Xs,s=void 0,r=!1):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Xs,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||!Os(e))&&(!!As(e,"textarea")||(As(e,"input")?De(Qs,(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}=tr(e,!1);return!function(e,t){if(!1===e||Ge(e))return!1;var i;if(!0===e)i=Ks;else{if(!Be(e))return!1;if(e.length>10)return es.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=>Ys(t,e)||Ys(s,e)))}))}(s,a.map((e=>{var t;return{safeText:Bs(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Vs(a,i)}var er=e=>!e||As(e,"html")||!Os(e),tr=(e,t)=>{if(!ge||er(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!As(r,"body");)if(Hs(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Gs(r);if(!n)break;if(t||Ws.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=ge.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function ir(e){for(var t=e;t.parentNode&&!As(t,"body");t=t.parentNode){var i=Ns(t);if(De(i,"ph-sensitive")||De(i,"ph-no-capture"))return!1}if(De(Ns(e),"ph-include"))return!0;var s=e.type||"";if(Ke(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Ke(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 sr(e){return!!(As(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||As(e,"select")||As(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rr="(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})",nr=new RegExp("^(?:"+rr+")$"),or=new RegExp(rr),ar="\\d{3}-?\\d{2}-?\\d{4}",lr=new RegExp("^("+ar+")$"),ur=new RegExp("("+ar+")");function cr(e,t){if(void 0===t&&(t=!0),Xe(e))return!1;if(Ke(e)){if(e=He(e),(t?nr:or).test((e||"").replace(/[- ]/g,"")))return!1;if((t?lr:ur).test(e))return!1}return!0}function dr(e){var t=Bs(e);return cr(t=(t+" "+_r(e)).trim())?t:""}function _r(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Bs(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+_r(e)).trim())}catch(e){es.error("[AutoCapture]",e)}})),t}function hr(e){return e.replace(/"|\\"/g,'\\"')}function pr(e){var t=e.attr__class;return t?Be(t)?t:qs(t):void 0}var gr=ts("[Dead Clicks]"),vr=()=>!0,fr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return et(s)?s:!!We(s)||i};class mr{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=Pe.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?gr.error("failed to load script",t):e()}))}_start(){var e;if(ye){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Pe.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=We(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Pe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ye),gr.info("starting...")}}else gr.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,gr.info("stopping..."))}}var yr=ts("[SegmentIntegration]");var br="posthog-js";function wr(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 xr{constructor(e,t,i,s,r,n){this.name=br,this.setupOnce=function(o){o(wr(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Sr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(es.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==ge?void 0:ge.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(!(Ge(n)||Ge(o)||Ge(a)||Ge(l)||Ge(u)||Ge(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?ut(o/n,0,1,es):1,_=n>1?ut(a/n,0,1,es):1,h=l>1?ut(u/l,0,1,es):1,p=l>1?ut(c/l,0,1,es):1;s=rs(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 Er=["flags","surveys"],kr={[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"},[E]:{exposure:"hidden"},[k]:{exposure:"event"},$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"},[P]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!We(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[I]:{exposure:"event",storageGroup:"flags"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"flags"},[T]:{exposure:"event",storageGroup:"flags"},[R]:{exposure:"event",storageGroup:"flags"},[L]:{exposure:"event"},[M]:{exposure:"hidden"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys"},[q]:{exposure:"event"},[z]:{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"},[N]:{exposure:"hidden"},[j]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[ee]:{exposure:"event"},[te]:{exposure:"event"},[ie]:{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"}},Pr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ir=e=>{var t=kr[e];if(t)return t;for(var[i,s]of Pr)if(0===e.indexOf(i))return s},Cr=e=>{var t=null==ye?void 0:ye.createElement("a");return Ge(t)?null:(t.href=e,t)},Fr=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(!Be(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){es.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Tr=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("=");Be(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},Rr=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Lr="https?://(.*)",$r=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Mr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...$r],Or="<masked>",Ar=["li_fat_id"];function Dr(e,t,i){if(!ye)return{};var s,r=t?[...$r,...i||[]]:[],n=Hr(Tr(ye.URL,r,Or),e),o=(s={},ss(Ar,(function(e){var t=xs._get(e);s[e]=t||null})),s);return rs(o,n)}function Hr(e,t){var i=Mr.concat(t||[]),s={};return ss(i,(function(t){var i=Fr(e,t);s[t]=i||null})),s}function qr(e){var t=function(e){return e?0===e.search(Lr+"google.([^/?]*)")?"google":0===e.search(Lr+"bing.com")?"bing":0===e.search(Lr+"yahoo.com")?"yahoo":0===e.search(Lr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Ye(t)){s.$search_engine=t;var r=ye?Fr(ye.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function zr(){return navigator.language||navigator.userLanguage}var Nr="$direct";function jr(){return(null==ye?void 0:ye.referrer)||Nr}function Br(e,t){var i=e?[...$r,...t||[]]:[],s=null==be?void 0:be.href.substring(0,1e3);return{r:jr().substring(0,1e3),u:s?Tr(s,i,Or):void 0}}function Ur(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Nr?Nr:null==(t=Cr(i))?void 0:t.host};if(s){r.$current_url=s;var n=Cr(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Hr(s);rs(r,o)}if(i){var a=qr(i);rs(r,a)}return r}function Wr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Vr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Gr={flags:U,surveys:H},Kr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Jr="main";class Yr{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&&es.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),ge){var r=()=>this.flush();ds(ge,"beforeunload",r,{capture:!1}),ds(ge,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Qe(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Kr.indexOf(e.persistence.toLowerCase())&&(es.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=[...ks,...e];return i({},Es,{_parse(e){try{var i={};try{i=xs._parse(e)||{}}catch(e){}var s,r=JSON.parse(Es._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Ye(a)||""===a||(n[o]=a)}s=rs(r,n)}else s=rs(i,r);return Es._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=Es._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&xs._set(e,l,i,r,n,o)}catch(e){Es._error(e)}return a},_remove(e,t){try{null==ge||ge.localStorage.removeItem(e),xs._remove(e,t)}catch(e){Es._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Es._is_supported()?(t=Es,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&Fs._is_supported()?t=Fs:"memory"===n?t=Is:"cookie"===n?t=xs:s._is_supported()?(t=s,r=!0):t=xs,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[U];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return ss(this.props,((t,i)=>{var s=Ir(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===P?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&rs(e,s.transformToEventProperties(t))}else s&&"event"!==s.exposure||(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=rs({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Er){var t=Es._parse(this._groupEntryName(e));if(t&&!Ve(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||rs(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ir(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Gr[e];if(!i)return!1;var s=t[i],r=this.props[i];return Qe(s)&&Qe(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ir(e))?void 0:t.storageGroup:void 0,s=i?Es._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?Ge(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Ge(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,Jr))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Jr),Er)){var s,r=t[i];(!Ve(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(Es,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of Er)t[i]={};return ss(this.props,((i,s)=>{var r,n=null==(r=Ir(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===Jr?i+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure:i}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Jr||r.dirty||Ge(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!==Jr&&(r.persisted=!0),Ge(n)||(r.fingerprint=n)):this._config.debug&&es.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(Ge(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 Er)Es._remove(this._groupEntryName(i));t?delete this._slotState[Jr]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(We(e)){Ge(t)&&(t="None"),this._expire_days=Ge(i)?this._default_expiry:i;var s=!1;if(ss(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(We(e)){this._expire_days=Ge(t)?this._default_expiry:t;var i=!1;if(ss(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=Dr(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ve(ls(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==ye?void 0:ye.referrer)?qr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:jr(),$referring_domain:null!=ye&&ye.referrer&&(null==(e=Cr(ye.referrer))?void 0:e.host)||Nr},void 0)}set_initial_person_info(){this.props[K]||this.props[J]||this.register_once({[Y]:Br(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ss([J,K],(t=>{var i=this.props[t];i&&ss(i,(function(t,i){e["$initial_"+qe(i)]=t}))}));var t,i,s=this.props[Y];if(s){var r=(t=Ur(s),i={},ss(t,(function(e,t){i["$initial_"+qe(t)]=e})),i);rs(e,r)}return e}safe_merge(e){return ss(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 Ge(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=Ir(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Xr="events",Qr="cancelEvents",Zr="survey shown",en="survey sent",tn="popover",sn=ts("[RateLimiter]");class rn{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=>{sn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void sn.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(G))&&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(G,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var nn=ts("[RemoteConfig]");class on{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Pe._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Pe.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Pe.__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 nn.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void nn.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return nn.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){nn.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&ye&&"hidden"!==ye.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||nn.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 an="gzip-js",ln="base64",un=Uint8Array,cn=Uint16Array,dn=Uint32Array,_n=new un([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]),hn=new un([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]),pn=new un([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gn=function(e,t){for(var i=new cn(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new dn(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]},vn=gn(_n,2),fn=vn[1];vn[0][28]=258,fn[258]=28;for(var mn=gn(hn,0)[1],yn=new cn(32768),bn=0;32768>bn;++bn){var wn=(43690&bn)>>>1|(21845&bn)<<1;yn[bn]=((65280&(wn=(61680&(wn=(52428&wn)>>>2|(13107&wn)<<2))>>>4|(3855&wn)<<4))>>>8|(255&wn)<<8)>>>1}var xn=function(e,t,i){for(var s=e.length,r=0,n=new cn(t);s>r;++r)++n[e[r]-1];var o,a=new cn(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new cn(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[yn[d]>>>l]=u}else for(o=new cn(s),r=0;s>r;++r)o[r]=yn[a[e[r]-1]++]>>>15-e[r];return o},Sn=new un(288);for(bn=0;144>bn;++bn)Sn[bn]=8;for(bn=144;256>bn;++bn)Sn[bn]=9;for(bn=256;280>bn;++bn)Sn[bn]=7;for(bn=280;288>bn;++bn)Sn[bn]=8;var En=new un(32);for(bn=0;32>bn;++bn)En[bn]=5;var kn=xn(Sn,9,0),Pn=xn(En,5,0),In=function(e){return(e/8>>0)+(7&e&&1)},Cn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof cn?cn:e instanceof dn?dn:un)(i-t);return s.set(e.subarray(t,i)),s},Fn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Tn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Rn=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 un(0),0];if(1==r){var o=new un(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 cn(_+1),p=Ln(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 un(h),p]},Ln=function(e,t,i){return-1==e.s?Math.max(Ln(e.l,t,i+1),Ln(e.r,t,i+1)):t[e.s]=i},$n=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cn(++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]},Mn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},On=function(e,t,i){var s=i.length,r=In(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)},An=function(e,t,i,s,r,n,o,a,l,u,c){Fn(t,c++,i),++r[256];for(var d=Rn(r,15),_=d[0],h=d[1],p=Rn(n,15),g=p[0],v=p[1],f=$n(_),m=f[0],y=f[1],b=$n(g),w=b[0],x=b[1],S=new cn(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=Rn(S,7),P=k[0],I=k[1],C=19;C>4&&!P[pn[C-1]];--C);var F,T,R,L,M=u+5<<3,O=Mn(r,Sn)+Mn(n,En)+o,A=Mn(r,_)+Mn(n,g)+o+14+3*C+Mn(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=M&&A>=M)return On(t,c,e.subarray(l,l+u));if(Fn(t,c,1+(O>A)),c+=2,O>A){F=xn(_,h,0),T=_,R=xn(g,v,0),L=g;var D=xn(P,I,0);for(Fn(t,c,y-257),Fn(t,c+5,x-1),Fn(t,c+10,C-4),c+=14,E=0;C>E;++E)Fn(t,c+3*E,P[pn[E]]);c+=3*C;for(var H=[m,w],q=0;2>q;++q){var z=H[q];for(E=0;z.length>E;++E)Fn(t,c,D[N=31&z[E]]),c+=P[N],N>15&&(Fn(t,c,z[E]>>>5&127),c+=z[E]>>>12)}}else F=kn,T=Sn,R=Pn,L=En;for(E=0;a>E;++E)if(s[E]>255){var N;Tn(t,c,F[257+(N=s[E]>>>18&31)]),c+=T[N+257],N>7&&(Fn(t,c,s[E]>>>23&31),c+=_n[N]);var j=31&s[E];Tn(t,c,R[j]),c+=L[j],j>3&&(Tn(t,c,s[E]>>>5&8191),c+=hn[j])}else Tn(t,c,F[s[E]]),c+=T[s[E]];return Tn(t,c,F[256]),c+T[256]},Dn=new dn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hn=function(){for(var e=new dn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),qn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function zn(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=Hn[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 un(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=On(l,u,e.subarray(c,d)):(l[c]=!0,u=On(l,u,e.subarray(c,o)))}else{for(var _=Dn[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new cn(32768),f=new cn(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 dn(25e3),x=new cn(288),S=new cn(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=An(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,H=T-R&32767;if(L>2&&F==b(c-H))for(var q=Math.min(h,L)-1,z=Math.min(32767,c),N=Math.min(258,L);z>=H&&--D&&T!=R;){if(e[c+O]==e[c+O-H]){for(var j=0;N>j&&e[c+j]==e[c+j-H];++j);if(j>O){if(O=j,A=H,j>q)break;var B=Math.min(H,j-2),U=0;for(M=0;B>M;++M){var W=c-H+M+32768&32767,V=W-v[W]+32768&32767;V>U&&(U=V,R=W)}}}H+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|fn[O]<<18|mn[A];var G=31&fn[O],K=31&mn[A];k+=_n[G]+hn[K],++x[257+G],++S[K],I=c+O,++E}else w[P++]=e[c],++x[e[c]]}}u=An(e,l,!0,w,x,S,k,P,C,c-C,u)}return Cn(a,0,s+In(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&&qn(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),qn(u,c-8,i.d()),qn(u,c-4,s),u}var Nn=!!xe||!!we,jn="text/plain",Bn=!1,Un=(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:"")},Wn=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 ss(e,(function(e,t){Ge(e)||Ge(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("&")},Vn=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Gn=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===an){var s=zn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new un(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 un(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 Cn(s,0,r)}(Vn(t)),{mtime:0});return{contentType:jn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===ln){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Vn(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Vn(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Vn(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Kn=e=>{var t,s,r,n=Gn(e);return!n||(s=e.compression,r=Fr(e.url,"compression"),s!==Ie.GZipJS&&r!==Ie.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?Te(new Uint8Array(t)):ArrayBuffer.isView(t)&&Te(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Bn=!0,{url:Un(e.url,"compression"),encodedBody:Gn(i({},e,{compression:void 0,_encodedBody:void 0}))})},Jn=function(){var e=t((function*(e){var t=Vn(e.data),s=yield function(e,t,i){return Me.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:jn,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Yn=(e,t)=>Wn(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),Xn=[];we&&Xn.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Kn(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;ss(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(Se){var c=new Se;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}we(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){es.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{es.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),xe&&Xn.push({transport:"XHR",method(e){var t=new xe,{url:i,encodedBody:s}=Kn(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};ss(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),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!=me&&me.sendBeacon&&Xn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Kn(e),s=Wn(t,{beacon:"1"}),{contentType:r,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:r});me.sendBeacon(s,o)}catch(e){}}});var Qn=3e3;class Zn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ut((null==t?void 0:t.flush_interval_ms)||Qn,250,5e3,es.createLogger("flush interval"),Qn),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&&Be(i.data)&&ss(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 ss(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ge(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var eo=["retriesPerformedSoFar"];class to{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ge(ge)&&"onLine"in ge.navigator&&(this._areWeOnline=ge.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ds(ge,"online",this._onlineListener),ds(ge,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,eo);Ze(t)&&(r.url=Wn(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)"),es.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,Ge(ge)||(this._onlineListener&&(ge.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ge.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){es.error(e)}this._queue=[]}}class io{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(){ds(ge,"scroll",this._updateScrollData,{capture:!0}),ds(ge,"scrollend",this._updateScrollData,{capture:!0}),ds(ge,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ge?void 0:ge.document.documentElement;var e=Be(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==ge?void 0:ge.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 ge?"y"===e?ge.scrollY||ge.pageYOffset||ge.document.documentElement.scrollTop||0:ge.scrollX||ge.pageXOffset||ge.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var so=e=>Br(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ro{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({[V]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||so,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[V]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Ur(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 ss(ls(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+qe(i)]=t})),e}}class no{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 oo=ts("[SessionId]");class ao{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 no,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ze(e)||!Ze(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ne)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||ms,this._windowIdGenerator=i||ms;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ut(this._config.session_idle_timeout_seconds||1800,60,36e3,oo.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=Fs._parse(this._window_id_storage_key),o=Fs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Fs._remove(this._window_id_storage_key),Fs._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){oo.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ge(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&&Fs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Fs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Fs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ye(t)&&!Ye(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({[E]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ze(t)&&t>0}_flushPendingActivityTimestamp(){var e;if(!Ye(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(E):(this._persistence.flush(),this._persistence.load());var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[E]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Ze(e)?e:0,i=Ze(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_getSessionId(){var e=this._persistence.props[E];return Be(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&&ge&&(ge.removeEventListener(ce,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Fs._remove(this._primary_window_exists_storage_key)},ds(ge,ce,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===ne)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=Ze(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(),oo.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=Ze(n)&&e&&!a?n:i,_=Ze(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 lo=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Ae(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>Ae(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},uo=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 co(e,t,i){return Vn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var _o={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=>uo(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!uo(t,e))))),icontains:(e,t)=>t.map(ho).some((t=>e.map(ho).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(ho).every((t=>e.map(ho).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)))}))},ho=e=>e.toLowerCase();function po(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ge(r)||Ye(r))return!1;var n=[String(r)],o=_o[s.operator];return!!o&&o(s.values,n)}))}var go="custom",vo="i.posthog.com",fo=/^\/static\//;class mo{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("."+vo,".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":go),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&fo.test(e))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===go)return this.apiHost+t;var s=vo+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var yo=ts("[Surveys]"),bo="seenSurvey_",wo=["popover","widget","api"],xo={ignoreConditions:!1,ignoreDelay:!1,displayType:tn},So=ts("[PostHog ExternalIntegrations]"),Eo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ko{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return So.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Pe.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Eo[t],(()=>{var i;null==(i=Pe.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Pe.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Pe.__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 Po,Io={},Co=0,Fo=()=>{},To='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ro="Surveys module not available",Lo="sanitize_properties is deprecated. Use before_send instead",$o="Invalid value for property_denylist config: ",Mo="posthog",Oo=!Nn&&-1===(null==ke?void 0:ke.indexOf("MSIE"))&&-1===(null==ke?void 0:ke.indexOf("Mozilla")),Ao=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:cs(null==ye?void 0:ye.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fo,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:be&&Ke(null==be?void 0:be.search)&&-1!==be.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,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ge||null==(t=ge.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){es.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:le,before_send:void 0,request_queue_config:{flush_interval_ms:Qn},error_tracking:{},_onCapture:Fo,__preview_eager_load_replay:!1},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Js,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)}))(e))},Do=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Ho=e=>{var t={};for(var[i,s]of Do)Ge(e[i])||(t[s]=e[i]);var r=rs({},t,e);return Be(e.property_blacklist)&&(Ge(e.property_denylist)?r.property_denylist=e.property_blacklist:Be(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:es.error($o+e.property_denylist)),r};class qo{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){es.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class zo{_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===ne||this.config.cookieless_mode===re&&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 qo,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new no,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ao(),this.SentryIntegration=xr,this.sentryIntegration=e=>function(e,t){var i=wr(e,t);return{name:br,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 io(this),this.pageViewManager=new Sr(this),this.rateLimiter=new rn(this),this.requestRouter=new mo(this),this.consent=new Ts(this),this.externalIntegrations=new ko(this);var t=null!==(e=zo.__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=Ke(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Ke(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>es.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Mo){var s,r=null!==(s=Io[i])&&void 0!==s?s:new zo;return r._init(e,t,i),Io[i]=r,Io[Mo][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;void 0===t&&(t={});var a=Ke(e)?e.trim():"";if(!a)return es.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=Ao(t.defaults),u=Ho(t),c=rs({},l,u,{name:s,token:a});We(l.rageclick)&&We(u.rageclick)&&(c.rageclick=rs({},l.rageclick,u.rageclick)),this.set_config(c),this.config.on_xhr_error&&es.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:an;var d=this._is_persistence_disabled();this.persistence=new Yr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(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 Zn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new to(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new ao(this),this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(es.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(es.info("Initializing extensions synchronously"),this._initExtensions(p)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&es.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(W);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===oe)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===ae)es.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(ms()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(W,t.bootstrap.isIdentifiedID?ae:oe),this.register({distinct_id:g,$device_id:y})}}if(p)this.register_once({distinct_id:Z,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(ms());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(W,oe)}return ds(ge,"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()||ms();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(W,ae)),t()},r=i.user();"then"in r&&Ue(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||yr.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()||(yr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(yr.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,de),identify:e=>t(e,he),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Ue(this.config._onCapture)&&this.config._onCapture!==Fo&&(es.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&es.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({},zo.__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,fr)),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){es.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[ee]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[te]:s}),this.config.__preview_deferred_init_extensions&&es.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!ye||!ye.body)return es.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=De(e.supportedCompression,an)?an:De(e.supportedCompression,ln)?ln:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:le}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){es.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=be&&be.hostname){var e=be.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 on(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()&&is(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(_e),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(_e,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Oo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wn(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,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_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=Yn(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Xn.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===an&&Ee&&!Bn?Jn(n).then((e=>{l(e)})).catch((t=>{if(Re(t))return Bn=!0,void l(i({},n,{compression:void 0,url:Yn(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Re(e)||t===Fe})(t)&&(Bn=!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){Co++;try{var t,i=[],s=[],r=[];is(e,(e=>{if(e)if(Be(t=e[0]))r.push(e);else if(Ue(e))try{e.call(this)}catch(t){es.error("Error executing queued PostHog call",e,t)}else Be(e)&&"alias"===t?i.push(e):Be(e)&&-1!==t.indexOf("capture")&&Ue(this[t])?r.push(e):s.push(e)}));var n=function(e,t){is(e,(function(e){try{if(Be(e[0])){var i=t;ss(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){es.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Co--}}push(e){if(Co>0&&Be(e)&&Ke(e[0])){var t=zo.prototype[e[0]];Ue(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(!Ge(e)&&Ke(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&&!Ke(null==t?void 0:t.$current_url)&&(es.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||es.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)||ms(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===de&&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!==pe,e===he);if(m&&(p.$set_once=m),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Ke(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),Be(t)?(s=[],is(t,(t=>{s.push(e(t))}))):(s={},ss(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ge(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===en){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})(bo,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){yo.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===en?"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===Zr&&(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(Ve(x)||this.setPersonPropertiesForFlags(x),!Xe(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}es.critical("This capture call is ignored due to client rate limiting.")}}else es.error("No event name provided to posthog.capture")}else es.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,(!Ke(l.distinct_id)&&!Qe(l.distinct_id)||Je(l.distinct_id))&&es.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,s,r,o;if(!ke)return{};var a,l,u,c,d,_,h,p,g,v=e?[...$r,...t||[]]:[],[f,m]=function(e){for(var t=0;gi.length>t;t++){var[i,s]=gi[t],r=i.exec(e),n=r&&(Ue(s)?s(r,e):s);if(n)return n}return["",""]}(ke),y=null!=(a="undefined"!=typeof navigator?navigator:void 0)&&a.brave?{brave:!0}:{},b=rs(ls({$os:f,$os_version:m,$browser:_i(ke,navigator.vendor,y),$device:vi(ke),$device_type:(u=ke,c={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==ge||null==(r=ge.screen)?void 0:r.width,screenHeight:null==ge||null==(o=ge.screen)?void 0:o.height,devicePixelRatio:null==ge?void 0:ge.devicePixelRatio},g=vi(u),g===yt||g===mt||"Kobo"===g||"Kindle Fire"===g||g===Jt?ft:g===Ht||g===zt||g===qt||g===Vt?"Console":g===wt?"Wearable":g?pt:"Android"===(null==c?void 0:c.userAgentDataPlatform)&&(null!==(d=null==c?void 0:c.maxTouchPoints)&&void 0!==d?d:0)>0?600>Math.min(null!==(_=null==c?void 0:c.screenWidth)&&void 0!==_?_:0,null!==(h=null==c?void 0:c.screenHeight)&&void 0!==h?h:0)/(null!==(p=null==c?void 0:c.devicePixelRatio)&&void 0!==p?p:1)?pt:ft:"Desktop"),$timezone:Wr(),$timezone_offset:Vr()}),{$current_url:Tr(null==be?void 0:be.href,v,Or),$host:null==be?void 0:be.host,$pathname:null==be?void 0:be.pathname,$raw_user_agent:ke.length>1e3?ke.substring(0,997)+"...":ke,$browser_version:pi(ke,navigator.vendor,y),$browser_language:zr(),$browser_language_prefix:(l=zr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==ge?void 0:ge.screen.height,$screen_width:null==ge?void 0:ge.screen.width,$viewport_height:null==ge?void 0:ge.innerHeight,$viewport_width:null==ge?void 0:ge.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&&(b.$sdk_dist_channel=n.SDK_DIST_CHANNEL),b}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&rs(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===go&&(l.$lib_custom_api_host=this.config.api_host),c=e!==de||o?e!==_e||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=rs(l,c),e===de&&ye&&(l.title=ye.title),!Ge(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}ke&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=rs({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Be(this.config.property_denylist)?ss(this.config.property_denylist,(function(e){delete l[e]})):es.error($o+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(es.error(Lo),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=rs({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(es.error(Lo),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ve(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:Ro}),()=>{})}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:Ro})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Ro})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=xo),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:Ro}}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:Ro})}_validateIdentifyId(e){return!e||Je(e)?(es.critical("Unique user id has not been set in posthog.identify"),!1):e===Z?(es.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())||(es.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 es.uninitializedWarning("posthog.identify");if(Qe(e)&&(e=e.toString(),es.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(W)||oe)===oe;e!==s&&n?(this.persistence.set_property(W,ae),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(he,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=co(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(N))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=co(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):es.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(pe,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else es.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(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}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(es.info("reset"),!this.__loaded)return es.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(),Ge(_)||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(W,oe),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===ne)this.register_once({distinct_id:Z,$device_id:null},"");else{var h=this.config.get_device_id(ms());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)?(es.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ge(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(es.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(We(e)){var s,r,o,a,l,u,c,d,_,h,p;rs(this.config,Ho(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 Yr(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);et(v)&&(this.config.debug=v),et(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Es._is_supported()&&Es._set("ph_debug",!0),es.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Es._is_supported()&&Es._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:zo._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:Mo;return t!==Mo&&(t=Mo+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(W))===ae||(null==(t=this.sessionPersistence)?void 0:t.get_property(W))===ae}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===le&&!this._isIdentified()&&Ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[X]))}_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?(es.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(X,!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!==re)}_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!==ne){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 ao(this),this.pageViewManager=new Sr(this),this.persistence&&(this.sessionPropsManager=new ro(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=zo.__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==re&&(null==(u=this.surveys)||u.loadIfEnabled()),(Ge(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 es.warn(To)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==ne?(this.config.cookieless_mode===re&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===re&&(this.register({distinct_id:Z,$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())):es.warn(To)}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===ne||(this.config.cookieless_mode===re?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 me?lo(me,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ye&&("visible"===ye.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(de,{title:ye.title},{send_instantly:!0}),this._visibilityStateListener&&(ye.removeEventListener(ue,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ds(ye,ue,this._visibilityStateListener)))}debug(e){!1===e?(null==ge||ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ge||ge.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?(es.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=es,r=(t="advanced_disable_flags")in(e=o)&&!Xe(e[t]),n=i in e&&!Xe(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(Xe(this.config.before_send))return e;var t=Be(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Xe(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return it(e.event)?es.warn(r+". This can cause unexpected behavior."):es.info(r),null}i.properties&&!Ve(i.properties)||es.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=et(e)&&!e,i=Es._is_supported()&&"true"===Es._get("ph_debug");return!t&&(!!i||e)}}zo.__defaultExtensionClasses={},zo._noopLogger={trace:Po=()=>{},debug:Po,info:Po,warn:Po,error:Po,fatal:Po},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=as(e.prototype[t[i]])}(zo,["identify"]);class No{constructor(e){this.disabled=!1===e;var t=We(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 jo="$copy_autocapture",Bo=ts("[AutoCapture]");function Uo(e,t){return t.length>e?t.slice(0,e)+"...":t}function Wo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Os(t));return t}function Vo(e,t){var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Os(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!As(d,"body");)if(Hs(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Os(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(ss(c,(e=>{var t=ir(e);if(As(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&cr(i)&&i}De(Ns(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Ws.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Uo(1024,dr(e)):Uo(1024,Bs(e)));var o=Ns(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),ss(e.attributes,(function(i){var r;if((!sr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&cr(i.value)&&(!Ke(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=qs(o).join(" ")),n["attr__"+i.name]=Uo(1024,o)}}));for(var a=1,l=1,u=e;u=Wo(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(!ir(e))return{};var t={};return ss(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&&cr(s)&&(t[i]=s)}})),t}(e);rs(g,s)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=As(e,"a")||As(e,"button")?dr(e):Bs(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Cr(v))?void 0:m.host,w=null==ge||null==(y=ge.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:rs({$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 ns(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[hr(t.toString())]=hr(i.toString())})),(r+=":")+ns(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:pr(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ns(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 Go=ts("[ExceptionAutocapture]"),Ko=ts("[TracingHeaders]"),Jo=ts("[Web Vitals]"),Yo=9e5,Xo="disabled",Qo="lazy_loading",Zo="awaiting_config",ea="missing_config";ts("[SessionRecording]"),ts("[SessionRecording]");var ta="[SessionRecording]",ia=ts(ta),sa=ts("[Heatmaps]");function ra(e){return We(e)&&"clientX"in e&&"clientY"in e&&Qe(e.clientX)&&Qe(e.clientY)}var na=ts("[Product Tours]"),oa=["$set_once","$set"],aa=ts("[SiteApps]"),la="Error while initializing PostHog app with config id ";function ua(e,t,i){if(Xe(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 ca{constructor(e){this._debugEventEmitter=new no,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;Ge(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(!Ge(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(!ua(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=>ua(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&ua((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=>ua(e.text,t.text,t.text_matching||"exact")||ua(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;!Xe(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=>ua(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||po(t.properties.reduce(((e,t)=>{var i=Be(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 da{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&po(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===Xr?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;Ge(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 ca(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,Xr),this._cancelEventToItems=this._buildEventToItemMap(e,Qr))}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,Qr);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,Xr);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 _a extends da{constructor(e){super(e)}_getActivatedKey(){return q}_getShownEventName(){return Zr}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return yo}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[q]:e})}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ha="SDK is not enabled or survey functionality is not yet loaded",pa="Disabled. Not loading surveys.",ga=null!=ge&&ge.location?Rr(ge.location.hash,"__posthog")||Rr(location.hash,"state"):null,va="_postHogToolbarParams",fa=ts("[Toolbar]"),ma=ts("[FeatureFlags]"),ya=ts("[FeatureFlags]",{debugEnabled:!0}),ba="\" failed. Feature flags didn't load in time.",wa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},xa=e=>{var t={};for(var[i,s]of ns(e||{}))s&&(t[i]=s);return t},Sa=ts("[Error tracking]"),Ea="Refusing to render web experiment since the viewer is a likely bot",ka={icontains:(e,t)=>!!ge&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ge&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!ge&&uo(t.href,e),not_regex:(e,t)=>!!ge&&!uo(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Pa{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Pa._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Pa._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);Ke(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];Pa._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())Pa._logInfo(Ea);else if(!this._config.disable_web_experiments){if(Xe(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Pa._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=Pa.getWindowLocation();if(null!=e&&e.search){var t=Fr(null==e?void 0:e.search,"__experiment_id"),i=Fr(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Pa._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&&(Pa._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!Xe(e.conditions)&&Pa._matchUrlConditions(e)&&Pa._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Xe(e.conditions)||Xe(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Pa.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||ka[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==ge?void 0:ge.location}static _matchUTMConditions(e){var t;if(Xe(e.conditions)||Xe(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Dr();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];es.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Pa._logInfo(Ea):"control"!==t?i.forEach((i=>{if(i.selector){var s;Pa._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)}))}})):Pa._logInfo("Control variants leave the page unmodified.")}_is_bot(){return me&&this._instance?lo(me,this._config.custom_blocked_useragents):void 0}}var Ia=ts("[Conversations]"),Ca="Conversations not available yet.",Fa={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,ma.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||(ma.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||ma.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(!Ge(e)){if(Be(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ma.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ma.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:Ge(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(F),t=this._prop(L),s=this._prop(M);if(!s&&!t)return e||{};var r=rs({},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=Ge(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ge(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||(ma.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(P),t=this._prop(L);if(!t)return e||{};for(var i=rs({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ma.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(T),t=this._prop(M);if(!t)return e||{};for(var i=rs({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ma.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(O)||{}),group_properties:this._prop(A),timezone:Wr()};Ye(r)||Ge(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();Ge(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:ln,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({[B]:o}),u)ma.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 ma.warn('getFeatureFlag for key "'+e+ba)}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(R)||void 0,l=this._prop(U)||void 0,u=this._prop(N)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(j);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[N]:u,[j]: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;Be(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[N]:u});var S=this.getFeatureFlagDetails(e),E=[...null!==(p=this._prop(B))&&void 0!==p?p:[]];Ge(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};Ge(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),Ge(null==S?void 0:S.original_variant)&&Ge(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ge(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(!Ge(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:C}}}}else ma.warn('getFeatureFlagResult for key "'+e+ba)}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();Ge(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:ln,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 Ge(i)?void 0:!!i}ma.warn('isFeatureEnabled for key "'+e+ba)}}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]})))):ma.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(Be(u)){ma.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({[I]:u,[P]: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({[I]:Object.keys(xa(g)),[P]:g||{},[T]:v||{},[F]:f||{}},d?{[R]:d}:{},_?{[U]:_}:{}))}}}(e,this._persistence,r,n,o,s),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ma.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ma.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(L),this._persistence.unregister(M),this._fireFeatureFlagsCallbacks(),ya.info("All overrides cleared");if(Be(e)){var t=wa(e);return this._persistence.register({[L]:t}),this._fireFeatureFlagsCallbacks(),ya.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(L),ya.info("Flag overrides cleared");else if(s.flags){if(Be(s.flags)){var r=wa(s.flags);this._persistence.register({[L]:r})}else this._persistence.register({[L]:s.flags});ya.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(M),ya.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[M]:s.payloads}),ya.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[L]:e}),this._fireFeatureFlagsCallbacks(),ya.info("Flag overrides set",{flags:e});ma.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(C)||[]).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({[I]:Object.keys(xa(l)),[P]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(C),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(C),null==(s=this._persistence)||s.register({[C]: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(O)||{},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({[O]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(O)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(A)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[A]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(A)||{};this._instance.register({[A]:i({},t,{[e]:{}})})}else this._instance.unregister(A)}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}}},Ta={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===Zo||this._recordingStatus===ea?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=Xo,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw ia.error("started without valid sessionManager"),new Error(ta+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===ne)throw new Error(ta+' 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 ge&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ge(Object.assign)&&!Ge(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),ia.info("starting")):(this._recordingStatus=Xo,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==Zo&&this._recordingStatus!==ea&&(this._recordingStatus=Qo),null!=Pe&&null!=(t=Pe.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=Pe.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=Pe.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return ia.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;null==(e=this._persistence)||e.unregister(k)}_validateSampleRate(e,t){if(Xe(e))return null;var i,s=Qe(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(ia.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;Xe(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:Ge(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===Zo&&(this._recordingStatus=ea,ia.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):ia.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 ia.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=Pe.__PosthogExtensions__)||!t.initSessionRecording)return ia.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ie]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=Pe.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ea||this._recordingStatus===Zo)return;return this._recordingStatus=Zo,ia.info("persisted remote config is stale, requesting fresh config before starting"),void new on(this._instance).load()}this._recordingStatus=Qo,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({[w]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[b]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?x:S]:!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))}}},Ra={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new No(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=We(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(ge&&ye){var e=e=>{e=e||(null==ge?void 0:ge.event);try{this._captureEvent(e)}catch(e){Bo.error("Failed to capture event",e)}};if(ds(ye,"submit",e,{capture:!0}),ds(ye,"change",e,{capture:!0}),ds(ye,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ge?void 0:ge.event);try{this._captureEvent(e,jo)}catch(e){Bo.error("Failed to capture copy/cut event",e)}};ds(ye,"copy",t,{capture:!0}),ds(ye,"cut",t,{capture:!0})}}}else Bo.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==ye?void 0:ye.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(Ye(this._isDisabledServerSide)&&!et(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=Us(e);Ds(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())&&Zs(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===jo;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!ge||er(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!zs(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&zs(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}=tr(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ge(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(!Vs(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=ge.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&&(Ws.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Vo(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===jo){var l,u=js(null==ge||null==(l=ge.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 Ue(null==ye?void 0:ye.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ge||null==(t=ge.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(es.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,es.info("History API monitoring stopped")}monitorHistoryChanges(){ge&&ge.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ge&&(null==(t=ge.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 Ue(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()=>{}}}(ge.history,e,(t=>function(s,r,n){t.call(this,s,r,n),i._capturePageview(e)}))}}_capturePageview(e){try{var t,i=null==ge||null==(t=ge.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(de,{navigation_type:e}),this._lastPathname=i}catch(t){es.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};ds(ge,"popstate",e),this._popstateListener=()=>{ge&&ge.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 No(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return We(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Xe(this._config.capture_heatmaps)?Xe(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;sa.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)}(ye)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ge&&ye&&(this._flushHandler=this._flush.bind(this),ds(ge,ce,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ge?void 0:ge.event)),ds(ye,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ge?void 0:ge.event)),ds(ye,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new mr(this.instance,vr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),ds(ye,ue,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ge&&ye&&(this._flushHandler&&ge.removeEventListener(ce,this._flushHandler),this._onClickHandler&&ye.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&ye.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&ye.removeEventListener(ue,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&&Os(s)&&!As(s,"body");){if(s===i)return!1;if(De(t,null==ge?void 0:ge.getComputedStyle(s).position))return!0;s=Gs(s)}return!1}(Us(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"),!Ms(e.target)&&ra(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Zs(Us(e),this.instance.config.rageclick)&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!Ms(e.target)&&ra(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ge){var t=ge.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...$r,...i||[]]:[],r=Tr(t,s,Or);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!Ve(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:mr,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(!Ge(s))if(Xe(null==e?void 0:e.name)||Xe(null==e?void 0:e.value))Jo.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)),Ge(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=Ge(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()});Ge(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 Jo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=Pe.__PosthogExtensions__;Ge(r)||Ge(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):Jo.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=We(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Xe(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(We(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=We(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=We(this._perfConfig)&&Qe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Yo;return e>0&&6e4>=e?Yo:e}get isEnabled(){var e=null==be?void 0:be.protocol;if("http:"!==e&&"https:"!==e)return Jo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=We(this._perfConfig)?this._perfConfig.web_vitals:et(this._perfConfig)?this._perfConfig:void 0;return et(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Jo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=We(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=We(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=Pe.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Jo.error("failed to load script",t):e()}))}_currentURL(){var e=ge?ge.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...$r,...t||[]]:[];return Tr(e,i,Or)}Jo.error("Could not determine current URL")}}},La={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(ge&&this.isEnabled&&null!=(e=Pe.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Pe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Pe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Pe.__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){Go.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new ct({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:Go}),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 We(e)?t=i({},t,e):(Ge(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?(Go.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=Pe.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Go.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)?Go.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 Si([new Oi,new Wi,new Di,new Ai,new Bi,new ji,new qi,new Ui],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=Mi.test(l)?l.replace(Mi,"$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||Ei});var s}))}(n)}}("web:javascript",Ti,$i)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Yi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Xi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Yi(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(!Ke(e)||0===e.trim().length)return void Sa.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)=>Ki.has(s)?(t.push(s),i):(i[s]=e[s],i)),{}),droppedKeys:t}}(s);n.length>0&&Sa.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[Vi]:e,[Gi]:(new Date).toISOString()},r))}catch(e){Sa.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 Sa.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 Sa.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 Sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Xe(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 Sa.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void Sa.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 Sa.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Vi]:e,[Gi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return We(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 Ke(i)&&i.length>0&&e.$exception_types.push(i),Ke(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=_o[e.operator],r=Be(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!Xe(e)&&Be(e)}}},$a=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=Pe.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?na.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Pe.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Pe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Be(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[z];if(Be(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 na.error(r),void e([],{isLoaded:!1,error:r})}var n=Be(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[z]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Xe(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(z)}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)}}},Fa),Ma={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=Pe._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,oa),{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&&(aa.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,aa.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){aa.error(la+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){aa.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){aa.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 aa.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;Pe["__$$ph_site_app_"+e]=r._instance,null==(t=Pe.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return aa.error(la+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Oa={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?(Ge(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Pe.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Ge(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Pe.__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=Pe.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Ko.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 Be(e)?(Be(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Be(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()}}},Aa=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(Xe(t))return yo.warn("Flags not loaded yet. Not loading surveys.");var i=Be(t);this._isSurveysEnabled=i?t.length>0:t,yo.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(bo)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)yo.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)yo.info(pa);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())yo.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Pe?void 0:Pe.__PosthogExtensions__;if(e){if(!Ge(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(se);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 yo.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new _a(this._instance),yo.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){yo.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 yo.info(pa),e([]);var i,s=this._instance.get_property(D);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;yo.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({[D]: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){yo.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Xe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);yo.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(Xe(this._surveyManager))return{eligible:!1,reason:ha};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Xe(this._surveyManager))return yo.warn("init was not called"),{visible:!1,disabledReason:ha};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Xe(this._surveyManager)?(yo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ha})):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(Xe(this._surveyManager))yo.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(wo.includes(r.type)){var n=null==ye?void 0:ye.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(yo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;yo.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),yo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);yo.warn("Survey element not found")}else yo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else yo.warn("Survey not found")}}displaySurvey(e,t){var s;if(Xe(this._surveyManager))yo.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!==tn&&t.initialResponses&&yo.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 yo.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 yo.warn("Survey not found")}}cancelPendingSurvey(e){Xe(this._surveyManager)?yo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Fa),Da={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Pe.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Pe.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),_s(this.instance.config))return!1;if(!ge||!ye)return!1;e=null!=e?e:ge.location,i=null!=i?i:ge.history;try{if(!t){try{ge.localStorage.setItem("test","test"),ge.localStorage.removeItem("test")}catch(e){return!1}t=null==ge?void 0:ge.localStorage}var s,r=ga||Rr(e.hash,"__posthog")||Rr(e.hash,"state"),n=r?os((()=>JSON.parse(atob(decodeURIComponent(r)))))||os((()=>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(va)||"{}")).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=Pe.ph_load_toolbar||Pe.ph_load_editor;!Xe(t)&&Ue(t)?t(e,this.instance):fa.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==ye||!ye.getElementById(Q));if(!ge||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(ge.localStorage.setItem(va,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=Pe.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return fa.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),ds(ge,"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)}}},Ha=i({experiments:Pa},Fa),qa={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;Xe(t)||(et(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||_s(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Pe?void 0:Pe.__PosthogExtensions__;if(e&&!Ge(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(se);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 Ia.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),Ia.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Ia.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Ia.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():Ia.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ye(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):(Ia.warn(Ca),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(Ia.warn(Ca),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(Ia.warn(Ca),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(Ia.warn(Ca),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(Ia.warn(Ca),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(Ia.warn(Ca),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ia.warn(Ca),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()}}},za={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ts("[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;!Xe(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==Pe?void 0:Pe.__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(se)}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}=mi[s]||yi,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:wi(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Ge(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:wi(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!=Pe&&null!=(e=Pe.location)&&e.href&&(t.currentUrl=Pe.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},Na=i({},Fa,Ta,Ra,La,$a,Ma,Aa,Oa,Da,Ha,qa,za);zo.__defaultExtensionClasses=i({},Na),function(){n.SDK_DIST_CHANNEL="cdn";var e=Io[Mo]=new zo,t=Pe.posthog;t&&ss(t._i,(function(i){if(i&&Be(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))}})),Pe.posthog=e,function(){function e(){e.done||(e.done=!0,Oo=!1,ss(Io,(function(e){e._dom_loaded()})))}null!=ye&&ye.addEventListener?"complete"===ye.readyState?e():ds(ye,"DOMContentLoaded",e,{capture:!1}):ge&&es.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.383.3",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_override_sampling",w="$replay_override_linked_flag",x="$replay_override_url_trigger",S="$replay_override_event_trigger",E="$sesid",k="$session_is_sampled",P="$enabled_feature_flags",I="$active_feature_flags",C="$early_access_features",F="$feature_flag_details",T="$feature_flag_payloads",R="$feature_flag_request_id",L="$override_feature_flags",M="$override_feature_flag_payloads",O="$stored_person_properties",A="$stored_group_properties",D="$surveys",H="$surveys_loaded_at",q="$surveys_activated",z="ph_product_tours",N="$flag_call_reported",j="$flag_call_reported_session_id",B="$feature_flag_errors",U="$feature_flag_evaluated_at",W="$user_state",V="$client_session_props",G="$capture_rate_limit",K="$initial_campaign_params",J="$initial_referrer_info",Y="$initial_person_info",X="$epp",Q="__POSTHOG_TOOLBAR__",Z="$posthog_cookieless",ee="$sdk_debug_extensions_init_method",te="$sdk_debug_extensions_init_time_ms",ie="$sdk_debug_recording_script_not_loaded",se="PostHog loadExternalDependency extension not found.",re="on_reject",ne="always",oe="anonymous",ae="identified",le="identified_only",ue="visibilitychange",ce="beforeunload",de="$pageview",_e="$pageleave",he="$identify",pe="$groupidentify",ge="undefined"!=typeof window?window:void 0,ve="undefined"!=typeof globalThis?globalThis:ge;"undefined"==typeof self&&(ve.self=ve),"undefined"==typeof File&&(ve.File=function(){});var fe,me=null==ve?void 0:ve.navigator,ye=null==ve?void 0:ve.document,be=null==ve?void 0:ve.location,we=null==ve?void 0:ve.fetch,xe=null!=ve&&ve.XMLHttpRequest&&"withCredentials"in new ve.XMLHttpRequest?ve.XMLHttpRequest:void 0,Se=null==ve?void 0:ve.AbortController,Ee=null==ve?void 0:ve.CompressionStream,ke=null==me?void 0:me.userAgent,Pe=null!=ge?ge:{},Ie=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Ce=["$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"],Fe="NativeGzipValidationError",Te=e=>e.length>=2&&31===e[0]&&139===e[1],Re=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Le=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Fe,t},$e=function(){var e=t((function*(e,t){18>e.size&&Le("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Te(i)&&8===i[2]||Le("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(fe)return fe;fe=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;fe[e]=t>>>0}return fe})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Le("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Le("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function Me(){return Me=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 $e(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),Me.apply(this,arguments)}var Oe=["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"],Ae=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Oe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function De(e,t){return-1!==e.indexOf(t)}var He=function(e){return e.trim()},qe=function(e){return e.replace(/^\$/,"")},ze=Object.prototype,Ne=ze.hasOwnProperty,je=ze.toString,Be=Array.isArray||function(e){return"[object Array]"===je.call(e)},Ue=e=>"function"==typeof e,We=e=>e===Object(e)&&!Be(e),Ve=e=>{if(We(e)){for(var t in e)if(Ne.call(e,t))return!1;return!0}return!1},Ge=e=>void 0===e,Ke=e=>"[object String]"==je.call(e),Je=e=>Ke(e)&&0===e.trim().length,Ye=e=>null===e,Xe=e=>Ge(e)||Ye(e),Qe=e=>"[object Number]"==je.call(e)&&e==e,Ze=e=>Qe(e)&&e>0,et=e=>"[object Boolean]"===je.call(e),tt=e=>e instanceof FormData,it=e=>De(Ce,e);function st(e){return null===e||"object"!=typeof e}function rt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function nt(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ot=[!0,"true",1,"1","yes"],at=e=>De(ot,e),lt=[!1,"false",0,"0","no"];function ut(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Qe(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),ut(r||i,t,i,s))}class ct{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ut(e.bucketSize,0,100,e._logger),this._refillRate=ut(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ut(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 dt,_t,ht,pt="Mobile",gt="iOS",vt="Android",ft="Tablet",mt=vt+" "+ft,yt="iPad",bt="Apple",wt=bt+" Watch",xt="Safari",St="BlackBerry",Et="Samsung",kt=Et+"Browser",Pt=Et+" Internet",It="Chrome",Ct=It+" OS",Ft=It+" "+gt,Tt="Internet Explorer",Rt=Tt+" "+pt,Lt="Opera",$t=Lt+" Mini",Mt="Edge",Ot="Microsoft "+Mt,At="Firefox",Dt=At+" "+gt,Ht="Nintendo",qt="PlayStation",zt="Xbox",Nt=vt+" "+pt,jt=pt+" "+xt,Bt="Windows",Ut=Bt+" Phone",Wt="Nokia",Vt="Ouya",Gt="Generic",Kt=Gt+" "+pt.toLowerCase(),Jt=Gt+" "+ft.toLowerCase(),Yt="Konqueror",Xt="Oculus Browser",Qt="Vivaldi",Zt="Yandex",ei="Whale",ti="DuckDuckGo",ii="Pale Moon",si="Waterfox",ri="Brave",ni="(\\d+(\\.\\d+)?)",oi=new RegExp("Version/"+ni),ai=new RegExp(zt,"i"),li=new RegExp(qt+" \\w+","i"),ui=new RegExp(Ht+" \\w+","i"),ci=new RegExp(St+"|PlayBook|BB10","i"),di={"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"},_i=function(e,t,i){t=t||"";var s=function(e){return null!=e&&e.brave?ri:null}(i);return s||(De(e," OPR/")&&De(e,"Mini")?$t:De(e," OPR/")?Lt:ci.test(e)?St:De(e,"IE"+pt)||De(e,"WPDesktop")?Rt:De(e,"OculusBrowser")?Xt:De(e,kt)?Pt:De(e,Mt)||De(e,"Edg/")?Ot:De(e,Qt+"/")?Qt:De(e,"YaBrowser/")?Zt:De(e,ei+"/")?ei:De(e,ti+"/")||De(e,"Ddg/")?ti:De(e,"FBIOS")?"Facebook "+pt:De(e,"UCWEB")||De(e,"UCBrowser")?"UC Browser":De(e,"CriOS")?Ft:De(e,"CrMo")||De(e,It)?It:De(e,vt)&&De(e,xt)?Nt:De(e,"FxiOS")?Dt:De(e.toLowerCase(),Yt.toLowerCase())?Yt:De(e,ri+"/")?ri:((e,t)=>t&&De(t,bt)||function(e){return De(e,xt)&&!De(e,It)&&!De(e,vt)}(e))(e,t)?De(e,pt)?jt:xt:De(e,"PaleMoon/")?ii:De(e,si+"/")?si:De(e,At)?At:De(e,"MSIE")||De(e,"Trident/")?Tt:De(e,"Gecko")?At:"")},hi={[Rt]:[new RegExp("rv:"+ni)],[Ot]:[new RegExp(Mt+"?\\/"+ni)],[It]:[new RegExp("("+It+"|CrMo)\\/"+ni)],[Ft]:[new RegExp("CriOS\\/"+ni)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ni)],[xt]:[oi],[jt]:[oi],[Lt]:[new RegExp("(Opera|OPR)\\/"+ni)],[At]:[new RegExp(At+"\\/"+ni)],[Dt]:[new RegExp("FxiOS\\/"+ni)],[Yt]:[new RegExp("Konqueror[:/]?"+ni,"i")],[St]:[new RegExp(St+" "+ni),oi],[Nt]:[new RegExp("android\\s"+ni,"i")],[Pt]:[new RegExp(kt+"\\/"+ni)],[Xt]:[new RegExp("OculusBrowser\\/"+ni)],[Qt]:[new RegExp(Qt+"\\/"+ni)],[Zt]:[new RegExp("YaBrowser\\/"+ni)],[ei]:[new RegExp(ei+"\\/"+ni)],[ri]:[new RegExp(ri+"\\/"+ni)],[ti]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ni)],[ii]:[new RegExp("PaleMoon\\/"+ni)],[si]:[new RegExp(si+"\\/"+ni)],[Tt]:[new RegExp("(rv:|MSIE )"+ni)],Mozilla:[new RegExp("rv:"+ni)]},pi=function(e,t,i){var s=_i(e,t,i),r=hi[s];if(Ge(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},gi=[[new RegExp(zt+"; "+zt+" (.*?)[);]","i"),e=>[zt,e&&e[1]||""]],[new RegExp(Ht,"i"),[Ht,""]],[new RegExp(qt,"i"),[qt,""]],[ci,[St,""]],[new RegExp(Bt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ut,""];if(new RegExp(pt).test(t)&&!/IEMobile\b/.test(t))return[Bt+" "+pt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=di[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Bt,s]}return[Bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[gt,[e[3],e[4],e[5]||"0"].join(".")]:[gt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ge(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+vt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+vt+")","i"),e=>e&&e[2]?[vt,[e[2],e[3],e[4]||"0"].join(".")]:[vt,""]],[/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/,[Ct,""]],[/Linux|debian/i,["Linux",""]]],vi=function(e){return ui.test(e)?Ht:li.test(e)?qt:ai.test(e)?zt:new RegExp(Vt,"i").test(e)?Vt:new RegExp("("+Ut+"|WPDesktop)","i").test(e)?Ut:/iPad/.test(e)?yt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?wt:ci.test(e)?St:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Wt,"i").test(e)?Wt:/(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(pt).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)?vt:mt:new RegExp("(pda|"+pt+")","i").test(e)?Kt:new RegExp(ft,"i").test(e)&&!new RegExp(ft+" pc","i").test(e)?Jt:""},fi=e=>e instanceof Error,mi={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}},yi=mi.info;function bi(e){if(et(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(Be(e))return{arrayValue:{values:e.map((e=>bi(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function wi(e){var t=[];for(var i in e){var s=e[i];Ye(s)||Ge(s)||t.push({key:i,value:bi(s)})}return t}function xi(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ht&&i.length===_t||(_t=i.length,ht=i.reduce(((i,s)=>{dt||(dt={});var r=dt[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,dt[s]=[l,u];break}}return i}),{})),ht}}class Si{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&&Be(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:xi(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 Ei="?";function ki(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Ei:i,in_app:!0};return Ge(s)||(n.lineno=s),Ge(r)||(n.colno=r),n}var Pi=(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]:Ei,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Ii=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ci=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ti=(e,t)=>{var i=Ii.exec(e);if(i){var[,s,r,n]=i;return ki(t,s,Ei,+r,+n)}var o=Ci.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Fi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Pi(o[1]||Ei,o[2]);return ki(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ri=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$i=(e,t)=>{var i=Ri.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Li.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]||Ei;return[n,r]=Pi(n,r),ki(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Mi=/\(error: (.*)\)/;class Oi{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Ke(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 rt(e,"DOMException")}isDOMError(e){return rt(e,"DOMError")}}class Ai{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 Di{constructor(){}match(e){return rt(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 Hi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class qi{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(Hi);return s&&(t=s[1],i=s[2]),[t,i]}}var zi=["fatal","error","warning","log","info","debug"];function Ni(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 ji{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 nt(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: "+Ni(e)}isSeverityLevel(e){return Ke(e)&&!Je(e)&&zi.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(fi(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Bi{match(e){return nt(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Ni(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ui{match(e){return st(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 Wi{match(e){return rt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!nt(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 st(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 Vi="$message",Gi="$timestamp",Ki=new Set([Vi,Gi]),Ji={enabled:!0,max_bytes:32768};function Yi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ji.enabled,max_bytes:Qi(e.max_bytes,Ji.max_bytes)}:i({},Ji)}class Xi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Yi(e)}setConfig(e){this._config=Yi(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(!We(i))return;var s=i,r=s[Vi],n=s[Gi];if(!Ke(r)||0===r.trim().length)return;if(!Ke(n)&&!Qe(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 Qi(e,t){if(!Qe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Zi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(ge&&(n.DEBUG||Pe.POSTHOG_DEBUG||i)&&!Ge(ge.console)&&ge.console){for(var s=("__rrweb_original__"in ge.console[t]?ge.console[t].__rrweb_original__:ge.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)=>Zi(e+" "+t,i)};return s},es=Zi("[PostHog.js]"),ts=es.createLogger;function is(e,t){Be(e)&&e.forEach(t)}function ss(e,t){if(!Xe(e))if(Be(e))e.forEach(t);else if(tt(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)Ne.call(e,i)&&t(e[i],i)}var rs=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 ns(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 os=function(e){try{return e()}catch(e){return}},as=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){es.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),es.critical(e)}}},ls=function(e){var t={};return ss(e,(function(e,i){(Ke(e)&&e.length>0||Qe(e))&&(t[i]=e)})),t};var us=["herokuapp.com","vercel.app","netlify.app"];function cs(e){var t=null==e?void 0:e.hostname;if(!Ke(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of us)if(i===s)return!1;return!0}function ds(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 _s(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 Qe(e)&&isFinite(e)&&Math.floor(e)===e});class hs{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 hs(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 hs(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 ps{constructor(){this._timestamp=0,this._counter=0,this._random=new fs}generate(){var e=this.generateOrAbort();if(Ge(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ge(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 hs.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 gs,vs=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};ge&&!Ge(ge.crypto)&&crypto.getRandomValues&&(vs=e=>crypto.getRandomValues(e));class fs{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(vs(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var ms=()=>ys().toString(),ys=()=>(gs||(gs=new ps)).generate(),bs="",ws=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var xs={_is_supported:()=>!!ye,_error(e){es.error("cookieStore error: "+e)},_get(e){if(ye){try{for(var t=e+"=",i=ye.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(xs._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!ye)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=ye),bs)return bs;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_"+ms();!bs&&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",bs=n)}return bs}(e);if(!i){var s=(e=>{var t=e.match(ws);return t?t[0]:""})(e);s!==i&&es.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(ye.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&&es.warn("cookieStore warning: large cookie, len="+u.length),ye.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=ye&&ye.cookie)try{xs._set(e,"",-1,t)}catch(e){return}}},Ss=null,Es={_is_supported(){if(!Ye(Ss))return Ss;var e=!0;if(Ge(ge))e=!1;else try{var t="__mplssupport__";Es._set(t,"xyz"),'"xyz"'!==Es._get(t)&&(e=!1),Es._remove(t)}catch(t){e=!1}return e||es.error("localStorage unsupported; falling back to cookie store"),Ss=e,e},_error(e){es.error("localStorage error: "+e)},_get(e){try{return null==ge?void 0:ge.localStorage.getItem(e)}catch(e){Es._error(e)}return null},_parse(e){try{return JSON.parse(Es._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==ge||ge.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Es._error(e)}return!1},_remove(e){try{null==ge||ge.localStorage.removeItem(e)}catch(e){Es._error(e)}}},ks=[a,"distinct_id",E,k,X,Y,W],Ps={},Is={_is_supported:()=>!0,_error(e){es.error("memoryStorage error: "+e)},_get:e=>Ps[e]||null,_parse:e=>Ps[e]||null,_set:(e,t)=>(Ps[e]=t,!0),_remove(e){delete Ps[e]}},Cs=null,Fs={_is_supported(){if(!Ye(Cs))return Cs;if(Cs=!0,Ge(ge))Cs=!1;else try{var e="__support__";Fs._set(e,"xyz"),'"xyz"'!==Fs._get(e)&&(Cs=!1),Fs._remove(e)}catch(e){Cs=!1}return Cs},_error(e){es.error("sessionStorage error: ",e)},_get(e){try{return null==ge?void 0:ge.sessionStorage.getItem(e)}catch(e){Fs._error(e)}return null},_parse(e){try{return JSON.parse(Fs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==ge||ge.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Fs._error(e)}return!1},_remove(e){try{null==ge||ge.sessionStorage.removeItem(e)}catch(e){Fs._error(e)}}};class Ts{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===ne||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===re}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 at(e)?1:De(lt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Es:xs;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?xs:Es;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(at(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==me?void 0:me.doNotTrack,null==me?void 0:me.msDoNotTrack,Pe.doNotTrack].some((e=>at(e)))}}var Rs=1,Ls=3,$s=11;function Ms(e){return e instanceof Element&&(e.id===Q||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Os(e){return!!e&&e.nodeType===Rs}function As(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ds(e){return!!e&&e.nodeType===Ls}function Hs(e){return!!e&&e.nodeType===$s&&Os(e.host)}function qs(e){return e?He(e).split(/\s+/):[]}function zs(e){var t=null==ge?void 0:ge.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Ns(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 qs(t)}function js(e){return Xe(e)?null:He(e).split(/(\s+)/).filter((e=>cr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Bs(e){var t="";return ir(e)&&!sr(e)&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(e){var i;Ds(e)&&e.textContent&&(t+=null!==(i=js(e.textContent))&&void 0!==i?i:"")})),He(t)}function Us(e){return Ge(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ws=["a","button","form","input","select","textarea","label"];function Vs(e,t){if(Ge(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 Gs(e){var t=e.parentNode;return!(!t||!Os(t))&&t}var Ks=["next","previous","prev",">","<"],Js=[...Ks,"+","-","−","–"],Ys=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Xs=[".ph-no-rageclick",".ph-no-capture"],Qs=["","text","search","email","password","url","tel","number"];function Zs(e,t){if(!ge||er(e))return!1;var i,s,r,n,o;if(et(t)?(i=!!t&&Xs,s=void 0,r=!1):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Xs,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||!Os(e))&&(!!As(e,"textarea")||(As(e,"input")?De(Qs,(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}=tr(e,!1);return!function(e,t){if(!1===e||Ge(e))return!1;var i;if(!0===e)i=Ks;else{if(!Be(e))return!1;if(e.length>10)return es.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=>Ys(t,e)||Ys(s,e)))}))}(s,a.map((e=>{var t;return{safeText:Bs(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Vs(a,i)}var er=e=>!e||As(e,"html")||!Os(e),tr=(e,t)=>{if(!ge||er(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!As(r,"body");)if(Hs(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Gs(r);if(!n)break;if(t||Ws.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=ge.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function ir(e){for(var t=e;t.parentNode&&!As(t,"body");t=t.parentNode){var i=Ns(t);if(De(i,"ph-sensitive")||De(i,"ph-no-capture"))return!1}if(De(Ns(e),"ph-include"))return!0;var s=e.type||"";if(Ke(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Ke(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 sr(e){return!!(As(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||As(e,"select")||As(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rr="(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})",nr=new RegExp("^(?:"+rr+")$"),or=new RegExp(rr),ar="\\d{3}-?\\d{2}-?\\d{4}",lr=new RegExp("^("+ar+")$"),ur=new RegExp("("+ar+")");function cr(e,t){if(void 0===t&&(t=!0),Xe(e))return!1;if(Ke(e)){if(e=He(e),(t?nr:or).test((e||"").replace(/[- ]/g,"")))return!1;if((t?lr:ur).test(e))return!1}return!0}function dr(e){var t=Bs(e);return cr(t=(t+" "+_r(e)).trim())?t:""}function _r(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Bs(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+_r(e)).trim())}catch(e){es.error("[AutoCapture]",e)}})),t}function hr(e){return e.replace(/"|\\"/g,'\\"')}function pr(e){var t=e.attr__class;return t?Be(t)?t:qs(t):void 0}var gr=ts("[Dead Clicks]"),vr=()=>!0,fr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return et(s)?s:!!We(s)||i};class mr{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=Pe.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?gr.error("failed to load script",t):e()}))}_start(){var e;if(ye){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=Pe.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=We(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Pe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ye),gr.info("starting...")}}else gr.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,gr.info("stopping..."))}}var yr=ts("[SegmentIntegration]");var br="posthog-js";function wr(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 xr{constructor(e,t,i,s,r,n){this.name=br,this.setupOnce=function(o){o(wr(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Sr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(es.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==ge?void 0:ge.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(!(Ge(n)||Ge(o)||Ge(a)||Ge(l)||Ge(u)||Ge(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?ut(o/n,0,1,es):1,_=n>1?ut(a/n,0,1,es):1,h=l>1?ut(u/l,0,1,es):1,p=l>1?ut(c/l,0,1,es):1;s=rs(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 Er=["flags","surveys"],kr={[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"},[E]:{exposure:"hidden"},[k]:{exposure:"event"},$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"},[P]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!We(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[I]:{exposure:"event",storageGroup:"flags"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"flags"},[T]:{exposure:"event",storageGroup:"flags"},[R]:{exposure:"event",storageGroup:"flags"},[L]:{exposure:"event"},[M]:{exposure:"hidden"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys"},[q]:{exposure:"event"},[z]:{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"},[N]:{exposure:"hidden"},[j]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[ee]:{exposure:"event"},[te]:{exposure:"event"},[ie]:{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"}},Pr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ir=e=>{var t=kr[e];if(t)return t;for(var[i,s]of Pr)if(0===e.indexOf(i))return s},Cr=e=>{var t=null==ye?void 0:ye.createElement("a");return Ge(t)?null:(t.href=e,t)},Fr=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(!Be(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){es.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Tr=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("=");Be(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},Rr=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Lr="https?://(.*)",$r=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Mr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...$r],Or="<masked>",Ar=["li_fat_id"];function Dr(e,t,i){if(!ye)return{};var s,r=t?[...$r,...i||[]]:[],n=Hr(Tr(ye.URL,r,Or),e),o=(s={},ss(Ar,(function(e){var t=xs._get(e);s[e]=t||null})),s);return rs(o,n)}function Hr(e,t){var i=Mr.concat(t||[]),s={};return ss(i,(function(t){var i=Fr(e,t);s[t]=i||null})),s}function qr(e){var t=function(e){return e?0===e.search(Lr+"google.([^/?]*)")?"google":0===e.search(Lr+"bing.com")?"bing":0===e.search(Lr+"yahoo.com")?"yahoo":0===e.search(Lr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Ye(t)){s.$search_engine=t;var r=ye?Fr(ye.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function zr(){return navigator.language||navigator.userLanguage}var Nr="$direct";function jr(){return(null==ye?void 0:ye.referrer)||Nr}function Br(e,t){var i=e?[...$r,...t||[]]:[],s=null==be?void 0:be.href.substring(0,1e3);return{r:jr().substring(0,1e3),u:s?Tr(s,i,Or):void 0}}function Ur(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Nr?Nr:null==(t=Cr(i))?void 0:t.host};if(s){r.$current_url=s;var n=Cr(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Hr(s);rs(r,o)}if(i){var a=qr(i);rs(r,a)}return r}function Wr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Vr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Gr={flags:U,surveys:H},Kr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Jr="main";class Yr{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&&es.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),ge){var r=()=>this.flush();ds(ge,"beforeunload",r,{capture:!1}),ds(ge,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Qe(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Kr.indexOf(e.persistence.toLowerCase())&&(es.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=[...ks,...e];return i({},Es,{_parse(e){try{var i={};try{i=xs._parse(e)||{}}catch(e){}var s,r=JSON.parse(Es._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Ye(a)||""===a||(n[o]=a)}s=rs(r,n)}else s=rs(i,r);return Es._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=Es._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&xs._set(e,l,i,r,n,o)}catch(e){Es._error(e)}return a},_remove(e,t){try{null==ge||ge.localStorage.removeItem(e),xs._remove(e,t)}catch(e){Es._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Es._is_supported()?(t=Es,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&Fs._is_supported()?t=Fs:"memory"===n?t=Is:"cookie"===n?t=xs:s._is_supported()?(t=s,r=!0):t=xs,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[U];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return ss(this.props,((t,i)=>{var s=Ir(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===P?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&rs(e,s.transformToEventProperties(t))}else s&&"event"!==s.exposure||(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=rs({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Er){var t=Es._parse(this._groupEntryName(e));if(t&&!Ve(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||rs(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ir(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Gr[e];if(!i)return!1;var s=t[i],r=this.props[i];return Qe(s)&&Qe(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ir(e))?void 0:t.storageGroup:void 0,s=i?Es._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?Ge(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Ge(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,Jr))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Jr),Er)){var s,r=t[i];(!Ve(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(Es,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of Er)t[i]={};return ss(this.props,((i,s)=>{var r,n=null==(r=Ir(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===Jr?i+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure:i}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Jr||r.dirty||Ge(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!==Jr&&(r.persisted=!0),Ge(n)||(r.fingerprint=n)):this._config.debug&&es.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(Ge(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 Er)Es._remove(this._groupEntryName(i));t?delete this._slotState[Jr]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(We(e)){Ge(t)&&(t="None"),this._expire_days=Ge(i)?this._default_expiry:i;var s=!1;if(ss(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(We(e)){this._expire_days=Ge(t)?this._default_expiry:t;var i=!1;if(ss(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=Dr(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ve(ls(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==ye?void 0:ye.referrer)?qr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:jr(),$referring_domain:null!=ye&&ye.referrer&&(null==(e=Cr(ye.referrer))?void 0:e.host)||Nr},void 0)}set_initial_person_info(){this.props[K]||this.props[J]||this.register_once({[Y]:Br(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ss([J,K],(t=>{var i=this.props[t];i&&ss(i,(function(t,i){e["$initial_"+qe(i)]=t}))}));var t,i,s=this.props[Y];if(s){var r=(t=Ur(s),i={},ss(t,(function(e,t){i["$initial_"+qe(t)]=e})),i);rs(e,r)}return e}safe_merge(e){return ss(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 Ge(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=Ir(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Xr="events",Qr="cancelEvents",Zr="survey shown",en="survey sent",tn="popover",sn=ts("[RateLimiter]");class rn{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=>{sn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void sn.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(G))&&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(G,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var nn=ts("[RemoteConfig]");class on{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Pe._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Pe.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Pe.__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 nn.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void nn.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return nn.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){nn.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&ye&&"hidden"!==ye.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||nn.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 an="gzip-js",ln="base64",un=Uint8Array,cn=Uint16Array,dn=Uint32Array,_n=new un([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]),hn=new un([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]),pn=new un([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gn=function(e,t){for(var i=new cn(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new dn(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]},vn=gn(_n,2),fn=vn[1];vn[0][28]=258,fn[258]=28;for(var mn=gn(hn,0)[1],yn=new cn(32768),bn=0;32768>bn;++bn){var wn=(43690&bn)>>>1|(21845&bn)<<1;yn[bn]=((65280&(wn=(61680&(wn=(52428&wn)>>>2|(13107&wn)<<2))>>>4|(3855&wn)<<4))>>>8|(255&wn)<<8)>>>1}var xn=function(e,t,i){for(var s=e.length,r=0,n=new cn(t);s>r;++r)++n[e[r]-1];var o,a=new cn(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new cn(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[yn[d]>>>l]=u}else for(o=new cn(s),r=0;s>r;++r)o[r]=yn[a[e[r]-1]++]>>>15-e[r];return o},Sn=new un(288);for(bn=0;144>bn;++bn)Sn[bn]=8;for(bn=144;256>bn;++bn)Sn[bn]=9;for(bn=256;280>bn;++bn)Sn[bn]=7;for(bn=280;288>bn;++bn)Sn[bn]=8;var En=new un(32);for(bn=0;32>bn;++bn)En[bn]=5;var kn=xn(Sn,9,0),Pn=xn(En,5,0),In=function(e){return(e/8>>0)+(7&e&&1)},Cn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof cn?cn:e instanceof dn?dn:un)(i-t);return s.set(e.subarray(t,i)),s},Fn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Tn=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Rn=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 un(0),0];if(1==r){var o=new un(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 cn(_+1),p=Ln(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 un(h),p]},Ln=function(e,t,i){return-1==e.s?Math.max(Ln(e.l,t,i+1),Ln(e.r,t,i+1)):t[e.s]=i},$n=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cn(++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]},Mn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},On=function(e,t,i){var s=i.length,r=In(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)},An=function(e,t,i,s,r,n,o,a,l,u,c){Fn(t,c++,i),++r[256];for(var d=Rn(r,15),_=d[0],h=d[1],p=Rn(n,15),g=p[0],v=p[1],f=$n(_),m=f[0],y=f[1],b=$n(g),w=b[0],x=b[1],S=new cn(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=Rn(S,7),P=k[0],I=k[1],C=19;C>4&&!P[pn[C-1]];--C);var F,T,R,L,M=u+5<<3,O=Mn(r,Sn)+Mn(n,En)+o,A=Mn(r,_)+Mn(n,g)+o+14+3*C+Mn(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=M&&A>=M)return On(t,c,e.subarray(l,l+u));if(Fn(t,c,1+(O>A)),c+=2,O>A){F=xn(_,h,0),T=_,R=xn(g,v,0),L=g;var D=xn(P,I,0);for(Fn(t,c,y-257),Fn(t,c+5,x-1),Fn(t,c+10,C-4),c+=14,E=0;C>E;++E)Fn(t,c+3*E,P[pn[E]]);c+=3*C;for(var H=[m,w],q=0;2>q;++q){var z=H[q];for(E=0;z.length>E;++E)Fn(t,c,D[N=31&z[E]]),c+=P[N],N>15&&(Fn(t,c,z[E]>>>5&127),c+=z[E]>>>12)}}else F=kn,T=Sn,R=Pn,L=En;for(E=0;a>E;++E)if(s[E]>255){var N;Tn(t,c,F[257+(N=s[E]>>>18&31)]),c+=T[N+257],N>7&&(Fn(t,c,s[E]>>>23&31),c+=_n[N]);var j=31&s[E];Tn(t,c,R[j]),c+=L[j],j>3&&(Tn(t,c,s[E]>>>5&8191),c+=hn[j])}else Tn(t,c,F[s[E]]),c+=T[s[E]];return Tn(t,c,F[256]),c+T[256]},Dn=new dn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hn=function(){for(var e=new dn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),qn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function zn(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=Hn[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 un(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=On(l,u,e.subarray(c,d)):(l[c]=!0,u=On(l,u,e.subarray(c,o)))}else{for(var _=Dn[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new cn(32768),f=new cn(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 dn(25e3),x=new cn(288),S=new cn(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=An(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,H=T-R&32767;if(L>2&&F==b(c-H))for(var q=Math.min(h,L)-1,z=Math.min(32767,c),N=Math.min(258,L);z>=H&&--D&&T!=R;){if(e[c+O]==e[c+O-H]){for(var j=0;N>j&&e[c+j]==e[c+j-H];++j);if(j>O){if(O=j,A=H,j>q)break;var B=Math.min(H,j-2),U=0;for(M=0;B>M;++M){var W=c-H+M+32768&32767,V=W-v[W]+32768&32767;V>U&&(U=V,R=W)}}}H+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|fn[O]<<18|mn[A];var G=31&fn[O],K=31&mn[A];k+=_n[G]+hn[K],++x[257+G],++S[K],I=c+O,++E}else w[P++]=e[c],++x[e[c]]}}u=An(e,l,!0,w,x,S,k,P,C,c-C,u)}return Cn(a,0,s+In(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&&qn(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),qn(u,c-8,i.d()),qn(u,c-4,s),u}var Nn=!!xe||!!we,jn="text/plain",Bn=!1,Un=(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:"")},Wn=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 ss(e,(function(e,t){Ge(e)||Ge(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("&")},Vn=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Gn=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===an){var s=zn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new un(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 un(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 Cn(s,0,r)}(Vn(t)),{mtime:0});return{contentType:jn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===ln){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Vn(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Vn(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Vn(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Kn=e=>{var t,s,r,n=Gn(e);return!n||(s=e.compression,r=Fr(e.url,"compression"),s!==Ie.GZipJS&&r!==Ie.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?Te(new Uint8Array(t)):ArrayBuffer.isView(t)&&Te(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Bn=!0,{url:Un(e.url,"compression"),encodedBody:Gn(i({},e,{compression:void 0,_encodedBody:void 0}))})},Jn=function(){var e=t((function*(e){var t=Vn(e.data),s=yield function(e,t,i){return Me.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:jn,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Yn=(e,t)=>Wn(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),Xn=[];we&&Xn.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Kn(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;ss(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(Se){var c=new Se;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}we(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){es.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{es.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),xe&&Xn.push({transport:"XHR",method(e){var t=new xe,{url:i,encodedBody:s}=Kn(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};ss(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),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!=me&&me.sendBeacon&&Xn.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Kn(e),s=Wn(t,{beacon:"1"}),{contentType:r,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:r});me.sendBeacon(s,o)}catch(e){}}});var Qn=3e3;class Zn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ut((null==t?void 0:t.flush_interval_ms)||Qn,250,5e3,es.createLogger("flush interval"),Qn),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&&Be(i.data)&&ss(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 ss(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ge(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var eo=["retriesPerformedSoFar"];class to{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ge(ge)&&"onLine"in ge.navigator&&(this._areWeOnline=ge.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ds(ge,"online",this._onlineListener),ds(ge,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,eo);Ze(t)&&(r.url=Wn(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)"),es.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,Ge(ge)||(this._onlineListener&&(ge.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(ge.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){es.error(e)}this._queue=[]}}class io{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(){ds(ge,"scroll",this._updateScrollData,{capture:!0}),ds(ge,"scrollend",this._updateScrollData,{capture:!0}),ds(ge,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==ge?void 0:ge.document.documentElement;var e=Be(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==ge?void 0:ge.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 ge?"y"===e?ge.scrollY||ge.pageYOffset||ge.document.documentElement.scrollTop||0:ge.scrollX||ge.pageXOffset||ge.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var so=e=>Br(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ro{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({[V]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||so,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[V]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Ur(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 ss(ls(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+qe(i)]=t})),e}}class no{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 oo=ts("[SessionId]");class ao{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 no,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ze(e)||!Ze(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ne)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||ms,this._windowIdGenerator=i||ms;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ut(this._config.session_idle_timeout_seconds||1800,60,36e3,oo.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=Fs._parse(this._window_id_storage_key),o=Fs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Fs._remove(this._window_id_storage_key),Fs._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){oo.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ge(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&&Fs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Fs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Fs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ye(t)&&!Ye(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({[E]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ze(t)&&t>0}_flushPendingActivityTimestamp(){var e;if(!Ye(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(E):(this._persistence.flush(),this._persistence.load());var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[E]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Ze(e)?e:0,i=Ze(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_getSessionId(){var e=this._persistence.props[E];return Be(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&&ge&&(ge.removeEventListener(ce,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Fs._remove(this._primary_window_exists_storage_key)},ds(ge,ce,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===ne)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=Ze(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(),oo.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=Ze(n)&&e&&!a?n:i,_=Ze(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 lo=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Ae(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>Ae(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},uo=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 co(e,t,i){return Vn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var _o={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=>uo(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!uo(t,e))))),icontains:(e,t)=>t.map(ho).some((t=>e.map(ho).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(ho).every((t=>e.map(ho).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)))}))},ho=e=>e.toLowerCase();function po(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ge(r)||Ye(r))return!1;var n=[String(r)],o=_o[s.operator];return!!o&&o(s.values,n)}))}var go="custom",vo="i.posthog.com",fo=/^\/static\//;class mo{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("."+vo,".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":go),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&fo.test(e))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===go)return this.apiHost+t;var s=vo+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var yo=ts("[Surveys]"),bo="seenSurvey_",wo=["popover","widget","api"],xo={ignoreConditions:!1,ignoreDelay:!1,displayType:tn},So=ts("[PostHog ExternalIntegrations]"),Eo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ko{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return So.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Pe.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Eo[t],(()=>{var i;null==(i=Pe.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Pe.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Pe.__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 Po,Io={},Co=0,Fo=()=>{},To='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ro="Surveys module not available",Lo="sanitize_properties is deprecated. Use before_send instead",$o="Invalid value for property_denylist config: ",Mo="posthog",Oo=!Nn&&-1===(null==ke?void 0:ke.indexOf("MSIE"))&&-1===(null==ke?void 0:ke.indexOf("Mozilla")),Ao=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:cs(null==ye?void 0:ye.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fo,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:be&&Ke(null==be?void 0:be.search)&&-1!==be.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,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==ge||null==(t=ge.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){es.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:le,before_send:void 0,request_queue_config:{flush_interval_ms:Qn},error_tracking:{},_onCapture:Fo,__preview_eager_load_replay:!1},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Js,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)}))(e))},Do=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Ho=e=>{var t={};for(var[i,s]of Do)Ge(e[i])||(t[s]=e[i]);var r=rs({},t,e);return Be(e.property_blacklist)&&(Ge(e.property_denylist)?r.property_denylist=e.property_blacklist:Be(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:es.error($o+e.property_denylist)),r};class qo{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){es.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class zo{_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===ne||this.config.cookieless_mode===re&&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 qo,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new no,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ao(),this.SentryIntegration=xr,this.sentryIntegration=e=>function(e,t){var i=wr(e,t);return{name:br,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 io(this),this.pageViewManager=new Sr(this),this.rateLimiter=new rn(this),this.requestRouter=new mo(this),this.consent=new Ts(this),this.externalIntegrations=new ko(this);var t=null!==(e=zo.__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=Ke(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Ke(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>es.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Mo){var s,r=null!==(s=Io[i])&&void 0!==s?s:new zo;return r._init(e,t,i),Io[i]=r,Io[Mo][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;void 0===t&&(t={});var a=Ke(e)?e.trim():"";if(!a)return es.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=Ao(t.defaults),u=Ho(t),c=rs({},l,u,{name:s,token:a});We(l.rageclick)&&We(u.rageclick)&&(c.rageclick=rs({},l.rageclick,u.rageclick)),this.set_config(c),this.config.on_xhr_error&&es.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:an;var d=this._is_persistence_disabled();this.persistence=new Yr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(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 Zn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new to(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new ao(this),this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(es.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(es.info("Initializing extensions synchronously"),this._initExtensions(p)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&es.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(W);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===oe)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&f===ae)es.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(ms()),y=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(W,t.bootstrap.isIdentifiedID?ae:oe),this.register({distinct_id:g,$device_id:y})}}if(p)this.register_once({distinct_id:Z,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(ms());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(W,oe)}return ds(ge,"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()||ms();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(W,ae)),t()},r=i.user();"then"in r&&Ue(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||yr.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()||(yr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(yr.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,de),identify:e=>t(e,he),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Ue(this.config._onCapture)&&this.config._onCapture!==Fo&&(es.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&es.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({},zo.__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,fr)),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){es.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[ee]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[te]:s}),this.config.__preview_deferred_init_extensions&&es.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!ye||!ye.body)return es.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=De(e.supportedCompression,an)?an:De(e.supportedCompression,ln)?ln:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:le}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){es.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=be&&be.hostname){var e=be.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 on(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()&&is(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(_e),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(_e,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Oo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wn(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,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_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=Yn(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Xn.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===an&&Ee&&!Bn?Jn(n).then((e=>{l(e)})).catch((t=>{if(Re(t))return Bn=!0,void l(i({},n,{compression:void 0,url:Yn(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Re(e)||t===Fe})(t)&&(Bn=!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){Co++;try{var t,i=[],s=[],r=[];is(e,(e=>{if(e)if(Be(t=e[0]))r.push(e);else if(Ue(e))try{e.call(this)}catch(t){es.error("Error executing queued PostHog call",e,t)}else Be(e)&&"alias"===t?i.push(e):Be(e)&&-1!==t.indexOf("capture")&&Ue(this[t])?r.push(e):s.push(e)}));var n=function(e,t){is(e,(function(e){try{if(Be(e[0])){var i=t;ss(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){es.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Co--}}push(e){if(Co>0&&Be(e)&&Ke(e[0])){var t=zo.prototype[e[0]];Ue(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(!Ge(e)&&Ke(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&&!Ke(null==t?void 0:t.$current_url)&&(es.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||es.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)||ms(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===de&&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!==pe,e===he);if(m&&(p.$set_once=m),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Ke(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),Be(t)?(s=[],is(t,(t=>{s.push(e(t))}))):(s={},ss(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ge(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===en){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})(bo,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){yo.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===en?"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===Zr&&(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(Ve(x)||this.setPersonPropertiesForFlags(x),!Xe(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}es.critical("This capture call is ignored due to client rate limiting.")}}else es.error("No event name provided to posthog.capture")}else es.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,(!Ke(l.distinct_id)&&!Qe(l.distinct_id)||Je(l.distinct_id))&&es.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,s,r,o;if(!ke)return{};var a,l,u,c,d,_,h,p,g,v=e?[...$r,...t||[]]:[],[f,m]=function(e){for(var t=0;gi.length>t;t++){var[i,s]=gi[t],r=i.exec(e),n=r&&(Ue(s)?s(r,e):s);if(n)return n}return["",""]}(ke),y=null!=(a="undefined"!=typeof navigator?navigator:void 0)&&a.brave?{brave:!0}:{},b=rs(ls({$os:f,$os_version:m,$browser:_i(ke,navigator.vendor,y),$device:vi(ke),$device_type:(u=ke,c={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==ge||null==(r=ge.screen)?void 0:r.width,screenHeight:null==ge||null==(o=ge.screen)?void 0:o.height,devicePixelRatio:null==ge?void 0:ge.devicePixelRatio},g=vi(u),g===yt||g===mt||"Kobo"===g||"Kindle Fire"===g||g===Jt?ft:g===Ht||g===zt||g===qt||g===Vt?"Console":g===wt?"Wearable":g?pt:"Android"===(null==c?void 0:c.userAgentDataPlatform)&&(null!==(d=null==c?void 0:c.maxTouchPoints)&&void 0!==d?d:0)>0?600>Math.min(null!==(_=null==c?void 0:c.screenWidth)&&void 0!==_?_:0,null!==(h=null==c?void 0:c.screenHeight)&&void 0!==h?h:0)/(null!==(p=null==c?void 0:c.devicePixelRatio)&&void 0!==p?p:1)?pt:ft:"Desktop"),$timezone:Wr(),$timezone_offset:Vr()}),{$current_url:Tr(null==be?void 0:be.href,v,Or),$host:null==be?void 0:be.host,$pathname:null==be?void 0:be.pathname,$raw_user_agent:ke.length>1e3?ke.substring(0,997)+"...":ke,$browser_version:pi(ke,navigator.vendor,y),$browser_language:zr(),$browser_language_prefix:(l=zr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==ge?void 0:ge.screen.height,$screen_width:null==ge?void 0:ge.screen.width,$viewport_height:null==ge?void 0:ge.innerHeight,$viewport_width:null==ge?void 0:ge.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&&(b.$sdk_dist_channel=n.SDK_DIST_CHANNEL),b}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&rs(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===go&&(l.$lib_custom_api_host=this.config.api_host),c=e!==de||o?e!==_e||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=rs(l,c),e===de&&ye&&(l.title=ye.title),!Ge(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}ke&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=rs({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Be(this.config.property_denylist)?ss(this.config.property_denylist,(function(e){delete l[e]})):es.error($o+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(es.error(Lo),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=rs({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(es.error(Lo),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ve(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:Ro}),()=>{})}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:Ro})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Ro})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=xo),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:Ro}}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:Ro})}_validateIdentifyId(e){return!e||Je(e)?(es.critical("Unique user id has not been set in posthog.identify"),!1):e===Z?(es.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())||(es.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 es.uninitializedWarning("posthog.identify");if(Qe(e)&&(e=e.toString(),es.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(W)||oe)===oe;e!==s&&n?(this.persistence.set_property(W,ae),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(he,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=co(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(N))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=co(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):es.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(pe,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else es.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(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}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(es.info("reset"),!this.__loaded)return es.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(),Ge(_)||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(W,oe),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===ne)this.register_once({distinct_id:Z,$device_id:null},"");else{var h=this.config.get_device_id(ms());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)?(es.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ge(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(es.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(We(e)){var s,r,o,a,l,u,c,d,_,h,p;rs(this.config,Ho(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 Yr(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);et(v)&&(this.config.debug=v),et(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Es._is_supported()&&Es._set("ph_debug",!0),es.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Es._is_supported()&&Es._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:zo._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:Mo;return t!==Mo&&(t=Mo+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(W))===ae||(null==(t=this.sessionPersistence)?void 0:t.get_property(W))===ae}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===le&&!this._isIdentified()&&Ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[X]))}_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?(es.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(X,!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!==re)}_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!==ne){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 ao(this),this.pageViewManager=new Sr(this),this.persistence&&(this.sessionPropsManager=new ro(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=zo.__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==re&&(null==(u=this.surveys)||u.loadIfEnabled()),(Ge(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 es.warn(To)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==ne?(this.config.cookieless_mode===re&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===re&&(this.register({distinct_id:Z,$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())):es.warn(To)}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===ne||(this.config.cookieless_mode===re?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 me?lo(me,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ye&&("visible"===ye.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(de,{title:ye.title},{send_instantly:!0}),this._visibilityStateListener&&(ye.removeEventListener(ue,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ds(ye,ue,this._visibilityStateListener)))}debug(e){!1===e?(null==ge||ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==ge||ge.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?(es.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=es,r=(t="advanced_disable_flags")in(e=o)&&!Xe(e[t]),n=i in e&&!Xe(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(Xe(this.config.before_send))return e;var t=Be(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Xe(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return it(e.event)?es.warn(r+". This can cause unexpected behavior."):es.info(r),null}i.properties&&!Ve(i.properties)||es.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=et(e)&&!e,i=Es._is_supported()&&"true"===Es._get("ph_debug");return!t&&(!!i||e)}}zo.__defaultExtensionClasses={},zo._noopLogger={trace:Po=()=>{},debug:Po,info:Po,warn:Po,error:Po,fatal:Po},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=as(e.prototype[t[i]])}(zo,["identify"]);class No{constructor(e){this.disabled=!1===e;var t=We(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 jo="$copy_autocapture",Bo=ts("[AutoCapture]");function Uo(e,t){return t.length>e?t.slice(0,e)+"...":t}function Wo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Os(t));return t}function Vo(e,t){var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Os(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!As(d,"body");)if(Hs(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Os(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(ss(c,(e=>{var t=ir(e);if(As(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&cr(i)&&i}De(Ns(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Ws.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Uo(1024,dr(e)):Uo(1024,Bs(e)));var o=Ns(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),ss(e.attributes,(function(i){var r;if((!sr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&cr(i.value)&&(!Ke(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=qs(o).join(" ")),n["attr__"+i.name]=Uo(1024,o)}}));for(var a=1,l=1,u=e;u=Wo(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(!ir(e))return{};var t={};return ss(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&&cr(s)&&(t[i]=s)}})),t}(e);rs(g,s)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=As(e,"a")||As(e,"button")?dr(e):Bs(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Cr(v))?void 0:m.host,w=null==ge||null==(y=ge.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:rs({$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 ns(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[hr(t.toString())]=hr(i.toString())})),(r+=":")+ns(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:pr(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ns(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 Go=ts("[ExceptionAutocapture]"),Ko=ts("[TracingHeaders]"),Jo=ts("[Web Vitals]"),Yo=9e5,Xo="disabled",Qo="lazy_loading",Zo="awaiting_config",ea="missing_config";ts("[SessionRecording]"),ts("[SessionRecording]");var ta="[SessionRecording]",ia=ts(ta),sa=ts("[Heatmaps]");function ra(e){return We(e)&&"clientX"in e&&"clientY"in e&&Qe(e.clientX)&&Qe(e.clientY)}var na=ts("[Product Tours]"),oa=["$set_once","$set"],aa=ts("[SiteApps]"),la="Error while initializing PostHog app with config id ";function ua(e,t,i){if(Xe(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 ca{constructor(e){this._debugEventEmitter=new no,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;Ge(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(!Ge(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(!ua(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=>ua(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&ua((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=>ua(e.text,t.text,t.text_matching||"exact")||ua(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;!Xe(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=>ua(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||po(t.properties.reduce(((e,t)=>{var i=Be(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 da{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&po(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===Xr?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;Ge(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 ca(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,Xr),this._cancelEventToItems=this._buildEventToItemMap(e,Qr))}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,Qr);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,Xr);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 _a extends da{constructor(e){super(e)}_getActivatedKey(){return q}_getShownEventName(){return Zr}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return yo}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[q]:e})}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ha="SDK is not enabled or survey functionality is not yet loaded",pa="Disabled. Not loading surveys.",ga=null!=ge&&ge.location?Rr(ge.location.hash,"__posthog")||Rr(location.hash,"state"):null,va="_postHogToolbarParams",fa=ts("[Toolbar]"),ma=ts("[FeatureFlags]"),ya=ts("[FeatureFlags]",{debugEnabled:!0}),ba="\" failed. Feature flags didn't load in time.",wa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},xa=e=>{var t={};for(var[i,s]of ns(e||{}))s&&(t[i]=s);return t},Sa=ts("[Error tracking]"),Ea="Refusing to render web experiment since the viewer is a likely bot",ka={icontains:(e,t)=>!!ge&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ge&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!ge&&uo(t.href,e),not_regex:(e,t)=>!!ge&&!uo(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Pa{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Pa._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Pa._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);Ke(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];Pa._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())Pa._logInfo(Ea);else if(!this._config.disable_web_experiments){if(Xe(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Pa._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=Pa.getWindowLocation();if(null!=e&&e.search){var t=Fr(null==e?void 0:e.search,"__experiment_id"),i=Fr(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Pa._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&&(Pa._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!Xe(e.conditions)&&Pa._matchUrlConditions(e)&&Pa._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Xe(e.conditions)||Xe(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Pa.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||ka[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==ge?void 0:ge.location}static _matchUTMConditions(e){var t;if(Xe(e.conditions)||Xe(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Dr();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];es.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Pa._logInfo(Ea):"control"!==t?i.forEach((i=>{if(i.selector){var s;Pa._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)}))}})):Pa._logInfo("Control variants leave the page unmodified.")}_is_bot(){return me&&this._instance?lo(me,this._config.custom_blocked_useragents):void 0}}var Ia=ts("[Conversations]"),Ca="Conversations not available yet.",Fa={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,ma.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||(ma.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||ma.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(!Ge(e)){if(Be(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ma.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ma.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:Ge(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(F),t=this._prop(L),s=this._prop(M);if(!s&&!t)return e||{};var r=rs({},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=Ge(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ge(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||(ma.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(P),t=this._prop(L);if(!t)return e||{};for(var i=rs({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ma.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(T),t=this._prop(M);if(!t)return e||{};for(var i=rs({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(ma.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(O)||{}),group_properties:this._prop(A),timezone:Wr()};Ye(r)||Ge(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();Ge(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:ln,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({[B]:o}),u)ma.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 ma.warn('getFeatureFlag for key "'+e+ba)}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(R)||void 0,l=this._prop(U)||void 0,u=this._prop(N)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(j);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[N]:u,[j]: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;Be(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[N]:u});var S=this.getFeatureFlagDetails(e),E=[...null!==(p=this._prop(B))&&void 0!==p?p:[]];Ge(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};Ge(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),Ge(null==S?void 0:S.original_variant)&&Ge(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ge(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(!Ge(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:C}}}}else ma.warn('getFeatureFlagResult for key "'+e+ba)}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();Ge(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:ln,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 Ge(i)?void 0:!!i}ma.warn('isFeatureEnabled for key "'+e+ba)}}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]})))):ma.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(Be(u)){ma.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({[I]:u,[P]: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({[I]:Object.keys(xa(g)),[P]:g||{},[T]:v||{},[F]:f||{}},d?{[R]:d}:{},_?{[U]:_}:{}))}}}(e,this._persistence,r,n,o,s),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ma.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ma.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(L),this._persistence.unregister(M),this._fireFeatureFlagsCallbacks(),ya.info("All overrides cleared");if(Be(e)){var t=wa(e);return this._persistence.register({[L]:t}),this._fireFeatureFlagsCallbacks(),ya.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(L),ya.info("Flag overrides cleared");else if(s.flags){if(Be(s.flags)){var r=wa(s.flags);this._persistence.register({[L]:r})}else this._persistence.register({[L]:s.flags});ya.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(M),ya.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[M]:s.payloads}),ya.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[L]:e}),this._fireFeatureFlagsCallbacks(),ya.info("Flag overrides set",{flags:e});ma.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(C)||[]).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({[I]:Object.keys(xa(l)),[P]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(C),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(C),null==(s=this._persistence)||s.register({[C]: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(O)||{},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({[O]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(O)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(A)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[A]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(A)||{};this._instance.register({[A]:i({},t,{[e]:{}})})}else this._instance.unregister(A)}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}}},Ta={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===Zo||this._recordingStatus===ea?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=Xo,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw ia.error("started without valid sessionManager"),new Error(ta+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===ne)throw new Error(ta+' 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 ge&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ge(Object.assign)&&!Ge(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),ia.info("starting")):(this._recordingStatus=Xo,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==Zo&&this._recordingStatus!==ea&&(this._recordingStatus=Qo),null!=Pe&&null!=(t=Pe.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=Pe.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=Pe.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return ia.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;null==(e=this._persistence)||e.unregister(k)}_validateSampleRate(e,t){if(Xe(e))return null;var i,s=Qe(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(ia.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;Xe(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:Ge(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===Zo&&(this._recordingStatus=ea,ia.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):ia.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 ia.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=Pe.__PosthogExtensions__)||!t.initSessionRecording)return ia.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ie]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=Pe.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ea||this._recordingStatus===Zo)return;return this._recordingStatus=Zo,ia.info("persisted remote config is stale, requesting fresh config before starting"),void new on(this._instance).load()}this._recordingStatus=Qo,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({[w]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[b]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?x:S]:!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))}}},Ra={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new No(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=We(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(ge&&ye){var e=e=>{e=e||(null==ge?void 0:ge.event);try{this._captureEvent(e)}catch(e){Bo.error("Failed to capture event",e)}};if(ds(ye,"submit",e,{capture:!0}),ds(ye,"change",e,{capture:!0}),ds(ye,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==ge?void 0:ge.event);try{this._captureEvent(e,jo)}catch(e){Bo.error("Failed to capture copy/cut event",e)}};ds(ye,"copy",t,{capture:!0}),ds(ye,"cut",t,{capture:!0})}}}else Bo.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==ye?void 0:ye.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(Ye(this._isDisabledServerSide)&&!et(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=Us(e);Ds(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())&&Zs(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===jo;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!ge||er(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!zs(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&zs(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}=tr(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ge(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(!Vs(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=ge.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&&(Ws.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Vo(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===jo){var l,u=js(null==ge||null==(l=ge.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 Ue(null==ye?void 0:ye.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==ge||null==(t=ge.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(es.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,es.info("History API monitoring stopped")}monitorHistoryChanges(){ge&&ge.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener())}_patchHistoryMethod(e){var t;if(ge&&(null==(t=ge.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 Ue(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()=>{}}}(ge.history,e,(t=>function(s,r,n){t.call(this,s,r,n),i._capturePageview(e)}))}}_capturePageview(e){try{var t,i=null==ge||null==(t=ge.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(de,{navigation_type:e}),this._lastPathname=i}catch(t){es.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};ds(ge,"popstate",e),this._popstateListener=()=>{ge&&ge.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 No(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return We(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Xe(this._config.capture_heatmaps)?Xe(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;sa.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)}(ye)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){ge&&ye&&(this._flushHandler=this._flush.bind(this),ds(ge,ce,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==ge?void 0:ge.event)),ds(ye,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==ge?void 0:ge.event)),ds(ye,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new mr(this.instance,vr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),ds(ye,ue,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;ge&&ye&&(this._flushHandler&&ge.removeEventListener(ce,this._flushHandler),this._onClickHandler&&ye.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&ye.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&ye.removeEventListener(ue,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&&Os(s)&&!As(s,"body");){if(s===i)return!1;if(De(t,null==ge?void 0:ge.getComputedStyle(s).position))return!0;s=Gs(s)}return!1}(Us(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"),!Ms(e.target)&&ra(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Zs(Us(e),this.instance.config.rageclick)&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!Ms(e.target)&&ra(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(ge){var t=ge.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...$r,...i||[]]:[],r=Tr(t,s,Or);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!Ve(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:mr,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(!Ge(s))if(Xe(null==e?void 0:e.name)||Xe(null==e?void 0:e.value))Jo.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)),Ge(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=Ge(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()});Ge(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 Jo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=Pe.__PosthogExtensions__;Ge(r)||Ge(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):Jo.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=We(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Xe(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(We(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=We(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=We(this._perfConfig)&&Qe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Yo;return e>0&&6e4>=e?Yo:e}get isEnabled(){var e=null==be?void 0:be.protocol;if("http:"!==e&&"https:"!==e)return Jo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=We(this._perfConfig)?this._perfConfig.web_vitals:et(this._perfConfig)?this._perfConfig:void 0;return et(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Jo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=We(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=We(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=Pe.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Jo.error("failed to load script",t):e()}))}_currentURL(){var e=ge?ge.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...$r,...t||[]]:[];return Tr(e,i,Or)}Jo.error("Could not determine current URL")}}},La={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(ge&&this.isEnabled&&null!=(e=Pe.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=Pe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Pe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Pe.__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){Go.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new ct({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:Go}),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 We(e)?t=i({},t,e):(Ge(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?(Go.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=Pe.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Go.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)?Go.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 Si([new Oi,new Wi,new Di,new Ai,new Bi,new ji,new qi,new Ui],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=Mi.test(l)?l.replace(Mi,"$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||Ei});var s}))}(n)}}("web:javascript",Ti,$i)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Yi(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Xi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Yi(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(!Ke(e)||0===e.trim().length)return void Sa.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)=>Ki.has(s)?(t.push(s),i):(i[s]=e[s],i)),{}),droppedKeys:t}}(s);n.length>0&&Sa.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[Vi]:e,[Gi]:(new Date).toISOString()},r))}catch(e){Sa.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 Sa.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 Sa.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 Sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Xe(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 Sa.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void Sa.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 Sa.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Vi]:e,[Gi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return We(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 Ke(i)&&i.length>0&&e.$exception_types.push(i),Ke(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=_o[e.operator],r=Be(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!Xe(e)&&Be(e)}}},$a=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=Pe.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?na.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=Pe.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=Pe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Be(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[z];if(Be(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 na.error(r),void e([],{isLoaded:!1,error:r})}var n=Be(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[z]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Xe(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(z)}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)}}},Fa),Ma={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=Pe._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,oa),{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&&(aa.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,aa.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){aa.error(la+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){aa.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){aa.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 aa.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;Pe["__$$ph_site_app_"+e]=r._instance,null==(t=Pe.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return aa.error(la+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else aa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Oa={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?(Ge(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=Pe.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Ge(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=Pe.__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=Pe.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=Pe.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Ko.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 Be(e)?(Be(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Be(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()}}},Aa=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(Xe(t))return yo.warn("Flags not loaded yet. Not loading surveys.");var i=Be(t);this._isSurveysEnabled=i?t.length>0:t,yo.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(bo)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)yo.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)yo.info(pa);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())yo.info("Not loading surveys in cookieless mode without consent.");else{var e=null==Pe?void 0:Pe.__PosthogExtensions__;if(e){if(!Ge(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(se);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 yo.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new _a(this._instance),yo.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){yo.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 yo.info(pa),e([]);var i,s=this._instance.get_property(D);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;yo.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({[D]: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){yo.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Xe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);yo.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(Xe(this._surveyManager))return{eligible:!1,reason:ha};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Xe(this._surveyManager))return yo.warn("init was not called"),{visible:!1,disabledReason:ha};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Xe(this._surveyManager)?(yo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ha})):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(Xe(this._surveyManager))yo.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(wo.includes(r.type)){var n=null==ye?void 0:ye.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(yo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;yo.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),yo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);yo.warn("Survey element not found")}else yo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else yo.warn("Survey not found")}}displaySurvey(e,t){var s;if(Xe(this._surveyManager))yo.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!==tn&&t.initialResponses&&yo.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 yo.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 yo.warn("Survey not found")}}cancelPendingSurvey(e){Xe(this._surveyManager)?yo.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},Fa),Da={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){Pe.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=Pe.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),_s(this.instance.config))return!1;if(!ge||!ye)return!1;e=null!=e?e:ge.location,i=null!=i?i:ge.history;try{if(!t){try{ge.localStorage.setItem("test","test"),ge.localStorage.removeItem("test")}catch(e){return!1}t=null==ge?void 0:ge.localStorage}var s,r=ga||Rr(e.hash,"__posthog")||Rr(e.hash,"state"),n=r?os((()=>JSON.parse(atob(decodeURIComponent(r)))))||os((()=>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(va)||"{}")).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=Pe.ph_load_toolbar||Pe.ph_load_editor;!Xe(t)&&Ue(t)?t(e,this.instance):fa.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==ye||!ye.getElementById(Q));if(!ge||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(ge.localStorage.setItem(va,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=Pe.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return fa.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),ds(ge,"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)}}},Ha=i({experiments:Pa},Fa),qa={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;Xe(t)||(et(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||_s(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==Pe?void 0:Pe.__PosthogExtensions__;if(e&&!Ge(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(se);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 Ia.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),Ia.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Ia.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Ia.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():Ia.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ye(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):(Ia.warn(Ca),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(Ia.warn(Ca),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(Ia.warn(Ca),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(Ia.warn(Ca),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(Ia.warn(Ca),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(Ia.warn(Ca),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ia.warn(Ca),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()}}},za={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=ts("[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;!Xe(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==Pe?void 0:Pe.__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(se)}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}=mi[s]||yi,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:wi(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),Ge(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:wi(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!=Pe&&null!=(e=Pe.location)&&e.href&&(t.currentUrl=Pe.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},Na=i({},Fa,Ta,Ra,La,$a,Ma,Aa,Oa,Da,Ha,qa,za);zo.__defaultExtensionClasses=i({},Na),function(){n.SDK_DIST_CHANNEL="cdn";var e=Io[Mo]=new zo,t=Pe.posthog;t&&ss(t._i,(function(i){if(i&&Be(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))}})),Pe.posthog=e,function(){function e(){e.done||(e.done=!0,Oo=!1,ss(Io,(function(e){e._dom_loaded()})))}null!=ye&&ye.addEventListener?"complete"===ye.readyState?e():ds(ye,"DOMContentLoaded",e,{capture:!1}):ge&&es.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
|
|
2
2
|
//# sourceMappingURL=array.no-external.js.map
|