posthog-js 1.376.0 → 1.376.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t,i,r,s,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(r,s)}function t(t){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=t.apply(i,r);function a(t){e(o,s,n,a,l,"next",t)}function l(t){e(o,s,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 r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}function r(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var s="1.376.0",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},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",E="$replay_override_event_trigger",S="$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",q="$surveys_activated",z="ph_product_tours",H="$flag_call_reported",j="$flag_call_reported_session_id",N="$feature_flag_errors",B="$feature_flag_evaluated_at",U="$user_state",V="$client_session_props",W="$capture_rate_limit",G="$initial_campaign_params",K="$initial_referrer_info",J="$initial_person_info",Y="$epp",X="__POSTHOG_TOOLBAR__",Q="$posthog_cookieless",Z="$sdk_debug_extensions_init_method",ee="$sdk_debug_extensions_init_time_ms",te="$sdk_debug_recording_script_not_loaded",ie="PostHog loadExternalDependency extension not found.",re="on_reject",se="always",ne="anonymous",oe="identified",ae="identified_only",le="visibilitychange",ue="beforeunload",ce="$pageview",de="$pageleave",_e="$identify",he="$groupidentify",pe="undefined"!=typeof window?window:void 0,ge="undefined"!=typeof globalThis?globalThis:pe;"undefined"==typeof self&&(ge.self=ge),"undefined"==typeof File&&(ge.File=function(){});var ve,fe=null==ge?void 0:ge.navigator,me=null==ge?void 0:ge.document,ye=null==ge?void 0:ge.location,be=null==ge?void 0:ge.fetch,we=null!=ge&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,xe=null==ge?void 0:ge.AbortController,Ee=null==ge?void 0:ge.CompressionStream,Se=null==fe?void 0:fe.userAgent,ke=null!=pe?pe:{},Pe=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Ie=["$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"],Ce="NativeGzipValidationError",Fe=e=>e.length>=2&&31===e[0]&&139===e[1],Te=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Re=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Ce,t},Le=function(){var e=t((function*(e,t){18>e.size&&Re("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Fe(i)&&8===i[2]||Re("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(ve)return ve;ve=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;ve[e]=t>>>0}return ve})(),i=4294967295,r=0;e.length>r;r++)i=t[255&(i^e[r])]^i>>>8;return(4294967295^i)>>>0})(t)&&Re("invalid-crc");var s=t.length>>>0;r.getUint32(4,!0)!==s&&Re("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function $e(){return $e=t((function*(e,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).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 Le(u,s),u}catch(e){if(null!=r&&r.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),$e.apply(this,arguments)}var Me=["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"],Oe=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Me.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function Ae(e,t){return-1!==e.indexOf(t)}var De=function(e){return e.trim()},qe=function(e){return e.replace(/^\$/,"")},ze=Object.prototype,He=ze.hasOwnProperty,je=ze.toString,Ne=Array.isArray||function(e){return"[object Array]"===je.call(e)},Be=e=>"function"==typeof e,Ue=e=>e===Object(e)&&!Ne(e),Ve=e=>{if(Ue(e)){for(var t in e)if(He.call(e,t))return!1;return!0}return!1},We=e=>void 0===e,Ge=e=>"[object String]"==je.call(e),Ke=e=>Ge(e)&&0===e.trim().length,Je=e=>null===e,Ye=e=>We(e)||Je(e),Xe=e=>"[object Number]"==je.call(e)&&e==e,Qe=e=>Xe(e)&&e>0,Ze=e=>"[object Boolean]"===je.call(e),et=e=>e instanceof FormData,tt=e=>Ae(Ie,e);function it(e){return null===e||"object"!=typeof e}function rt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function st(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var nt=[!0,"true",1,"1","yes"],ot=e=>Ae(nt,e),at=[!1,"false",0,"0","no"];function lt(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),Xe(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),lt(s||i,t,i,r))}class ut{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=lt(e.bucketSize,0,100,e._logger),this._refillRate=lt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=lt(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(),r=String(e),s=this._buckets[r];return s?this._applyRefill(s,i):this._buckets[r]=s={tokens:this._bucketSize,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var ct,dt,_t,ht="Mobile",pt="iOS",gt="Android",vt="Tablet",ft=gt+" "+vt,mt="iPad",yt="Apple",bt=yt+" Watch",wt="Safari",xt="BlackBerry",Et="Samsung",St=Et+"Browser",kt=Et+" Internet",Pt="Chrome",It=Pt+" OS",Ct=Pt+" "+pt,Ft="Internet Explorer",Tt=Ft+" "+ht,Rt="Opera",Lt=Rt+" Mini",$t="Edge",Mt="Microsoft "+$t,Ot="Firefox",At=Ot+" "+pt,Dt="Nintendo",qt="PlayStation",zt="Xbox",Ht=gt+" "+ht,jt=ht+" "+wt,Nt="Windows",Bt=Nt+" Phone",Ut="Nokia",Vt="Ouya",Wt="Generic",Gt=Wt+" "+ht.toLowerCase(),Kt=Wt+" "+vt.toLowerCase(),Jt="Konqueror",Yt="Oculus Browser",Xt="(\\d+(\\.\\d+)?)",Qt=new RegExp("Version/"+Xt),Zt=new RegExp(zt,"i"),ei=new RegExp(qt+" \\w+","i"),ti=new RegExp(Dt+" \\w+","i"),ii=new RegExp(xt+"|PlayBook|BB10","i"),ri={"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"},si=function(e,t){return t=t||"",Ae(e," OPR/")&&Ae(e,"Mini")?Lt:Ae(e," OPR/")?Rt:ii.test(e)?xt:Ae(e,"IE"+ht)||Ae(e,"WPDesktop")?Tt:Ae(e,"OculusBrowser")?Yt:Ae(e,St)?kt:Ae(e,$t)||Ae(e,"Edg/")?Mt:Ae(e,"FBIOS")?"Facebook "+ht:Ae(e,"UCWEB")||Ae(e,"UCBrowser")?"UC Browser":Ae(e,"CriOS")?Ct:Ae(e,"CrMo")||Ae(e,Pt)?Pt:Ae(e,gt)&&Ae(e,wt)?Ht:Ae(e,"FxiOS")?At:Ae(e.toLowerCase(),Jt.toLowerCase())?Jt:((e,t)=>t&&Ae(t,yt)||function(e){return Ae(e,wt)&&!Ae(e,Pt)&&!Ae(e,gt)}(e))(e,t)?Ae(e,ht)?jt:wt:Ae(e,Ot)?Ot:Ae(e,"MSIE")||Ae(e,"Trident/")?Ft:Ae(e,"Gecko")?Ot:""},ni={[Tt]:[new RegExp("rv:"+Xt)],[Mt]:[new RegExp($t+"?\\/"+Xt)],[Pt]:[new RegExp("("+Pt+"|CrMo)\\/"+Xt)],[Ct]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[wt]:[Qt],[jt]:[Qt],[Rt]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Ot]:[new RegExp(Ot+"\\/"+Xt)],[At]:[new RegExp("FxiOS\\/"+Xt)],[Jt]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[xt]:[new RegExp(xt+" "+Xt),Qt],[Ht]:[new RegExp("android\\s"+Xt,"i")],[kt]:[new RegExp(St+"\\/"+Xt)],[Yt]:[new RegExp("OculusBrowser\\/"+Xt)],[Ft]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},oi=function(e,t){var i=si(e,t),r=ni[i];if(We(r))return null;for(var s=0;r.length>s;s++){var n=e.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},ai=[[new RegExp(zt+"; "+zt+" (.*?)[);]","i"),e=>[zt,e&&e[1]||""]],[new RegExp(Dt,"i"),[Dt,""]],[new RegExp(qt,"i"),[qt,""]],[ii,[xt,""]],[new RegExp(Nt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Bt,""];if(new RegExp(ht).test(t)&&!/IEMobile\b/.test(t))return[Nt+" "+ht,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=ri[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[Nt,r]}return[Nt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[pt,[e[3],e[4],e[5]||"0"].join(".")]:[pt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=We(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+gt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+gt+")","i"),e=>e&&e[2]?[gt,[e[2],e[3],e[4]||"0"].join(".")]:[gt,""]],[/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/,[It,""]],[/Linux|debian/i,["Linux",""]]],li=function(e){return ti.test(e)?Dt:ei.test(e)?qt:Zt.test(e)?zt:new RegExp(Vt,"i").test(e)?Vt:new RegExp("("+Bt+"|WPDesktop)","i").test(e)?Bt:/iPad/.test(e)?mt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?bt:ii.test(e)?xt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ut,"i").test(e)?Ut:/(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(ht).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)?gt:ft:new RegExp("(pda|"+ht+")","i").test(e)?Gt:new RegExp(vt,"i").test(e)&&!new RegExp(vt+" pc","i").test(e)?Kt:""},ui=e=>e instanceof Error,ci={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}},di=ci.info;function _i(e){if(Ze(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(Ne(e))return{arrayValue:{values:e.map((e=>_i(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function hi(e){var t=[];for(var i in e){var r=e[i];Je(r)||We(r)||t.push({key:i,value:_i(r)})}return t}function pi(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return _t&&i.length===dt||(dt=i.length,_t=i.reduce(((i,r)=>{ct||(ct={});var s=ct[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[r];if(l&&u){i[l]=u,ct[r]=[l,u];break}}return i}),{})),_t}}class gi{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"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);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&&Ne(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 r,s;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:r,stack:s})}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 r of i.modifiers)t=yield r(t);return t}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(s=t.handled)||void 0===s||s,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:pi(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return i({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,r),next:e=>s(e,r+1)})}}var vi="?";function fi(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?vi:i,in_app:!0};return We(r)||(n.lineno=r),We(s)||(n.colno=s),n}var mi=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:vi,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},yi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wi=/\((\S*)(?::(\d+))(?::(\d+))\)/,xi=(e,t)=>{var i=yi.exec(e);if(i){var[,r,s,n]=i;return fi(t,r,vi,+s,+n)}var o=bi.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=wi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=mi(o[1]||vi,o[2]);return fi(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ei=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Si=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ki=(e,t)=>{var i=Ei.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Si.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||vi;return[n,s]=mi(n,s),fi(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Pi=/\(error: (.*)\)/;class Ii{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Ge(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 Ci{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 Fi{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 Ti=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ri{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Ti);return r&&(t=r[1],i=r[2]),[t,i]}}var Li=["fatal","error","warning","log","info","debug"];function $i(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class Mi{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{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 st(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: "+$i(e)}isSeverityLevel(e){return Ge(e)&&!Ke(e)&&Li.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(ui(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Oi{match(e){return st(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$i(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ai{match(e){return it(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 Di{match(e){return rt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!st(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,r=this.getUnhandledRejectionReason(e);return it(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}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 qi="$message",zi="$timestamp",Hi=new Set([qi,zi]),ji={enabled:!0,max_bytes:32768};function Ni(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ji.enabled,max_bytes:Ui(e.max_bytes,ji.max_bytes)}:i({},ji)}class Bi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Ni(e)}setConfig(e){this._config=Ni(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(!Ue(i))return;var r=i,s=r[qi],n=r[zi];if(!Ge(s)||0===s.trim().length)return;if(!Ge(n)&&!Xe(n))return;return{step:r,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,r=0;t.length>r;r++)"%"===t[r]?(i+=1,r+=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 Ui(e,t){if(!Xe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Vi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={_log(t){if(pe&&(n.DEBUG||ke.POSTHOG_DEBUG||i)&&!We(pe.console)&&pe.console){for(var r=("__rrweb_original__"in pe.console[t]?pe.console[t].__rrweb_original__:pe.console[t]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Vi(e+" "+t,i)};return r},Wi=Vi("[PostHog.js]"),Gi=Wi.createLogger;function Ki(e,t){Ne(e)&&e.forEach(t)}function Ji(e,t){if(!Ye(e))if(Ne(e))e.forEach(t);else if(et(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)He.call(e,i)&&t(e[i],i)}var Yi=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function Xi(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Qi=function(e){try{return e()}catch(e){return}},Zi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Wi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wi.critical(e)}}},er=function(e){var t={};return Ji(e,(function(e,i){(Ge(e)&&e.length>0||Xe(e))&&(t[i]=e)})),t};var tr=["herokuapp.com","vercel.app","netlify.app"];function ir(e){var t=null==e?void 0:e.hostname;if(!Ge(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of tr)if(i===r)return!1;return!0}function rr(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}function sr(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 Xe(e)&&isFinite(e)&&Math.floor(e)===e});class nr{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||0>e||0>t||0>i||0>r||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new nr(s)}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 nr(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 or{constructor(){this._timestamp=0,this._counter=0,this._random=new ur}generate(){var e=this.generateOrAbort();if(We(e)){this._timestamp=0;var t=this.generateOrAbort();if(We(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 nr.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 ar,lr=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};pe&&!We(pe.crypto)&&crypto.getRandomValues&&(lr=e=>crypto.getRandomValues(e));class ur{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(lr(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var cr=()=>dr().toString(),dr=()=>(ar||(ar=new or)).generate(),_r="",hr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var pr={_is_supported:()=>!!me,_error(e){Wi.error("cookieStore error: "+e)},_get(e){if(me){try{for(var t=e+"=",i=me.cookie.split(";").filter((e=>e.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(pr._get(e))||{}}catch(e){}return t},_set(e,t,i,r,s){if(me)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=me),_r)return _r;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+cr();!_r&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",_r=n)}return _r}(e);if(!i){var r=(e=>{var t=e.match(hr);return t?t[0]:""})(e);r!==i&&Wi.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(me.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Wi.warn("cookieStore warning: large cookie, len="+u.length),me.cookie=u,u}catch(e){return}},_remove(e,t){if(null!=me&&me.cookie)try{pr._set(e,"",-1,t)}catch(e){return}}},gr=null,vr={_is_supported(){if(!Je(gr))return gr;var e=!0;if(We(pe))e=!1;else try{var t="__mplssupport__";vr._set(t,"xyz"),'"xyz"'!==vr._get(t)&&(e=!1),vr._remove(t)}catch(t){e=!1}return e||Wi.error("localStorage unsupported; falling back to cookie store"),gr=e,e},_error(e){Wi.error("localStorage error: "+e)},_get(e){try{return null==pe?void 0:pe.localStorage.getItem(e)}catch(e){vr._error(e)}return null},_parse(e){try{return JSON.parse(vr._get(e))||{}}catch(e){}return null},_set(e,t){try{null==pe||pe.localStorage.setItem(e,JSON.stringify(t))}catch(e){vr._error(e)}},_remove(e){try{null==pe||pe.localStorage.removeItem(e)}catch(e){vr._error(e)}}},fr=[a,"distinct_id",S,k,Y,J,U],mr={},yr={_is_supported:()=>!0,_error(e){Wi.error("memoryStorage error: "+e)},_get:e=>mr[e]||null,_parse:e=>mr[e]||null,_set(e,t){mr[e]=t},_remove(e){delete mr[e]}},br=null,wr={_is_supported(){if(!Je(br))return br;if(br=!0,We(pe))br=!1;else try{var e="__support__";wr._set(e,"xyz"),'"xyz"'!==wr._get(e)&&(br=!1),wr._remove(e)}catch(e){br=!1}return br},_error(e){Wi.error("sessionStorage error: ",e)},_get(e){try{return null==pe?void 0:pe.sessionStorage.getItem(e)}catch(e){wr._error(e)}return null},_parse(e){try{return JSON.parse(wr._get(e))||null}catch(e){}return null},_set(e,t){try{null==pe||pe.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){wr._error(e)}},_remove(e){try{null==pe||pe.sessionStorage.removeItem(e)}catch(e){wr._error(e)}}};class xr{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===se||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 ot(e)?1:Ae(at,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?vr:pr;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?pr:vr;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(ot(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==fe?void 0:fe.doNotTrack,null==fe?void 0:fe.msDoNotTrack,ke.doNotTrack].some((e=>ot(e)))}}var Er=Gi("[Dead Clicks]"),Sr=()=>!0,kr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),r=e.instance.config.capture_dead_clicks;return Ze(r)?r:!!Ue(r)||i};class Pr{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=ke.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Er.error("failed to load script",t):e()}))}_start(){var e;if(me){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=ke.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Ue(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=ke.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(me),Er.info("starting...")}}else Er.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Er.info("stopping..."))}}var Ir=Gi("[SegmentIntegration]");var Cr="posthog-js";function Fr(e,t){var{organization:r,projectId:s,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 r&&s&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Tr{constructor(e,t,i,r,s,n){this.name=Cr,this.setupOnce=function(o){o(Fr(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Rr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Wi.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,r=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==pe?void 0:pe.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}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 r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(We(n)||We(o)||We(a)||We(l)||We(u)||We(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?lt(o/n,0,1,Wi):1,_=n>1?lt(a/n,0,1,Wi):1,h=l>1?lt(u/l,0,1,Wi):1,p=l>1?lt(c/l,0,1,Wi):1;r=Yi(r,{$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&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var Lr={[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"},[S]:{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",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ue(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[I]:{exposure:"event"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden"},[T]:{exposure:"event"},[R]:{exposure:"event"},[L]:{exposure:"event"},[M]:{exposure:"hidden"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[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"},[H]:{exposure:"hidden"},[j]:{exposure:"hidden"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[Z]:{exposure:"event"},[ee]:{exposure:"event"},[te]:{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"}},$r=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mr=e=>{var t=null==me?void 0:me.createElement("a");return We(t)?null:(t.href=e,t)},Or=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!Ne(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Wi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ar=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ne(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=s&&(_+="#"+s),_},Dr=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},qr="https?://(.*)",zr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Hr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...zr],jr="<masked>",Nr=["li_fat_id"];function Br(e,t,i){if(!me)return{};var r,s=t?[...zr,...i||[]]:[],n=Ur(Ar(me.URL,s,jr),e),o=(r={},Ji(Nr,(function(e){var t=pr._get(e);r[e]=t||null})),r);return Yi(o,n)}function Ur(e,t){var i=Hr.concat(t||[]),r={};return Ji(i,(function(t){var i=Or(e,t);r[t]=i||null})),r}function Vr(e){var t=function(e){return e?0===e.search(qr+"google.([^/?]*)")?"google":0===e.search(qr+"bing.com")?"bing":0===e.search(qr+"yahoo.com")?"yahoo":0===e.search(qr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!Je(t)){r.$search_engine=t;var s=me?Or(me.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Wr(){return navigator.language||navigator.userLanguage}var Gr="$direct";function Kr(){return(null==me?void 0:me.referrer)||Gr}function Jr(e,t){var i=e?[...zr,...t||[]]:[],r=null==ye?void 0:ye.href.substring(0,1e3);return{r:Kr().substring(0,1e3),u:r?Ar(r,i,jr):void 0}}function Yr(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:i==Gr?Gr:null==(t=Mr(i))?void 0:t.host};if(r){s.$current_url=r;var n=Mr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Ur(r);Yi(s,o)}if(i){var a=Vr(i);Yi(s,a)}return s}function Xr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Qr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Zr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class es{constructor(e,t){this._config=e,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.load(),e.debug&&Wi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Zr.indexOf(e.persistence.toLowerCase())&&(Wi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...fr,...e];return i({},vr,{_parse(e){try{var t={};try{t=pr._parse(e)||{}}catch(e){}var i=Yi(t,JSON.parse(vr._get(e)||"{}"));return vr._set(e,i),i}catch(e){}return null},_set(e,i,r,s,n,o){try{vr._set(e,i,void 0,void 0,o);var a={};t.forEach((e=>{i[e]&&(a[e]=i[e])})),Object.keys(a).length&&pr._set(e,a,r,s,n,o)}catch(e){vr._error(e)}},_remove(e,t){try{null==pe||pe.localStorage.removeItem(e),pr._remove(e,t)}catch(e){vr._error(e)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&vr._is_supported()?vr:"localstorage+cookie"===r&&t._is_supported()?t:"sessionstorage"===r&&wr._is_supported()?wr:"memory"===r?yr:"cookie"===r?pr:t._is_supported()?t:pr}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[B];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ji(this.props,((t,i)=>{var r=(e=>{var t=Lr[e];if(t)return t;for(var[i,r]of $r)if(0===e.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(t,i===P?()=>this._isFeatureFlagCacheStale():()=>!1))return;r.transformToEventProperties&&Yi(e,r.transformToEventProperties(t))}else r&&"event"!==r.exposure||(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Yi({},e))}}save(){this._disabled||this._storage._set(this._name,this.props,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)}remove(){this._storage._remove(this._name,!1),this._storage._remove(this._name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Ue(e)){We(t)&&(t="None"),this._expire_days=We(i)?this._default_expiry:i;var r=!1;if(Ji(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Ue(e)){this._expire_days=We(t)?this._default_expiry:t;var i=!1;if(Ji(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this._setProp(r,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=Br(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ve(er(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==me?void 0:me.referrer)?Vr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Kr(),$referring_domain:null!=me&&me.referrer&&(null==(e=Mr(me.referrer))?void 0:e.host)||Gr},void 0)}set_initial_person_info(){this.props[G]||this.props[K]||this.register_once({[J]:Jr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ji([K,G],(t=>{var i=this.props[t];i&&Ji(i,(function(t,i){e["$initial_"+qe(i)]=t}))}));var t,i,r=this.props[J];if(r){var s=(t=Yr(r),i={},Ji(t,(function(e,t){i["$initial_"+qe(t)]=e})),i);Yi(e,s)}return e}safe_merge(e){return Ji(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(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),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this._buildStorage(e),s=this.props;this.clear(),this._storage=r,this.props=s,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(),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),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 We(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}_deleteProp(e){delete this.props[e]}}var ts="events",is="cancelEvents",rs="survey shown",ss="survey sent",ns="popover",os=Gi("[RateLimiter]");class as{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=>{os.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void os.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,r;void 0===e&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(W))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;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 "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(W,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var ls=Gi("[RemoteConfig]");class us{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=ke._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=ke.__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 ls.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void ls.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return ls.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){ls.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&me&&"hidden"!==me.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||ls.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 cs="gzip-js",ds="base64",_s=Uint8Array,hs=Uint16Array,ps=Uint32Array,gs=new _s([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]),vs=new _s([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]),fs=new _s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ms=function(e,t){for(var i=new hs(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new ps(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},ys=ms(gs,2),bs=ys[1];ys[0][28]=258,bs[258]=28;for(var ws=ms(vs,0)[1],xs=new hs(32768),Es=0;32768>Es;++Es){var Ss=(43690&Es)>>>1|(21845&Es)<<1;xs[Es]=((65280&(Ss=(61680&(Ss=(52428&Ss)>>>2|(13107&Ss)<<2))>>>4|(3855&Ss)<<4))>>>8|(255&Ss)<<8)>>>1}var ks=function(e,t,i){for(var r=e.length,s=0,n=new hs(t);r>s;++s)++n[e[s]-1];var o,a=new hs(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new hs(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[xs[d]>>>l]=u}else for(o=new hs(r),s=0;r>s;++s)o[s]=xs[a[e[s]-1]++]>>>15-e[s];return o},Ps=new _s(288);for(Es=0;144>Es;++Es)Ps[Es]=8;for(Es=144;256>Es;++Es)Ps[Es]=9;for(Es=256;280>Es;++Es)Ps[Es]=7;for(Es=280;288>Es;++Es)Ps[Es]=8;var Is=new _s(32);for(Es=0;32>Es;++Es)Is[Es]=5;var Cs=ks(Ps,9,0),Fs=ks(Is,5,0),Ts=function(e){return(e/8>>0)+(7&e&&1)},Rs=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof hs?hs:e instanceof ps?ps:_s)(i-t);return r.set(e.subarray(t,i)),r},Ls=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},$s=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Ms=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new _s(0),0];if(1==s){var o=new _s(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!=s-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(r=1;s>r;++r)n[r].s>_&&(_=n[r].s);var h=new hs(_+1),p=Os(i[c-1],h,0);if(p>t){r=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}));s>r;++r){var m=n[r].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[r].s;t>h[y]?g-=1<<t-h[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;h[b]==t&&(--h[b],++g)}p=t}return[new _s(h),p]},Os=function(e,t,i){return-1==e.s?Math.max(Os(e.l,t,i+1),Os(e.r,t,i+1)):t[e.s]=i},As=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new hs(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Ds=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},qs=function(e,t,i){var r=i.length,s=Ts(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},zs=function(e,t,i,r,s,n,o,a,l,u,c){Ls(t,c++,i),++s[256];for(var d=Ms(s,15),_=d[0],h=d[1],p=Ms(n,15),g=p[0],v=p[1],f=As(_),m=f[0],y=f[1],b=As(g),w=b[0],x=b[1],E=new hs(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=Ms(E,7),P=k[0],I=k[1],C=19;C>4&&!P[fs[C-1]];--C);var F,T,R,L,M=u+5<<3,O=Ds(s,Ps)+Ds(n,Is)+o,A=Ds(s,_)+Ds(n,g)+o+14+3*C+Ds(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O>=M&&A>=M)return qs(t,c,e.subarray(l,l+u));if(Ls(t,c,1+(O>A)),c+=2,O>A){F=ks(_,h,0),T=_,R=ks(g,v,0),L=g;var D=ks(P,I,0);for(Ls(t,c,y-257),Ls(t,c+5,x-1),Ls(t,c+10,C-4),c+=14,S=0;C>S;++S)Ls(t,c+3*S,P[fs[S]]);c+=3*C;for(var q=[m,w],z=0;2>z;++z){var H=q[z];for(S=0;H.length>S;++S)Ls(t,c,D[j=31&H[S]]),c+=P[j],j>15&&(Ls(t,c,H[S]>>>5&127),c+=H[S]>>>12)}}else F=Cs,T=Ps,R=Fs,L=Is;for(S=0;a>S;++S)if(r[S]>255){var j;$s(t,c,F[257+(j=r[S]>>>18&31)]),c+=T[j+257],j>7&&(Ls(t,c,r[S]>>>23&31),c+=gs[j]);var N=31&r[S];$s(t,c,R[N]),c+=L[N],N>3&&($s(t,c,r[S]>>>5&8191),c+=vs[N])}else $s(t,c,F[r[S]]),c+=T[r[S]];return $s(t,c,F[256]),c+T[256]},Hs=new ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),js=function(){for(var e=new ps(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Ns=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Bs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,r=0;t.length>r;++r)i=js[255&i^t[r]]^i>>>8;e=i},d(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n,o,a,l,u=(a=10+((s=t).filename&&s.filename.length+1||0),l=8,function(e,t,i,r,s,n){var o=e.length,a=new _s(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=qs(l,u,e.subarray(c,d)):(l[c]=!0,u=qs(l,u,e.subarray(c,o)))}else{for(var _=Hs[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new hs(32768),f=new hs(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 ps(25e3),x=new hs(288),E=new hs(32),S=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((S>7e3||P>24576)&&L>423){u=zs(e,l,0,w,x,E,k,P,C,c-C,u),P=S=k=0,C=c;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var O=2,A=0,D=p,q=T-R&32767;if(L>2&&F==b(c-q))for(var z=Math.min(h,L)-1,H=Math.min(32767,c),j=Math.min(258,L);H>=q&&--D&&T!=R;){if(e[c+O]==e[c+O-q]){for(var N=0;j>N&&e[c+N]==e[c+N-q];++N);if(N>O){if(O=N,A=q,N>z)break;var B=Math.min(q,N-2),U=0;for(M=0;B>M;++M){var V=c-q+M+32768&32767,W=V-v[V]+32768&32767;W>U&&(U=W,R=V)}}}q+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|bs[O]<<18|ws[A];var G=31&bs[O],K=31&ws[A];k+=gs[G]+vs[K],++x[257+G],++E[K],I=c+O,++S}else w[P++]=e[c],++x[e[c]]}}u=zs(e,l,!0,w,x,E,k,P,C,c-C,u)}return Rs(a,0,r+Ts(u)+s)}(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&&Ns(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;i.length>=r;++r)e[r+10]=i.charCodeAt(r)}}(u,t),Ns(u,c-8,i.d()),Ns(u,c-4,r),u}var Us=!!we||!!be,Vs="text/plain",Ws=!1,Gs=(e,t)=>{var[i,r]=e.split("#"),[s,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},Ks=function(e,t,r){var s;void 0===r&&(r=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(s=null==o?void 0:o.split("&").map((e=>{var t,[i,s]=e.split("="),n=r&&null!==(t=a[i])&&void 0!==t?t:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Ji(e,(function(e,t){We(e)||We(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)})),s.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Js=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Ys=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===cs){var r=Bs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new _s(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;i>o;++o){if(s+5>r.length){var a=new _s(s+8+(i-o<<1));a.set(r),r=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 Rs(r,0,s)}(Js(t)),{mtime:0});return{contentType:Vs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ds){var s=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Js(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Js(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Js(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Xs=e=>{var t,r,s,n=Ys(e);return!n||(r=e.compression,s=Or(e.url,"compression"),r!==Pe.GZipJS&&s!==Pe.GZipJS&&"gzip"!==s)||((t=n.body)instanceof ArrayBuffer?Fe(new Uint8Array(t)):ArrayBuffer.isView(t)&&Fe(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Ws=!0,{url:Gs(e.url,"compression"),encodedBody:Ys(i({},e,{compression:void 0,_encodedBody:void 0}))})},Qs=function(){var e=t((function*(e){var t=Js(e.data),r=yield function(e,t,i){return $e.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:Vs,body:s,estimatedSize:s.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Zs=(e,t)=>Ks(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),en=[];be&&en.push({transport:"fetch",method(e){var t,{url:r,encodedBody:s}=Xs(e),{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},l=new Headers;Ji(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(xe){var c=new xe;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}be(r,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 r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Wi.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{Wi.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),we&&en.push({transport:"XHR",method(e){var t=new we,{url:i,encodedBody:r}=Xs(e);t.open(e.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};Ji(e.headers,(function(e,i){t.setRequestHeader(i,e)})),s&&t.setRequestHeader("Content-Type",s),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!=fe&&fe.sendBeacon&&en.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Xs(e),r=Ks(t,{beacon:"1"}),{contentType:s,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});fe.sendBeacon(r,o)}catch(e){}}});var tn=3e3;class rn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=lt((null==t?void 0:t.flush_interval_ms)||tn,250,5e3,Wi.createLogger("flush interval"),tn),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[r],s=(new Date).getTime();i.data&&Ne(i.data)&&Ji(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequest(i)};for(var r in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Ji(this._queue,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;We(e[n])&&(e[n]=i({},s,{data:[]})),null==(r=e[n].data)||r.push(s.data)})),this._queue=[],e}}var sn=["retriesPerformedSoFar"];class nn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!We(pe)&&"onLine"in pe.navigator&&(this._areWeOnline=pe.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},rr(pe,"online",this._onlineListener),rr(pe,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=r(e,sn);Qe(t)&&(s.url=Ks(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==s.callback||s.callback(e):this._enqueue(i({retriesPerformedSoFar:t},s))}}))}_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,r=Math.min(18e5,t),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(t),r=Date.now()+i;this._queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Wi.warn(s),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:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,We(pe)||(this._onlineListener&&(pe.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(pe.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Wi.error(e)}this._queue=[]}}class on{constructor(e){this._updateScrollData=()=>{var e,t,i,r;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._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!==(r=this._context.maxContentHeight)&&void 0!==r?r: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(){rr(pe,"scroll",this._updateScrollData,{capture:!0}),rr(pe,"scrollend",this._updateScrollData,{capture:!0}),rr(pe,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==pe?void 0:pe.document.documentElement;var e=Ne(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==pe?void 0:pe.document.querySelector(t);if(i)return i}}scrollY(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollTop||0}return pe&&(pe.scrollY||pe.pageYOffset||pe.document.documentElement.scrollTop)||0}scrollX(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollLeft||0}return pe&&(pe.scrollX||pe.pageXOffset||pe.document.documentElement.scrollLeft)||0}}var an=e=>Jr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ln{constructor(e,t,i,r){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=r||an,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?Yr(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 Ji(er(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+qe(i)]=t})),e}}class un{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 r of this._events["*"]||[])r(e,t)}}var cn=Gi("[SessionId]");class dn{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var r;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new un,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Qe(e)||!Qe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===se)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||cr,this._windowIdGenerator=i||cr;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*lt(this._config.session_idle_timeout_seconds||1800,60,36e3,cn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=wr._parse(this._window_id_storage_key),o=wr._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:wr._remove(this._window_id_storage_key),wr._set(this._primary_window_exists_storage_key,!0)}if(null!=(r=this._config.bootstrap)&&r.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){cn.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return We(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&&wr._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&wr._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?wr._parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this._persistence.register({[S]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[S];return Ne(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&pe&&(pe.removeEventListener(ue,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&wr._remove(this._primary_window_exists_storage_key)},rr(pe,ue,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===se)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this._getSessionId(),o=this._getWindowId(),a=Qe(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,r);u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),cn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=Qe(r)&&e&&!a?r:i,_=Qe(n)?n:(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:r}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var _n=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Oe(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>Oe(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},hn=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 pn(e,t,i){return Js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var gn={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=>hn(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!hn(t,e))))),icontains:(e,t)=>t.map(vn).some((t=>e.map(vn).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(vn).every((t=>e.map(vn).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)))}))},vn=e=>e.toLowerCase();function fn(e,t){return!e||Object.entries(e).every((e=>{var[i,r]=e,s=null==t?void 0:t[i];if(We(s)||Je(s))return!1;var n=[String(s)],o=gn[r.operator];return!!o&&o(r.values,n)}))}var mn="custom",yn="i.posthog.com",bn=/^\/static\//;class wn{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("."+yn,".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":mn),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&bn.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===mn)return this.apiHost+t;var r=yn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var xn=Gi("[Surveys]"),En="seenSurvey_",Sn=["popover","widget","api"],kn={ignoreConditions:!1,ignoreDelay:!1,displayType:ns},Pn=Gi("[PostHog ExternalIntegrations]"),In={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cn{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Pn.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=ke.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(In[t],(()=>{var i;null==(i=ke.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!r&&null!=(s=ke.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=ke.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var Fn,Tn={},Rn=0,Ln=()=>{},$n='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Mn="Surveys module not available",On="sanitize_properties is deprecated. Use before_send instead",An="Invalid value for property_denylist config: ",Dn="posthog",qn=!Us&&-1===(null==Se?void 0:Se.indexOf("MSIE"))&&-1===(null==Se?void 0:Se.indexOf("Mozilla")),zn=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:ir(null==me?void 0:me.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ln,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,debug:ye&&Ge(null==ye?void 0:ye.search)&&-1!==ye.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==pe||null==(t=pe.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){Wi.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:ae,before_send:void 0,request_queue_config:{flush_interval_ms:tn},error_tracking:{},_onCapture:Ln,__preview_eager_load_replay:!1},(e=>({rageclick:!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}))(e))},Hn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],jn=e=>{var t={};for(var[i,r]of Hn)We(e[i])||(t[r]=e[i]);var s=Yi({},t,e);return Ne(e.property_blacklist)&&(We(e.property_denylist)?s.property_denylist=e.property_blacklist:Ne(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:Wi.error(An+e.property_denylist)),s};class Nn{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Wi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Bn{_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===se||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 Nn,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new un,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zn(),this.SentryIntegration=Tr,this.sentryIntegration=e=>function(e,t){var i=Fr(e,t);return{name:Cr,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 on(this),this.pageViewManager=new Rr(this),this.rateLimiter=new as(this),this.requestRouter=new wn(this),this.consent=new xr(this),this.externalIntegrations=new Cn(this);var t=null!==(e=Bn.__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 r=Ge(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=Ge(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Wi.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Dn){var r,s=null!==(r=Tn[i])&&void 0!==r?r:new Bn;return s._init(e,t,i),Tn[i]=s,Tn[Dn][i]=s,s}return this._init(e,t,i)}_init(e,t,r){var s,o;if(void 0===t&&(t={}),We(e)||Ke(e))return Wi.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),this.set_config(Yi({},zn(t.defaults),jn(t),{name:r,token:e})),this.config.on_xhr_error&&Wi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:cs;var a=this._is_persistence_disabled();this.persistence=new es(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new es(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new rn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new nn(this),this.__request_queue=[];var c=this._inCookielessMode();if(c||(this.sessionManager=new dn(this),this.sessionPropsManager=new ln(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Wi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(Wi.info("Initializing extensions synchronously"),this._initExtensions(c)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&Wi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(s=t.bootstrap)&&s.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 d=t.bootstrap.distinctID,_=this.get_distinct_id(),h=this.persistence.get_property(U);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===ne)this.identify(d);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===oe)Wi.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 p=this.config.get_device_id(cr()),g=t.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(U,t.bootstrap.isIdentifiedID?oe:ne),this.register({distinct_id:d,$device_id:g})}}if(c)this.register_once({distinct_id:Q,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(cr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(U,ne)}return rr(pe,"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 r=i=>{var r=()=>i.anonymousId()||cr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(U,oe)),t()},s=i.user();"then"in s&&Be(s.then)?s.then(r):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Ir.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()||(Ir.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ir.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,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,ce),identify:e=>t(e,_e),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Be(this.config._onCapture)&&this.config._onCapture!==Ln&&(Wi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Wi.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,r,s,n,o,a,l,u=performance.now(),c=i({},Bn.__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!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(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!==(s=this.surveys)&&void 0!==s?s: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,kr)),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){Wi.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({[Z]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ee]:r}),this.config.__preview_deferred_init_extensions&&Wi.info("PostHog extensions initialized ("+r+"ms)")}_onRemoteConfig(e){var t;if(!me||!me.body)return Wi.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=Ae(e.supportedCompression,cs)?cs:Ae(e.supportedCompression,ds)?ds:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:ae}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Wi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=ye&&ye.hostname){var e=ye.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 us(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()&&Ki(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,r;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(de),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(de,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(qn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ks(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,r,s,n=i({},e);n.timeout=n.timeout||6e4,n.url=Zs(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=en.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(r=null==(s=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===cs&&Ee&&!Ws?Qs(n).then((e=>{l(e)})).catch((t=>{if(Te(t))return Ws=!0,void l(i({},n,{compression:void 0,url:Zs(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Te(e)||t===Ce})(t)&&(Ws=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,t),null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Rn++;try{var t,i=[],r=[],s=[];Ki(e,(e=>{if(e)if(Ne(t=e[0]))s.push(e);else if(Be(e))try{e.call(this)}catch(t){Wi.error("Error executing queued PostHog call",e,t)}else Ne(e)&&"alias"===t?i.push(e):Ne(e)&&-1!==t.indexOf("capture")&&Be(this[t])?s.push(e):r.push(e)}));var n=function(e,t){Ki(e,(function(e){try{if(Ne(e[0])){var i=t;Ji(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Wi.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(r,this),n(s,this)}finally{Rn--}}push(e){if(Rn>0&&Ne(e)&&Ge(e[0])){var t=Bn.prototype[e[0]];Be(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!We(e)&&Ge(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Ge(null==t?void 0:t.$current_url)&&(Wi.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!=r&&r._originatedFromCaptureException||Wi.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==r?void 0:r.timestamp)||d,h=(null==r?void 0:r.uuid)||cr(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===ce&&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==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var g,v,f,m=this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==he,e===_e);if(m&&(p.$set_once=m),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Ge(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),Ne(t)?(r=[],Ki(t,(t=>{r.push(e(t))}))):(r={},Ji(t,((t,i)=>{l.has(t)||(r[i]=e(t,i))}))),r);var r}(o)),p.timestamp=_,We(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),"survey dismissed"===e||e===ss){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})(En,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){xn.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===ss?"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===rs&&(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),!Ye(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;p=E}this._internalEventEmitter.emit("eventCaptured",p);var S={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(S):this._requestQueue.enqueue(S),p}Wi.critical("This capture call is ignored due to client rate limiting.")}}else Wi.error("No event name provided to posthog.capture")}else Wi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,o){if(r=r||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,(!Ge(l.distinct_id)&&!Xe(l.distinct_id)||Ke(l.distinct_id))&&Wi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,r,s,o;if(!Se)return{};var a,l,u,c,d,_,h,p,g=e?[...zr,...t||[]]:[],[v,f]=function(e){for(var t=0;ai.length>t;t++){var[i,r]=ai[t],s=i.exec(e),n=s&&(Be(r)?r(s,e):r);if(n)return n}return["",""]}(Se);return Yi(er({$os:v,$os_version:f,$browser:si(Se,navigator.vendor),$device:li(Se),$device_type:(l=Se,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==pe||null==(s=pe.screen)?void 0:s.width,screenHeight:null==pe||null==(o=pe.screen)?void 0:o.height,devicePixelRatio:null==pe?void 0:pe.devicePixelRatio},p=li(l),p===mt||p===ft||"Kobo"===p||"Kindle Fire"===p||p===Kt?vt:p===Dt||p===zt||p===qt||p===Vt?"Console":p===bt?"Wearable":p?ht:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(c=null==u?void 0:u.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(_=null==u?void 0:u.screenHeight)&&void 0!==_?_:0)/(null!==(h=null==u?void 0:u.devicePixelRatio)&&void 0!==h?h:1)?ht:vt:"Desktop"),$timezone:Xr(),$timezone_offset:Qr()}),{$current_url:Ar(null==ye?void 0:ye.href,g,jr),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:Se.length>1e3?Se.substring(0,997)+"...":Se,$browser_version:oi(Se,navigator.vendor),$browser_language:Wr(),$browser_language_prefix:(a=Wr(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==pe?void 0:pe.screen.height,$screen_width:null==pe?void 0:pe.screen.width,$viewport_height:null==pe?void 0:pe.innerHeight,$viewport_width:null==pe?void 0:pe.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})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&Yi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Yi(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===mn&&(l.$lib_custom_api_host=this.config.api_host),c=e!==ce||o?e!==de||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Yi(l,c),e===ce&&me&&(l.title=me.title),!We(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Se&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Yi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ne(this.config.property_denylist)?Ji(this.config.property_denylist,(function(e){delete l[e]})):Wi.error(An+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Wi.error(On),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 r;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Yi({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Wi.error(On),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 r;null==(r=this.persistence)||r.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 r;null==(r=this.featureFlags)||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return void 0===t&&(t=!1),null==(r=this.featureFlags)?void 0:r.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:Mn}),()=>{})}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:Mn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Mn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=kn),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:Mn}}canRenderSurveyAsync(e,t){var i,r;return void 0===t&&(t=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Mn})}_validateIdentifyId(e){return!e||Ke(e)?(Wi.critical("Unique user id has not been set in posthog.identify"),!1):e===Q?(Wi.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())||(Wi.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 Wi.uninitializedWarning("posthog.identify");if(Xe(e)&&(e=e.toString(),Wi.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 r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var s,n=(this.persistence.get_property(U)||ne)===ne;e!==r&&n?(this.persistence.set_property(U,oe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(_e,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=pn(e,t,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(H))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=pn(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):Wi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},s,{[e]:t})}),n||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(he,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else Wi.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,r,s,n,o,l,u;if(Wi.info("reset"),!this.__loaded)return Wi.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(),We(_)||null==(c=this.persistence)||c.register({[y]:_}),null==(r=this.surveys)||r.reset(),null==(s=this._remoteConfigLoader)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(U,ne),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===se)this.register_once({distinct_id:Q,$device_id:null},"");else{var h=this.config.get_device_id(cr());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),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(o)?(Wi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(We(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Wi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(Ue(e)){var r,s,o,a,l,u,c,d,_,h;Yi(this.config,jn(e));var p=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new es(i({},this.config,{persistence:"sessionStorage"}),p);var g=this._checkLocalStorageForDebug(this.config.debug);Ze(g)&&(this.config.debug=g),Ze(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,vr._is_supported()&&vr._set("ph_debug",!0),Wi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,vr._is_supported()&&vr._remove("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,r,s,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==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,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:Bn._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:Dn;return t!==Dn&&(t=Dn+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(U))===oe||(null==(t=this.sessionPersistence)?void 0:t.get_property(U))===oe}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ae&&!this._isIdentified()&&Ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Y]))}_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?(Wi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Y,!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,r,s=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==se){if(this._inCookielessMode()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new dn(this),this.pageViewManager=new Rr(this),this.persistence&&(this.sessionPropsManager=new ln(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Bn.__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()),(We(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 Wi.warn($n)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==se?(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:Q,$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._captureInitialPageview())):Wi.warn($n)}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===se||(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 fe?_n(fe,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){me&&("visible"===me.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(ce,{title:me.title},{send_instantly:!0}),this._visibilityStateListener&&(me.removeEventListener(le,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),rr(me,le,this._visibilityStateListener)))}debug(e){!1===e?(null==pe||pe.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==pe||pe.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,r,s,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?(Wi.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,r=Wi,s=(t="advanced_disable_flags")in(e=o)&&!Ye(e[t]),n=i in e&&!Ye(e[i]),s?e[t]:!!n&&(r&&r.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(Ye(this.config.before_send))return e;var t=Ne(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),Ye(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return tt(e.event)?Wi.warn(s+". This can cause unexpected behavior."):Wi.info(s),null}i.properties&&!Ve(i.properties)||Wi.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=Ze(e)&&!e,i=vr._is_supported()&&"true"===vr._get("ph_debug");return!t&&(!!i||e)}}Bn.__defaultExtensionClasses={},Bn._noopLogger={trace:Fn=()=>{},debug:Fn,info:Fn,warn:Fn,error:Fn,fatal:Fn},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Zi(e.prototype[t[i]])}(Bn,["identify"]);var Un=1,Vn=3,Wn=11;function Gn(e){return e instanceof Element&&(e.id===X||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Kn(e){return!!e&&e.nodeType===Un}function Jn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Yn(e){return!!e&&e.nodeType===Vn}function Xn(e){return!!e&&e.nodeType===Wn&&Kn(e.host)}function Qn(e){return e?De(e).split(/\s+/):[]}function Zn(e){var t=null==pe?void 0:pe.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function eo(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 Qn(t)}function to(e){return Ye(e)?null:De(e).split(/(\s+)/).filter((e=>bo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function io(e){var t="";return _o(e)&&!ho(e)&&e.childNodes&&e.childNodes.length&&Ji(e.childNodes,(function(e){var i;Yn(e)&&e.textContent&&(t+=null!==(i=to(e.textContent))&&void 0!==i?i:"")})),De(t)}function ro(e){return We(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var so=["a","button","form","input","select","textarea","label"];function no(e,t){if(We(t))return!0;var i,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function oo(e){var t=e.parentNode;return!(!t||!Kn(t))&&t}var ao=["next","previous","prev",">","<"],lo=[".ph-no-rageclick",".ph-no-capture"];var uo=e=>!e||Jn(e,"html")||!Kn(e),co=(e,t)=>{if(!pe||uo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Jn(s,"body");)if(Xn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=oo(s);if(!n)break;if(t||so.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=pe.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function _o(e){for(var t=e;t.parentNode&&!Jn(t,"body");t=t.parentNode){var i=eo(t);if(Ae(i,"ph-sensitive")||Ae(i,"ph-no-capture"))return!1}if(Ae(eo(e),"ph-include"))return!0;var r=e.type||"";if(Ge(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!Ge(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function ho(e){return!!(Jn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Jn(e,"select")||Jn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var po="(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})",go=new RegExp("^(?:"+po+")$"),vo=new RegExp(po),fo="\\d{3}-?\\d{2}-?\\d{4}",mo=new RegExp("^("+fo+")$"),yo=new RegExp("("+fo+")");function bo(e,t){if(void 0===t&&(t=!0),Ye(e))return!1;if(Ge(e)){if(e=De(e),(t?go:vo).test((e||"").replace(/[- ]/g,"")))return!1;if((t?mo:yo).test(e))return!1}return!0}function wo(e){var t=io(e);return bo(t=(t+" "+xo(e)).trim())?t:""}function xo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ji(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=io(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+xo(e)).trim())}catch(e){Wi.error("[AutoCapture]",e)}})),t}function Eo(e){return e.replace(/"|\\"/g,'\\"')}function So(e){var t=e.attr__class;return t?Ne(t)?t:Qn(t):void 0}class ko{constructor(e){this.disabled=!1===e;var t=Ue(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 r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>i-r.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 Po="$copy_autocapture",Io=Gi("[AutoCapture]");function Co(e,t){return t.length>e?t.slice(0,e)+"...":t}function Fo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Kn(t));return t}function To(e,t){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Kn(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!Jn(d,"body");)if(Xn(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Kn(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(Ji(c,(e=>{var t=_o(e);if(Jn(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&bo(i)&&i}Ae(eo(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};so.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Co(1024,wo(e)):Co(1024,io(e)));var o=eo(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),Ji(e.attributes,(function(i){var s;if((!ho(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&bo(i.value)&&(!Ge(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Qn(o).join(" ")),n["attr__"+i.name]=Co(1024,o)}}));for(var a=1,l=1,u=e;u=Fo(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var r=function(e){if(!_o(e))return{};var t={};return Ji(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&bo(r)&&(t[i]=r)}})),t}(e);Yi(g,r)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=Jn(e,"a")||Jn(e,"button")?wo(e):io(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Mr(v))?void 0:m.host,w=null==pe||null==(y=pe.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:Yi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,r,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))s+="."+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!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Xi(o).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return a[Eo(t.toString())]=Eo(i.toString())})),(s+=":")+Xi(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,r={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:So(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Xi(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(h)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Ro=Gi("[ExceptionAutocapture]");function Lo(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return Be(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}var $o=Gi("[TracingHeaders]"),Mo=Gi("[Web Vitals]"),Oo=9e5,Ao="disabled",Do="lazy_loading",qo="awaiting_config",zo="missing_config";Gi("[SessionRecording]"),Gi("[SessionRecording]");var Ho="[SessionRecording]",jo=Gi(Ho),No=Gi("[Heatmaps]");function Bo(e){return Ue(e)&&"clientX"in e&&"clientY"in e&&Xe(e.clientX)&&Xe(e.clientY)}var Uo=Gi("[Product Tours]"),Vo=["$set_once","$set"],Wo=Gi("[SiteApps]"),Go="Error while initializing PostHog app with config id ";function Ko(e,t,i){if(Ye(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Jo{constructor(e){this._debugEventEmitter=new un,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;We(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(!We(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 r,s=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}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,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Ko(r,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 r=this._getElementsList(e);if(r.length>0)return r.some((e=>Ko(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Ko((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Ko(e.text,t.text,t.text_matching||"exact")||Ko(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!Ye(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some((e=>Ko(e,n,o))))}_checkStepSelector(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$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||fn(t.properties.reduce(((e,t)=>{var i=Ne(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 Yo{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&fn(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var i=new Map;return e.forEach((e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach((t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}}))})),i}_getMatchingItems(e,t,i){var r=(i===ts?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems((e=>{s=e.filter((e=>null==r?void 0:r.includes(e.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;We(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 Jo(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this._actionMatcher)||s.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})),r=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===r.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,ts),this._cancelEventToItems=this._buildEventToItemMap(e,is))}onEvent(e,t){var i,r=this._getLogger(),s=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===e&&t&&o.length>0){var a,l;r.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,is);d.length>0&&(r.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)){r.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,ts);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(r.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 Xo extends Yo{constructor(e){super(e)}_getActivatedKey(){return q}_getShownEventName(){return rs}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return xn}_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 Qo="SDK is not enabled or survey functionality is not yet loaded",Zo="Disabled. Not loading surveys.",ea=null!=pe&&pe.location?Dr(pe.location.hash,"__posthog")||Dr(location.hash,"state"):null,ta="_postHogToolbarParams",ia=Gi("[Toolbar]"),ra=Gi("[FeatureFlags]"),sa=Gi("[FeatureFlags]",{debugEnabled:!0}),na="\" failed. Feature flags didn't load in time.",oa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},aa=e=>{var t={};for(var[i,r]of Xi(e||{}))r&&(t[i]=r);return t},la=Gi("[Error tracking]"),ua="Refusing to render web experiment since the viewer is a likely bot",ca={icontains:(e,t)=>!!pe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!pe&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!pe&&hn(t.href,e),not_regex:(e,t)=>!!pe&&!hn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class da{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{da._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(da._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);Ge(r)&&e.variants[r]&&t._applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];da._matchesTestVariant(n)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())da._logInfo(ua);else if(!this._config.disable_web_experiments){if(Ye(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();da._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this._flagToExperiments)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this._applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=da.getWindowLocation();if(null!=e&&e.search){var t=Or(null==e?void 0:e.search,"__experiment_id"),i=Or(null==e?void 0:e.search,"__experiment_variant");t&&i&&(da._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 r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(da._logInfo("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this._applyTransforms(r[0].name,t,r[0].variants[t].transforms))}static _matchesTestVariant(e){return!Ye(e.conditions)&&da._matchUrlConditions(e)&&da._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Ye(e.conditions)||Ye(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=da.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||ca[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==pe?void 0:pe.location}static _matchUTMConditions(e){var t;if(Ye(e.conditions)||Ye(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Br();if(i.utm_source){var r,s,n,o,a,l,u,c,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.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),r=1;t>r;r++)i[r-1]=arguments[r];Wi.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?da._logInfo(ua):"control"!==t?i.forEach((i=>{if(i.selector){var r;da._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):da._logInfo("Control variants leave the page unmodified.")}_is_bot(){return fe&&this._instance?_n(fe,this._config.custom_blocked_useragents):void 0}}var _a,ha,pa=Gi("[Conversations]"),ga="Conversations not available yet.",va={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,ra.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||(ra.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||ra.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(!We(e)){if(Ne(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ra.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ra.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,r=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((e=>!!r[e])).reduce(((e,t)=>(e[t]=r[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,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=i({},s,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:We(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),r=this._prop(M);if(!r&&!t)return e||{};var s=Yi({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=s[o],c=null==t?void 0:t[o],d=We(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=We(c)?u.variant:"string"==typeof c?c:void 0,h=null==r?void 0:r[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})),s[o]=p}return this._override_warning||(ra.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var e=this._prop(P),t=this._prop(L);if(!t)return e||{};for(var i=Yi({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this._override_warning||(ra.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=Yi({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this._override_warning||(ra.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 r=this._config.token,s=this._prop(a),n={token:r,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:Xr()};Je(s)||We(s)||(n.$device_id=s),(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();We(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:ds,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,r,s=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),s=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!s;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==(r=this._persistence)||r.register({[N]:o}),u)ra.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:{},s,{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 r=this.getFeatureFlagResult(e,t);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else ra.warn('getFeatureFlag for key "'+e+na)}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(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],o=String(s),a=this._prop(R)||void 0,l=this._prop(B)||void 0,u=this._prop(H)||{};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({[H]: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;Ne(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[H]:u});var E=this.getFeatureFlagDetails(e),S=[...null!==(p=this._prop(N))&&void 0!==p?p:[]];We(s)&&S.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:s,$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};We(null==E||null==(f=E.metadata)?void 0:f.version)||(k.$feature_flag_version=E.metadata.version);var P,I=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;I&&(k.$feature_flag_reason=I),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),We(null==E?void 0:E.original_variant)&&We(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=We(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var C=n;if(!We(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:C}}}}else ra.warn('getFeatureFlagResult for key "'+e+na)}getRemoteConfigPayload(e,t){var i=this._config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_contexts=this._getValidEvaluationEnvironments());var s=this._getValidFlagKeys();We(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._config.disable_compression?void 0:ds,timeout:this._config.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[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 We(i)?void 0:!!i}ra.warn('isFeatureEnabled for key "'+e+na)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,r){if(this._persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),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]})))):ra.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(Ne(u)){ra.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({},r,g),v=i({},s,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({},r,Object.fromEntries(Object.entries(g).filter((e=>{var[t]=e;return m.has(t)})))),v=i({},s,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({},r,g),v=i({},s,v),f=i({},n,f);t&&t.register(i({[I]:Object.keys(aa(g)),[P]:g||{},[T]:v||{},[F]:f||{}},d?{[R]:d}:{},_?{[B]:_}:{}))}}}(e,this._persistence,s,n,o,r),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ra.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ra.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(L),this._persistence.unregister(M),this._fireFeatureFlagsCallbacks(),sa.info("All overrides cleared");if(Ne(e)){var t=oa(e);return this._persistence.register({[L]:t}),this._fireFeatureFlagsCallbacks(),sa.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,r=e;if(this._override_warning=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this._persistence.unregister(L),sa.info("Flag overrides cleared");else if(r.flags){if(Ne(r.flags)){var s=oa(r.flags);this._persistence.register({[L]:s})}else this._persistence.register({[L]:r.flags});sa.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this._persistence.unregister(M),sa.info("Payload overrides cleared")):r.payloads&&(this._persistence.register({[M]:r.payloads}),sa.info("Payload overrides set",{payloads:r.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[L]:e}),this._fireFeatureFlagsCallbacks(),sa.info("Flag overrides set",{flags:e});ra.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,r){var s,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),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(s=this._persistence)||s.register({[I]:Object.keys(aa(l)),[P]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._prop(C),s=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(C),null==(r=this._persistence)||r.register({[C]:s}),e(s)}}})}_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((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(O)||{},s=(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 r||(o[a]=n[a]));this._instance.register({[O]:i({},r,o,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(O)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(A)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((t=>{r[t]=i({},r[t],e[t]),delete e[t]})),this._instance.register({[A]:i({},r,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}}},fa={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===qo||this._recordingStatus===zo?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=Ao,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw jo.error("started without valid sessionManager"),new Error(Ho+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===se)throw new Error(Ho+' 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,r=this._config.disable_session_recording||this._instance.consent.isOptedOut();return pe&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!We(Object.assign)&&!We(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),jo.info("starting")):(this._recordingStatus=Ao,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,r;this._isRecordingEnabled&&(this._recordingStatus!==qo&&this._recordingStatus!==zo&&(this._recordingStatus=Do),null!=ke&&null!=(t=ke.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=ke.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(r=ke.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return jo.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(Ye(e))return null;var i,r=Xe(e)?e:parseFloat(e);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(jo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}_persistRemoteConfig(e){if(this._persistence){var t,r,s=this._persistence,n=()=>{var t,r=!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==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Ye(a)&&this._resetSampling();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[y]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:We(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.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===qo&&(this._recordingStatus=zo,jo.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):jo.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 jo.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var r=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-r}_onScriptLoaded(e){var t,i;if(null==(t=ke.__PosthogExtensions__)||!t.initSessionRecording)return jo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[te]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=ke.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===zo||this._recordingStatus===qo)return;return this._recordingStatus=qo,jo.info("persisted remote config is stale, requesting fresh config before starting"),void new us(this._instance).load()}this._recordingStatus=Do,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:E]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},ma={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new ko(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=Ue(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(pe&&me){var e=e=>{e=e||(null==pe?void 0:pe.event);try{this._captureEvent(e)}catch(e){Io.error("Failed to capture event",e)}};if(rr(me,"submit",e,{capture:!0}),rr(me,"change",e,{capture:!0}),rr(me,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==pe?void 0:pe.event);try{this._captureEvent(e,Po)}catch(e){Io.error("Failed to capture copy/cut event",e)}};rr(me,"copy",t,{capture:!0}),rr(me,"cut",t,{capture:!0})}}}else Io.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 r=null==me?void 0:me.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[c];if(Je(this._isDisabledServerSide)&&!Ze(i)&&!this.instance._shouldDisableFlags())return!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=ro(e);Yn(r)&&(r=r.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())&&function(e,t){if(!pe||uo(e))return!1;var i,r,s;if(Ze(t)?(i=!!t&&lo,r=void 0):(i=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:lo,r=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=co(e,!1);return!function(e,t){if(!1===e||We(e))return!1;var i;if(!0===e)i=ao;else{if(!Ne(e))return!1;if(e.length>10)return Wi.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:r}=e;return i.some((e=>t.includes(e)||r.includes(e)))}))}(r,n.map((e=>{var t;return{safeText:io(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!no(n,i)}(r,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var s=t===Po;if(r&&function(e,t,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!pe||uo(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Zn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&Zn(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}=co(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(We(i))return!0;var r,s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!no(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=pe.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(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return c?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(so.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this._config,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=To(r,{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(r);if(a&&a.length>0&&(n.$element_selectors=a),t===Po){var l,u=to(null==pe||null==(l=pe.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 Be(null==me?void 0:me.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==pe||null==(t=pe.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Wi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,Wi.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(pe&&pe.history){var i=this;null!=(e=pe.history.pushState)&&e.__posthog_wrapped__||Lo(pe.history,"pushState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("pushState")})),null!=(t=pe.history.replaceState)&&t.__posthog_wrapped__||Lo(pe.history,"replaceState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==pe||null==(t=pe.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(ce,{navigation_type:e}),this._lastPathname=i}catch(t){Wi.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};rr(pe,"popstate",e),this._popstateListener=()=>{pe&&pe.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 ko(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ue(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ye(this._config.capture_heatmaps)?Ye(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;No.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)}(me)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){pe&&me&&(this._flushHandler=this._flush.bind(this),rr(pe,ue,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==pe?void 0:pe.event)),rr(me,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==pe?void 0:pe.event)),rr(me,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Pr(this.instance,Sr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),rr(me,le,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;pe&&me&&(this._flushHandler&&pe.removeEventListener(ue,this._flushHandler),this._onClickHandler&&me.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&me.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&me.removeEventListener(le,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&Kn(r)&&!Jn(r,"body");){if(r===i)return!1;if(Ae(t,null==pe?void 0:pe.getComputedStyle(r).position))return!0;r=oo(r)}return!1}(ro(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!Gn(e.target)&&Bo(e)){var s=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},s,{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){!Gn(e.target)&&Bo(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(pe){var t=pe.location.href,i=this._config.custom_personal_data_properties,r=this._config.mask_personal_data_properties?[...zr,...i||[]]:[],s=Ar(t,r,jr);this._buffer=this._buffer||{},this._buffer[s]||(this._buffer[s]=[]),this._buffer[s].push(e)}}_flush(){this._buffer&&!Ve(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pr,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 r=this._currentURL();if(!We(r))if(Ye(null==e?void 0:e.name)||Ye(null==e?void 0:e.value))Mo.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),We(this._buffer.url)&&(this._buffer.url=r),this._buffer.firstMetricTimestamp=We(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),n=i({},e,{$current_url:r,timestamp:Date.now()});We(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this._buffer.metrics.push(n),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Mo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,r,s=ke.__PosthogExtensions__;We(s)||We(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(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&&r(this._addToBuffer.bind(this)),this._initialized=!0):Mo.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=Ue(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Ye(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Ue(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ue(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Ue(this._perfConfig)&&Xe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Oo;return e>0&&6e4>=e?Oo:e}get isEnabled(){var e=null==ye?void 0:ye.protocol;if("http:"!==e&&"https:"!==e)return Mo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ue(this._perfConfig)?this._perfConfig.web_vitals:Ze(this._perfConfig)?this._perfConfig:void 0;return Ze(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Mo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ue(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Ue(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=ke.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Mo.error("failed to load script",t):e()}))}_currentURL(){var e=pe?pe.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...zr,...t||[]]:[];return Ar(e,i,jr)}Mo.error("Could not determine current URL")}}},ya={exceptionObserver:class{constructor(e){var t,i,r;this._startCapturing=()=>{var e;if(pe&&this.isEnabled&&null!=(e=ke.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=ke.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=ke.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=ke.__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=r(this.captureException.bind(this)))}catch(e){Ro.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new ut({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,_logger:Ro}),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 Ue(e)?t=i({},t,e):(We(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?(Ro.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Ro.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,r,s=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(s)?Ro.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=new gi([new Ii,new Di,new Fi,new Ci,new Oi,new Mi,new Ri,new Ai],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;t>s;s++)r[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var n=[],o=t.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Pi.test(l)?l.replace(Pi,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of r){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||(r=t,r[r.length-1]||{}).filename,function:e.function||vi});var r}))}(n)}}("web:javascript",xi,ki)),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Ni(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Bi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Ni(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,r;if("errorTracking"in e){var s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this._suppressionRules=s,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(!Ge(e)||0===e.trim().length)return void la.warn("Ignoring exception step because message must be a non-empty string");var r=this._coerceExceptionStepProperties(t),{sanitizedProperties:s,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((i,r)=>Hi.has(r)?(t.push(r),i):(i[r]=e[r],i)),{}),droppedKeys:t}}(r);n.length>0&&la.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[qi]:e,[zi]:(new Date).toISOString()},s))}catch(e){la.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 la.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 la.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 la.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Ye(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return r&&this._exceptionStepsBuffer.clear(),r}catch(e){return la.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void la.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 la.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[qi]:e,[zi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Ue(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:r}=t;return Ge(i)&&i.length>0&&e.$exception_types.push(i),Ge(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,r=gn[e.operator],s=Ne(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,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,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}_isExceptionList(e){return!Ye(e)&&Ne(e)}}},ba=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=ke.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?Uo.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=ke.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=ke.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ne(this._cachedTours)||t){var i=this._persistence;if(i){var r=i.props[z];if(Ne(r)&&!t)return this._cachedTours=r,void e(r,{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 r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return Uo.error(s),void e([],{isLoaded:!1,error:s})}var n=Ne(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){Ye(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)}}},va),wa={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=ke._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,s,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({},r(e,Vo),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(s=e.properties)?void 0:s.$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&&(Wo.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))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Wo.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){s(e)}});n&&(t.processEvent=n),r=!0}catch(t){Wo.error(Go+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){Wo.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){Wo.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void Wo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;ke["__$$ph_site_app_"+e]=s._instance,null==(t=ke.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,(t=>{if(t)return Wo.error(Go+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else Wo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},xa={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t,i=this._getConfiguredHostnames()||[];We(this._restoreXHRPatch)&&(null==(e=ke.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),We(this._restoreFetchPatch)&&(null==(t=ke.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return $o.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this._getConfiguredHostnames()?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}},Ea=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(Ye(t))return xn.warn("Flags not loaded yet. Not loading surveys.");var i=Ne(t);this._isSurveysEnabled=i?t.length>0:t,xn.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(En)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)xn.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)xn.info(Zo);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())xn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==ke?void 0:ke.__PosthogExtensions__;if(e){if(!We(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 r=e.loadExternalDependency;if(!r)return void this._handleSurveyLoadError(ie);r(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 xn.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Xo(this._instance),xn.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){xn.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 xn.info(Zo),e([]);var i,r=this._instance.get_property(D);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:r}=t;return e(i,r)})):("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 r;this._getSurveysInFlightPromise=null;var s=t.statusCode;if(200!==s||!t.json){var n="Surveys API could not be loaded, status: "+s;xn.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==(r=this._instance.persistence)||r.register({[D]:l});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){xn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Ye(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);xn.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}_checkSurveyEligibility(e){if(Ye(this._surveyManager))return{eligible:!1,reason:Qo};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ye(this._surveyManager))return xn.warn("init was not called"),{visible:!1,disabledReason:Qo};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ye(this._surveyManager)?(xn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Qo})):new Promise((i=>{this.getSurveys((t=>{var r,s=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(s){var n=this._checkSurveyEligibility(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(Ye(this._surveyManager))xn.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(Sn.includes(s.type)){var n=null==me?void 0:me.querySelector(t);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(xn.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;xn.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,i),xn.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);xn.warn("Survey element not found")}else xn.warn("Surveys of type "+s.type+" cannot be rendered in the app");else xn.warn("Survey not found")}}displaySurvey(e,t){var r;if(Ye(this._surveyManager))xn.warn("init was not called");else{var s=this._getSurveyById(e);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ns&&t.initialResponses&&xn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void xn.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 xn.warn("Survey not found")}}cancelPendingSurvey(e){Ye(this._surveyManager)?xn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},va),Sa={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){ke.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=ke.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),sr(this.instance.config))return!1;if(!pe||!me)return!1;e=null!=e?e:pe.location,i=null!=i?i:pe.history;try{if(!t){try{pe.localStorage.setItem("test","test"),pe.localStorage.removeItem("test")}catch(e){return!1}t=null==pe?void 0:pe.localStorage}var r,s=ea||Dr(e.hash,"__posthog")||Dr(e.hash,"state"),n=s?Qi((()=>JSON.parse(atob(decodeURIComponent(s)))))||Qi((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(ta)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){var t=ke.ph_load_toolbar||ke.ph_load_editor;!Ye(t)&&Be(t)?t(e,this.instance):ia.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==me||!me.getElementById(X));if(!pe||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(pe.localStorage.setItem(ta,JSON.stringify(i({},s,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(s);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=ke.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ia.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(s)})),rr(pe,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(s)}))}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)}}},ka=i({experiments:da},va),Pa={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;Ye(t)||(Ze(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||sr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==ke?void 0:ke.__PosthogExtensions__;if(e&&!We(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(ie);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 pa.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),pa.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else pa.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){pa.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():pa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Je(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,r){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,i,r):(pa.warn(ga),null)}))()}getMessages(e,i){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,i):(pa.warn(ga),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(pa.warn(ga),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(pa.warn(ga),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(pa.warn(ga),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(pa.warn(ga),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(pa.warn(ga),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()}}},Ia={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=Gi("[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;!Ye(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==ke?void 0:ke.__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(ie)}else this._logger.error("PostHog Extensions not found.")}}captureLog(e){var t,r,s,n,o,a;if(this._instance.is_capturing())if(e&&e.body){var l=null!==(t=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s: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 r=e.level||"info",{text:s,number:n}=ci[r]||di,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:s,body:{stringValue:e.body},attributes:hi(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),We(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 r=this._instance.config.logs,s=i({"service.name":(null==r?void 0:r.serviceName)||"unknown_service"},(null==r?void 0:r.environment)&&{"deployment.environment":r.environment},(null==r?void 0:r.serviceVersion)&&{"service.version":r.serviceVersion},null==r?void 0:r.resourceAttributes),o=function(e,t,i,r){return{resourceLogs:[{resource:{attributes:hi(t)},scopeLogs:[{scope:{name:i,version:r},logRecords:e}]}]}}(t.map((e=>e.record)),s,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!=ke&&null!=(e=ke.location)&&e.href&&(t.currentUrl=ke.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},Ca=i({},va,fa,ma,ya,ba,wa,Ea,xa,Sa,ka,Pa,Ia);Bn.__defaultExtensionClasses=i({},Ca),_a=Tn[Dn]=new Bn,(ha=ke.posthog)&&Ji(ha._i,(function(e){if(e&&Ne(e)){var t=_a.init(e[0],e[1],e[2]),i=ha[e[2]]||ha;t&&(t._execute_array.call(t.people,i.people),t._execute_array(i))}})),ke.posthog=_a,function(){function e(){e.done||(e.done=!0,qn=!1,Ji(Tn,(function(e){e._dom_loaded()})))}null!=me&&me.addEventListener?"complete"===me.readyState?e():rr(me,"DOMContentLoaded",e,{capture:!1}):pe&&Wi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
1
+ !function(){"use strict";function e(e,t,i,r,s,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(r,s)}function t(t){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=t.apply(i,r);function a(t){e(o,s,n,a,l,"next",t)}function l(t){e(o,s,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 r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}function r(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var s="1.376.1",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},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",E="$replay_override_event_trigger",S="$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",q="$surveys_activated",z="ph_product_tours",H="$flag_call_reported",j="$flag_call_reported_session_id",N="$feature_flag_errors",B="$feature_flag_evaluated_at",U="$user_state",V="$client_session_props",W="$capture_rate_limit",G="$initial_campaign_params",K="$initial_referrer_info",J="$initial_person_info",Y="$epp",X="__POSTHOG_TOOLBAR__",Q="$posthog_cookieless",Z="$sdk_debug_extensions_init_method",ee="$sdk_debug_extensions_init_time_ms",te="$sdk_debug_recording_script_not_loaded",ie="PostHog loadExternalDependency extension not found.",re="on_reject",se="always",ne="anonymous",oe="identified",ae="identified_only",le="visibilitychange",ue="beforeunload",ce="$pageview",de="$pageleave",_e="$identify",he="$groupidentify",pe="undefined"!=typeof window?window:void 0,ge="undefined"!=typeof globalThis?globalThis:pe;"undefined"==typeof self&&(ge.self=ge),"undefined"==typeof File&&(ge.File=function(){});var ve,fe=null==ge?void 0:ge.navigator,me=null==ge?void 0:ge.document,ye=null==ge?void 0:ge.location,be=null==ge?void 0:ge.fetch,we=null!=ge&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,xe=null==ge?void 0:ge.AbortController,Ee=null==ge?void 0:ge.CompressionStream,Se=null==fe?void 0:fe.userAgent,ke=null!=pe?pe:{},Pe=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Ie=["$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"],Ce="NativeGzipValidationError",Fe=e=>e.length>=2&&31===e[0]&&139===e[1],Te=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Re=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Ce,t},Le=function(){var e=t((function*(e,t){18>e.size&&Re("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Fe(i)&&8===i[2]||Re("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(ve)return ve;ve=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;ve[e]=t>>>0}return ve})(),i=4294967295,r=0;e.length>r;r++)i=t[255&(i^e[r])]^i>>>8;return(4294967295^i)>>>0})(t)&&Re("invalid-crc");var s=t.length>>>0;r.getUint32(4,!0)!==s&&Re("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function $e(){return $e=t((function*(e,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).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 Le(u,s),u}catch(e){if(null!=r&&r.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),$e.apply(this,arguments)}var Me=["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"],Oe=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return Me.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function Ae(e,t){return-1!==e.indexOf(t)}var De=function(e){return e.trim()},qe=function(e){return e.replace(/^\$/,"")},ze=Object.prototype,He=ze.hasOwnProperty,je=ze.toString,Ne=Array.isArray||function(e){return"[object Array]"===je.call(e)},Be=e=>"function"==typeof e,Ue=e=>e===Object(e)&&!Ne(e),Ve=e=>{if(Ue(e)){for(var t in e)if(He.call(e,t))return!1;return!0}return!1},We=e=>void 0===e,Ge=e=>"[object String]"==je.call(e),Ke=e=>Ge(e)&&0===e.trim().length,Je=e=>null===e,Ye=e=>We(e)||Je(e),Xe=e=>"[object Number]"==je.call(e)&&e==e,Qe=e=>Xe(e)&&e>0,Ze=e=>"[object Boolean]"===je.call(e),et=e=>e instanceof FormData,tt=e=>Ae(Ie,e);function it(e){return null===e||"object"!=typeof e}function rt(e,t){return{}.toString.call(e)==="[object "+t+"]"}function st(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var nt=[!0,"true",1,"1","yes"],ot=e=>Ae(nt,e),at=[!1,"false",0,"0","no"];function lt(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),Xe(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),lt(s||i,t,i,r))}class ut{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=lt(e.bucketSize,0,100,e._logger),this._refillRate=lt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=lt(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(),r=String(e),s=this._buckets[r];return s?this._applyRefill(s,i):this._buckets[r]=s={tokens:this._bucketSize,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var ct,dt,_t,ht="Mobile",pt="iOS",gt="Android",vt="Tablet",ft=gt+" "+vt,mt="iPad",yt="Apple",bt=yt+" Watch",wt="Safari",xt="BlackBerry",Et="Samsung",St=Et+"Browser",kt=Et+" Internet",Pt="Chrome",It=Pt+" OS",Ct=Pt+" "+pt,Ft="Internet Explorer",Tt=Ft+" "+ht,Rt="Opera",Lt=Rt+" Mini",$t="Edge",Mt="Microsoft "+$t,Ot="Firefox",At=Ot+" "+pt,Dt="Nintendo",qt="PlayStation",zt="Xbox",Ht=gt+" "+ht,jt=ht+" "+wt,Nt="Windows",Bt=Nt+" Phone",Ut="Nokia",Vt="Ouya",Wt="Generic",Gt=Wt+" "+ht.toLowerCase(),Kt=Wt+" "+vt.toLowerCase(),Jt="Konqueror",Yt="Oculus Browser",Xt="(\\d+(\\.\\d+)?)",Qt=new RegExp("Version/"+Xt),Zt=new RegExp(zt,"i"),ei=new RegExp(qt+" \\w+","i"),ti=new RegExp(Dt+" \\w+","i"),ii=new RegExp(xt+"|PlayBook|BB10","i"),ri={"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"},si=function(e,t){return t=t||"",Ae(e," OPR/")&&Ae(e,"Mini")?Lt:Ae(e," OPR/")?Rt:ii.test(e)?xt:Ae(e,"IE"+ht)||Ae(e,"WPDesktop")?Tt:Ae(e,"OculusBrowser")?Yt:Ae(e,St)?kt:Ae(e,$t)||Ae(e,"Edg/")?Mt:Ae(e,"FBIOS")?"Facebook "+ht:Ae(e,"UCWEB")||Ae(e,"UCBrowser")?"UC Browser":Ae(e,"CriOS")?Ct:Ae(e,"CrMo")||Ae(e,Pt)?Pt:Ae(e,gt)&&Ae(e,wt)?Ht:Ae(e,"FxiOS")?At:Ae(e.toLowerCase(),Jt.toLowerCase())?Jt:((e,t)=>t&&Ae(t,yt)||function(e){return Ae(e,wt)&&!Ae(e,Pt)&&!Ae(e,gt)}(e))(e,t)?Ae(e,ht)?jt:wt:Ae(e,Ot)?Ot:Ae(e,"MSIE")||Ae(e,"Trident/")?Ft:Ae(e,"Gecko")?Ot:""},ni={[Tt]:[new RegExp("rv:"+Xt)],[Mt]:[new RegExp($t+"?\\/"+Xt)],[Pt]:[new RegExp("("+Pt+"|CrMo)\\/"+Xt)],[Ct]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[wt]:[Qt],[jt]:[Qt],[Rt]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Ot]:[new RegExp(Ot+"\\/"+Xt)],[At]:[new RegExp("FxiOS\\/"+Xt)],[Jt]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[xt]:[new RegExp(xt+" "+Xt),Qt],[Ht]:[new RegExp("android\\s"+Xt,"i")],[kt]:[new RegExp(St+"\\/"+Xt)],[Yt]:[new RegExp("OculusBrowser\\/"+Xt)],[Ft]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},oi=function(e,t){var i=si(e,t),r=ni[i];if(We(r))return null;for(var s=0;r.length>s;s++){var n=e.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},ai=[[new RegExp(zt+"; "+zt+" (.*?)[);]","i"),e=>[zt,e&&e[1]||""]],[new RegExp(Dt,"i"),[Dt,""]],[new RegExp(qt,"i"),[qt,""]],[ii,[xt,""]],[new RegExp(Nt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Bt,""];if(new RegExp(ht).test(t)&&!/IEMobile\b/.test(t))return[Nt+" "+ht,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=ri[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[Nt,r]}return[Nt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[pt,[e[3],e[4],e[5]||"0"].join(".")]:[pt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=We(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+gt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+gt+")","i"),e=>e&&e[2]?[gt,[e[2],e[3],e[4]||"0"].join(".")]:[gt,""]],[/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/,[It,""]],[/Linux|debian/i,["Linux",""]]],li=function(e){return ti.test(e)?Dt:ei.test(e)?qt:Zt.test(e)?zt:new RegExp(Vt,"i").test(e)?Vt:new RegExp("("+Bt+"|WPDesktop)","i").test(e)?Bt:/iPad/.test(e)?mt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?bt:ii.test(e)?xt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ut,"i").test(e)?Ut:/(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(ht).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)?gt:ft:new RegExp("(pda|"+ht+")","i").test(e)?Gt:new RegExp(vt,"i").test(e)&&!new RegExp(vt+" pc","i").test(e)?Kt:""},ui=e=>e instanceof Error,ci={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}},di=ci.info;function _i(e){if(Ze(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(Ne(e))return{arrayValue:{values:e.map((e=>_i(e)))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function hi(e){var t=[];for(var i in e){var r=e[i];Je(r)||We(r)||t.push({key:i,value:_i(r)})}return t}function pi(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return _t&&i.length===dt||(dt=i.length,_t=i.reduce(((i,r)=>{ct||(ct={});var s=ct[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[r];if(l&&u){i[l]=u,ct[r]=[l,u];break}}return i}),{})),_t}}class gi{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"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);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&&Ne(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 r,s;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:r,stack:s})}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 r of i.modifiers)t=yield r(t);return t}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(s=t.handled)||void 0===s||s,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:pi(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return i({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,r),next:e=>s(e,r+1)})}}var vi="?";function fi(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?vi:i,in_app:!0};return We(r)||(n.lineno=r),We(s)||(n.colno=s),n}var mi=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:vi,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},yi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wi=/\((\S*)(?::(\d+))(?::(\d+))\)/,xi=(e,t)=>{var i=yi.exec(e);if(i){var[,r,s,n]=i;return fi(t,r,vi,+s,+n)}var o=bi.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=wi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=mi(o[1]||vi,o[2]);return fi(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ei=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Si=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ki=(e,t)=>{var i=Ei.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Si.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||vi;return[n,s]=mi(n,s),fi(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Pi=/\(error: (.*)\)/;class Ii{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Ge(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 Ci{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 Fi{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 Ti=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ri{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Ti);return r&&(t=r[1],i=r[2]),[t,i]}}var Li=["fatal","error","warning","log","info","debug"];function $i(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class Mi{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{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 st(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: "+$i(e)}isSeverityLevel(e){return Ge(e)&&!Ke(e)&&Li.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(ui(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Oi{match(e){return st(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$i(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ai{match(e){return it(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 Di{match(e){return rt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!st(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,r=this.getUnhandledRejectionReason(e);return it(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}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 qi="$message",zi="$timestamp",Hi=new Set([qi,zi]),ji={enabled:!0,max_bytes:32768};function Ni(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:ji.enabled,max_bytes:Ui(e.max_bytes,ji.max_bytes)}:i({},ji)}class Bi{constructor(e){this._entries=[],this._totalBytes=0,this._config=Ni(e)}setConfig(e){this._config=Ni(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(!Ue(i))return;var r=i,s=r[qi],n=r[zi];if(!Ge(s)||0===s.trim().length)return;if(!Ge(n)&&!Xe(n))return;return{step:r,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,r=0;t.length>r;r++)"%"===t[r]?(i+=1,r+=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 Ui(e,t){if(!Xe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Vi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={_log(t){if(pe&&(n.DEBUG||ke.POSTHOG_DEBUG||i)&&!We(pe.console)&&pe.console){for(var r=("__rrweb_original__"in pe.console[t]?pe.console[t].__rrweb_original__:pe.console[t]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Vi(e+" "+t,i)};return r},Wi=Vi("[PostHog.js]"),Gi=Wi.createLogger;function Ki(e,t){Ne(e)&&e.forEach(t)}function Ji(e,t){if(!Ye(e))if(Ne(e))e.forEach(t);else if(et(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)He.call(e,i)&&t(e[i],i)}var Yi=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function Xi(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Qi=function(e){try{return e()}catch(e){return}},Zi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Wi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wi.critical(e)}}},er=function(e){var t={};return Ji(e,(function(e,i){(Ge(e)&&e.length>0||Xe(e))&&(t[i]=e)})),t};var tr=["herokuapp.com","vercel.app","netlify.app"];function ir(e){var t=null==e?void 0:e.hostname;if(!Ge(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of tr)if(i===r)return!1;return!0}function rr(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}function sr(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 Xe(e)&&isFinite(e)&&Math.floor(e)===e});class nr{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||0>e||0>t||0>i||0>r||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new nr(s)}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 nr(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 or{constructor(){this._timestamp=0,this._counter=0,this._random=new ur}generate(){var e=this.generateOrAbort();if(We(e)){this._timestamp=0;var t=this.generateOrAbort();if(We(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 nr.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 ar,lr=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};pe&&!We(pe.crypto)&&crypto.getRandomValues&&(lr=e=>crypto.getRandomValues(e));class ur{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(lr(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var cr=()=>dr().toString(),dr=()=>(ar||(ar=new or)).generate(),_r="",hr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var pr={_is_supported:()=>!!me,_error(e){Wi.error("cookieStore error: "+e)},_get(e){if(me){try{for(var t=e+"=",i=me.cookie.split(";").filter((e=>e.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(pr._get(e))||{}}catch(e){}return t},_set(e,t,i,r,s){if(me)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=me),_r)return _r;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+cr();!_r&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",_r=n)}return _r}(e);if(!i){var r=(e=>{var t=e.match(hr);return t?t[0]:""})(e);r!==i&&Wi.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(me.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Wi.warn("cookieStore warning: large cookie, len="+u.length),me.cookie=u,u}catch(e){return}},_remove(e,t){if(null!=me&&me.cookie)try{pr._set(e,"",-1,t)}catch(e){return}}},gr=null,vr={_is_supported(){if(!Je(gr))return gr;var e=!0;if(We(pe))e=!1;else try{var t="__mplssupport__";vr._set(t,"xyz"),'"xyz"'!==vr._get(t)&&(e=!1),vr._remove(t)}catch(t){e=!1}return e||Wi.error("localStorage unsupported; falling back to cookie store"),gr=e,e},_error(e){Wi.error("localStorage error: "+e)},_get(e){try{return null==pe?void 0:pe.localStorage.getItem(e)}catch(e){vr._error(e)}return null},_parse(e){try{return JSON.parse(vr._get(e))||{}}catch(e){}return null},_set(e,t){try{null==pe||pe.localStorage.setItem(e,JSON.stringify(t))}catch(e){vr._error(e)}},_remove(e){try{null==pe||pe.localStorage.removeItem(e)}catch(e){vr._error(e)}}},fr=[a,"distinct_id",S,k,Y,J,U],mr={},yr={_is_supported:()=>!0,_error(e){Wi.error("memoryStorage error: "+e)},_get:e=>mr[e]||null,_parse:e=>mr[e]||null,_set(e,t){mr[e]=t},_remove(e){delete mr[e]}},br=null,wr={_is_supported(){if(!Je(br))return br;if(br=!0,We(pe))br=!1;else try{var e="__support__";wr._set(e,"xyz"),'"xyz"'!==wr._get(e)&&(br=!1),wr._remove(e)}catch(e){br=!1}return br},_error(e){Wi.error("sessionStorage error: ",e)},_get(e){try{return null==pe?void 0:pe.sessionStorage.getItem(e)}catch(e){wr._error(e)}return null},_parse(e){try{return JSON.parse(wr._get(e))||null}catch(e){}return null},_set(e,t){try{null==pe||pe.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){wr._error(e)}},_remove(e){try{null==pe||pe.sessionStorage.removeItem(e)}catch(e){wr._error(e)}}};class xr{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===se||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 ot(e)?1:Ae(at,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?vr:pr;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?pr:vr;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(ot(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==fe?void 0:fe.doNotTrack,null==fe?void 0:fe.msDoNotTrack,ke.doNotTrack].some((e=>ot(e)))}}var Er=Gi("[Dead Clicks]"),Sr=()=>!0,kr=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),r=e.instance.config.capture_dead_clicks;return Ze(r)?r:!!Ue(r)||i};class Pr{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=ke.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Er.error("failed to load script",t):e()}))}_start(){var e;if(me){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=ke.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Ue(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=ke.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(me),Er.info("starting...")}}else Er.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Er.info("stopping..."))}}var Ir=Gi("[SegmentIntegration]");var Cr="posthog-js";function Fr(e,t){var{organization:r,projectId:s,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 r&&s&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Tr{constructor(e,t,i,r,s,n){this.name=Cr,this.setupOnce=function(o){o(Fr(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Rr{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Wi.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,r=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==pe?void 0:pe.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}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 r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(We(n)||We(o)||We(a)||We(l)||We(u)||We(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?lt(o/n,0,1,Wi):1,_=n>1?lt(a/n,0,1,Wi):1,h=l>1?lt(u/l,0,1,Wi):1,p=l>1?lt(c/l,0,1,Wi):1;r=Yi(r,{$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&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var Lr={[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"},[S]:{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",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ue(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[I]:{exposure:"event"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden"},[T]:{exposure:"event"},[R]:{exposure:"event"},[L]:{exposure:"event"},[M]:{exposure:"hidden"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[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"},[H]:{exposure:"hidden"},[j]:{exposure:"hidden"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[Z]:{exposure:"event"},[ee]:{exposure:"event"},[te]:{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"}},$r=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mr=e=>{var t=null==me?void 0:me.createElement("a");return We(t)?null:(t.href=e,t)},Or=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!Ne(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Wi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ar=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ne(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=s&&(_+="#"+s),_},Dr=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},qr="https?://(.*)",zr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Hr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...zr],jr="<masked>",Nr=["li_fat_id"];function Br(e,t,i){if(!me)return{};var r,s=t?[...zr,...i||[]]:[],n=Ur(Ar(me.URL,s,jr),e),o=(r={},Ji(Nr,(function(e){var t=pr._get(e);r[e]=t||null})),r);return Yi(o,n)}function Ur(e,t){var i=Hr.concat(t||[]),r={};return Ji(i,(function(t){var i=Or(e,t);r[t]=i||null})),r}function Vr(e){var t=function(e){return e?0===e.search(qr+"google.([^/?]*)")?"google":0===e.search(qr+"bing.com")?"bing":0===e.search(qr+"yahoo.com")?"yahoo":0===e.search(qr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!Je(t)){r.$search_engine=t;var s=me?Or(me.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Wr(){return navigator.language||navigator.userLanguage}var Gr="$direct";function Kr(){return(null==me?void 0:me.referrer)||Gr}function Jr(e,t){var i=e?[...zr,...t||[]]:[],r=null==ye?void 0:ye.href.substring(0,1e3);return{r:Kr().substring(0,1e3),u:r?Ar(r,i,jr):void 0}}function Yr(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:i==Gr?Gr:null==(t=Mr(i))?void 0:t.host};if(r){s.$current_url=r;var n=Mr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Ur(r);Yi(s,o)}if(i){var a=Vr(i);Yi(s,a)}return s}function Xr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Qr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Zr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class es{constructor(e,t){this._config=e,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.load(),e.debug&&Wi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Zr.indexOf(e.persistence.toLowerCase())&&(Wi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...fr,...e];return i({},vr,{_parse(e){try{var t={};try{t=pr._parse(e)||{}}catch(e){}var i=Yi(t,JSON.parse(vr._get(e)||"{}"));return vr._set(e,i),i}catch(e){}return null},_set(e,i,r,s,n,o){try{vr._set(e,i,void 0,void 0,o);var a={};t.forEach((e=>{i[e]&&(a[e]=i[e])})),Object.keys(a).length&&pr._set(e,a,r,s,n,o)}catch(e){vr._error(e)}},_remove(e,t){try{null==pe||pe.localStorage.removeItem(e),pr._remove(e,t)}catch(e){vr._error(e)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&vr._is_supported()?vr:"localstorage+cookie"===r&&t._is_supported()?t:"sessionstorage"===r&&wr._is_supported()?wr:"memory"===r?yr:"cookie"===r?pr:t._is_supported()?t:pr}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[B];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ji(this.props,((t,i)=>{var r=(e=>{var t=Lr[e];if(t)return t;for(var[i,r]of $r)if(0===e.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(t,i===P?()=>this._isFeatureFlagCacheStale():()=>!1))return;r.transformToEventProperties&&Yi(e,r.transformToEventProperties(t))}else r&&"event"!==r.exposure||(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Yi({},e))}}save(){this._disabled||this._storage._set(this._name,this.props,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)}remove(){this._storage._remove(this._name,!1),this._storage._remove(this._name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Ue(e)){We(t)&&(t="None"),this._expire_days=We(i)?this._default_expiry:i;var r=!1;if(Ji(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Ue(e)){this._expire_days=We(t)?this._default_expiry:t;var i=!1;if(Ji(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this._setProp(r,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=Br(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Ve(er(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==me?void 0:me.referrer)?Vr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Kr(),$referring_domain:null!=me&&me.referrer&&(null==(e=Mr(me.referrer))?void 0:e.host)||Gr},void 0)}set_initial_person_info(){this.props[G]||this.props[K]||this.register_once({[J]:Jr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ji([K,G],(t=>{var i=this.props[t];i&&Ji(i,(function(t,i){e["$initial_"+qe(i)]=t}))}));var t,i,r=this.props[J];if(r){var s=(t=Yr(r),i={},Ji(t,(function(e,t){i["$initial_"+qe(t)]=e})),i);Yi(e,s)}return e}safe_merge(e){return Ji(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(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),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this._buildStorage(e),s=this.props;this.clear(),this._storage=r,this.props=s,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(),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),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 We(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}_deleteProp(e){delete this.props[e]}}var ts="events",is="cancelEvents",rs="survey shown",ss="survey sent",ns="popover",os=Gi("[RateLimiter]");class as{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=>{os.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void os.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,r;void 0===e&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(W))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;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 "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(W,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var ls=Gi("[RemoteConfig]");class us{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=ke._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=ke.__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 ls.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void ls.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return ls.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){ls.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&me&&"hidden"!==me.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||ls.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 cs="gzip-js",ds="base64",_s=Uint8Array,hs=Uint16Array,ps=Uint32Array,gs=new _s([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]),vs=new _s([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]),fs=new _s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ms=function(e,t){for(var i=new hs(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new ps(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},ys=ms(gs,2),bs=ys[1];ys[0][28]=258,bs[258]=28;for(var ws=ms(vs,0)[1],xs=new hs(32768),Es=0;32768>Es;++Es){var Ss=(43690&Es)>>>1|(21845&Es)<<1;xs[Es]=((65280&(Ss=(61680&(Ss=(52428&Ss)>>>2|(13107&Ss)<<2))>>>4|(3855&Ss)<<4))>>>8|(255&Ss)<<8)>>>1}var ks=function(e,t,i){for(var r=e.length,s=0,n=new hs(t);r>s;++s)++n[e[s]-1];var o,a=new hs(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new hs(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[xs[d]>>>l]=u}else for(o=new hs(r),s=0;r>s;++s)o[s]=xs[a[e[s]-1]++]>>>15-e[s];return o},Ps=new _s(288);for(Es=0;144>Es;++Es)Ps[Es]=8;for(Es=144;256>Es;++Es)Ps[Es]=9;for(Es=256;280>Es;++Es)Ps[Es]=7;for(Es=280;288>Es;++Es)Ps[Es]=8;var Is=new _s(32);for(Es=0;32>Es;++Es)Is[Es]=5;var Cs=ks(Ps,9,0),Fs=ks(Is,5,0),Ts=function(e){return(e/8>>0)+(7&e&&1)},Rs=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof hs?hs:e instanceof ps?ps:_s)(i-t);return r.set(e.subarray(t,i)),r},Ls=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},$s=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Ms=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new _s(0),0];if(1==s){var o=new _s(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!=s-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(r=1;s>r;++r)n[r].s>_&&(_=n[r].s);var h=new hs(_+1),p=Os(i[c-1],h,0);if(p>t){r=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}));s>r;++r){var m=n[r].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[r].s;t>h[y]?g-=1<<t-h[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;h[b]==t&&(--h[b],++g)}p=t}return[new _s(h),p]},Os=function(e,t,i){return-1==e.s?Math.max(Os(e.l,t,i+1),Os(e.r,t,i+1)):t[e.s]=i},As=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new hs(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Ds=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},qs=function(e,t,i){var r=i.length,s=Ts(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},zs=function(e,t,i,r,s,n,o,a,l,u,c){Ls(t,c++,i),++s[256];for(var d=Ms(s,15),_=d[0],h=d[1],p=Ms(n,15),g=p[0],v=p[1],f=As(_),m=f[0],y=f[1],b=As(g),w=b[0],x=b[1],E=new hs(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=Ms(E,7),P=k[0],I=k[1],C=19;C>4&&!P[fs[C-1]];--C);var F,T,R,L,M=u+5<<3,O=Ds(s,Ps)+Ds(n,Is)+o,A=Ds(s,_)+Ds(n,g)+o+14+3*C+Ds(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O>=M&&A>=M)return qs(t,c,e.subarray(l,l+u));if(Ls(t,c,1+(O>A)),c+=2,O>A){F=ks(_,h,0),T=_,R=ks(g,v,0),L=g;var D=ks(P,I,0);for(Ls(t,c,y-257),Ls(t,c+5,x-1),Ls(t,c+10,C-4),c+=14,S=0;C>S;++S)Ls(t,c+3*S,P[fs[S]]);c+=3*C;for(var q=[m,w],z=0;2>z;++z){var H=q[z];for(S=0;H.length>S;++S)Ls(t,c,D[j=31&H[S]]),c+=P[j],j>15&&(Ls(t,c,H[S]>>>5&127),c+=H[S]>>>12)}}else F=Cs,T=Ps,R=Fs,L=Is;for(S=0;a>S;++S)if(r[S]>255){var j;$s(t,c,F[257+(j=r[S]>>>18&31)]),c+=T[j+257],j>7&&(Ls(t,c,r[S]>>>23&31),c+=gs[j]);var N=31&r[S];$s(t,c,R[N]),c+=L[N],N>3&&($s(t,c,r[S]>>>5&8191),c+=vs[N])}else $s(t,c,F[r[S]]),c+=T[r[S]];return $s(t,c,F[256]),c+T[256]},Hs=new ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),js=function(){for(var e=new ps(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Ns=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Bs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,r=0;t.length>r;++r)i=js[255&i^t[r]]^i>>>8;e=i},d(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n,o,a,l,u=(a=10+((s=t).filename&&s.filename.length+1||0),l=8,function(e,t,i,r,s,n){var o=e.length,a=new _s(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=qs(l,u,e.subarray(c,d)):(l[c]=!0,u=qs(l,u,e.subarray(c,o)))}else{for(var _=Hs[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new hs(32768),f=new hs(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 ps(25e3),x=new hs(288),E=new hs(32),S=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((S>7e3||P>24576)&&L>423){u=zs(e,l,0,w,x,E,k,P,C,c-C,u),P=S=k=0,C=c;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var O=2,A=0,D=p,q=T-R&32767;if(L>2&&F==b(c-q))for(var z=Math.min(h,L)-1,H=Math.min(32767,c),j=Math.min(258,L);H>=q&&--D&&T!=R;){if(e[c+O]==e[c+O-q]){for(var N=0;j>N&&e[c+N]==e[c+N-q];++N);if(N>O){if(O=N,A=q,N>z)break;var B=Math.min(q,N-2),U=0;for(M=0;B>M;++M){var V=c-q+M+32768&32767,W=V-v[V]+32768&32767;W>U&&(U=W,R=V)}}}q+=(T=R)-(R=v[T])+32768&32767}if(A){w[P++]=268435456|bs[O]<<18|ws[A];var G=31&bs[O],K=31&ws[A];k+=gs[G]+vs[K],++x[257+G],++E[K],I=c+O,++S}else w[P++]=e[c],++x[e[c]]}}u=zs(e,l,!0,w,x,E,k,P,C,c-C,u)}return Rs(a,0,r+Ts(u)+s)}(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&&Ns(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;i.length>=r;++r)e[r+10]=i.charCodeAt(r)}}(u,t),Ns(u,c-8,i.d()),Ns(u,c-4,r),u}var Us=!!we||!!be,Vs="text/plain",Ws=!1,Gs=(e,t)=>{var[i,r]=e.split("#"),[s,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},Ks=function(e,t,r){var s;void 0===r&&(r=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(s=null==o?void 0:o.split("&").map((e=>{var t,[i,s]=e.split("="),n=r&&null!==(t=a[i])&&void 0!==t?t:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Ji(e,(function(e,t){We(e)||We(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)})),s.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Js=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Ys=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===cs){var r=Bs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new _s(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;i>o;++o){if(s+5>r.length){var a=new _s(s+8+(i-o<<1));a.set(r),r=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 Rs(r,0,s)}(Js(t)),{mtime:0});return{contentType:Vs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ds){var s=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Js(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Js(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Js(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Xs=e=>{var t,r,s,n=Ys(e);return!n||(r=e.compression,s=Or(e.url,"compression"),r!==Pe.GZipJS&&s!==Pe.GZipJS&&"gzip"!==s)||((t=n.body)instanceof ArrayBuffer?Fe(new Uint8Array(t)):ArrayBuffer.isView(t)&&Fe(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Ws=!0,{url:Gs(e.url,"compression"),encodedBody:Ys(i({},e,{compression:void 0,_encodedBody:void 0}))})},Qs=function(){var e=t((function*(e){var t=Js(e.data),r=yield function(e,t,i){return $e.apply(this,arguments)}(t,n.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:Vs,body:s,estimatedSize:s.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Zs=(e,t)=>Ks(e,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:t}),en=[];be&&en.push({transport:"fetch",method(e){var t,{url:r,encodedBody:s}=Xs(e),{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},l=new Headers;Ji(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var u=null;if(xe){var c=new xe;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}be(r,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 r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Wi.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{Wi.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),we&&en.push({transport:"XHR",method(e){var t=new we,{url:i,encodedBody:r}=Xs(e);t.open(e.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};Ji(e.headers,(function(e,i){t.setRequestHeader(i,e)})),s&&t.setRequestHeader("Content-Type",s),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!=fe&&fe.sendBeacon&&en.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Xs(e),r=Ks(t,{beacon:"1"}),{contentType:s,body:n}=null!=i?i:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});fe.sendBeacon(r,o)}catch(e){}}});var tn=3e3;class rn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=lt((null==t?void 0:t.flush_interval_ms)||tn,250,5e3,Wi.createLogger("flush interval"),tn),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[r],s=(new Date).getTime();i.data&&Ne(i.data)&&Ji(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequest(i)};for(var r in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Ji(this._queue,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;We(e[n])&&(e[n]=i({},s,{data:[]})),null==(r=e[n].data)||r.push(s.data)})),this._queue=[],e}}var sn=["retriesPerformedSoFar"];class nn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!We(pe)&&"onLine"in pe.navigator&&(this._areWeOnline=pe.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},rr(pe,"online",this._onlineListener),rr(pe,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=r(e,sn);Qe(t)&&(s.url=Ks(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==s.callback||s.callback(e):this._enqueue(i({retriesPerformedSoFar:t},s))}}))}_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,r=Math.min(18e5,t),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(t),r=Date.now()+i;this._queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Wi.warn(s),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:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,We(pe)||(this._onlineListener&&(pe.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(pe.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Wi.error(e)}this._queue=[]}}class on{constructor(e){this._updateScrollData=()=>{var e,t,i,r;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._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!==(r=this._context.maxContentHeight)&&void 0!==r?r: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(){rr(pe,"scroll",this._updateScrollData,{capture:!0}),rr(pe,"scrollend",this._updateScrollData,{capture:!0}),rr(pe,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==pe?void 0:pe.document.documentElement;var e=Ne(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==pe?void 0:pe.document.querySelector(t);if(i)return i}}scrollY(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollTop||0}return pe&&(pe.scrollY||pe.pageYOffset||pe.document.documentElement.scrollTop)||0}scrollX(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollLeft||0}return pe&&(pe.scrollX||pe.pageXOffset||pe.document.documentElement.scrollLeft)||0}}var an=e=>Jr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ln{constructor(e,t,i,r){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=r||an,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?Yr(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 Ji(er(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+qe(i)]=t})),e}}class un{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 r of this._events["*"]||[])r(e,t)}}var cn=Gi("[SessionId]");class dn{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var r;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new un,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Qe(e)||!Qe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===se)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||cr,this._windowIdGenerator=i||cr;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*lt(this._config.session_idle_timeout_seconds||1800,60,36e3,cn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=wr._parse(this._window_id_storage_key),o=wr._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:wr._remove(this._window_id_storage_key),wr._set(this._primary_window_exists_storage_key,!0)}if(null!=(r=this._config.bootstrap)&&r.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){cn.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return We(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&&wr._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&wr._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?wr._parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this._persistence.register({[S]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[S];return Ne(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&pe&&(pe.removeEventListener(ue,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&wr._remove(this._primary_window_exists_storage_key)},rr(pe,ue,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===se)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this._getSessionId(),o=this._getWindowId(),a=Qe(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,r);u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),cn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=Qe(r)&&e&&!a?r:i,_=Qe(n)?n:(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:r}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var _n=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Oe(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>Oe(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},hn=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 pn(e,t,i){return Js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var gn={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=>hn(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!hn(t,e))))),icontains:(e,t)=>t.map(vn).some((t=>e.map(vn).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(vn).every((t=>e.map(vn).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)))}))},vn=e=>e.toLowerCase();function fn(e,t){return!e||Object.entries(e).every((e=>{var[i,r]=e,s=null==t?void 0:t[i];if(We(s)||Je(s))return!1;var n=[String(s)],o=gn[r.operator];return!!o&&o(r.values,n)}))}var mn="custom",yn="i.posthog.com",bn=/^\/static\//;class wn{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("."+yn,".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":mn),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof t&&bn.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===mn)return this.apiHost+t;var r=yn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var xn=Gi("[Surveys]"),En="seenSurvey_",Sn=["popover","widget","api"],kn={ignoreConditions:!1,ignoreDelay:!1,displayType:ns},Pn=Gi("[PostHog ExternalIntegrations]"),In={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cn{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Pn.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=ke.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(In[t],(()=>{var i;null==(i=ke.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!r&&null!=(s=ke.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=ke.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var Fn,Tn={},Rn=0,Ln=()=>{},$n='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Mn="Surveys module not available",On="sanitize_properties is deprecated. Use before_send instead",An="Invalid value for property_denylist config: ",Dn="posthog",qn=!Us&&-1===(null==Se?void 0:Se.indexOf("MSIE"))&&-1===(null==Se?void 0:Se.indexOf("Mozilla")),zn=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:ir(null==me?void 0:me.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ln,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,debug:ye&&Ge(null==ye?void 0:ye.search)&&-1!==ye.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==pe||null==(t=pe.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){Wi.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:ae,before_send:void 0,request_queue_config:{flush_interval_ms:tn},error_tracking:{},_onCapture:Ln,__preview_eager_load_replay:!1},(e=>({rageclick:!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}))(e))},Hn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],jn=e=>{var t={};for(var[i,r]of Hn)We(e[i])||(t[r]=e[i]);var s=Yi({},t,e);return Ne(e.property_blacklist)&&(We(e.property_denylist)?s.property_denylist=e.property_blacklist:Ne(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:Wi.error(An+e.property_denylist)),s};class Nn{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Wi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Bn{_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===se||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 Nn,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new un,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zn(),this.SentryIntegration=Tr,this.sentryIntegration=e=>function(e,t){var i=Fr(e,t);return{name:Cr,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 on(this),this.pageViewManager=new Rr(this),this.rateLimiter=new as(this),this.requestRouter=new wn(this),this.consent=new xr(this),this.externalIntegrations=new Cn(this);var t=null!==(e=Bn.__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 r=Ge(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=Ge(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Wi.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Dn){var r,s=null!==(r=Tn[i])&&void 0!==r?r:new Bn;return s._init(e,t,i),Tn[i]=s,Tn[Dn][i]=s,s}return this._init(e,t,i)}_init(e,t,r){var s,o;if(void 0===t&&(t={}),We(e)||Ke(e))return Wi.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),this.set_config(Yi({},zn(t.defaults),jn(t),{name:r,token:e})),this.config.on_xhr_error&&Wi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:cs;var a=this._is_persistence_disabled();this.persistence=new es(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new es(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new rn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new nn(this),this.__request_queue=[];var c=this._inCookielessMode();if(c||(this.sessionManager=new dn(this),this.sessionPropsManager=new ln(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Wi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(Wi.info("Initializing extensions synchronously"),this._initExtensions(c)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&Wi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(s=t.bootstrap)&&s.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 d=t.bootstrap.distinctID,_=this.get_distinct_id(),h=this.persistence.get_property(U);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===ne)this.identify(d);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===oe)Wi.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 p=this.config.get_device_id(cr()),g=t.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(U,t.bootstrap.isIdentifiedID?oe:ne),this.register({distinct_id:d,$device_id:g})}}if(c)this.register_once({distinct_id:Q,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(cr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(U,ne)}return rr(pe,"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 r=i=>{var r=()=>i.anonymousId()||cr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(U,oe)),t()},s=i.user();"then"in s&&Be(s.then)?s.then(r):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Ir.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()||(Ir.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ir.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,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,ce),identify:e=>t(e,_e),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Be(this.config._onCapture)&&this.config._onCapture!==Ln&&(Wi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Wi.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,r,s,n,o,a,l,u=performance.now(),c=i({},Bn.__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!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(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!==(s=this.surveys)&&void 0!==s?s: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,kr)),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){Wi.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({[Z]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ee]:r}),this.config.__preview_deferred_init_extensions&&Wi.info("PostHog extensions initialized ("+r+"ms)")}_onRemoteConfig(e){var t;if(!me||!me.body)return Wi.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=Ae(e.supportedCompression,cs)?cs:Ae(e.supportedCompression,ds)?ds:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:ae}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Wi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=ye&&ye.hostname){var e=ye.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 us(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()&&Ki(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,r;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(de),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(de,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(qn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ks(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,r,s,n=i({},e);n.timeout=n.timeout||6e4,n.url=Zs(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=en.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(r=null==(s=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===cs&&Ee&&!Ws?Qs(n).then((e=>{l(e)})).catch((t=>{if(Te(t))return Ws=!0,void l(i({},n,{compression:void 0,url:Zs(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Te(e)||t===Ce})(t)&&(Ws=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,t),null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Rn++;try{var t,i=[],r=[],s=[];Ki(e,(e=>{if(e)if(Ne(t=e[0]))s.push(e);else if(Be(e))try{e.call(this)}catch(t){Wi.error("Error executing queued PostHog call",e,t)}else Ne(e)&&"alias"===t?i.push(e):Ne(e)&&-1!==t.indexOf("capture")&&Be(this[t])?s.push(e):r.push(e)}));var n=function(e,t){Ki(e,(function(e){try{if(Ne(e[0])){var i=t;Ji(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Wi.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(r,this),n(s,this)}finally{Rn--}}push(e){if(Rn>0&&Ne(e)&&Ge(e[0])){var t=Bn.prototype[e[0]];Be(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!We(e)&&Ge(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Ge(null==t?void 0:t.$current_url)&&(Wi.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!=r&&r._originatedFromCaptureException||Wi.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==r?void 0:r.timestamp)||d,h=(null==r?void 0:r.uuid)||cr(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===ce&&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==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var g,v,f,m=this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==he,e===_e);if(m&&(p.$set_once=m),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Ge(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),Ne(t)?(r=[],Ki(t,(t=>{r.push(e(t))}))):(r={},Ji(t,((t,i)=>{l.has(t)||(r[i]=e(t,i))}))),r);var r}(o)),p.timestamp=_,We(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),"survey dismissed"===e||e===ss){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})(En,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){xn.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===ss?"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===rs&&(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),!Ye(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;p=E}this._internalEventEmitter.emit("eventCaptured",p);var S={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(S):this._requestQueue.enqueue(S),p}Wi.critical("This capture call is ignored due to client rate limiting.")}}else Wi.error("No event name provided to posthog.capture")}else Wi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,o){if(r=r||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,(!Ge(l.distinct_id)&&!Xe(l.distinct_id)||Ke(l.distinct_id))&&Wi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,r,s,o;if(!Se)return{};var a,l,u,c,d,_,h,p,g=e?[...zr,...t||[]]:[],[v,f]=function(e){for(var t=0;ai.length>t;t++){var[i,r]=ai[t],s=i.exec(e),n=s&&(Be(r)?r(s,e):r);if(n)return n}return["",""]}(Se);return Yi(er({$os:v,$os_version:f,$browser:si(Se,navigator.vendor),$device:li(Se),$device_type:(l=Se,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==pe||null==(s=pe.screen)?void 0:s.width,screenHeight:null==pe||null==(o=pe.screen)?void 0:o.height,devicePixelRatio:null==pe?void 0:pe.devicePixelRatio},p=li(l),p===mt||p===ft||"Kobo"===p||"Kindle Fire"===p||p===Kt?vt:p===Dt||p===zt||p===qt||p===Vt?"Console":p===bt?"Wearable":p?ht:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(c=null==u?void 0:u.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(_=null==u?void 0:u.screenHeight)&&void 0!==_?_:0)/(null!==(h=null==u?void 0:u.devicePixelRatio)&&void 0!==h?h:1)?ht:vt:"Desktop"),$timezone:Xr(),$timezone_offset:Qr()}),{$current_url:Ar(null==ye?void 0:ye.href,g,jr),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:Se.length>1e3?Se.substring(0,997)+"...":Se,$browser_version:oi(Se,navigator.vendor),$browser_language:Wr(),$browser_language_prefix:(a=Wr(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==pe?void 0:pe.screen.height,$screen_width:null==pe?void 0:pe.screen.width,$viewport_height:null==pe?void 0:pe.innerHeight,$viewport_width:null==pe?void 0:pe.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})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&Yi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Yi(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===mn&&(l.$lib_custom_api_host=this.config.api_host),c=e!==ce||o?e!==de||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Yi(l,c),e===ce&&me&&(l.title=me.title),!We(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Se&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Yi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ne(this.config.property_denylist)?Ji(this.config.property_denylist,(function(e){delete l[e]})):Wi.error(An+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Wi.error(On),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 r;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Yi({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Wi.error(On),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 r;null==(r=this.persistence)||r.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 r;null==(r=this.featureFlags)||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return void 0===t&&(t=!1),null==(r=this.featureFlags)?void 0:r.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:Mn}),()=>{})}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:Mn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Mn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=kn),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:Mn}}canRenderSurveyAsync(e,t){var i,r;return void 0===t&&(t=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Mn})}_validateIdentifyId(e){return!e||Ke(e)?(Wi.critical("Unique user id has not been set in posthog.identify"),!1):e===Q?(Wi.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())||(Wi.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 Wi.uninitializedWarning("posthog.identify");if(Xe(e)&&(e=e.toString(),Wi.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 r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var s,n=(this.persistence.get_property(U)||ne)===ne;e!==r&&n?(this.persistence.set_property(U,oe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(_e,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=pn(e,t,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(H))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=pn(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):Wi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},s,{[e]:t})}),n||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(he,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else Wi.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,r,s,n,o,l,u;if(Wi.info("reset"),!this.__loaded)return Wi.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(),We(_)||null==(c=this.persistence)||c.register({[y]:_}),null==(r=this.surveys)||r.reset(),null==(s=this._remoteConfigLoader)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(U,ne),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===se)this.register_once({distinct_id:Q,$device_id:null},"");else{var h=this.config.get_device_id(cr());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),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(o)?(Wi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(We(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Wi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(Ue(e)){var r,s,o,a,l,u,c,d,_,h;Yi(this.config,jn(e));var p=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new es(i({},this.config,{persistence:"sessionStorage"}),p);var g=this._checkLocalStorageForDebug(this.config.debug);Ze(g)&&(this.config.debug=g),Ze(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,vr._is_supported()&&vr._set("ph_debug",!0),Wi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,vr._is_supported()&&vr._remove("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,r,s,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==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,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:Bn._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:Dn;return t!==Dn&&(t=Dn+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(U))===oe||(null==(t=this.sessionPersistence)?void 0:t.get_property(U))===oe}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===ae&&!this._isIdentified()&&Ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Y]))}_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?(Wi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Y,!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,r,s=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==se){if(this._inCookielessMode()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new dn(this),this.pageViewManager=new Rr(this),this.persistence&&(this.sessionPropsManager=new ln(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Bn.__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()),(We(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 Wi.warn($n)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==se?(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:Q,$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._captureInitialPageview())):Wi.warn($n)}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===se||(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 fe?_n(fe,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){me&&("visible"===me.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(ce,{title:me.title},{send_instantly:!0}),this._visibilityStateListener&&(me.removeEventListener(le,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),rr(me,le,this._visibilityStateListener)))}debug(e){!1===e?(null==pe||pe.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==pe||pe.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,r,s,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?(Wi.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,r=Wi,s=(t="advanced_disable_flags")in(e=o)&&!Ye(e[t]),n=i in e&&!Ye(e[i]),s?e[t]:!!n&&(r&&r.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(Ye(this.config.before_send))return e;var t=Ne(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),Ye(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return tt(e.event)?Wi.warn(s+". This can cause unexpected behavior."):Wi.info(s),null}i.properties&&!Ve(i.properties)||Wi.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=Ze(e)&&!e,i=vr._is_supported()&&"true"===vr._get("ph_debug");return!t&&(!!i||e)}}Bn.__defaultExtensionClasses={},Bn._noopLogger={trace:Fn=()=>{},debug:Fn,info:Fn,warn:Fn,error:Fn,fatal:Fn},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Zi(e.prototype[t[i]])}(Bn,["identify"]);var Un=1,Vn=3,Wn=11;function Gn(e){return e instanceof Element&&(e.id===X||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Kn(e){return!!e&&e.nodeType===Un}function Jn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Yn(e){return!!e&&e.nodeType===Vn}function Xn(e){return!!e&&e.nodeType===Wn&&Kn(e.host)}function Qn(e){return e?De(e).split(/\s+/):[]}function Zn(e){var t=null==pe?void 0:pe.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function eo(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 Qn(t)}function to(e){return Ye(e)?null:De(e).split(/(\s+)/).filter((e=>bo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function io(e){var t="";return _o(e)&&!ho(e)&&e.childNodes&&e.childNodes.length&&Ji(e.childNodes,(function(e){var i;Yn(e)&&e.textContent&&(t+=null!==(i=to(e.textContent))&&void 0!==i?i:"")})),De(t)}function ro(e){return We(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var so=["a","button","form","input","select","textarea","label"];function no(e,t){if(We(t))return!0;var i,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function oo(e){var t=e.parentNode;return!(!t||!Kn(t))&&t}var ao=["next","previous","prev",">","<"],lo=[".ph-no-rageclick",".ph-no-capture"];var uo=e=>!e||Jn(e,"html")||!Kn(e),co=(e,t)=>{if(!pe||uo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Jn(s,"body");)if(Xn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=oo(s);if(!n)break;if(t||so.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=pe.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function _o(e){for(var t=e;t.parentNode&&!Jn(t,"body");t=t.parentNode){var i=eo(t);if(Ae(i,"ph-sensitive")||Ae(i,"ph-no-capture"))return!1}if(Ae(eo(e),"ph-include"))return!0;var r=e.type||"";if(Ge(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!Ge(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function ho(e){return!!(Jn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Jn(e,"select")||Jn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var po="(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})",go=new RegExp("^(?:"+po+")$"),vo=new RegExp(po),fo="\\d{3}-?\\d{2}-?\\d{4}",mo=new RegExp("^("+fo+")$"),yo=new RegExp("("+fo+")");function bo(e,t){if(void 0===t&&(t=!0),Ye(e))return!1;if(Ge(e)){if(e=De(e),(t?go:vo).test((e||"").replace(/[- ]/g,"")))return!1;if((t?mo:yo).test(e))return!1}return!0}function wo(e){var t=io(e);return bo(t=(t+" "+xo(e)).trim())?t:""}function xo(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ji(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=io(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+xo(e)).trim())}catch(e){Wi.error("[AutoCapture]",e)}})),t}function Eo(e){return e.replace(/"|\\"/g,'\\"')}function So(e){var t=e.attr__class;return t?Ne(t)?t:Qn(t):void 0}class ko{constructor(e){this.disabled=!1===e;var t=Ue(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 r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>i-r.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 Po="$copy_autocapture",Io=Gi("[AutoCapture]");function Co(e,t){return t.length>e?t.slice(0,e)+"...":t}function Fo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Kn(t));return t}function To(e,t){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!Kn(e))return{props:{}};for(var c=[e],d=e;d.parentNode&&!Jn(d,"body");)if(Xn(d.parentNode))c.push(d.parentNode.host),d=d.parentNode.host;else{if(!Kn(d.parentNode))break;c.push(d.parentNode),d=d.parentNode}var _,h,p=[],g={},v=!1,f=!1;if(Ji(c,(e=>{var t=_o(e);if(Jn(e,"a")){var i=e.getAttribute("href");v=t&&!!i&&bo(i)&&i}Ae(eo(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};so.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Co(1024,wo(e)):Co(1024,io(e)));var o=eo(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),Ji(e.attributes,(function(i){var s;if((!ho(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&bo(i.value)&&(!Ge(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Qn(o).join(" ")),n["attr__"+i.name]=Co(1024,o)}}));for(var a=1,l=1,u=e;u=Fo(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var r=function(e){if(!_o(e))return{};var t={};return Ji(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&bo(r)&&(t[i]=r)}})),t}(e);Yi(g,r)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text=Jn(e,"a")||Jn(e,"button")?wo(e):io(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=Mr(v))?void 0:m.host,w=null==pe||null==(y=pe.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:Yi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,r,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))s+="."+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!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Xi(o).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return a[Eo(t.toString())]=Eo(i.toString())})),(s+=":")+Xi(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,r={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:So(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Xi(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(h)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Ro=Gi("[ExceptionAutocapture]");function Lo(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return Be(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}var $o=Gi("[TracingHeaders]"),Mo=Gi("[Web Vitals]"),Oo=9e5,Ao="disabled",Do="lazy_loading",qo="awaiting_config",zo="missing_config";Gi("[SessionRecording]"),Gi("[SessionRecording]");var Ho="[SessionRecording]",jo=Gi(Ho),No=Gi("[Heatmaps]");function Bo(e){return Ue(e)&&"clientX"in e&&"clientY"in e&&Xe(e.clientX)&&Xe(e.clientY)}var Uo=Gi("[Product Tours]"),Vo=["$set_once","$set"],Wo=Gi("[SiteApps]"),Go="Error while initializing PostHog app with config id ";function Ko(e,t,i){if(Ye(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Jo{constructor(e){this._debugEventEmitter=new un,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;We(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(!We(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 r,s=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}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,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Ko(r,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 r=this._getElementsList(e);if(r.length>0)return r.some((e=>Ko(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Ko((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Ko(e.text,t.text,t.text_matching||"exact")||Ko(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!Ye(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some((e=>Ko(e,n,o))))}_checkStepSelector(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$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||fn(t.properties.reduce(((e,t)=>{var i=Ne(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 Yo{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&fn(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var i=new Map;return e.forEach((e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach((t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}}))})),i}_getMatchingItems(e,t,i){var r=(i===ts?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems((e=>{s=e.filter((e=>null==r?void 0:r.includes(e.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;We(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 Jo(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this._actionMatcher)||s.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})),r=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===r.length||(null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToItems=this._buildEventToItemMap(e,ts),this._cancelEventToItems=this._buildEventToItemMap(e,is))}onEvent(e,t){var i,r=this._getLogger(),s=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===e&&t&&o.length>0){var a,l;r.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,is);d.length>0&&(r.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)){r.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,ts);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(r.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 Xo extends Yo{constructor(e){super(e)}_getActivatedKey(){return q}_getShownEventName(){return rs}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return xn}_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 Qo="SDK is not enabled or survey functionality is not yet loaded",Zo="Disabled. Not loading surveys.",ea=null!=pe&&pe.location?Dr(pe.location.hash,"__posthog")||Dr(location.hash,"state"):null,ta="_postHogToolbarParams",ia=Gi("[Toolbar]"),ra=Gi("[FeatureFlags]"),sa=Gi("[FeatureFlags]",{debugEnabled:!0}),na="\" failed. Feature flags didn't load in time.",oa=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},aa=e=>{var t={};for(var[i,r]of Xi(e||{}))r&&(t[i]=r);return t},la=Gi("[Error tracking]"),ua="Refusing to render web experiment since the viewer is a likely bot",ca={icontains:(e,t)=>!!pe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!pe&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!pe&&hn(t.href,e),not_regex:(e,t)=>!!pe&&!hn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class da{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{da._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(da._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);Ge(r)&&e.variants[r]&&t._applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];da._matchesTestVariant(n)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())da._logInfo(ua);else if(!this._config.disable_web_experiments){if(Ye(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();da._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this._flagToExperiments)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this._applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=da.getWindowLocation();if(null!=e&&e.search){var t=Or(null==e?void 0:e.search,"__experiment_id"),i=Or(null==e?void 0:e.search,"__experiment_variant");t&&i&&(da._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 r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(da._logInfo("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this._applyTransforms(r[0].name,t,r[0].variants[t].transforms))}static _matchesTestVariant(e){return!Ye(e.conditions)&&da._matchUrlConditions(e)&&da._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Ye(e.conditions)||Ye(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=da.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||ca[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==pe?void 0:pe.location}static _matchUTMConditions(e){var t;if(Ye(e.conditions)||Ye(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Br();if(i.utm_source){var r,s,n,o,a,l,u,c,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.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),r=1;t>r;r++)i[r-1]=arguments[r];Wi.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?da._logInfo(ua):"control"!==t?i.forEach((i=>{if(i.selector){var r;da._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):da._logInfo("Control variants leave the page unmodified.")}_is_bot(){return fe&&this._instance?_n(fe,this._config.custom_blocked_useragents):void 0}}var _a,ha,pa=Gi("[Conversations]"),ga="Conversations not available yet.",va={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,ra.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||(ra.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||ra.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(!We(e)){if(Ne(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ra.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ra.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,r=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((e=>!!r[e])).reduce(((e,t)=>(e[t]=r[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,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=i({},s,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:We(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),r=this._prop(M);if(!r&&!t)return e||{};var s=Yi({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=s[o],c=null==t?void 0:t[o],d=We(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=We(c)?u.variant:"string"==typeof c?c:void 0,h=null==r?void 0:r[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})),s[o]=p}return this._override_warning||(ra.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var e=this._prop(P),t=this._prop(L);if(!t)return e||{};for(var i=Yi({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this._override_warning||(ra.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=Yi({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this._override_warning||(ra.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 r=this._config.token,s=this._prop(a),n={token:r,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:Xr()};Je(s)||We(s)||(n.$device_id=s),(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();We(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:ds,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,r,s=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),s=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!s;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==(r=this._persistence)||r.register({[N]:o}),u)ra.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:{},s,{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 r=this.getFeatureFlagResult(e,t);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else ra.warn('getFeatureFlag for key "'+e+na)}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(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],o=String(s),a=this._prop(R)||void 0,l=this._prop(B)||void 0,u=this._prop(H)||{};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({[H]: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;Ne(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[H]:u});var E=this.getFeatureFlagDetails(e),S=[...null!==(p=this._prop(N))&&void 0!==p?p:[]];We(s)&&S.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:s,$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};We(null==E||null==(f=E.metadata)?void 0:f.version)||(k.$feature_flag_version=E.metadata.version);var P,I=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;I&&(k.$feature_flag_reason=I),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),We(null==E?void 0:E.original_variant)&&We(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=We(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var C=n;if(!We(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:C}}}}else ra.warn('getFeatureFlagResult for key "'+e+na)}getRemoteConfigPayload(e,t){var i=this._config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_contexts=this._getValidEvaluationEnvironments());var s=this._getValidFlagKeys();We(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._config.disable_compression?void 0:ds,timeout:this._config.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[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 We(i)?void 0:!!i}ra.warn('isFeatureEnabled for key "'+e+na)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,r){if(this._persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(e,t,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),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]})))):ra.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(Ne(u)){ra.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({},r,g),v=i({},s,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({},r,Object.fromEntries(Object.entries(g).filter((e=>{var[t]=e;return m.has(t)})))),v=i({},s,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({},r,g),v=i({},s,v),f=i({},n,f);t&&t.register(i({[I]:Object.keys(aa(g)),[P]:g||{},[T]:v||{},[F]:f||{}},d?{[R]:d}:{},_?{[B]:_}:{}))}}}(e,this._persistence,s,n,o,r),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),ra.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return ra.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(L),this._persistence.unregister(M),this._fireFeatureFlagsCallbacks(),sa.info("All overrides cleared");if(Ne(e)){var t=oa(e);return this._persistence.register({[L]:t}),this._fireFeatureFlagsCallbacks(),sa.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,r=e;if(this._override_warning=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this._persistence.unregister(L),sa.info("Flag overrides cleared");else if(r.flags){if(Ne(r.flags)){var s=oa(r.flags);this._persistence.register({[L]:s})}else this._persistence.register({[L]:r.flags});sa.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this._persistence.unregister(M),sa.info("Payload overrides cleared")):r.payloads&&(this._persistence.register({[M]:r.payloads}),sa.info("Payload overrides set",{payloads:r.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[L]:e}),this._fireFeatureFlagsCallbacks(),sa.info("Flag overrides set",{flags:e});ra.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,r){var s,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),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(s=this._persistence)||s.register({[I]:Object.keys(aa(l)),[P]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._prop(C),s=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(C),null==(r=this._persistence)||r.register({[C]:s}),e(s)}}})}_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((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(O)||{},s=(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 r||(o[a]=n[a]));this._instance.register({[O]:i({},r,o,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(O)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(A)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((t=>{r[t]=i({},r[t],e[t]),delete e[t]})),this._instance.register({[A]:i({},r,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}}},fa={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===qo||this._recordingStatus===zo?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=Ao,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw jo.error("started without valid sessionManager"),new Error(Ho+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===se)throw new Error(Ho+' 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,r=this._config.disable_session_recording||this._instance.consent.isOptedOut();return pe&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!We(Object.assign)&&!We(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),jo.info("starting")):(this._recordingStatus=Ao,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,r;this._isRecordingEnabled&&(this._recordingStatus!==qo&&this._recordingStatus!==zo&&(this._recordingStatus=Do),null!=ke&&null!=(t=ke.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=ke.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(r=ke.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return jo.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(Ye(e))return null;var i,r=Xe(e)?e:parseFloat(e);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(jo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}_persistRemoteConfig(e){if(this._persistence){var t,r,s=this._persistence,n=()=>{var t,r=!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==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Ye(a)&&this._resetSampling();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[y]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:We(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.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===qo&&(this._recordingStatus=zo,jo.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):jo.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 jo.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var r=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-r}_onScriptLoaded(e){var t,i;if(null==(t=ke.__PosthogExtensions__)||!t.initSessionRecording)return jo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[te]:!0});if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=ke.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===zo||this._recordingStatus===qo)return;return this._recordingStatus=qo,jo.info("persisted remote config is stale, requesting fresh config before starting"),void new us(this._instance).load()}this._recordingStatus=Do,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:E]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},ma={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new ko(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=Ue(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(pe&&me){var e=e=>{e=e||(null==pe?void 0:pe.event);try{this._captureEvent(e)}catch(e){Io.error("Failed to capture event",e)}};if(rr(me,"submit",e,{capture:!0}),rr(me,"change",e,{capture:!0}),rr(me,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==pe?void 0:pe.event);try{this._captureEvent(e,Po)}catch(e){Io.error("Failed to capture copy/cut event",e)}};rr(me,"copy",t,{capture:!0}),rr(me,"cut",t,{capture:!0})}}}else Io.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 r=null==me?void 0:me.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[c];if(Je(this._isDisabledServerSide)&&!Ze(i)&&!this.instance._shouldDisableFlags())return!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=ro(e);Yn(r)&&(r=r.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())&&function(e,t){if(!pe||uo(e))return!1;var i,r,s;if(Ze(t)?(i=!!t&&lo,r=void 0):(i=null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:lo,r=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=co(e,!1);return!function(e,t){if(!1===e||We(e))return!1;var i;if(!0===e)i=ao;else{if(!Ne(e))return!1;if(e.length>10)return Wi.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:r}=e;return i.some((e=>t.includes(e)||r.includes(e)))}))}(r,n.map((e=>{var t;return{safeText:io(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!no(n,i)}(r,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var s=t===Po;if(r&&function(e,t,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!pe||uo(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Zn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&Zn(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}=co(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(We(i))return!0;var r,s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!no(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=pe.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(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return c?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(so.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this._config,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=To(r,{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(r);if(a&&a.length>0&&(n.$element_selectors=a),t===Po){var l,u=to(null==pe||null==(l=pe.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 Be(null==me?void 0:me.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==pe||null==(t=pe.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Wi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,Wi.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(pe&&pe.history){var i=this;null!=(e=pe.history.pushState)&&e.__posthog_wrapped__||Lo(pe.history,"pushState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("pushState")})),null!=(t=pe.history.replaceState)&&t.__posthog_wrapped__||Lo(pe.history,"replaceState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==pe||null==(t=pe.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(ce,{navigation_type:e}),this._lastPathname=i}catch(t){Wi.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};rr(pe,"popstate",e),this._popstateListener=()=>{pe&&pe.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 ko(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ue(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ye(this._config.capture_heatmaps)?Ye(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;No.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)}(me)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){pe&&me&&(this._flushHandler=this._flush.bind(this),rr(pe,ue,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==pe?void 0:pe.event)),rr(me,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==pe?void 0:pe.event)),rr(me,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Pr(this.instance,Sr,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),rr(me,le,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;pe&&me&&(this._flushHandler&&pe.removeEventListener(ue,this._flushHandler),this._onClickHandler&&me.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&me.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&me.removeEventListener(le,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&Kn(r)&&!Jn(r,"body");){if(r===i)return!1;if(Ae(t,null==pe?void 0:pe.getComputedStyle(r).position))return!0;r=oo(r)}return!1}(ro(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!Gn(e.target)&&Bo(e)){var s=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},s,{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){!Gn(e.target)&&Bo(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(pe){var t=pe.location.href,i=this._config.custom_personal_data_properties,r=this._config.mask_personal_data_properties?[...zr,...i||[]]:[],s=Ar(t,r,jr);this._buffer=this._buffer||{},this._buffer[s]||(this._buffer[s]=[]),this._buffer[s].push(e)}}_flush(){this._buffer&&!Ve(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pr,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 r=this._currentURL();if(!We(r))if(Ye(null==e?void 0:e.name)||Ye(null==e?void 0:e.value))Mo.error("Invalid metric received",e);else if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),We(this._buffer.url)&&(this._buffer.url=r),this._buffer.firstMetricTimestamp=We(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),n=i({},e,{$current_url:r,timestamp:Date.now()});We(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this._buffer.metrics.push(n),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else Mo.error("Ignoring metric with value >= "+this._maxAllowedValue,e)},this._startCapturing=()=>{if(!this._initialized){var e,t,i,r,s=ke.__PosthogExtensions__;We(s)||We(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(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&&r(this._addToBuffer.bind(this)),this._initialized=!0):Mo.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=Ue(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Ye(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Ue(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ue(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=Ue(this._perfConfig)&&Xe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:Oo;return e>0&&6e4>=e?Oo:e}get isEnabled(){var e=null==ye?void 0:ye.protocol;if("http:"!==e&&"https:"!==e)return Mo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ue(this._perfConfig)?this._perfConfig.web_vitals:Ze(this._perfConfig)?this._perfConfig:void 0;return Ze(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Mo.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ue(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Ue(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=ke.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?Mo.error("failed to load script",t):e()}))}_currentURL(){var e=pe?pe.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...zr,...t||[]]:[];return Ar(e,i,jr)}Mo.error("Could not determine current URL")}}},ya={exceptionObserver:class{constructor(e){var t,i,r;this._startCapturing=()=>{var e;if(pe&&this.isEnabled&&null!=(e=ke.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=ke.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=ke.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=ke.__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=r(this.captureException.bind(this)))}catch(e){Ro.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new ut({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,_logger:Ro}),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 Ue(e)?t=i({},t,e):(We(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?(Ro.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Ro.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,r,s=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(s)?Ro.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=new gi([new Ii,new Di,new Fi,new Ci,new Oi,new Mi,new Ri,new Ai],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;t>s;s++)r[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var n=[],o=t.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Pi.test(l)?l.replace(Pi,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of r){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||(r=t,r[r.length-1]||{}).filename,function:e.function||vi});var r}))}(n)}}("web:javascript",xi,ki)),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(h))&&void 0!==t?t:[],this._exceptionStepsConfig=Ni(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Bi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Ni(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,r;if("errorTracking"in e){var s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this._suppressionRules=s,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(!Ge(e)||0===e.trim().length)return void la.warn("Ignoring exception step because message must be a non-empty string");var r=this._coerceExceptionStepProperties(t),{sanitizedProperties:s,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((i,r)=>Hi.has(r)?(t.push(r),i):(i[r]=e[r],i)),{}),droppedKeys:t}}(r);n.length>0&&la.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(i({[qi]:e,[zi]:(new Date).toISOString()},s))}catch(e){la.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 la.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 la.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 la.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this._exceptionStepsConfig.enabled&&Ye(e.$exception_steps)?this._addBufferedExceptionSteps(e):e;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return r&&this._exceptionStepsBuffer.clear(),r}catch(e){return la.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void la.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 la.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[qi]:e,[zi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Ue(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:r}=t;return Ge(i)&&i.length>0&&e.$exception_types.push(i),Ge(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,r=gn[e.operator],s=Ne(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,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,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}_isExceptionList(e){return!Ye(e)&&Ne(e)}}},ba=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=ke.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?Uo.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=ke.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=ke.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ne(this._cachedTours)||t){var i=this._persistence;if(i){var r=i.props[z];if(Ne(r)&&!t)return this._cachedTours=r,void e(r,{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 r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return Uo.error(s),void e([],{isLoaded:!1,error:s})}var n=Ne(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){Ye(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)}}},va),wa={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=ke._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,s,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({},r(e,Vo),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(s=e.properties)?void 0:s.$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&&(Wo.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))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Wo.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){s(e)}});n&&(t.processEvent=n),r=!0}catch(t){Wo.error(Go+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){Wo.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){Wo.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void Wo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;ke["__$$ph_site_app_"+e]=s._instance,null==(t=ke.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,(t=>{if(t)return Wo.error(Go+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else Wo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},xa={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t,i=this._getConfiguredHostnames()||[];We(this._restoreXHRPatch)&&(null==(e=ke.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),We(this._restoreFetchPatch)&&(null==(t=ke.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i;null!=(t=ke.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=ke.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return $o.error("failed to load script",t);e()}))}_getConfiguredHostnames(){var e;return null!==(e=this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this._getConfiguredHostnames()?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}},Ea=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(Ye(t))return xn.warn("Flags not loaded yet. Not loading surveys.");var i=Ne(t);this._isSurveysEnabled=i?t.length>0:t,xn.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(En)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)xn.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)xn.info(Zo);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())xn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==ke?void 0:ke.__PosthogExtensions__;if(e){if(!We(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 r=e.loadExternalDependency;if(!r)return void this._handleSurveyLoadError(ie);r(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 xn.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Xo(this._instance),xn.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){xn.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 xn.info(Zo),e([]);var i,r=this._instance.get_property(D);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:r}=t;return e(i,r)})):("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 r;this._getSurveysInFlightPromise=null;var s=t.statusCode;if(200!==s||!t.json){var n="Surveys API could not be loaded, status: "+s;xn.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==(r=this._instance.persistence)||r.register({[D]:l});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){xn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Ye(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);xn.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}_checkSurveyEligibility(e){if(Ye(this._surveyManager))return{eligible:!1,reason:Qo};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ye(this._surveyManager))return xn.warn("init was not called"),{visible:!1,disabledReason:Qo};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ye(this._surveyManager)?(xn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Qo})):new Promise((i=>{this.getSurveys((t=>{var r,s=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(s){var n=this._checkSurveyEligibility(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(Ye(this._surveyManager))xn.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(Sn.includes(s.type)){var n=null==me?void 0:me.querySelector(t);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(xn.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;xn.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,i),xn.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);xn.warn("Survey element not found")}else xn.warn("Surveys of type "+s.type+" cannot be rendered in the app");else xn.warn("Survey not found")}}displaySurvey(e,t){var r;if(Ye(this._surveyManager))xn.warn("init was not called");else{var s=this._getSurveyById(e);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ns&&t.initialResponses&&xn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void xn.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 xn.warn("Survey not found")}}cancelPendingSurvey(e){Ye(this._surveyManager)?xn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},va),Sa={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){ke.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=ke.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),sr(this.instance.config))return!1;if(!pe||!me)return!1;e=null!=e?e:pe.location,i=null!=i?i:pe.history;try{if(!t){try{pe.localStorage.setItem("test","test"),pe.localStorage.removeItem("test")}catch(e){return!1}t=null==pe?void 0:pe.localStorage}var r,s=ea||Dr(e.hash,"__posthog")||Dr(e.hash,"state"),n=s?Qi((()=>JSON.parse(atob(decodeURIComponent(s)))))||Qi((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(ta)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){var t=ke.ph_load_toolbar||ke.ph_load_editor;!Ye(t)&&Be(t)?t(e,this.instance):ia.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==me||!me.getElementById(X));if(!pe||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(pe.localStorage.setItem(ta,JSON.stringify(i({},s,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(s);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=ke.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ia.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(s)})),rr(pe,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(s)}))}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)}}},ka=i({experiments:da},va),Pa={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;Ye(t)||(Ze(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||sr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==ke?void 0:ke.__PosthogExtensions__;if(e&&!We(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(ie);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 pa.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),pa.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else pa.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){pa.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():pa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Je(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,r){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,i,r):(pa.warn(ga),null)}))()}getMessages(e,i){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,i):(pa.warn(ga),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(pa.warn(ga),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(pa.warn(ga),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(pa.warn(ga),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(pa.warn(ga),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(pa.warn(ga),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()}}},Ia={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._logger=Gi("[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;!Ye(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==ke?void 0:ke.__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(ie)}else this._logger.error("PostHog Extensions not found.")}}captureLog(e){var t,r,s,n,o,a;if(this._instance.is_capturing())if(e&&e.body){var l=null!==(t=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==t?t:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s: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 r=e.level||"info",{text:s,number:n}=ci[r]||di,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:s,body:{stringValue:e.body},attributes:hi(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),We(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 r=this._instance.config.logs,s=i({"service.name":(null==r?void 0:r.serviceName)||"unknown_service"},(null==r?void 0:r.environment)&&{"deployment.environment":r.environment},(null==r?void 0:r.serviceVersion)&&{"service.version":r.serviceVersion},null==r?void 0:r.resourceAttributes),o=function(e,t,i,r){return{resourceLogs:[{resource:{attributes:hi(t)},scopeLogs:[{scope:{name:i,version:r},logRecords:e}]}]}}(t.map((e=>e.record)),s,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!=ke&&null!=(e=ke.location)&&e.href&&(t.currentUrl=ke.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},Ca=i({},va,fa,ma,ya,ba,wa,Ea,xa,Sa,ka,Pa,Ia);Bn.__defaultExtensionClasses=i({},Ca),_a=Tn[Dn]=new Bn,(ha=ke.posthog)&&Ji(ha._i,(function(e){if(e&&Ne(e)){var t=_a.init(e[0],e[1],e[2]),i=ha[e[2]]||ha;t&&(t._execute_array.call(t.people,i.people),t._execute_array(i))}})),ke.posthog=_a,function(){function e(){e.done||(e.done=!0,qn=!1,Ji(Tn,(function(e){e._dom_loaded()})))}null!=me&&me.addEventListener?"complete"===me.readyState?e():rr(me,"DOMContentLoaded",e,{capture:!1}):pe&&Wi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
2
2
  //# sourceMappingURL=array.no-external.js.map