posthog-js 1.427.0 → 1.427.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/utils/stack-overflow.d.ts +1 -0
- package/lib/package.json +1 -1
- package/lib/src/browser-surveys.js +1 -1
- package/lib/src/customizations/before-send.js +1 -1
- package/lib/src/customizations/posthogReduxLogger.js +4 -4
- package/lib/src/customizations/posthogReduxLogger.js.map +1 -1
- package/lib/src/entrypoints/array.full.es5.js +1 -1
- package/lib/src/entrypoints/exception-autocapture.js +31 -19
- package/lib/src/entrypoints/exception-autocapture.js.map +1 -1
- package/lib/src/entrypoints/external-scripts-loader.js +3 -3
- package/lib/src/entrypoints/tracing-headers.js +5 -5
- package/lib/src/entrypoints/tracing-headers.js.map +1 -1
- package/lib/src/extensions/browser-client.js +1 -1
- package/lib/src/extensions/conversations/external/components/RichContent.js +1 -1
- package/lib/src/extensions/conversations/external/index.js +5 -5
- package/lib/src/extensions/conversations/external/url-utils.js +2 -2
- package/lib/src/extensions/exception-autocapture/index.js +14 -8
- package/lib/src/extensions/exception-autocapture/index.js.map +1 -1
- package/lib/src/extensions/replay/external/config.js +1 -1
- package/lib/src/extensions/replay/external/config.js.map +1 -1
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +5 -5
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
- package/lib/src/extensions/replay/external/network-plugin.js +11 -11
- package/lib/src/extensions/replay/external/network-plugin.js.map +1 -1
- package/lib/src/extensions/segment-integration.js +1 -1
- package/lib/src/posthog-core.js +23 -16
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-exceptions.js +7 -2
- package/lib/src/posthog-exceptions.js.map +1 -1
- package/lib/src/posthog-logs.js +1 -1
- package/lib/src/posthog-metrics.js +1 -1
- package/lib/src/posthog-surveys.js +1 -1
- package/lib/src/utils/stack-overflow.d.ts +1 -0
- package/lib/src/utils/stack-overflow.js +11 -0
- package/lib/src/utils/stack-overflow.js.map +1 -0
- package/lib/src/web-experiments.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/module.slim.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],g=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return f.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function m(t,e){return-1!==t.indexOf(e)}var w=function(t){return t.replace(/^\$/,"")},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),y=["$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"],x=["token"],E=Object.prototype,S=E.hasOwnProperty,T=E.toString,k=Array.isArray||function(t){return"[object Array]"===T.call(t)},R=t=>"function"==typeof t,P=t=>t===Object(t)&&!k(t),I=t=>{if(P(t)){for(var e in t)if(S.call(t,e))return!1;return!0}return!1},O=t=>void 0===t,C=t=>"[object String]"==T.call(t),A=t=>C(t)&&0===t.trim().length,D=t=>null===t,M=t=>O(t)||D(t),N=t=>"[object Number]"==T.call(t)&&t==t,U=t=>N(t)&&t>0,F=t=>"[object Boolean]"===T.call(t),B=t=>t instanceof FormData,L=t=>m(y,t),j=t=>m(x,t),z=[!0,"true",1,"1","yes"],q=t=>m(z,t),H=[!1,"false",0,"0","no"];function G(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),N(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),G(null!=s?s:i,e,i,r))}var W="Mobile",V="iOS",J="Android",Y="Tablet",K=J+" "+Y,X="iPad",Q="Apple",Z=Q+" Watch",tt="Safari",et="BlackBerry",it="Samsung",rt=it+"Browser",st=it+" Internet",nt="Chrome",ot=nt+" OS",at=nt+" "+V,ht="Internet Explorer",lt=ht+" "+W,ut="Opera",dt=ut+" Mini",vt="Edge",ct="Microsoft "+vt,_t="Firefox",pt=_t+" "+V,ft="Nintendo",gt="PlayStation",mt="Xbox",wt=J+" "+W,bt=W+" "+tt,yt="Windows",$t=yt+" Phone",xt="Nokia",Et="Ouya",St="Generic",Tt=St+" "+W.toLowerCase(),kt=St+" "+Y.toLowerCase(),Rt="Konqueror",Pt="Oculus Browser",It="Vivaldi",Ot="Yandex",Ct="Whale",At="DuckDuckGo",Dt="Pale Moon",Mt="Waterfox",Nt="Brave",Ut="Claude",Ft="Codex",Bt="ChatGPT",Lt="Google Search App",jt="(\\d+(\\.\\d+)?)",zt=new RegExp("Version/"+jt),qt=new RegExp("("+Ut+"|"+Ft+"|"+Bt+")\\/"+jt),Ht=new RegExp(mt,"i"),Gt=new RegExp(gt+" \\w+","i"),Wt=new RegExp(ft+" \\w+","i"),Vt=new RegExp(et+"|PlayBook|BB10","i"),Jt={"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"},Yt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Nt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&m(t,"GSA/")?Lt:m(t," OPR/")&&m(t,"Mini")?dt:m(t," OPR/")?ut:Vt.test(t)?et:m(t,"IE"+W)||m(t,"WPDesktop")?lt:m(t,"OculusBrowser")?Pt:m(t,rt)?st:m(t,vt)||m(t,"Edg/")?ct:m(t,It+"/")?It:m(t,"YaBrowser/")?Ot:m(t,Ct+"/")?Ct:m(t,At+"/")||m(t,"Ddg/")?At:m(t,Ut+"/")?Ut:m(t,Ft+"/")?Ft:m(t,Bt+"/")?Bt:m(t,"FBIOS")?"Facebook "+W:m(t,"UCWEB")||m(t,"UCBrowser")?"UC Browser":m(t,"CriOS")?at:m(t,"CrMo")||m(t,nt)?nt:m(t,J)&&m(t,tt)?wt:m(t,"FxiOS")?pt:m(t.toLowerCase(),Rt.toLowerCase())?Rt:m(t,Nt+"/")?Nt:((t,e)=>e&&m(e,Q)||function(t){return m(t,tt)&&!m(t,nt)&&!m(t,J)}(t))(t,e)?m(t,W)?bt:tt:m(t,"PaleMoon/")?Dt:m(t,Mt+"/")?Mt:m(t,_t)?_t:m(t,"MSIE")||m(t,"Trident/")?ht:m(t,"Gecko")?_t:"")},Kt={[lt]:[new RegExp("rv:"+jt)],[ct]:[new RegExp(vt+"?\\/"+jt)],[nt]:[new RegExp("("+nt+"|CrMo)\\/"+jt)],[at]:[new RegExp("CriOS\\/"+jt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+jt)],[tt]:[zt],[bt]:[zt],[ut]:[new RegExp("(Opera|OPR)\\/"+jt)],[_t]:[new RegExp(_t+"\\/"+jt)],[pt]:[new RegExp("FxiOS\\/"+jt)],[Rt]:[new RegExp("Konqueror[:/]?"+jt,"i")],[et]:[new RegExp(et+" "+jt),zt],[wt]:[new RegExp("android\\s"+jt,"i")],[st]:[new RegExp(rt+"\\/"+jt)],[Pt]:[new RegExp("OculusBrowser\\/"+jt)],[It]:[new RegExp(It+"\\/"+jt)],[Ot]:[new RegExp("YaBrowser\\/"+jt)],[Ct]:[new RegExp(Ct+"\\/"+jt)],[Nt]:[new RegExp(Nt+"\\/"+jt)],[Ut]:[qt],[Ft]:[qt],[Bt]:[qt],[At]:[new RegExp("(DuckDuckGo|Ddg)\\/"+jt)],[Dt]:[new RegExp("PaleMoon\\/"+jt)],[Mt]:[new RegExp(Mt+"\\/"+jt)],[Lt]:[new RegExp("GSA\\/"+jt)],[ht]:[new RegExp("(rv:|MSIE )"+jt)],Mozilla:[new RegExp("rv:"+jt)]},Xt=function(t,e,i,r){var s=Yt(t,e,i,r),n=Kt[s];if(O(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Qt=[[new RegExp(mt+"; "+mt+" (.*?)[);]","i"),t=>[mt,t&&t[1]||""]],[new RegExp(ft,"i"),[ft,""]],[new RegExp(gt,"i"),[gt,""]],[Vt,[et,""]],[new RegExp(yt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[$t,""];if(new RegExp(W).test(e)&&!/IEMobile\b/.test(e))return[yt+" "+W,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Jt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[yt,r]}return[yt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[V,[t[3],t[4],t[5]||"0"].join(".")]:[V,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+J+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+J+")","i"),t=>t&&t[2]?[J,[t[2],t[3],t[4]||"0"].join(".")]:[J,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ot,""]],[/Linux|debian/i,["Linux",""]]],Zt=function(t){return Wt.test(t)?ft:Gt.test(t)?gt:Ht.test(t)?mt:new RegExp(Et,"i").test(t)?Et:new RegExp("("+$t+"|WPDesktop)","i").test(t)?$t:/iPad/.test(t)?X:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Z:Vt.test(t)?et:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(xt,"i").test(t)?xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(W).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?J:K:new RegExp("(pda|"+W+")","i").test(t)?Tt:new RegExp(Y,"i").test(t)&&!new RegExp(Y+" pc","i").test(t)?kt:""},te=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ee(t,e){return"string"==typeof(i=t)&&te.test(i)?t:e();var i}function ie(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function re(t){return t?t.split("#")[0]:t}var se,ne=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],oe="NativeGzipValidationError",ae=t=>t.length>=2&&31===t[0]&&139===t[1],he=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,le=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ue=t=>{throw ie(oe,"Native gzip produced invalid output: "+t)},de=function(){var t=_((function*(t,e){18>t.size&&ue("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ae(i)&&8===i[2]||ue("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(se)return se;se=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;se[t]=e>>>0}return se})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&ue("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&ue("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function ve(){return ve=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield de(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),ve.apply(this,arguments)}var ce=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={q(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!O(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>ce(e+" "+t,i)};return s},_e=ce("[PostHog.js]"),pe=_e.createLogger,fe=pe("[ExternalScriptsLoader]"),ge=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},me=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ge(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ge(e))return me(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},we={},be=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=we[s];if("fallback"===r&&n){if(ge(n))return void me(t,n,i);delete we[s]}me(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=be(t,e);we[s]=a;var h=ge(s);null==h||null==(o=h.parentNode)||o.removeChild(h),me(t,a,i)}else i(void 0,n)}:i)}else me(t,be(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");me(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);me(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.427.0",v.LIB_NAME="web";var ye="$people_distinct_id",$e="distinct_id",xe="$device_id",Ee="$device_model",Se="__alias",Te="$fbc",ke="$fbc_persistence",Re="__timers",Pe="$dead_clicks_enabled_server_side",Ie="$session_recording_remote_config",Oe="$sesid",Ce="$session_is_sampled",Ae="$enabled_feature_flags",De="$active_feature_flags",Me="$feature_flag_details",Ne="$feature_flag_payloads",Ue="$feature_flag_request_id",Fe="$minimal_flag_called_events",Be="$stored_person_properties",Le="$stored_group_properties",je="$groups",ze="$surveys_loaded_at",qe="$flag_call_reported",He="$feature_flag_errors",Ge="$feature_flag_evaluated_at",We="$user_state",Ve="$client_session_props",Je="$capture_rate_limit",Ye="$initial_campaign_params",Ke="$initial_referrer_info",Xe="$initial_person_info",Qe="$epp",Ze="$posthog_cookieless",ti="$cookieless_mode",ei="$sdk_debug_extensions_init_method",ii="$sdk_debug_extensions_init_time_ms",ri="on_reject",si="always",ni="anonymous",oi="identified",ai="identified_only",hi="visibilitychange",li="beforeunload",ui="$pageview",di="$pageleave",vi="$identify",ci="$groupidentify";function _i(t,e){k(t)&&t.forEach(e)}function pi(t,e){if(!M(t))if(k(t))t.forEach(e);else if(B(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)S.call(t,i)&&e(t[i],i)}var fi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},gi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(t)}}},mi=function(t){var e={};return pi(t,(function(t,i){(C(t)&&t.length>0||N(t))&&(e[i]=t)})),e};var wi=["herokuapp.com","vercel.app","netlify.app"];function bi(t){var e=null==t?void 0:t.hostname;if(!C(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of wi)if(i===r)return!1;return!0}function yi(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var $i=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return N(t)&&isFinite(t)&&Math.floor(t)===t});class xi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,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 xi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new xi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Ei{generate(){var t=this.generateOrAbort();if(!O(t))return t;this.Kr=0;var e=this.generateOrAbort();if(O(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ti++,this.ti>4398046511103&&(this.Kr++,this.Xr())}return xi.fromFieldsV7(this.Kr,Math.trunc(this.ti/Math.pow(2,30)),this.ti&Math.pow(2,30)-1,this.ei.nextUint32())}Xr(){this.ti=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Kr=0,this.ti=0,this.ei=new ki}}var Si,Ti=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!O(t.crypto)&&crypto.getRandomValues&&(Ti=t=>crypto.getRandomValues(t));class ki{nextUint32(){return this.De.length>this.ri||(Ti(this.De),this.ri=0),this.De[this.ri++]}constructor(){this.De=new Uint32Array(8),this.ri=1/0}}var Ri=()=>Pi().toString(),Pi=()=>(Si||(Si=new Ei)).generate(),Ii="",Oi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ci=null,Ai={ii(){if(!D(Ci))return Ci;if(Ci=!1,r)try{var t="__ph_cookie_support_"+Ri();Ai.ni(t,"xyz"),Ci='"xyz"'===$i(t),Ai.oi(t)}catch(t){Ci=!1}return Ci},si(t){_e.error("cookieStore error: "+t)},ai:$i,ui(t){var e;try{e=JSON.parse(Ai.ai(t))||{}}catch(t){}return e},ni(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ii)return Ii;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ri();!Ii&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ii=o)}return Ii}(t);if(!i){var s=(t=>{var e=t.match(Oi);return e?e[0]:""})(t);s!==i&&_e.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},oi(t,e){if(null!=r&&r.cookie)try{Ai.ni(t,"",-1,e)}catch(t){return}}},Di=null,Mi={ii(){if(!D(Di))return Di;var e=!0;if(O(t))e=!1;else try{var i="__mplssupport__";Mi.ni(i,"xyz"),'"xyz"'!==Mi.ai(i)&&(e=!1),Mi.oi(i)}catch(t){e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),Di=e,e},si(t){_e.error("localStorage error: "+t)},ai(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Mi.si(t)}return null},ui(t){try{return JSON.parse(Mi.ai(t))||{}}catch(t){}return null},ni(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Mi.si(t)}return!1},oi(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Mi.si(t)}}},Ni=[Be,De,Ae,Me,Ne,Ue,Ge,He,qe],Ui=[xe,$e,Oe,Ce,Qe,Xe,ke,We],Fi=t=>t+"_cpm",Bi=["__proto__","constructor","prototype"],Li=t=>{if(!P(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Bi.indexOf(i)&&(e[i]=t[i])})),e},ji=function(t,e){void 0===e&&(e=[]);var i={};return[...Ui,...e].forEach((e=>{var r=t[e];O(r)||D(r)||""===r||(i[e]=r)})),i},zi=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},qi=(t,e)=>({p:e,f:zi(JSON.stringify(t))}),Hi=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Ai.ui(Fi(t)),r=(null==i?void 0:i.f)===zi(e)&&k(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Gi=(t,e)=>e+"|"+(Ai.ai(Fi(t))||""),Wi={},Vi={ii:()=>!0,si(t){_e.error("memoryStorage error: "+t)},ai:t=>t in Wi?Wi[t]:null,ui:t=>t in Wi?Wi[t]:null,ni:(t,e)=>(Wi[t]=e,!0),oi(t){delete Wi[t]}},Ji=null,Yi={ii(){if(!D(Ji))return Ji;if(Ji=!0,O(t))Ji=!1;else try{var e="__support__";Yi.ni(e,"xyz"),'"xyz"'!==Yi.ai(e)&&(Ji=!1),Yi.oi(e)}catch(t){Ji=!1}return Ji},si(t){_e.error("sessionStorage error: ",t)},ai(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Yi.si(t)}return null},ui(t){try{return JSON.parse(Yi.ai(t))||null}catch(t){}return null},ni(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Yi.si(t)}return!1},oi(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Yi.si(t)}}};class Ki{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===si||this.isRejected()||-1===this.consent&&this.mn.cookieless_mode===ri}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Gs(){var t=this.Zs.ai(this.Qs);return q(t)?1:m(H,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,e="localStorage"===t?Mi:Ai,i=e.ii()?e:Vi;if(!this.Js||this.Js!==i){this.Js=i;var r="localStorage"===t?Ai:Mi;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(q(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some((t=>q(t)))}}var Xi=["next","previous","prev",">","<","+","-","−","–"];pe("[Dead Clicks]");var Qi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Pe)),r=t.instance.config.capture_dead_clicks;return F(r)?r:!!P(r)||i},Zi=pe("[SegmentIntegration]");function tr(t,e,i){void 0===i&&(i=!0);var r=t.config.segment;if(!r)return e();!function(t,e,i){var r=t.config.segment;if(!r)return e();var s=r=>{var s=()=>r.anonymousId()||Ri();t.config.get_device_id=s,i&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(We,oi)),e(i?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,(i=>{r.register(((t,e)=>{"undefined"!=typeof Promise&&Promise.resolve||Zi.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,r)=>{if(!r)return i;var s=!!e&&i.event.anonymousId===e&&!i.event.userId;s||i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Zi.info("No userId set, resetting PostHog"),t.reset()),s||(e=void 0),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Zi.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var n=t.calculateEventProperties(r,i.event.properties);return i.event.properties=Object.assign({},n,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return i(t,t.event.event)},page(t){return i(t,ui)},identify(t){return i(t,vi)},screen(t){return i(t,"$screen")}}})(t,i)).then((()=>{e()}),(t=>{Zi.error("Failed to register the Segment integration",t),e()}))}),i)}var er="posthog-js";function ir(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class rr{constructor(t,e,i,r,s,n){this.name=er,this.setupOnce=function(o){o(ir(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class sr{constructor(t){this.eo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.io=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ro()}ro(){var t;this.no=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.eo)}destroy(){var t;null==(t=this.no)||t.call(this),this.no=void 0}doPageView(e,i){var r,s=this.so(e,i);return this.io={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.so(t,null==(e=this.io)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.io)?void 0:t.pageViewId}}so(t,e){var i=this.io;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(O(n)||O(o)||O(a)||O(h)||O(l)||O(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?G(o/n,0,1,_e):1,v=n>1?G(a/n,0,1,_e):1,c=h>1?G(l/h,0,1,_e):1,_=h>1?G(u/h,0,1,_e):1;r=fi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var nr=["flags","surveys"],or={[ye]:{exposure:"hidden"},[Se]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Re]:{exposure:"hidden"},[ke]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$logs_capture_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[Pe]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[Ie]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Ce]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ae]:{exposure:"hidden",storageGroup:"flags"},[De]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags"},[Ne]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Be]:{exposure:"hidden"},[Le]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[ze]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[qe]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[je]:{exposure:"event"},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[ei]:{exposure:"event"},[ii]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},ar=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],hr=t=>{var e=or[t];if(e)return e;for(var i of ar){var r=i[1];if(0===t.indexOf(i[0]))return r}},lr=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},ur=t=>{var e=null==r?void 0:r.createElement("a");return O(e)?null:(e.href=t,e)},dr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!k(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){_e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},vr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");k(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},cr="https?://(.*)",_r=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._r],fr="<masked>",gr=["li_fat_id"];function mr(t,e){var i=pr.concat(e||[]),r={};return pi(i,(function(e){var i=dr(t,e);r[e]=i||null})),r}function wr(t){var e=function(t){return t?0===t.search(cr+"google.([^/?]*)")?"google":0===t.search(cr+"bing.com")?"bing":0===t.search(cr+"yahoo.com")?"yahoo":0===t.search(cr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!D(e)){s.$search_engine=e;var n=r?dr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function br(){return navigator.language||navigator.userLanguage}var yr="$direct";function $r(){return(null==r?void 0:r.referrer)||yr}function xr(t,e,i){void 0===i&&(i=!1);var r=t?[..._r,...e||[]]:[],n=i?re(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:$r().substring(0,1e3),u:o?vr(o,r,fr):void 0}}function Er(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?re(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==yr?yr:null==(i=ur(r))?void 0:i.host};if(n){o.$current_url=n;var a=ur(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=mr(n);fi(o,h)}if(r){var l=wr(r);fi(o,l)}return o}function Sr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Tr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var kr={flags:Ge,surveys:ze},Rr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Pr=t=>t+"_cookie_identity_change_pending",Ir=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},Or="main",Cr=[Ae,De,Me,Ne,Ue,Ge,Fe,Be],Ar=t=>-1!==Cr.indexOf(t),Dr=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Mr=t=>{if(!t)return{};var e=JSON.parse(t);return P(e)?e:{}},Nr=(t,e)=>{pi(t,((i,r)=>{var s=hr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class Ur{constructor(e,i,r){if(void 0===r&&(r=!0),this.oo={},this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.do=!1,this.vo=new Map,this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=new Set,this.mn=e,this.bo=r,this.props={},this._o=void 0,this.wo=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Zs=this.ko(e),this.uo=this.So(e),this.load(),this.xo(),e.debug&&_e.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();yi(t,"beforeunload",s,{capture:!1}),yi(t,"pagehide",s,{capture:!1}),this.Co=e=>{if(this.ao&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.wo){if(this.uo){var i=nr.find((t=>e.key===this.To(t)));i&&this.Mo(e.key,i)}}else this.Mo(e.key,Or)},yi(t,"storage",this.Co)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var e=t[0],i=t[1],r=this.vo.get(e);if(Ar(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach((t=>s.add(t))),s.size&&this.Io(e,s)}else this.Io(e,!0)}))}onCrossTabFeatureFlagChange(t){return this.yo.add(t),()=>this.yo.delete(t)}destroy(){this.Co&&t&&(t.removeEventListener("storage",this.Co),this.Co=void 0),this.yo.clear()}Mo(t,e,i){if(void 0===i&&(i=!0),this.Eo)return!1;var r,s;try{if(s=Mi.ai(t),D(s)){var n=this.Ro(e);return n.storageValue=null,e!==Or&&(n.persisted=!1),!1}r=Mr(s)}catch(t){return!1}var o=e===Or?r:Mi.ui(this.wo);if(o&&this.Po(o))return!1;var a=this.Ao(r,e,i);return e===Or&&this.uo&&!Dr(this.Fo().main,r)||this.Oo(r,e,!0,s),a}Po(t){var e=this.props[$e],i=t[$e];return!O(e)&&!O(i)&&e!==i}Oo(t,e,i,r){var s=this.Ro(e);s.storageValue=r,e!==Or&&(s.persisted=i);try{s.fingerprint=this.Lo(t,e)}catch(t){s.fingerprint=void 0}}Ao(t,e,i){var r=!1;return Cr.forEach((i=>{var s,n=null==(s=hr(i))?void 0:s.storageGroup;if(!(e===Or&&this.uo&&n||e!==Or&&n!==e)){var o=i in t,a=this.Do(i,o?t[i]:void 0),h=this.vo.has(i)?i in this.props:o;h===i in this.props&&Dr(a,this.props[i])||(h?this.$o(i,a,!1):this.No(i,!1),r=!0)}})),r&&i&&this.yo.forEach((t=>t())),r}qo(){if(!this.ao)return!1;try{this.po=!1;var t,e=Mi.ai(this.wo),i=this.Ro(Or),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=Mr(e),this.po=!this.fo&&this.Po(t),this.po)return!1;s=this.Ao(t,Or,!1),!this.uo||Dr(this.Fo().main,t)?this.Oo(t,Or,!0,e):i.storageValue=e,r=!0}return this.uo&&nr.forEach((e=>{var i=Mi.ai(this.To(e)),n=this.Ro(e),o=t||{},a=r&&Cr.some((t=>{var i;return(null==(i=hr(t))?void 0:i.storageGroup)===e&&t in o}));if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ao(o,e,!1)||s));var h=Mr(i);s=this.Ao(h,e,!1)||s,this.Oo(h,e,!0,i)}})),s}catch(t){return!1}}Io(t,e){this.vo.set(t,e);var i=hr(t);null!=i&&i.volatile||(this.Ro((this.uo?null==i?void 0:i.storageGroup:void 0)||Or).fingerprint=void 0,this.jo(t))}Bo(){Cr.forEach((t=>this.vo.set(t,!0)))}xo(){if(this.ao)try{var t=Mi.ai(this.wo),e=Mr(t);this.Ro(Or).storageValue=t,Cr.forEach((t=>{var i,r=this.uo?null==(i=hr(t))?void 0:i.storageGroup:void 0,s=r?Mi.ai(this.To(r)):null;if(r){var n=this.Ro(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?Mr(s):e;t in this.props?this.Ho(t,o[t],this.props[t]):t in o&&this.Io(t,!0)}))}catch(t){}}Do(t,e){var i=this.vo.get(t);if(!i)return e;if(!0===i)return this.props[t];if(t===De){var r=new Set(k(e)?e:[]),s=new Set(k(this.props[t])?this.props[t]:[]);return i.forEach((t=>s.has(t)?r.add(t):r.delete(t))),Array.from(r)}var n=P(e)?p({},e):{},o=P(this.props[t])?this.props[t]:{};return i.forEach((t=>{t in o?n[t]=o[t]:delete n[t]})),n}Ho(t,e,i){if(Ar(t)){var r=this.vo.get(t);if(!0!==r){var s=e;if(this.ao)try{var n,o=this.uo?null==(n=hr(t))?void 0:n.storageGroup:void 0,a=o?this.To(o):this.wo;s=Mr(Mi.ai(a))[t]}catch(t){}var h=new Set(r||[]);if(t===De){if(!O(e)&&!k(e)||!O(s)&&!k(s)||!k(i))return void this.Io(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach((t=>{l.has(t)!==d.has(t)&&h.add(t)})),h.forEach((t=>{u.has(t)===d.has(t)&&h.delete(t)}))}else{if(!P(i))return void(Dr(s,i)?this.vo.delete(t):this.Io(t,!0));if(!O(e)&&!P(e)||O(e)&&I(i)&&O(s))return void this.Io(t,!0);var v=P(e)?e:{},c=P(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach((t=>{t in v==t in i&&Dr(v[t],i[t])||h.add(t)})),h.forEach((t=>{t in c==t in i&&Dr(c[t],i[t])&&h.delete(t)}))}h.size?this.Io(t,h):this.vo.delete(t)}}}zo(){var t,e=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return N(e)&&e>0?e:0}Uo(t){if(this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase())if(t)try{var e=ji(t,this.mn.cookie_persisted_properties||[]),i=qi(e,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ai.ai(this.wo)||void 0;s&&Gi(this.wo,s)===r&&(this.Wo=r,this.Vo=s)}catch(t){}else try{var n=Ai.ai(this.wo)||void 0;this.Wo=n?Gi(this.wo,n):void 0,this.Vo=n}catch(t){}}syncCookieProperties(){return this.Go(this.mn)}Go(t,e){if(void 0===e&&(e=!1),this.Eo&&!e||this.do||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Ai.ai(this.wo)||void 0}catch(t){}if(!i||i===this.Vo)return!1;var r,s=Gi(this.wo,i);try{r=Li(JSON.parse(i))}catch(t){return!1}if((Ai.ai(this.wo)||void 0)!==i)return!1;this.Wo=s,this.Vo=i;var n=Hi(this.wo,i),o=[...Ui,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(O(e)||D(e)||""===e||t===We&&e!==ni&&e!==oi)&&(a[t]=!0,delete r[t])})),I(r))return!1;var h=$e in r||r[We]===ni||r[We]===oi,l=this.props,u=l[$e],d=l[We],v=fi({},l);[...Ui,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==$e&&t!==We)){var e=v[t];!n.isValid&&-1!==Ui.indexOf(t)&&(!1===e||0===e)||delete v[t]}})),this.props=fi(v,r),Cr.forEach((t=>{var e=t in this.props;t in l===e&&Dr(l[t],this.props[t])||(e?this.Ho(t,l[t],this.props[t]):this.Io(t,!0))})),!h||We in r||We in this.props||this.$o(We,ni);var c=this.props[$e],_=this.props[We];return!h||c===u&&_===d||(this.fo=!0,this.ho=!0,Yi.ni(Pr(this.wo),!0),this.No(Be),this.No(De),this.No(Ae),this.No(Me),this.No(Ne),this.No(Ue),this.No(Ge),this.No(He),this.No(qe),_===ni&&(d===oi||r[We]===ni||!O(u)&&c!==u)&&(Nr(this.props,r),this.No(Le)),_===oi?this.props.$user_id=c:delete this.props.$user_id,this.No(Se)),!0}consumeCookieIdentityChange(){var t=Pr(this.wo),e=this.ho||!!Yi.ai(t);return this.ho=!1,e&&Yi.oi(t),e}Zo(t){return void 0===t&&(t=!1),!(this.do||this.Eo&&!t||!this.mn.cookieWinsOnConflict||"localstorage+cookie"!==this.mn.persistence.toLowerCase()||(this.do=!0,0))}Qo(){this.do&&(O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),delete this.oo[Or],this.Ko(!0))}Yo(t){if(void 0===t&&(t=!0),this.do)try{t?this.Qo():O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0)}finally{this.do=!1}}isDisabled(){return!!this.Eo}ko(e){-1===Rr.indexOf(e.persistence.toLowerCase())&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Ui,...e];return p({},Mi,{ui(t){try{var e,s={};try{e=Ai.ai(t)||void 0,s=e?Li(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Mi.ai(t)||"{}");if(i){var a=Hi(t,e),h=[...Ui,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];D(e)||""===e||t===We&&e!==ni&&e!==oi||(l[t]=e)}));var u=$e in l||l[We]===ni||l[We]===oi;if(Object.keys(l).length>0){var d,v=o[$e],c=null!==(d=o[We])&&void 0!==d?d:ni;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==$e&&t!==We)){var e=o[t];!a.isValid&&-1!==Ui.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||We in s||We in o||(o[We]=ni),!u||($e in l?l[$e]:o[$e])===v&&(We in l?l[We]:o[We])===c||(Ni.forEach((t=>delete o[t])),l[We]===oi&&$e in l?o.$user_id=l[$e]:delete o.$user_id,l[We]!==oi&&(delete o[je],delete o[Le]),delete o.__alias)}n=fi(o,l)}else n=fi(s,o);return Mi.ni(t,n),n}catch(t){}return null},ni(t,r,s,n,o,a){var h=Mi.ni(t,r,void 0,void 0,a);try{var l=ji(r,e);if(Object.keys(l).length){if(i){var u=Fi(t),d=qi(l,e);if(Ai.ni(u,d,s,n,o,a),Ai.ai(u)!==JSON.stringify(d)){Ai.oi(u,n);var v=ji(r);return Ai.ni(t,v,s,n,o,a),h}}Ai.ni(t,l,s,n,o,a)}}catch(t){Mi.si(t)}return h},oi(e,i){try{null==t||t.localStorage.removeItem(e),Ai.oi(e,i),Ai.oi(Fi(e),i)}catch(t){Mi.si(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&Mi.ii()?(i=Mi,n=!0):"localstorage+cookie"===o&&r.ii()?(i=r,n=!0,s=!0):"sessionstorage"===o&&Yi.ii()?i=Yi:"memory"===o?i=Vi:"cookie"===o&&Ai.ii()?(i=Ai,s=!0):r.ii()?(i=r,n=!0,s=!0):Ai.ii()?(i=Ai,s=!0):i=Vi,this.ao=n,this.lo=s,i}To(t){return this.wo+"__"+t}So(t){return this.ao&&!!t.split_storage}properties(){var t={};return pi(this.props,((e,i)=>{var r=hr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Eo||t){var e=this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase(),i=e?Mi.ui(this.wo):null,r={};if(e)try{pi(r=Li(Ai.ui(this.wo)),((t,e)=>{(O(t)||D(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Zs.ui(this.wo);if(s&&(this.props=fi({},s)),this.uo&&this.Xo(),e&&s){var n,o,a=null==i?void 0:i[$e],h=null!==(n=null==i?void 0:i[We])&&void 0!==n?n:ni,l=s[$e],u=null!==(o=s[We])&&void 0!==o?o:ni;if(l!==a||u!==h){this.ho=!0,Yi.ni(Pr(this.wo),!0);var d=fi({},this.props);Ni.forEach((t=>delete d[t])),u===ni&&(h===oi||r[We]===ni||!O(a)&&l!==a)&&(Nr(d,r),delete d[Le]),this.props=d;var v=new Set;Ni.forEach((t=>{var e,i=null==(e=hr(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};pi(this.props,((i,r)=>{var s;(null==(s=hr(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),I(e)?(Mi.oi(this.To(t)),this.oo[t]={}):Mi.ni(this.To(t),e)&&(this.oo[t]={persisted:!0,fingerprint:this.Lo(e,t)})}))}}Yi.ai(Pr(this.wo))&&(this.ho=!0)}}Xo(){for(var t of nr){var e=Mi.ui(this.To(t));if(e&&!I(e)){var i=this.Ro(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Lo(e,t)),this.ea(t,e)||fi(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=hr(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=kr[t];if(!i)return!1;var r=e[i],s=this.props[i];return N(r)&&N(s)&&s>r}refreshKey(t){var e;if(!(this.Eo||t===ke&&this.mo)){var i=this.uo?null==(e=hr(t))?void 0:e.storageGroup:void 0,r=i?Mi.ui(this.To(i)):this.Zs.ui(this.wo);if(r&&t in r)this.$o(t,r[t],!1);else{if(i){var s=this.Zs.ui(this.wo);if(s&&t in s)return void this.$o(t,s[t],!1)}this.No(t,!1)}}}save(){if(!this.Eo){var t=this.zo();t>0?O(this.Jo)&&(this.Jo=setTimeout((()=>{this.Jo=void 0,this.Ko()}),t)):this.Ko()}}flush(){O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0,this.Ko())}Ko(t){if(void 0===t&&(t=!1),!(this.Eo||this.do&&!t)){t||(this.syncCookieProperties(),this.mo||this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase()||this.refreshKey(ke));var e=!t&&!this.co;e||(this.po=!1);var i=!!e&&this.qo();if(this.po)this.mn.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.uo)return this.ia(),void(i&&this.yo.forEach((t=>t())));var r=this.ra(this.Zs,this.wo,this.props,Or);"written"===r&&this.Uo(this.props),"failed"!==r&&(this.vo.clear(),this.fo=!1,this.mo=!1),i&&this.yo.forEach((t=>t()))}}}ia(){var t=this,e=this.Fo(),i=e.main,r=e.groups,s=this.ra(this.Zs,this.wo,i,Or);"written"===s&&this.Uo(i),"failed"!==s&&(this.fo=!1,this.mo=!1,Cr.forEach((t=>{var e;null!=(e=hr(t))&&e.storageGroup||this.vo.delete(t)})));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.oo[e])||!i.persisted))return Cr.forEach((i=>{var r;(null==(r=hr(i))?void 0:r.storageGroup)===e&&t.vo.delete(i)})),1;var n=t.ra(Mi,t.To(e),s,e);"failed"!==n&&Cr.forEach((i=>{var r=hr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.vo.delete(i)}))};for(var o of nr)n(o)}Fo(){var t={},e={flags:{},surveys:{}};return pi(this.props,((i,r)=>{var s,n=null==(s=hr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Lo(t,e){if(e===Or)return JSON.stringify(t)+"|"+this.na+"|"+this.sa+"|"+this.oa;var i={};return pi(t,((t,e)=>{var r;i[e]=null!=(r=hr(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Ro(r);if(r!==Or&&!n.dirty&&!O(n.fingerprint))return"skipped";try{if((s=this.Lo(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ni(e,i,this.na,this.sa,this.oa,this.mn.debug)?(n.dirty=!1,r!==Or&&(n.persisted=!0),O(s)||(n.fingerprint=s),this.ao&&(n.storageValue=Mi.ai(e)),"written"):(this.mn.debug&&_e.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.Bo(),O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),this.Zs.oi(this.wo,!1),this.Zs.oi(this.wo,!0),!i&&this.bo)for(var r of nr)Mi.oi(this.To(r));i?delete this.oo[Or]:this.oo={},this.Wo=void 0,this.Vo=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(P(t)){this.syncCookieProperties(),O(e)&&(e="None"),this.na=O(i)?this.aa:i;var r=!1;if(pi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.$o(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(P(t)){this.syncCookieProperties(),this.na=O(e)?this.aa:e;var i=!1;if(pi(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||P(e)||k(e))&&(this.$o(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.No(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this._o){var e=function(t,e,i){if(!r)return{};var s,n=e?[..._r,...i||[]]:[],o=mr(vr(r.URL,n,fr),t),a=(s={},pi(gr,(function(t){var e=$i(t);s[t]=e||null})),s);return fi(a,o)}(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),i=!I(mi(e));return i&&this.register(e),this._o=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?wr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:$r(),$referring_domain:null!=r&&r.referrer&&(null==(t=ur(r.referrer))?void 0:t.host)||yr},void 0)}set_initial_person_info(){if(!this.props[Ye]&&!this.props[Ke]){var t=xr(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[Xe]:this.lo?{r:Ir(t.r),u:t.u?Ir(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};pi([Ke,Ye],(e=>{var i=this.props[e];i&&pi(i,(function(e,i){t["$initial_"+w(i)]=e}))}));var e=this.props[Xe];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=Er(t,e),r={};return pi(i,(function(t,e){r["$initial_"+w(e)]=t})),r}(e,this.mn.disable_capture_url_hashes);fi(t,i)}return t}safe_merge(t){return pi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.Eo&&!a;a||this.Go(e,h),this.mn=t,!a&&(r||s||o)&&(this.Wo=void 0,this.Vo=void 0,this.Go(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.ko(t):this.Zs;this.la();var u=this.So(t),d=n||u!==this.uo,v=!a&&(d||t.cross_subdomain_cookie!==this.sa||t.secure_cookie!==this.oa)&&this.Zo(h);this.co=d;try{if(this.aa=this.na=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.Zs=l,this.uo=u,this.props=c,this.save()}else o&&(this.Zs=l,a||(delete this.oo[Or],this.Ko()))}finally{this.co=!1,v&&this.Yo()}}la(){var t=this.props[Xe];if(this.lo&&P(t)&&"string"==typeof t.r){var e=Ir(t.r),i="string"==typeof t.u?Ir(t.u):t.u;e===t.r&&i===t.u||this.$o(Xe,p({},t,{r:e,u:i}))}}set_disabled(t){this.Eo=t,this.Eo?this.remove():this.save()}set_cross_subdomain(t){t!==this.sa&&(this.sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[Re]||{};i[t]=e,this.$o(Re,i),this.save()}remove_event_timer(t){var e=this.props[Re]||{},i=e[t];return O(i)||(delete e[t],this.$o(Re,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.$o(t,e),this.save()}$o(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&(t!==$e&&t!==We||s===e||(this.fo=!0),t!==ke||Dr(s,e)||(this.mo=!0),this.Ho(t,s,e),null!=(r=hr(t))&&r.volatile||this.jo(t))}No(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(Ar(t)&&this.Io(t,!0),t===ke&&(this.mo=!0),this.jo(t))}jo(t){var e,i=null==(e=hr(t))?void 0:e.storageGroup;i&&(this.Ro(i).dirty=!0)}Ro(t){return this.oo[t]||(this.oo[t]={})}}var Fr={GZipJS:"gzip-js",Base64:"base64"},Br={Activation:"events",Cancellation:"cancelEvents"},Lr={Button:"button",Tab:"tab",Selector:"selector"},jr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},zr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},qr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Hr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Gr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Wr={Once:"once",Recurring:"recurring",Always:"always"},Vr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Jr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Yr={Popover:"popover",Inline:"inline"};function Kr(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,(()=>{}))}}}}var Xr={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Qr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Zr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ts=pe("[RateLimiter]");class es{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{ts.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void ts.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Je))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(N(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.ua(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(Je,a),{isRateLimited:h,remainingTokens:a.tokens}}ha(t){var e=this.instance.config.property_denylist;return!k(e)||!e.includes(t)}da(){var t;if(this.ha("$current_url")&&this.ha("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ua(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.da(),o=this.ha("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var is=pe("[RemoteConfig]");class rs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}va(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ca(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return is.info("Using preloaded remote config",this.remoteConfig),void this.fa(this.remoteConfig);if(this._instance._shouldDisableFlags())return void is.warn("Remote config is disabled. Falling back to local config.");this.va((t=>{if(!t)return is.info("No config found after loading remote JS config. Falling back to JSON."),void this.ca((t=>{this.fa(t.json,t)}));this.fa(t)}))}catch(t){is.error("Error loading remote config",t),this.fa()}}fa(t,e){!t&&e&&(0===e.statusCode?e.error||is.warn("Failed to fetch remote config from PostHog."):is.error("Failed to fetch remote config from PostHog."));try{this._instance.fa(t?{ok:!0,config:t}:{ok:!1})}catch(t){is.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){is.error("Error loading feature flags",t)}}}var ss=["fatal","error","warning","log","info","debug"],ns=Uint8Array,os=Uint16Array,as=Uint32Array,hs=new ns([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]),ls=new ns([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]),us=new ns([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ds=function(t,e){for(var i=new os(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new as(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]},vs=ds(hs,2),cs=vs[1];vs[0][28]=258,cs[258]=28;for(var _s=ds(ls,0)[1],ps=new os(32768),fs=0;32768>fs;++fs){var gs=(43690&fs)>>>1|(21845&fs)<<1;ps[fs]=((65280&(gs=(61680&(gs=(52428&gs)>>>2|(13107&gs)<<2))>>>4|(3855&gs)<<4))>>>8|(255&gs)<<8)>>>1}var ms=function(t,e,i){for(var r=t.length,s=0,n=new os(e);r>s;++s)++n[t[s]-1];var o,a=new os(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new os(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[ps[d]>>>h]=l}else for(o=new os(r),s=0;r>s;++s)o[s]=ps[a[t[s]-1]++]>>>15-t[s];return o},ws=new ns(288);for(fs=0;144>fs;++fs)ws[fs]=8;for(fs=144;256>fs;++fs)ws[fs]=9;for(fs=256;280>fs;++fs)ws[fs]=7;for(fs=280;288>fs;++fs)ws[fs]=8;var bs=new ns(32);for(fs=0;32>fs;++fs)bs[fs]=5;var ys=ms(ws,9,0),$s=ms(bs,5,0),xs=function(t){return(t/8>>0)+(7&t&&1)},Es=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof os?os:t instanceof as?as:ns)(i-e);return r.set(t.subarray(e,i)),r},Ss=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ts=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ks=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new ns(0),0];if(1==s){var o=new ns(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new os(v+1),_=Rs(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}_=e}return[new ns(c),_]},Rs=function(t,e,i){return-1==t.s?Math.max(Rs(t.l,e,i+1),Rs(t.r,e,i+1)):e[t.s]=i},Ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new os(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Is=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Os=function(t,e,i){var r=i.length,s=xs(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Cs=function(t,e,i,r,s,n,o,a,h,l,u){Ss(e,u++,i),++s[256];for(var d=ks(s,15),v=d[0],c=d[1],_=ks(n,15),p=_[0],f=_[1],g=Ps(v),m=g[0],w=g[1],b=Ps(p),y=b[0],x=b[1],E=new os(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;y.length>S;++S)E[31&y[S]]++;for(var T=ks(E,7),k=T[0],R=T[1],P=19;P>4&&!k[us[P-1]];--P);var I,O,C,A,D=l+5<<3,M=Is(s,ws)+Is(n,bs)+o,N=Is(s,v)+Is(n,p)+o+14+3*P+Is(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=D&&N>=D)return Os(e,u,t.subarray(h,h+l));if(Ss(e,u,1+(M>N)),u+=2,M>N){I=ms(v,c,0),O=v,C=ms(p,f,0),A=p;var U=ms(k,R,0);for(Ss(e,u,w-257),Ss(e,u+5,x-1),Ss(e,u+10,P-4),u+=14,S=0;P>S;++S)Ss(e,u+3*S,k[us[S]]);u+=3*P;for(var F=[m,y],B=0;2>B;++B){var L=F[B];for(S=0;L.length>S;++S)Ss(e,u,U[j=31&L[S]]),u+=k[j],j>15&&(Ss(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else I=ys,O=ws,C=$s,A=bs;for(S=0;a>S;++S)if(r[S]>255){var j;Ts(e,u,I[257+(j=r[S]>>>18&31)]),u+=O[j+257],j>7&&(Ss(e,u,r[S]>>>23&31),u+=hs[j]);var z=31&r[S];Ts(e,u,C[z]),u+=A[z],z>3&&(Ts(e,u,r[S]>>>5&8191),u+=ls[z])}else Ts(e,u,I[r[S]]),u+=O[r[S]];return Ts(e,u,I[256]),u+O[256]},As=new as([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ds=function(){for(var t=new as(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Ms=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ns(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Ds[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new ns(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=Os(h,l,t.subarray(u,d)):(h[u]=!0,l=Os(h,l,t.subarray(u,o)))}else{for(var v=As[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new os(32768),g=new os(p+1),m=Math.ceil(i/3),w=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},y=new as(25e3),x=new os(288),E=new os(32),S=0,T=0,k=(u=0,0),R=0,P=0;o>u;++u){var I=b(u),O=32767&u,C=g[I];if(f[O]=C,g[I]=O,u>=R){var A=o-u;if((S>7e3||k>24576)&&A>423){l=Cs(t,h,0,y,x,E,T,k,P,u-P,l),k=S=T=0,P=u;for(var D=0;286>D;++D)x[D]=0;for(D=0;30>D;++D)E[D]=0}var M=2,N=0,U=_,F=O-C&32767;if(A>2&&I==b(u-F))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=F&&--U&&O!=C;){if(t[u+M]==t[u+M-F]){for(var z=0;j>z&&t[u+z]==t[u+z-F];++z);if(z>M){if(M=z,N=F,z>B)break;var q=Math.min(F,z-2),H=0;for(D=0;q>D;++D){var G=u-F+D+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}F+=(O=C)-(C=f[O])+32768&32767}if(N){y[k++]=268435456|cs[M]<<18|_s[N];var V=31&cs[M],J=31&_s[N];T+=hs[V]+ls[J],++x[257+V],++E[J],R=u+M,++S}else y[k++]=t[u],++x[t[u]]}}l=Cs(t,h,!0,y,x,E,T,k,P,u-P,l)}return Es(a,0,r+xs(l)+s)}(n=t,null==(o=e).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,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ms(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),Ms(l,u-8,i.d()),Ms(l,u-4,r),l}var Us=!!o||!!n,Fs="text/plain",Bs=!1,Ls=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},js=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return pi(t,(function(t,e){O(t)||O(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},zs=t=>{if(t.ga)return t.ga;var e=t.data,i=t.compression;if(e){if(i===Fr.GZipJS){var r=Ns(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ns(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new ns(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return Es(r,0,s)}(lr(e)),{mtime:0});return{contentType:Fs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Fr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(lr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:lr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=lr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},qs=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:js(t.url,{compression:Fr.Base64}),encodedBody:zs(p({},t,{compression:Fr.Base64,ga:void 0}))}:{url:Ls(t.url,"compression"),encodedBody:zs(p({},t,{compression:void 0,ga:void 0}))};try{e=zs(t)}catch(e){if(he(t.compression,dr(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&he(t.compression,dr(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?ae(new Uint8Array(i)):ArrayBuffer.isView(i)&&ae(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Bs=!0,r()):{url:t.url,encodedBody:e}},Hs=t=>{try{return qs(t)}catch(e){return _e.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Gs=function(){var t=_((function*(t){var e=lr(t.data),i=yield function(t,e,i){return ve.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{ga:{contentType:Fs,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Ws=/Failed to fetch|NetworkError|Load failed/i,Vs=t=>"TypeError"===(null==t?void 0:t.name)&&Ws.test((null==t?void 0:t.message)||""),Js=t=>{var e=Hs(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;pi(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e;v=!0,c.abort(ie("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||Vs(e)?_e.warn(e):_e.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.ma&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){_e.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Ys=t=>{try{var e,r=qs(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=k(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(k(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>k(t.data)?e:p({},t.data,{batch:e});return Ys(p({},t,{data:v(u.slice(0,d))})),void Ys(p({},t,{data:v(u.slice(d))}))}_e.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),Js(p({},t,{ma:!0}))}catch(t){_e.warn("Beacon send failed",t)}},Ks=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return js(i===Fr.GZipJS?Ls(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Fr.GZipJS?{}:{compression:i}))},Xs=[];n&&Xs.push({transport:"fetch",method:Js}),o&&Xs.push({transport:"XHR",method(t){var e=Hs(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;pi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Xs.push({transport:"sendBeacon",method:Ys});var Qs=3e3;class Zs{constructor(t,e){this.ya=!0,this.ba=[],this._a=G((null==e?void 0:e.flush_interval_ms)||Qs,250,5e3,_e.createLogger("flush interval"),Qs),this.wa=t}enqueue(t){this.ba.push(t),this.ka||this.Sa()}unload(){this.xa();var t=this.ba.length>0?this.Ca():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ta(p({},t,{transport:"sendBeacon"}))}))}enable(){this.ya=!1,this.Sa()}Sa(){var t=this;this.ya||(this.ka=setTimeout((()=>{if(this.xa(),this.ba.length>0){var e=this.Ca(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&k(i.data)&&pi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ta(i)};for(var r in e)i()}}),this._a))}Ta(t){try{this.wa(t)}catch(t){_e.error(t)}}xa(){clearTimeout(this.ka),this.ka=void 0}Ca(){var t={};return pi(this.ba,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;O(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ba=[],t}}var tn=["retriesPerformedSoFar"];class en{constructor(e){this.Ma=!1,this.Ia=3e3,this.ba=[],this._instance=e,this.ba=[],this.Ea=!0,!O(t)&&"onLine"in t.navigator&&(this.Ea=t.navigator.onLine,this.Ra=()=>{this.Ea=!0,this.Pa()},this.Aa=()=>{this.Ea=!1},yi(t,"online",this.Ra),yi(t,"offline",this.Aa))}get length(){return this.ba.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,tn);U(e)&&(i.url=js(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.os(p({retriesPerformedSoFar:e},i));0===t.statusCode&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}os(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ba.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),_e.warn(s),this.Ma||(this.Ma=!0,this.Fa())}Fa(){if(this.Oa&&clearTimeout(this.Oa),0===this.ba.length)return this.Ma=!1,void(this.Oa=void 0);this.Oa=setTimeout((()=>{this.Ea&&this.ba.length>0&&this.Pa(),this.Fa()}),this.Ia)}Pa(){var t=Date.now(),e=[],i=this.ba.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ba=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Oa&&(clearTimeout(this.Oa),this.Oa=void 0),this.Ma=!1,O(t)||(this.Ra&&(t.removeEventListener("online",this.Ra),this.Ra=void 0),this.Aa&&(t.removeEventListener("offline",this.Aa),this.Aa=void 0)),this.ba)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){_e.error(t)}}this.ba=[]}}class rn{constructor(t){this.La=()=>{var t,e,i,r;this.Da||(this.Da={});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),h=(null==s?void 0:s.scrollHeight)||0;this.Da.lastScrollY=Math.ceil(n),this.Da.maxScrollY=Math.max(n,null!==(t=this.Da.maxScrollY)&&void 0!==t?t:0),this.Da.maxScrollHeight=Math.max(o,null!==(e=this.Da.maxScrollHeight)&&void 0!==e?e:0),this.Da.lastContentY=a,this.Da.maxContentY=Math.max(a,null!==(i=this.Da.maxContentY)&&void 0!==i?i:0),this.Da.maxContentHeight=Math.max(h,null!==(r=this.Da.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get $a(){return this._instance.config.scroll_root_selector}getContext(){return this.Da}resetContext(){var t=this.Da;return setTimeout(this.La,0),t}startMeasuringScrollPosition(){yi(t,"scroll",this.La,{capture:!0}),yi(t,"scrollend",this.La,{capture:!0}),yi(t,"resize",this.La)}scrollElement(){var e;if(!this.$a)return null==t||null==(e=t.document)?void 0:e.documentElement;var i=k(this.$a)?this.$a:[this.$a];for(var r of i){var s,n=null==t||null==(s=t.document)?void 0:s.querySelector(r);if(n)return n}}Na(e){var i,r,s="y"===e?"scrollTop":"scrollLeft";if(this.$a){var n=this.scrollElement();return n&&n[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null==(i=t.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null==(r=t.document)||null==(r=r.documentElement)?void 0:r.scrollLeft)||0:0}scrollY(){return this.Na("y")}scrollX(){return this.Na("x")}}var sn=t=>xr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class nn{constructor(t,e,i,r){this.Te=t=>{var e=this.qa();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ja(this._instance)};this.Ba.register({[Ve]:i})}},this._instance=t,this.Ha=e,this.Ba=i,this.ja=r||sn,this.Ha.onSessionId(this.Te)}qa(){return this.Ba.props[Ve]}getSetOnceProps(){var t,e=null==(t=this.qa())?void 0:t.props;return e?"r"in e?Er(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return pi(mi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+w(i)]=e})),t}}class on{on(t,e){return this.za[t]||(this.za[t]=[]),this.za[t].push(e),()=>{this.za[t]=this.za[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.za[t]||[])i(e);for(var r of this.za["*"]||[])r(t,e)}constructor(){this.za={}}}var an=pe("[SessionId]"),hn=864e5;class ln{on(t,e){return this.Ua.on(t,e)}constructor(t,e,i){var r;if(this.Wa=null,this.Va=null,this.Ga=[],this.Za=void 0,this.Qa=!1,this.Ua=new on,this.Ja=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===si)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Ba=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.Ka=void 0,this._sessionActivityTimestamp=null,this.Ya=e||Ri,this.Xa=i||Ri;var s=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*G(this.mn.session_idle_timeout_seconds||1800,60,36e3,an.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+s+"_window_id",this.il="ph_"+s+"_primary_window_exists",this.rl()){var n=Yi.ui(this.el),o=Yi.ui(this.il);n&&!o?this.Ie=n:Yi.oi(this.el),Yi.ni(this.il,!0)}null!=(r=this.mn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return O(this.Ga)&&(this.Ga=[]),this.Ga.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ga=this.Ga.filter((e=>e!==t))}}rl(){return"memory"!==this.mn.persistence&&!this.Ba.Eo&&Yi.ii()}sl(t){t!==this.Ie&&(this.Ie=t,this.rl()&&Yi.ni(this.el,t))}ol(){return this.Ie?this.Ie:this.rl()?Yi.ui(this.el):null}al(t){var e=this.Wa;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}ll(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Bt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Bt=t,s&&!r||s&&this.al(e)||(this.Wa=e,this.Ba.register({[Oe]:[e,t,i]}))}ul(){var t,e=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}hl(){this.ul()?this.Ba.refreshKey(Oe):(this.Ba.flush(),this.Ba.load())}dl(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wa){this.hl();var e=this.vl();e[1]===this.Bt&&e[2]===this._sessionStartTimestamp&&(this.Wa=this._sessionActivityTimestamp,this.Ba.register({[Oe]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ba.flush())}}cl(){var t=this.vl()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}fl(t){return this.hl(),this.Ja(t,this.cl())}vl(){var t=this.Ba.props[Oe];return k(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wa=null,this.Ka=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void an.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void an.error("Invalid sessionID in bootstrap",t)}}(t);return!O(i)&&(e?this.Ka={sessionId:t,sessionStartTimestamp:i}:this.ll(t,(new Date).getTime(),i),!0)}destroy(){this.Qa=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Za&&t&&(t.removeEventListener(li,this.Za,{capture:!1}),this.Za=void 0),this.Ga=[]}nl(){this.Za=()=>{this.dl(),this.rl()&&Yi.oi(this.il)},yi(t,li,this.Za,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.mn.cookieless_mode===si)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Bt;if(i)this.Va=r;else if(D(this.Va)||this.Va>r||r-this.Va>=1e3){var n,o;null==(n=(o=this.Ba).syncCookieProperties)||n.call(o),this.Va=r}var a=this.vl(),h=a[1],l=a[2],u=!O(s)&&h!==s,d=this.cl(),v=this.ol(),c=this.Ka,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>hn),p=c?_:U(l)&&Math.abs(r-l)>hn,f=!1,g=u,m=!h||!!c,w=h,b=!m&&!t&&this.Ja(r,d);if(b){(b=this.fl(r))||an.info("cross-tab refresh kept the session alive",{sessionId:h});var y=this.vl();h=y[1],l=y[2]}if(m||b||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Ya(),v=this.Xa(),an.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.Ka=void 0,f=!0}else v||(v=this.Xa(),f=!0),(g=g||h!==w)&&(an.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=U(d)&&t&&!p?d:r,S=U(l)?l:(new Date).getTime();this.sl(v),this.ll(h,E,S),t||this.tl();var T={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ga.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}tl(){this.Qa||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qa)if(this.fl((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.Ua.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}function un(){return(un=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return C(r)&&r.length>0?r:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function dn(t,e,i){return lr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var vn="custom",cn="i.posthog.com",_n=/^\/static\//,pn=["/s/","/e/","/i/"];class fn{constructor(t){this.gl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+cn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.gl[this.apiHost]||(this.gl[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":vn),this.gl[this.apiHost]}ml(t){if(_n.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}yl(t){var e=ur(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}bl(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ur(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&pn.some((t=>0===e.indexOf(t)))){var a=this.yl(r);if(a){var h,l=this.apiHost,u=this._l;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this._l=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this._l,i=this.yl(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.bl(t,e,this.uiHost+e);if("flags"===t)return this.bl(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ml(e);if(i)return this.bl(t,e,""+i+e)}if(this.region===vn)return this.bl(t,e,this.apiHost+e);var r=cn+e;switch(t){case"assets":return this.bl(t,e,"https://"+this.region+"-assets."+r);case"api":return this.bl(t,e,"https://"+this.region+"."+r)}}}var gn=pe("[Surveys]"),mn={ignoreConditions:!1,ignoreDelay:!1,displayType:Yr.Popover},wn=pe("[PostHog ExternalIntegrations]"),bn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class yn{constructor(t){this._instance=t}Ys(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return wn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ys(bn[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class $n{constructor(t,e){this.A=t,this.Ns=e,this.wl=new Map,this.Os=!1}add(t){var e=this;return _((function*(){if(e.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.wl.set(t.name,t);try{var i=t.setup(e.Ns);i&&(yield i)}catch(i){var r=e.wl.get(t.name)===t;r&&e.wl.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var e of(this.wl.clear(),t))this.kl(e)}}kl(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,(e=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class xn{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);O(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var En="extensionsRemoteConfig";class Sn{constructor(t){this.Os=!1,this.instance=t,this.A=_e,this.Sl=t.xl,this.kv=new xn(t),this.onEvent=t=>Kr(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Os)return Kr((()=>{}));var e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.Cl.on(En,e);return this.Sl&&e(this.Sl),Kr(i)},this.Tl=new $n(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(xe))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(xe);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Kr(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(En,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?js(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?b.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var Tn,kn={},Rn=0,Pn=()=>{},In='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',On="Surveys module not available",Cn="sanitize_properties is deprecated. Use before_send instead",An="Invalid value for property_denylist config: ",Dn=/^[A-Za-z0-9_-]{1,400}$/,Mn=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Nn=["token","distinct_id",ti],Un="posthog",Fn=!Us&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),Bn=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Ln=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:bi(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&C(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){_e.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ai,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Qs},error_tracking:{},_onCapture:Pn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Xi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Bn(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},jn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],zn=t=>{var e={};for(var i of jn){var r=i[0],s=i[1];O(t[r])||(e[s]=t[r])}var n=fi({},e,t),o=t.__preview_external_dependency_versioned_paths;return O(o)||(O(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),C(o)&&O(t.asset_host)&&(n.asset_host=o)),k(t.property_blacklist)&&(O(t.property_denylist)?n.property_denylist=t.property_blacklist:k(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(An+t.property_denylist)),n};class qn{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Hn{El(t){if(t){var e=this.wl.indexOf(t);-1!==e&&this.wl.splice(e,1)}}Rl(t,e){return this.El(t),this.wl.push(e),null==e.initialize||e.initialize(),e}Pl(){return this.config.cookieless_mode===si||this.config.cookieless_mode===ri&&this.consent.isRejected()}Al(){if(!(this.Fl||this.config.reuseAnonymousId||this.config.segment||this.Pl())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Ol||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===Ze){var t=this.persistence;if(t){this.Dl()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Ze){var i=this.config.get_device_id(Ri());this.register({distinct_id:i,$device_id:i}),t.set_property(We,ni)}this.$l()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new qn,this.Nl=!1,this.version=v.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new on,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ln(),this.SentryIntegration=rr,this.sentryIntegration=t=>function(t,e){var i=ir(t,e);return{name:er,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new rn(this),this.pageViewManager=new sr(this),this.rateLimiter=new es(this),this.requestRouter=new fn(this),this.consent=new Ki(this),this.externalIntegrations=new yn(this);var e=null!==(t=Hn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=C(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=C(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>_e.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Un){var r,s=null!==(r=kn[i])&&void 0!==r?r:new Hn;return s._init(t,e,i),kn[i]=s,kn[Un][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n,o;void 0===i&&(i={});var a,h=C(e)?e.trim():"";if(!h)return _e.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ln(i.defaults),i.debug=this.Vl(i.debug),this.Gl=i,this.Zl=[],i.person_profiles?this.Ul=i.person_profiles:i.process_person&&(this.Ul=i.process_person);var l=Ln(i.defaults),u=zn(i),d=fi({},l,u,{name:r,token:h});P(l.rageclick)&&P(u.rageclick)&&(d.rageclick=fi({},l.rageclick,u.rageclick)),P(l.session_recording)&&P(u.session_recording)&&(d.session_recording=fi({},l.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fr.GZipJS;var c=this.Dl();if(this.persistence=new Ur(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ur(p({},this.config,{persistence:"sessionStorage"}),c,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Yi.ii()){var _=Yi.ui(this.jl);k(_)&&_.forEach((t=>{C(t)&&this.ql.add(t)}))}else Yi.oi(this.jl);var f=p({},this.persistence.props),g=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ql=new Zs((t=>this.Jl(t)),this.config.request_queue_config),this.Kl=new en(this),this.__request_queue=[];var m=this.Pl();m||(this.sessionManager=new ln(this),this.sessionPropsManager=new nn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(m)}),0)):(_e.info("Initializing extensions synchronously"),this.tu(m)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&_e.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Ol=!!w&&!A(w),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var b=i.bootstrap.distinctID,y=this.get_distinct_id(),x=this.persistence.get_property(We);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&x===ni)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&x===oi)_e.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 E=this.config.get_device_id(Ri()),S=i.bootstrap.isIdentifiedID?E:b;this.persistence.set_property(We,i.bootstrap.isIdentifiedID?oi:ni),this.register({distinct_id:b,$device_id:S})}}if(m)this.register_once({distinct_id:Ze,$device_id:null},"");else if(!this.get_distinct_id()){var T=this.config.get_device_id(Ri());this.register_once({distinct_id:T,$device_id:T},""),this.persistence.set_property(We,ni)}return yi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?tr(this,(()=>this.eu())):this.eu(),R(this.config._onCapture)&&this.config._onCapture!==Pn&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&_e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return un.apply(this,arguments)}().then((t=>{t&&this.register({[Ee]:t})})).catch(Pn),this}iu(t){var e=t;return C(e.name)&&R(e.setup)}ru(t,e){this.iu(t)?e.push((()=>{this.nu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{_e.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.wl.push(t)}Xl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Hn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.su)||r.call(this),this.su=void 0,this.featureFlags=new o(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}tu(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Hn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.wl.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.wl.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.wl.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.wl.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.wl.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.ru(this.autocapture=new l.autocapture(this),u),l.surveys&&this.ru(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.ru(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this),u),l.metrics&&this.wl.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.wl.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.wl.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.wl.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.wl.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Qi)),l.toolbar&&this.wl.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.wl.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.wl.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ou){var t=this.ou;this.ou=void 0,this.wl.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.au(u,h)}au(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.au(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){_e.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ei]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ii]:r}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+r+"ms)")}fa(t){var e;if(!r||!r.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ou=t),this.xl=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=m(s.supportedCompression,Fr.GZipJS)?Fr.GZipJS:m(s.supportedCompression,Fr.Base64)?Fr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:ai}),null==(e=this.lu)||e.handleRemoteConfig(t),this.wl.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.uu(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Pl())&&this.hu()}),1),this.du=new rs(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ql)||t.enable())}_dom_loaded(){this.is_capturing()&&_i(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(di),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Ql)||r.unload(),null==(s=this.Kl)||s.unload()):this.vu()&&this.capture(di,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?Fn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(O(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&O(s.compression)&&s.data&&(s.compression=Fr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(k(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),k(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ks(s.url,s.method,s.compression,s.timestampMode);var v=Xs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){Vs(t)?_e.warn(t):_e.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Fr.GZipJS&&h&&"undefined"!=typeof Promise&&!Bs?Gs(s).then((t=>{_(t)})).catch((e=>{if(le(e))return Bs=!0,void _(p({},s,{compression:void 0,url:Ks(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return le(t)||e===oe})(e)&&(Bs=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){Rn++;try{var e,i=[],r=[],s=[];_i(t,(t=>{if(t)if(k(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){_e.error("Error executing queued PostHog call",t,e)}else k(t)&&"alias"===e?i.push(t):k(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)}));var n=function(t,e){_i(t,(function(t){try{if(k(t[0])){var i=e;pi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){_e.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Rn--}}push(t){if(Rn>0&&k(t)&&C(t[0])){var e=Hn.prototype[t[0]];R(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(ke);return C(e)&&Mn.test(e)?{value:e,delivered:!1}:P(e)&&C(e.value)&&Mn.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}fu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(ke);var s=this.cu();if(!r){if(i)return C(e)&&Mn.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[ke]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(ke);if(C(t)&&Dn.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[ke]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(ke)}}pu(t){if(this.persistence){this.persistence.refreshKey(ke);var e=this.cu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[ke]:{value:t,delivered:!0}})}}capture(t,e,i){var r,s,n,o,a,h,l,u,d,v;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!O(t)&&C(t)){this.Ll();var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var _=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){var f;null!=e&&e.$current_url&&!C(null==e?void 0:e.$current_url)&&(_e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||_e.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&&(f=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 g=new Date,m=(null==i?void 0:i.timestamp)||g,w=ee(null==i?void 0:i.uuid,Ri),b={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},m,w)};t===ui&&this.config.__preview_capture_bot_pageviews&&c&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),_&&(b.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var y="$feature_flag_called"===t&&!1===b.properties.$feature_flag_has_experiment&&!0===this.get_property(Fe);(null==i?void 0:i.$set)&&!y&&(b.$set=null==i?void 0:i.$set);var x=P(null==e?void 0:e.$set)?e.$set:void 0,E=!(null==i||!i.$set)&&Te in i.$set,S=E||!!x&&Te in x,T=E?null==i||null==(r=i.$set)?void 0:r[Te]:null==x?void 0:x[Te],R=k(null==e?void 0:e.$unset)?e.$unset:[],A=(null==i?void 0:i.$unset)||[],D=-1!==R.indexOf(Te)||-1!==A.indexOf(Te),N=this.fu(null==(s=f)?void 0:s.fbclid,T,S,D);N&&!0===b.properties.$process_person_profile&&N.pending&&!S&&!y&&(b.$set=p({[Te]:N.value},b.$set));var U=null==i?void 0:i.$unset;U&&(b.$unset=U);var F,B,L,j=y?void 0:this.mu(null==i?void 0:i.$set_once,t!==ci,t===vi);if(j&&(b.$set_once=j),null!=i&&i._noTruncate||(l=this.config.properties_string_max_length,u=b,d=t=>C(t)?t.slice(0,l):t,v=new Set,b=function t(e,i){if(e!==Object(e))return d?d(e):e;if(!v.has(e)){var r;if(v.add(e),k(e))r=[],_i(e,(e=>{r.push(t(e))}));else{var s={};pi(e,((e,i)=>{v.has(e)||(s[i]=t(e,i))})),r=s}return r}}(u)),b.timestamp=m,O(null==i?void 0:i.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=g),y&&(b.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ne.forEach(r),e.forEach(r),i}(b.properties,Nn)),t===Vr.DISMISSED||t===Vr.SENT){var z=null==e?void 0:e[Jr.SURVEY_ID],q=null==e?void 0:e[Jr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){gn.error("Failed to persist survey seen state",t)}})({id:z,current_iteration:q}),b.$set=p({},b.$set,{[(F={id:z,current_iteration:q},B=t===Vr.SENT?"responded":"dismissed",L="$survey_"+B+"/"+F.id,F.current_iteration&&F.current_iteration>0&&(L="$survey_"+B+"/"+F.id+"/"+F.current_iteration),L)]:!0})}else t===Vr.SHOWN&&(b.$set=p({},b.$set,{[Jr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Qr.SHOWN){var H=null==e?void 0:e[Zr.TOUR_TYPE];H&&(b.$set=p({},b.$set,{[Zr.TOUR_LAST_SEEN_DATE+"/"+H]:(new Date).toISOString()}))}var G=p({},b.properties.$set,b.$set);if(I(G)||this.setPersonPropertiesForFlags(G),!M(this.config.before_send)){var W=this.ns(b);if(!W)return;(b=W).uuid=ee(b.uuid,Ri)}var V=null!==(n=null==(o=b.$set)?void 0:o[Te])&&void 0!==n?n:P(null==(a=b.properties)?void 0:a.$set)?b.properties.$set[Te]:void 0,J=null!=N&&N.pending&&V===N.value?N.value:void 0;this.Cl.emit("eventCaptured",b);var Y=null!==(h=null==i?void 0:i._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),K=p({method:"POST",url:Y,data:b,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(Y)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},null!=i&&i.transport?{transport:i.transport}:{},J?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.pu(J)}}:{});return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly||J?this.Jl(K):this.Ql.enqueue(K),b}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.lu)?void 0:e.getExtension(t)}nu(){var t;return null!==(t=this.lu)&&void 0!==t?t:this.lu=new Sn(this)}Ml(t){this.Bl.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Bl.indexOf(t);-1!==i&&this.Bl.splice(i,1)}}}yu(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(We)===ni&&(null==(r=this.sessionPersistence)||r.clear(),this.ql.clear(),this.bu()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.yu();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Pl()&&(u[ti]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!C(u.distinct_id)&&!N(u.distinct_id)||A(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[..._r,...i||[]]:[],_=function(t){for(var e=0;Qt.length>e;e++){var i=Qt[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="u">typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};O(r)||(m.detectGoogleSearchApp=r);var w={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,y=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;O(b)||(w.userAgentDataPlatform=b),O(y)||(w.maxTouchPoints=y),O(x)||(w.screenWidth=x),O(E)||(w.screenHeight=E),O(S)||(w.devicePixelRatio=S);var T,k,P,I,C,A,D,M,N=fi(mi({$os:p,$os_version:f,$browser:Yt(l,navigator.vendor,g,m),$device:Zt(l),$device_type:(k=l,P=w,M=Zt(k),M===X||M===K||"Kobo"===M||"Kindle Fire"===M||M===kt?Y:M===ft||M===mt||M===gt||M===Et?"Console":M===Z?"Wearable":M?W:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(I=null==P?void 0:P.maxTouchPoints)&&void 0!==I?I:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(A=null==P?void 0:P.screenHeight)&&void 0!==A?A:0)/(null!==(D=null==P?void 0:P.devicePixelRatio)&&void 0!==D?D:1)?W:Y:"Desktop"),$timezone:Sr(),$timezone_offset:Tr()}),{$current_url:vr(n?re(null==s?void 0:s.href):null==s?void 0:s.href,c,fr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:Xt(l,navigator.vendor,g,m),$browser_language:br(),$browser_language_prefix:(T=br(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=v.SDK_DIST_CHANNEL),N}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&fi(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&fi(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Kl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===vn&&(u.$lib_custom_api_host=this.config.api_host),c=e!==ui||a?e!==di||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=fi(u,c),e===ui&&r&&(u.title=r.title),!O(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),y=this.sessionPersistence.properties(),x=u.$groups,E=b.$groups;P(x)&&!I(x)&&(u.$groups=p({},P(E)?E:{},x)),pi(["$referrer","$referring_domain"],(t=>{t in b&&delete y[t]}));var S={};if(this.Bl.length>0)for(var T of this.Bl.slice())try{fi(S,T())}catch(t){_e.error("Failed to produce browser extension event properties",t)}(u=fi({},_,b,y,p({},S,u))).$is_identified=this._isIdentified(),k(this.config.property_denylist)?pi(this.config.property_denylist,(function(t){delete u[t]})):_e.error(An+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var D=this.config.sanitize_properties;D&&(_e.error(Cn),u=D(u,e));var M=this._u();return u.$process_person_profile=M,M&&!a&&this.wu("_calculate_event_properties"),u}mu(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this._u())return t;if(this.Nl&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=fi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(_e.error(Cn),o=a(o,"$set_once")),e&&(this.Nl=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.yu(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.ql.add(t))),this.bu()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.ql.delete(t),this.bu()}ku(t,e){this.register({[t]:e})}Yl(){this.ql.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Eo||!Yi.ii())Yi.oi(this.jl);else{var e=[];this.ql.forEach((t=>e.push(t))),e.length>0?Yi.ni(this.jl,e):Yi.oi(this.jl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Cl.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:On}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:On})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:On})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=mn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:On}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:On})}Su(t){return!t||A(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t===Ze?(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(N(t)&&(t=t.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Su(t)&&this.wu("posthog.identify")){this.Ll();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.yu(!1),o=this.persistence.Zo(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(xe)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(Se)&&(this.unregister(Se),this.register({distinct_id:t}));var l=(this.persistence.get_property(We)||ni)===ni,u=t!==h,d=!u&&l;if(u&&l){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:h};this.persistence.set_property(We,oi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture(vi,c,{$set:e||{},$set_once:i||{}}),this.Wl=dn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(We,oi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture("$set",{$set:_,$set_once:p}),this.Wl=dn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(qe)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Yo(a)}}}setPersonProperties(t,e){if((t||e)&&this.wu("posthog.setPersonProperties")){var i=dn(this.get_distinct_id(),t,e);this.Wl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Wl=i):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(k(t)?t:[t]).filter((t=>C(t)&&t.length>0));0!==i.length&&this.wu("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Wl=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.yu();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),(n||i)&&this._u()){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(ci,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.wu("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=F(t)?t:null==t?void 0:t.resetDeviceID,i=F(t)||null==t?void 0:t.bootstrap;this.xu(e,!1,i)}xu(t,e,i){var r,s,n;if(void 0===e&&(e=!1),_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Gl)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(xe),h=this.get_property(Ee),l=this.get_property(Ie),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Zo?void 0:n.Zo(),v=!1;try{var c,_,f,g,m,w,b,y,x,E,S,T,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.ql.clear(),this.bu(),O(l)||null==(E=this.persistence)||E.register({[Ie]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(b=this.metrics)||b.reset(),null==(y=this.persistence)||y.set_property(We,ni),null==(x=this.sessionManager)||x.resetSessionId(),this.Wl=null,this.config.cookieless_mode===si)this.register_once({distinct_id:Ze,$device_id:null},"");else{var R=this.config.get_device_id(Ri());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||O(h)||this.register({[Ee]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Pl()||(null==(k=this.persistence)||k.set_property(We,i.isIdentifiedID?oi:ni),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(O(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var I;d&&(null==(I=this.persistence)||null==I.Yo||I.Yo(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.nu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Ql)||s.unload(),null==(n=e.Kl)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){_e.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else _e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.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(t,e){return t===this.get_property(ye)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(O(e)&&(e=this.get_distinct_id()),t!==e?(this.ku(Se,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(P(t)){var i,r,s,n,o,a,h,l,u,d,c,_;fi(this.config,zn(t));var f=this.Dl();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ur(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Vl(this.config.debug);F(m)&&(this.config.debug=m),F(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Mi.ii()&&Mi.ni("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Mi.ii()&&Mi.oi("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.$l(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&tr(this,Pn,!1)}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Hn.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Un;return e!==Un&&(e=Un+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(We))===oi||(null==(e=this.sessionPersistence)?void 0:e.get_property(We))===oi}_u(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ai&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Se])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Qe]))}vu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(t){return"never"===this.config.person_profiles?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Al(),this.ku(Qe,!0),!0)}Dl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ri)}$l(){var t,e,i,r,s,n=this.Dl();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(t=this.persistence)?void 0:t.Eo)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.Eo)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.ql.clear(),this.bu()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==si){if(this.Pl()){var i,r,s,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new ln(this),this.pageViewManager=new sr(this),this.persistence&&(this.sessionPropsManager=new nn(this,this.sessionManager,this.persistence));var h,l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Hn.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Rl(this.sessionRecording,new l(this)),this.xl&&(null==(h=this.sessionRecording)||null==h.onRemoteConfig||h.onRemoteConfig(this.xl)))}var u,d;this.consent.optInOut(!0),this.$l(),this.uu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ri&&(null==(u=this.surveys)||u.loadIfEnabled()),(O(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else _e.warn(In)}opt_out_capturing(){if(this.config.cookieless_mode!==si){var t,e,i=this.config.cookieless_mode===ri?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ri&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===ri&&(this.register({distinct_id:Ze,$device_id:null}),this.El(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else _e.warn(In)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===si||(this.config.cookieless_mode===ri?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&g(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>g(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}hu(){r&&("visible"===r.visibilityState?this.Hl||(this.Hl=!0,this.capture(ui,{title:r.title},{send_instantly:!0}),this.zl&&(r.removeEventListener(hi,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),yi(r,hi,this.zl)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var t=this.Gl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(_e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!M(t[e]),o=i in t&&!M(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}ns(t){var e;if(M(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=k(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),M(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?_e.warn(o+". This can cause unexpected behavior."):_e.info(o),null}s.properties&&!I(s.properties)||_e.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return _e.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&M(s.properties[a]))return _e.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.io)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Vl(t){var e=F(t)&&!t,i=Mi.ii()&&"true"===Mi.ai("ph_debug");return!e&&(!!i||t)}}Hn.__defaultExtensionClasses={},Hn.Mu={trace:Tn=()=>{},debug:Tn,info:Tn,warn:Tn,error:Tn,fatal:Tn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=gi(t.prototype[e[i]])}(Hn,["identify"]);var Gn=function(){v.SDK_DIST_CHANNEL="npm";var e=kn[Un]=new Hn;return function(){function e(){e.done||(e.done=!0,Fn=!1,pi(kn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():yi(r,"DOMContentLoaded",e,{capture:!1}):t&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Fr as Compression,Xr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Yr as DisplaySurveyType,Hn as PostHog,Qr as ProductTourEventName,Zr as ProductTourEventProperties,Vr as SurveyEventName,Jr as SurveyEventProperties,Br as SurveyEventType,jr as SurveyPosition,Gr as SurveyQuestionBranchingType,Hr as SurveyQuestionType,Wr as SurveySchedule,zr as SurveyTabPosition,qr as SurveyType,Lr as SurveyWidgetType,Gn as default,Gn as posthog,ss as severityLevels};
|
|
1
|
+
var t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],g=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return f.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function m(t,e){return-1!==t.indexOf(e)}var w=function(t){return t.replace(/^\$/,"")},y=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),b=["$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"],x=["token"],E=Object.prototype,S=E.hasOwnProperty,T=E.toString,k=Array.isArray||function(t){return"[object Array]"===T.call(t)},R=t=>"function"==typeof t,P=t=>t===Object(t)&&!k(t),I=t=>{if(P(t)){for(var e in t)if(S.call(t,e))return!1;return!0}return!1},O=t=>void 0===t,C=t=>"[object String]"==T.call(t),A=t=>C(t)&&0===t.trim().length,D=t=>null===t,M=t=>O(t)||D(t),N=t=>"[object Number]"==T.call(t)&&t==t,U=t=>N(t)&&t>0,F=t=>"[object Boolean]"===T.call(t),B=t=>t instanceof FormData,L=t=>m(b,t),j=t=>m(x,t),z=[!0,"true",1,"1","yes"],q=t=>m(z,t),H=[!1,"false",0,"0","no"];function G(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),N(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),G(null!=s?s:i,e,i,r))}var W="Mobile",V="iOS",J="Android",Y="Tablet",K=J+" "+Y,X="iPad",Q="Apple",Z=Q+" Watch",tt="Safari",et="BlackBerry",it="Samsung",rt=it+"Browser",st=it+" Internet",nt="Chrome",ot=nt+" OS",at=nt+" "+V,ht="Internet Explorer",lt=ht+" "+W,ut="Opera",dt=ut+" Mini",vt="Edge",ct="Microsoft "+vt,_t="Firefox",pt=_t+" "+V,ft="Nintendo",gt="PlayStation",mt="Xbox",wt=J+" "+W,yt=W+" "+tt,bt="Windows",$t=bt+" Phone",xt="Nokia",Et="Ouya",St="Generic",Tt=St+" "+W.toLowerCase(),kt=St+" "+Y.toLowerCase(),Rt="Konqueror",Pt="Oculus Browser",It="Vivaldi",Ot="Yandex",Ct="Whale",At="DuckDuckGo",Dt="Pale Moon",Mt="Waterfox",Nt="Brave",Ut="Claude",Ft="Codex",Bt="ChatGPT",Lt="Google Search App",jt="(\\d+(\\.\\d+)?)",zt=new RegExp("Version/"+jt),qt=new RegExp("("+Ut+"|"+Ft+"|"+Bt+")\\/"+jt),Ht=new RegExp(mt,"i"),Gt=new RegExp(gt+" \\w+","i"),Wt=new RegExp(ft+" \\w+","i"),Vt=new RegExp(et+"|PlayBook|BB10","i"),Jt={"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"},Yt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Nt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&m(t,"GSA/")?Lt:m(t," OPR/")&&m(t,"Mini")?dt:m(t," OPR/")?ut:Vt.test(t)?et:m(t,"IE"+W)||m(t,"WPDesktop")?lt:m(t,"OculusBrowser")?Pt:m(t,rt)?st:m(t,vt)||m(t,"Edg/")?ct:m(t,It+"/")?It:m(t,"YaBrowser/")?Ot:m(t,Ct+"/")?Ct:m(t,At+"/")||m(t,"Ddg/")?At:m(t,Ut+"/")?Ut:m(t,Ft+"/")?Ft:m(t,Bt+"/")?Bt:m(t,"FBIOS")?"Facebook "+W:m(t,"UCWEB")||m(t,"UCBrowser")?"UC Browser":m(t,"CriOS")?at:m(t,"CrMo")||m(t,nt)?nt:m(t,J)&&m(t,tt)?wt:m(t,"FxiOS")?pt:m(t.toLowerCase(),Rt.toLowerCase())?Rt:m(t,Nt+"/")?Nt:((t,e)=>e&&m(e,Q)||function(t){return m(t,tt)&&!m(t,nt)&&!m(t,J)}(t))(t,e)?m(t,W)?yt:tt:m(t,"PaleMoon/")?Dt:m(t,Mt+"/")?Mt:m(t,_t)?_t:m(t,"MSIE")||m(t,"Trident/")?ht:m(t,"Gecko")?_t:"")},Kt={[lt]:[new RegExp("rv:"+jt)],[ct]:[new RegExp(vt+"?\\/"+jt)],[nt]:[new RegExp("("+nt+"|CrMo)\\/"+jt)],[at]:[new RegExp("CriOS\\/"+jt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+jt)],[tt]:[zt],[yt]:[zt],[ut]:[new RegExp("(Opera|OPR)\\/"+jt)],[_t]:[new RegExp(_t+"\\/"+jt)],[pt]:[new RegExp("FxiOS\\/"+jt)],[Rt]:[new RegExp("Konqueror[:/]?"+jt,"i")],[et]:[new RegExp(et+" "+jt),zt],[wt]:[new RegExp("android\\s"+jt,"i")],[st]:[new RegExp(rt+"\\/"+jt)],[Pt]:[new RegExp("OculusBrowser\\/"+jt)],[It]:[new RegExp(It+"\\/"+jt)],[Ot]:[new RegExp("YaBrowser\\/"+jt)],[Ct]:[new RegExp(Ct+"\\/"+jt)],[Nt]:[new RegExp(Nt+"\\/"+jt)],[Ut]:[qt],[Ft]:[qt],[Bt]:[qt],[At]:[new RegExp("(DuckDuckGo|Ddg)\\/"+jt)],[Dt]:[new RegExp("PaleMoon\\/"+jt)],[Mt]:[new RegExp(Mt+"\\/"+jt)],[Lt]:[new RegExp("GSA\\/"+jt)],[ht]:[new RegExp("(rv:|MSIE )"+jt)],Mozilla:[new RegExp("rv:"+jt)]},Xt=function(t,e,i,r){var s=Yt(t,e,i,r),n=Kt[s];if(O(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Qt=[[new RegExp(mt+"; "+mt+" (.*?)[);]","i"),t=>[mt,t&&t[1]||""]],[new RegExp(ft,"i"),[ft,""]],[new RegExp(gt,"i"),[gt,""]],[Vt,[et,""]],[new RegExp(bt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[$t,""];if(new RegExp(W).test(e)&&!/IEMobile\b/.test(e))return[bt+" "+W,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Jt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[bt,r]}return[bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[V,[t[3],t[4],t[5]||"0"].join(".")]:[V,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+J+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+J+")","i"),t=>t&&t[2]?[J,[t[2],t[3],t[4]||"0"].join(".")]:[J,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ot,""]],[/Linux|debian/i,["Linux",""]]],Zt=function(t){return Wt.test(t)?ft:Gt.test(t)?gt:Ht.test(t)?mt:new RegExp(Et,"i").test(t)?Et:new RegExp("("+$t+"|WPDesktop)","i").test(t)?$t:/iPad/.test(t)?X:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Z:Vt.test(t)?et:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(xt,"i").test(t)?xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(W).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?J:K:new RegExp("(pda|"+W+")","i").test(t)?Tt:new RegExp(Y,"i").test(t)&&!new RegExp(Y+" pc","i").test(t)?kt:""},te=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ee(t,e){return"string"==typeof(i=t)&&te.test(i)?t:e();var i}function ie(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function re(t){return t?t.split("#")[0]:t}var se,ne=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],oe="NativeGzipValidationError",ae=t=>t.length>=2&&31===t[0]&&139===t[1],he=(t,e)=>t===y.GZipJS||e===y.GZipJS||"gzip"===e,le=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ue=t=>{throw ie(oe,"Native gzip produced invalid output: "+t)},de=function(){var t=_((function*(t,e){18>t.size&&ue("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ae(i)&&8===i[2]||ue("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(se)return se;se=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;se[t]=e>>>0}return se})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&ue("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&ue("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function ve(){return ve=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield de(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),ve.apply(this,arguments)}var ce=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={q(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!O(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.q("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>ce(e+" "+t,i)};return s},_e=ce("[PostHog.js]"),pe=_e.createLogger,fe=pe("[ExternalScriptsLoader]"),ge=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},me=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ge(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ge(e))return me(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},we={},ye=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=we[s];if("fallback"===r&&n){if(ge(n))return void me(t,n,i);delete we[s]}me(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ye(t,e);we[s]=a;var h=ge(s);null==h||null==(o=h.parentNode)||o.removeChild(h),me(t,a,i)}else i(void 0,n)}:i)}else me(t,ye(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");me(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);me(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.427.2",v.LIB_NAME="web";var be="$people_distinct_id",$e="distinct_id",xe="$device_id",Ee="$device_model",Se="__alias",Te="$fbc",ke="$fbc_persistence",Re="__timers",Pe="$dead_clicks_enabled_server_side",Ie="$session_recording_remote_config",Oe="$sesid",Ce="$session_is_sampled",Ae="$enabled_feature_flags",De="$active_feature_flags",Me="$feature_flag_details",Ne="$feature_flag_payloads",Ue="$feature_flag_request_id",Fe="$minimal_flag_called_events",Be="$stored_person_properties",Le="$stored_group_properties",je="$groups",ze="$surveys_loaded_at",qe="$flag_call_reported",He="$feature_flag_errors",Ge="$feature_flag_evaluated_at",We="$user_state",Ve="$client_session_props",Je="$capture_rate_limit",Ye="$initial_campaign_params",Ke="$initial_referrer_info",Xe="$initial_person_info",Qe="$epp",Ze="$posthog_cookieless",ti="$cookieless_mode",ei="$sdk_debug_extensions_init_method",ii="$sdk_debug_extensions_init_time_ms",ri="on_reject",si="always",ni="anonymous",oi="identified",ai="identified_only",hi="visibilitychange",li="beforeunload",ui="$pageview",di="$pageleave",vi="$identify",ci="$groupidentify";function _i(t,e){k(t)&&t.forEach(e)}function pi(t,e){if(!M(t))if(k(t))t.forEach(e);else if(B(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)S.call(t,i)&&e(t[i],i)}var fi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},gi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(t)}}},mi=function(t){var e={};return pi(t,(function(t,i){(C(t)&&t.length>0||N(t))&&(e[i]=t)})),e};var wi=["herokuapp.com","vercel.app","netlify.app"];function yi(t){var e=null==t?void 0:t.hostname;if(!C(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of wi)if(i===r)return!1;return!0}function bi(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var $i=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return N(t)&&isFinite(t)&&Math.floor(t)===t});class xi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,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 xi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new xi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Ei{generate(){var t=this.generateOrAbort();if(!O(t))return t;this.Kr=0;var e=this.generateOrAbort();if(O(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ti++,this.ti>4398046511103&&(this.Kr++,this.Xr())}return xi.fromFieldsV7(this.Kr,Math.trunc(this.ti/Math.pow(2,30)),this.ti&Math.pow(2,30)-1,this.ei.nextUint32())}Xr(){this.ti=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Kr=0,this.ti=0,this.ei=new ki}}var Si,Ti=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!O(t.crypto)&&crypto.getRandomValues&&(Ti=t=>crypto.getRandomValues(t));class ki{nextUint32(){return this.De.length>this.ri||(Ti(this.De),this.ri=0),this.De[this.ri++]}constructor(){this.De=new Uint32Array(8),this.ri=1/0}}var Ri=()=>Pi().toString(),Pi=()=>(Si||(Si=new Ei)).generate(),Ii="",Oi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ci=null,Ai={ii(){if(!D(Ci))return Ci;if(Ci=!1,r)try{var t="__ph_cookie_support_"+Ri();Ai.ni(t,"xyz"),Ci='"xyz"'===$i(t),Ai.oi(t)}catch(t){Ci=!1}return Ci},si(t){_e.error("cookieStore error: "+t)},ai:$i,ui(t){var e;try{e=JSON.parse(Ai.ai(t))||{}}catch(t){}return e},ni(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ii)return Ii;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ri();!Ii&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ii=o)}return Ii}(t);if(!i){var s=(t=>{var e=t.match(Oi);return e?e[0]:""})(t);s!==i&&_e.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},oi(t,e){if(null!=r&&r.cookie)try{Ai.ni(t,"",-1,e)}catch(t){return}}},Di=null,Mi={ii(){if(!D(Di))return Di;var e=!0;if(O(t))e=!1;else try{var i="__mplssupport__";Mi.ni(i,"xyz"),'"xyz"'!==Mi.ai(i)&&(e=!1),Mi.oi(i)}catch(t){e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),Di=e,e},si(t){_e.error("localStorage error: "+t)},ai(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Mi.si(t)}return null},ui(t){try{return JSON.parse(Mi.ai(t))||{}}catch(t){}return null},ni(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Mi.si(t)}return!1},oi(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Mi.si(t)}}},Ni=[Be,De,Ae,Me,Ne,Ue,Ge,He,qe],Ui=[xe,$e,Oe,Ce,Qe,Xe,ke,We],Fi=t=>t+"_cpm",Bi=["__proto__","constructor","prototype"],Li=t=>{if(!P(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Bi.indexOf(i)&&(e[i]=t[i])})),e},ji=function(t,e){void 0===e&&(e=[]);var i={};return[...Ui,...e].forEach((e=>{var r=t[e];O(r)||D(r)||""===r||(i[e]=r)})),i},zi=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},qi=(t,e)=>({p:e,f:zi(JSON.stringify(t))}),Hi=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Ai.ui(Fi(t)),r=(null==i?void 0:i.f)===zi(e)&&k(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Gi=(t,e)=>e+"|"+(Ai.ai(Fi(t))||""),Wi={},Vi={ii:()=>!0,si(t){_e.error("memoryStorage error: "+t)},ai:t=>t in Wi?Wi[t]:null,ui:t=>t in Wi?Wi[t]:null,ni:(t,e)=>(Wi[t]=e,!0),oi(t){delete Wi[t]}},Ji=null,Yi={ii(){if(!D(Ji))return Ji;if(Ji=!0,O(t))Ji=!1;else try{var e="__support__";Yi.ni(e,"xyz"),'"xyz"'!==Yi.ai(e)&&(Ji=!1),Yi.oi(e)}catch(t){Ji=!1}return Ji},si(t){_e.error("sessionStorage error: ",t)},ai(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Yi.si(t)}return null},ui(t){try{return JSON.parse(Yi.ai(t))||null}catch(t){}return null},ni(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Yi.si(t)}return!1},oi(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Yi.si(t)}}};class Ki{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===si||this.isRejected()||-1===this.consent&&this.mn.cookieless_mode===ri}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Gs(){var t=this.Zs.ai(this.Qs);return q(t)?1:m(H,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,e="localStorage"===t?Mi:Ai,i=e.ii()?e:Vi;if(!this.Js||this.Js!==i){this.Js=i;var r="localStorage"===t?Ai:Mi;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(q(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some((t=>q(t)))}}var Xi=["next","previous","prev",">","<","+","-","−","–"];pe("[Dead Clicks]");var Qi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Pe)),r=t.instance.config.capture_dead_clicks;return F(r)?r:!!P(r)||i},Zi=pe("[SegmentIntegration]");function tr(t,e,i){void 0===i&&(i=!0);var r=t.config.segment;if(!r)return e();!function(t,e,i){var r=t.config.segment;if(!r)return e();var s=r=>{var s=()=>r.anonymousId()||Ri();t.config.get_device_id=s,i&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(We,oi)),e(i?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,(i=>{r.register(((t,e)=>{"undefined"!=typeof Promise&&Promise.resolve||Zi.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,r)=>{if(!r)return i;var s=!!e&&i.event.anonymousId===e&&!i.event.userId;s||i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Zi.info("No userId set, resetting PostHog"),t.reset()),s||(e=void 0),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Zi.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var n=t.calculateEventProperties(r,i.event.properties);return i.event.properties=Object.assign({},n,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return i(t,t.event.event)},page(t){return i(t,ui)},identify(t){return i(t,vi)},screen(t){return i(t,"$screen")}}})(t,i)).then((()=>{e()}),(t=>{Zi.error("Failed to register the Segment integration",t),e()}))}),i)}var er="posthog-js";function ir(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class rr{constructor(t,e,i,r,s,n){this.name=er,this.setupOnce=function(o){o(ir(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class sr{constructor(t){this.eo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.io=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ro()}ro(){var t;this.no=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.eo)}destroy(){var t;null==(t=this.no)||t.call(this),this.no=void 0}doPageView(e,i){var r,s=this.so(e,i);return this.io={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.so(t,null==(e=this.io)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.io)?void 0:t.pageViewId}}so(t,e){var i=this.io;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(O(n)||O(o)||O(a)||O(h)||O(l)||O(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?G(o/n,0,1,_e):1,v=n>1?G(a/n,0,1,_e):1,c=h>1?G(l/h,0,1,_e):1,_=h>1?G(u/h,0,1,_e):1;r=fi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var nr=["flags","surveys"],or={[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Re]:{exposure:"hidden"},[ke]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$logs_capture_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[Pe]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[Ie]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Ce]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ae]:{exposure:"hidden",storageGroup:"flags"},[De]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags"},[Ne]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Be]:{exposure:"hidden"},[Le]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[ze]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[qe]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[je]:{exposure:"event"},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[ei]:{exposure:"event"},[ii]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},ar=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],hr=t=>{var e=or[t];if(e)return e;for(var i of ar){var r=i[1];if(0===t.indexOf(i[0]))return r}},lr=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},ur=t=>{var e=null==r?void 0:r.createElement("a");return O(e)?null:(e.href=t,e)},dr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!k(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){_e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},vr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");k(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},cr="https?://(.*)",_r=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._r],fr="<masked>",gr=["li_fat_id"];function mr(t,e){var i=pr.concat(e||[]),r={};return pi(i,(function(e){var i=dr(t,e);r[e]=i||null})),r}function wr(t){var e=function(t){return t?0===t.search(cr+"google.([^/?]*)")?"google":0===t.search(cr+"bing.com")?"bing":0===t.search(cr+"yahoo.com")?"yahoo":0===t.search(cr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!D(e)){s.$search_engine=e;var n=r?dr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function yr(){return navigator.language||navigator.userLanguage}var br="$direct";function $r(){return(null==r?void 0:r.referrer)||br}function xr(t,e,i){void 0===i&&(i=!1);var r=t?[..._r,...e||[]]:[],n=i?re(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:$r().substring(0,1e3),u:o?vr(o,r,fr):void 0}}function Er(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?re(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==br?br:null==(i=ur(r))?void 0:i.host};if(n){o.$current_url=n;var a=ur(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=mr(n);fi(o,h)}if(r){var l=wr(r);fi(o,l)}return o}function Sr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Tr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var kr={flags:Ge,surveys:ze},Rr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Pr=t=>t+"_cookie_identity_change_pending",Ir=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},Or="main",Cr=[Ae,De,Me,Ne,Ue,Ge,Fe,Be],Ar=t=>-1!==Cr.indexOf(t),Dr=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Mr=t=>{if(!t)return{};var e=JSON.parse(t);return P(e)?e:{}},Nr=(t,e)=>{pi(t,((i,r)=>{var s=hr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class Ur{constructor(e,i,r){if(void 0===r&&(r=!0),this.oo={},this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.do=!1,this.vo=new Map,this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=new Set,this.mn=e,this.bo=r,this.props={},this._o=void 0,this.wo=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Zs=this.ko(e),this.uo=this.So(e),this.load(),this.xo(),e.debug&&_e.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();bi(t,"beforeunload",s,{capture:!1}),bi(t,"pagehide",s,{capture:!1}),this.Co=e=>{if(this.ao&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.wo){if(this.uo){var i=nr.find((t=>e.key===this.To(t)));i&&this.Mo(e.key,i)}}else this.Mo(e.key,Or)},bi(t,"storage",this.Co)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var e=t[0],i=t[1],r=this.vo.get(e);if(Ar(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach((t=>s.add(t))),s.size&&this.Io(e,s)}else this.Io(e,!0)}))}onCrossTabFeatureFlagChange(t){return this.yo.add(t),()=>this.yo.delete(t)}destroy(){this.Co&&t&&(t.removeEventListener("storage",this.Co),this.Co=void 0),this.yo.clear()}Mo(t,e,i){if(void 0===i&&(i=!0),this.Eo)return!1;var r,s;try{if(s=Mi.ai(t),D(s)){var n=this.Ro(e);return n.storageValue=null,e!==Or&&(n.persisted=!1),!1}r=Mr(s)}catch(t){return!1}var o=e===Or?r:Mi.ui(this.wo);if(o&&this.Po(o))return!1;var a=this.Ao(r,e,i);return e===Or&&this.uo&&!Dr(this.Fo().main,r)||this.Oo(r,e,!0,s),a}Po(t){var e=this.props[$e],i=t[$e];return!O(e)&&!O(i)&&e!==i}Oo(t,e,i,r){var s=this.Ro(e);s.storageValue=r,e!==Or&&(s.persisted=i);try{s.fingerprint=this.Lo(t,e)}catch(t){s.fingerprint=void 0}}Ao(t,e,i){var r=!1;return Cr.forEach((i=>{var s,n=null==(s=hr(i))?void 0:s.storageGroup;if(!(e===Or&&this.uo&&n||e!==Or&&n!==e)){var o=i in t,a=this.Do(i,o?t[i]:void 0),h=this.vo.has(i)?i in this.props:o;h===i in this.props&&Dr(a,this.props[i])||(h?this.$o(i,a,!1):this.No(i,!1),r=!0)}})),r&&i&&this.yo.forEach((t=>t())),r}qo(){if(!this.ao)return!1;try{this.po=!1;var t,e=Mi.ai(this.wo),i=this.Ro(Or),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=Mr(e),this.po=!this.fo&&this.Po(t),this.po)return!1;s=this.Ao(t,Or,!1),!this.uo||Dr(this.Fo().main,t)?this.Oo(t,Or,!0,e):i.storageValue=e,r=!0}return this.uo&&nr.forEach((e=>{var i=Mi.ai(this.To(e)),n=this.Ro(e),o=t||{},a=r&&Cr.some((t=>{var i;return(null==(i=hr(t))?void 0:i.storageGroup)===e&&t in o}));if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ao(o,e,!1)||s));var h=Mr(i);s=this.Ao(h,e,!1)||s,this.Oo(h,e,!0,i)}})),s}catch(t){return!1}}Io(t,e){this.vo.set(t,e);var i=hr(t);null!=i&&i.volatile||(this.Ro((this.uo?null==i?void 0:i.storageGroup:void 0)||Or).fingerprint=void 0,this.jo(t))}Bo(){Cr.forEach((t=>this.vo.set(t,!0)))}xo(){if(this.ao)try{var t=Mi.ai(this.wo),e=Mr(t);this.Ro(Or).storageValue=t,Cr.forEach((t=>{var i,r=this.uo?null==(i=hr(t))?void 0:i.storageGroup:void 0,s=r?Mi.ai(this.To(r)):null;if(r){var n=this.Ro(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?Mr(s):e;t in this.props?this.Ho(t,o[t],this.props[t]):t in o&&this.Io(t,!0)}))}catch(t){}}Do(t,e){var i=this.vo.get(t);if(!i)return e;if(!0===i)return this.props[t];if(t===De){var r=new Set(k(e)?e:[]),s=new Set(k(this.props[t])?this.props[t]:[]);return i.forEach((t=>s.has(t)?r.add(t):r.delete(t))),Array.from(r)}var n=P(e)?p({},e):{},o=P(this.props[t])?this.props[t]:{};return i.forEach((t=>{t in o?n[t]=o[t]:delete n[t]})),n}Ho(t,e,i){if(Ar(t)){var r=this.vo.get(t);if(!0!==r){var s=e;if(this.ao)try{var n,o=this.uo?null==(n=hr(t))?void 0:n.storageGroup:void 0,a=o?this.To(o):this.wo;s=Mr(Mi.ai(a))[t]}catch(t){}var h=new Set(r||[]);if(t===De){if(!O(e)&&!k(e)||!O(s)&&!k(s)||!k(i))return void this.Io(t,!0);var l=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...l,...d]).forEach((t=>{l.has(t)!==d.has(t)&&h.add(t)})),h.forEach((t=>{u.has(t)===d.has(t)&&h.delete(t)}))}else{if(!P(i))return void(Dr(s,i)?this.vo.delete(t):this.Io(t,!0));if(!O(e)&&!P(e)||O(e)&&I(i)&&O(s))return void this.Io(t,!0);var v=P(e)?e:{},c=P(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach((t=>{t in v==t in i&&Dr(v[t],i[t])||h.add(t)})),h.forEach((t=>{t in c==t in i&&Dr(c[t],i[t])&&h.delete(t)}))}h.size?this.Io(t,h):this.vo.delete(t)}}}zo(){var t,e=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return N(e)&&e>0?e:0}Uo(t){if(this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase())if(t)try{var e=ji(t,this.mn.cookie_persisted_properties||[]),i=qi(e,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ai.ai(this.wo)||void 0;s&&Gi(this.wo,s)===r&&(this.Wo=r,this.Vo=s)}catch(t){}else try{var n=Ai.ai(this.wo)||void 0;this.Wo=n?Gi(this.wo,n):void 0,this.Vo=n}catch(t){}}syncCookieProperties(){return this.Go(this.mn)}Go(t,e){if(void 0===e&&(e=!1),this.Eo&&!e||this.do||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Ai.ai(this.wo)||void 0}catch(t){}if(!i||i===this.Vo)return!1;var r,s=Gi(this.wo,i);try{r=Li(JSON.parse(i))}catch(t){return!1}if((Ai.ai(this.wo)||void 0)!==i)return!1;this.Wo=s,this.Vo=i;var n=Hi(this.wo,i),o=[...Ui,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(O(e)||D(e)||""===e||t===We&&e!==ni&&e!==oi)&&(a[t]=!0,delete r[t])})),I(r))return!1;var h=$e in r||r[We]===ni||r[We]===oi,l=this.props,u=l[$e],d=l[We],v=fi({},l);[...Ui,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==$e&&t!==We)){var e=v[t];!n.isValid&&-1!==Ui.indexOf(t)&&(!1===e||0===e)||delete v[t]}})),this.props=fi(v,r),Cr.forEach((t=>{var e=t in this.props;t in l===e&&Dr(l[t],this.props[t])||(e?this.Ho(t,l[t],this.props[t]):this.Io(t,!0))})),!h||We in r||We in this.props||this.$o(We,ni);var c=this.props[$e],_=this.props[We];return!h||c===u&&_===d||(this.fo=!0,this.ho=!0,Yi.ni(Pr(this.wo),!0),this.No(Be),this.No(De),this.No(Ae),this.No(Me),this.No(Ne),this.No(Ue),this.No(Ge),this.No(He),this.No(qe),_===ni&&(d===oi||r[We]===ni||!O(u)&&c!==u)&&(Nr(this.props,r),this.No(Le)),_===oi?this.props.$user_id=c:delete this.props.$user_id,this.No(Se)),!0}consumeCookieIdentityChange(){var t=Pr(this.wo),e=this.ho||!!Yi.ai(t);return this.ho=!1,e&&Yi.oi(t),e}Zo(t){return void 0===t&&(t=!1),!(this.do||this.Eo&&!t||!this.mn.cookieWinsOnConflict||"localstorage+cookie"!==this.mn.persistence.toLowerCase()||(this.do=!0,0))}Qo(){this.do&&(O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),delete this.oo[Or],this.Ko(!0))}Yo(t){if(void 0===t&&(t=!0),this.do)try{t?this.Qo():O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0)}finally{this.do=!1}}isDisabled(){return!!this.Eo}ko(e){-1===Rr.indexOf(e.persistence.toLowerCase())&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Ui,...e];return p({},Mi,{ui(t){try{var e,s={};try{e=Ai.ai(t)||void 0,s=e?Li(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Mi.ai(t)||"{}");if(i){var a=Hi(t,e),h=[...Ui,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];D(e)||""===e||t===We&&e!==ni&&e!==oi||(l[t]=e)}));var u=$e in l||l[We]===ni||l[We]===oi;if(Object.keys(l).length>0){var d,v=o[$e],c=null!==(d=o[We])&&void 0!==d?d:ni;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==$e&&t!==We)){var e=o[t];!a.isValid&&-1!==Ui.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||We in s||We in o||(o[We]=ni),!u||($e in l?l[$e]:o[$e])===v&&(We in l?l[We]:o[We])===c||(Ni.forEach((t=>delete o[t])),l[We]===oi&&$e in l?o.$user_id=l[$e]:delete o.$user_id,l[We]!==oi&&(delete o[je],delete o[Le]),delete o.__alias)}n=fi(o,l)}else n=fi(s,o);return Mi.ni(t,n),n}catch(t){}return null},ni(t,r,s,n,o,a){var h=Mi.ni(t,r,void 0,void 0,a);try{var l=ji(r,e);if(Object.keys(l).length){if(i){var u=Fi(t),d=qi(l,e);if(Ai.ni(u,d,s,n,o,a),Ai.ai(u)!==JSON.stringify(d)){Ai.oi(u,n);var v=ji(r);return Ai.ni(t,v,s,n,o,a),h}}Ai.ni(t,l,s,n,o,a)}}catch(t){Mi.si(t)}return h},oi(e,i){try{null==t||t.localStorage.removeItem(e),Ai.oi(e,i),Ai.oi(Fi(e),i)}catch(t){Mi.si(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&Mi.ii()?(i=Mi,n=!0):"localstorage+cookie"===o&&r.ii()?(i=r,n=!0,s=!0):"sessionstorage"===o&&Yi.ii()?i=Yi:"memory"===o?i=Vi:"cookie"===o&&Ai.ii()?(i=Ai,s=!0):r.ii()?(i=r,n=!0,s=!0):Ai.ii()?(i=Ai,s=!0):i=Vi,this.ao=n,this.lo=s,i}To(t){return this.wo+"__"+t}So(t){return this.ao&&!!t.split_storage}properties(){var t={};return pi(this.props,((e,i)=>{var r=hr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Eo||t){var e=this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase(),i=e?Mi.ui(this.wo):null,r={};if(e)try{pi(r=Li(Ai.ui(this.wo)),((t,e)=>{(O(t)||D(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Zs.ui(this.wo);if(s&&(this.props=fi({},s)),this.uo&&this.Xo(),e&&s){var n,o,a=null==i?void 0:i[$e],h=null!==(n=null==i?void 0:i[We])&&void 0!==n?n:ni,l=s[$e],u=null!==(o=s[We])&&void 0!==o?o:ni;if(l!==a||u!==h){this.ho=!0,Yi.ni(Pr(this.wo),!0);var d=fi({},this.props);Ni.forEach((t=>delete d[t])),u===ni&&(h===oi||r[We]===ni||!O(a)&&l!==a)&&(Nr(d,r),delete d[Le]),this.props=d;var v=new Set;Ni.forEach((t=>{var e,i=null==(e=hr(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};pi(this.props,((i,r)=>{var s;(null==(s=hr(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),I(e)?(Mi.oi(this.To(t)),this.oo[t]={}):Mi.ni(this.To(t),e)&&(this.oo[t]={persisted:!0,fingerprint:this.Lo(e,t)})}))}}Yi.ai(Pr(this.wo))&&(this.ho=!0)}}Xo(){for(var t of nr){var e=Mi.ui(this.To(t));if(e&&!I(e)){var i=this.Ro(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Lo(e,t)),this.ea(t,e)||fi(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=hr(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=kr[t];if(!i)return!1;var r=e[i],s=this.props[i];return N(r)&&N(s)&&s>r}refreshKey(t){var e;if(!(this.Eo||t===ke&&this.mo)){var i=this.uo?null==(e=hr(t))?void 0:e.storageGroup:void 0,r=i?Mi.ui(this.To(i)):this.Zs.ui(this.wo);if(r&&t in r)this.$o(t,r[t],!1);else{if(i){var s=this.Zs.ui(this.wo);if(s&&t in s)return void this.$o(t,s[t],!1)}this.No(t,!1)}}}save(){if(!this.Eo){var t=this.zo();t>0?O(this.Jo)&&(this.Jo=setTimeout((()=>{this.Jo=void 0,this.Ko()}),t)):this.Ko()}}flush(){O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0,this.Ko())}Ko(t){if(void 0===t&&(t=!1),!(this.Eo||this.do&&!t)){t||(this.syncCookieProperties(),this.mo||this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase()||this.refreshKey(ke));var e=!t&&!this.co;e||(this.po=!1);var i=!!e&&this.qo();if(this.po)this.mn.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.uo)return this.ia(),void(i&&this.yo.forEach((t=>t())));var r=this.ra(this.Zs,this.wo,this.props,Or);"written"===r&&this.Uo(this.props),"failed"!==r&&(this.vo.clear(),this.fo=!1,this.mo=!1),i&&this.yo.forEach((t=>t()))}}}ia(){var t=this,e=this.Fo(),i=e.main,r=e.groups,s=this.ra(this.Zs,this.wo,i,Or);"written"===s&&this.Uo(i),"failed"!==s&&(this.fo=!1,this.mo=!1,Cr.forEach((t=>{var e;null!=(e=hr(t))&&e.storageGroup||this.vo.delete(t)})));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.oo[e])||!i.persisted))return Cr.forEach((i=>{var r;(null==(r=hr(i))?void 0:r.storageGroup)===e&&t.vo.delete(i)})),1;var n=t.ra(Mi,t.To(e),s,e);"failed"!==n&&Cr.forEach((i=>{var r=hr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.vo.delete(i)}))};for(var o of nr)n(o)}Fo(){var t={},e={flags:{},surveys:{}};return pi(this.props,((i,r)=>{var s,n=null==(s=hr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Lo(t,e){if(e===Or)return JSON.stringify(t)+"|"+this.na+"|"+this.sa+"|"+this.oa;var i={};return pi(t,((t,e)=>{var r;i[e]=null!=(r=hr(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Ro(r);if(r!==Or&&!n.dirty&&!O(n.fingerprint))return"skipped";try{if((s=this.Lo(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ni(e,i,this.na,this.sa,this.oa,this.mn.debug)?(n.dirty=!1,r!==Or&&(n.persisted=!0),O(s)||(n.fingerprint=s),this.ao&&(n.storageValue=Mi.ai(e)),"written"):(this.mn.debug&&_e.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.Bo(),O(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),this.Zs.oi(this.wo,!1),this.Zs.oi(this.wo,!0),!i&&this.bo)for(var r of nr)Mi.oi(this.To(r));i?delete this.oo[Or]:this.oo={},this.Wo=void 0,this.Vo=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(P(t)){this.syncCookieProperties(),O(e)&&(e="None"),this.na=O(i)?this.aa:i;var r=!1;if(pi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.$o(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(P(t)){this.syncCookieProperties(),this.na=O(e)?this.aa:e;var i=!1;if(pi(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||P(e)||k(e))&&(this.$o(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.No(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this._o){var e=function(t,e,i){if(!r)return{};var s,n=e?[..._r,...i||[]]:[],o=mr(vr(r.URL,n,fr),t),a=(s={},pi(gr,(function(t){var e=$i(t);s[t]=e||null})),s);return fi(a,o)}(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),i=!I(mi(e));return i&&this.register(e),this._o=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?wr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:$r(),$referring_domain:null!=r&&r.referrer&&(null==(t=ur(r.referrer))?void 0:t.host)||br},void 0)}set_initial_person_info(){if(!this.props[Ye]&&!this.props[Ke]){var t=xr(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[Xe]:this.lo?{r:Ir(t.r),u:t.u?Ir(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};pi([Ke,Ye],(e=>{var i=this.props[e];i&&pi(i,(function(e,i){t["$initial_"+w(i)]=e}))}));var e=this.props[Xe];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=Er(t,e),r={};return pi(i,(function(t,e){r["$initial_"+w(e)]=t})),r}(e,this.mn.disable_capture_url_hashes);fi(t,i)}return t}safe_merge(t){return pi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.Eo&&!a;a||this.Go(e,h),this.mn=t,!a&&(r||s||o)&&(this.Wo=void 0,this.Vo=void 0,this.Go(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.ko(t):this.Zs;this.la();var u=this.So(t),d=n||u!==this.uo,v=!a&&(d||t.cross_subdomain_cookie!==this.sa||t.secure_cookie!==this.oa)&&this.Zo(h);this.co=d;try{if(this.aa=this.na=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.Zs=l,this.uo=u,this.props=c,this.save()}else o&&(this.Zs=l,a||(delete this.oo[Or],this.Ko()))}finally{this.co=!1,v&&this.Yo()}}la(){var t=this.props[Xe];if(this.lo&&P(t)&&"string"==typeof t.r){var e=Ir(t.r),i="string"==typeof t.u?Ir(t.u):t.u;e===t.r&&i===t.u||this.$o(Xe,p({},t,{r:e,u:i}))}}set_disabled(t){this.Eo=t,this.Eo?this.remove():this.save()}set_cross_subdomain(t){t!==this.sa&&(this.sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[Re]||{};i[t]=e,this.$o(Re,i),this.save()}remove_event_timer(t){var e=this.props[Re]||{},i=e[t];return O(i)||(delete e[t],this.$o(Re,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.$o(t,e),this.save()}$o(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&(t!==$e&&t!==We||s===e||(this.fo=!0),t!==ke||Dr(s,e)||(this.mo=!0),this.Ho(t,s,e),null!=(r=hr(t))&&r.volatile||this.jo(t))}No(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(Ar(t)&&this.Io(t,!0),t===ke&&(this.mo=!0),this.jo(t))}jo(t){var e,i=null==(e=hr(t))?void 0:e.storageGroup;i&&(this.Ro(i).dirty=!0)}Ro(t){return this.oo[t]||(this.oo[t]={})}}var Fr={GZipJS:"gzip-js",Base64:"base64"},Br={Activation:"events",Cancellation:"cancelEvents"},Lr={Button:"button",Tab:"tab",Selector:"selector"},jr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},zr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},qr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Hr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Gr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Wr={Once:"once",Recurring:"recurring",Always:"always"},Vr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Jr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Yr={Popover:"popover",Inline:"inline"};function Kr(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,(()=>{}))}}}}var Xr={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Qr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Zr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ts=pe("[RateLimiter]");class es{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{ts.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void ts.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Je))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(N(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.ua(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(Je,a),{isRateLimited:h,remainingTokens:a.tokens}}ha(t){var e=this.instance.config.property_denylist;return!k(e)||!e.includes(t)}da(){var t;if(this.ha("$current_url")&&this.ha("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ua(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.da(),o=this.ha("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var is=pe("[RemoteConfig]");class rs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}va(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ca(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return is.info("Using preloaded remote config",this.remoteConfig),void this.fa(this.remoteConfig);if(this._instance._shouldDisableFlags())return void is.warn("Remote config is disabled. Falling back to local config.");this.va((t=>{if(!t)return is.info("No config found after loading remote JS config. Falling back to JSON."),void this.ca((t=>{this.fa(t.json,t)}));this.fa(t)}))}catch(t){is.error("Error loading remote config",t),this.fa()}}fa(t,e){!t&&e&&(0===e.statusCode?e.error||is.warn("Failed to fetch remote config from PostHog."):is.error("Failed to fetch remote config from PostHog."));try{this._instance.fa(t?{ok:!0,config:t}:{ok:!1})}catch(t){is.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){is.error("Error loading feature flags",t)}}}var ss=["fatal","error","warning","log","info","debug"],ns=Uint8Array,os=Uint16Array,as=Uint32Array,hs=new ns([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]),ls=new ns([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]),us=new ns([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ds=function(t,e){for(var i=new os(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new as(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]},vs=ds(hs,2),cs=vs[1];vs[0][28]=258,cs[258]=28;for(var _s=ds(ls,0)[1],ps=new os(32768),fs=0;32768>fs;++fs){var gs=(43690&fs)>>>1|(21845&fs)<<1;ps[fs]=((65280&(gs=(61680&(gs=(52428&gs)>>>2|(13107&gs)<<2))>>>4|(3855&gs)<<4))>>>8|(255&gs)<<8)>>>1}var ms=function(t,e,i){for(var r=t.length,s=0,n=new os(e);r>s;++s)++n[t[s]-1];var o,a=new os(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new os(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[ps[d]>>>h]=l}else for(o=new os(r),s=0;r>s;++s)o[s]=ps[a[t[s]-1]++]>>>15-t[s];return o},ws=new ns(288);for(fs=0;144>fs;++fs)ws[fs]=8;for(fs=144;256>fs;++fs)ws[fs]=9;for(fs=256;280>fs;++fs)ws[fs]=7;for(fs=280;288>fs;++fs)ws[fs]=8;var ys=new ns(32);for(fs=0;32>fs;++fs)ys[fs]=5;var bs=ms(ws,9,0),$s=ms(ys,5,0),xs=function(t){return(t/8>>0)+(7&t&&1)},Es=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof os?os:t instanceof as?as:ns)(i-e);return r.set(t.subarray(e,i)),r},Ss=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ts=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ks=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new ns(0),0];if(1==s){var o=new ns(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new os(v+1),_=Rs(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new ns(c),_]},Rs=function(t,e,i){return-1==t.s?Math.max(Rs(t.l,e,i+1),Rs(t.r,e,i+1)):e[t.s]=i},Ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new os(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Is=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Os=function(t,e,i){var r=i.length,s=xs(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Cs=function(t,e,i,r,s,n,o,a,h,l,u){Ss(e,u++,i),++s[256];for(var d=ks(s,15),v=d[0],c=d[1],_=ks(n,15),p=_[0],f=_[1],g=Ps(v),m=g[0],w=g[1],y=Ps(p),b=y[0],x=y[1],E=new os(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=ks(E,7),k=T[0],R=T[1],P=19;P>4&&!k[us[P-1]];--P);var I,O,C,A,D=l+5<<3,M=Is(s,ws)+Is(n,ys)+o,N=Is(s,v)+Is(n,p)+o+14+3*P+Is(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=D&&N>=D)return Os(e,u,t.subarray(h,h+l));if(Ss(e,u,1+(M>N)),u+=2,M>N){I=ms(v,c,0),O=v,C=ms(p,f,0),A=p;var U=ms(k,R,0);for(Ss(e,u,w-257),Ss(e,u+5,x-1),Ss(e,u+10,P-4),u+=14,S=0;P>S;++S)Ss(e,u+3*S,k[us[S]]);u+=3*P;for(var F=[m,b],B=0;2>B;++B){var L=F[B];for(S=0;L.length>S;++S)Ss(e,u,U[j=31&L[S]]),u+=k[j],j>15&&(Ss(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else I=bs,O=ws,C=$s,A=ys;for(S=0;a>S;++S)if(r[S]>255){var j;Ts(e,u,I[257+(j=r[S]>>>18&31)]),u+=O[j+257],j>7&&(Ss(e,u,r[S]>>>23&31),u+=hs[j]);var z=31&r[S];Ts(e,u,C[z]),u+=A[z],z>3&&(Ts(e,u,r[S]>>>5&8191),u+=ls[z])}else Ts(e,u,I[r[S]]),u+=O[r[S]];return Ts(e,u,I[256]),u+O[256]},As=new as([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ds=function(){for(var t=new as(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Ms=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ns(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Ds[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new ns(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=Os(h,l,t.subarray(u,d)):(h[u]=!0,l=Os(h,l,t.subarray(u,o)))}else{for(var v=As[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new os(32768),g=new os(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new as(25e3),x=new os(288),E=new os(32),S=0,T=0,k=(u=0,0),R=0,P=0;o>u;++u){var I=y(u),O=32767&u,C=g[I];if(f[O]=C,g[I]=O,u>=R){var A=o-u;if((S>7e3||k>24576)&&A>423){l=Cs(t,h,0,b,x,E,T,k,P,u-P,l),k=S=T=0,P=u;for(var D=0;286>D;++D)x[D]=0;for(D=0;30>D;++D)E[D]=0}var M=2,N=0,U=_,F=O-C&32767;if(A>2&&I==y(u-F))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=F&&--U&&O!=C;){if(t[u+M]==t[u+M-F]){for(var z=0;j>z&&t[u+z]==t[u+z-F];++z);if(z>M){if(M=z,N=F,z>B)break;var q=Math.min(F,z-2),H=0;for(D=0;q>D;++D){var G=u-F+D+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}F+=(O=C)-(C=f[O])+32768&32767}if(N){b[k++]=268435456|cs[M]<<18|_s[N];var V=31&cs[M],J=31&_s[N];T+=hs[V]+ls[J],++x[257+V],++E[J],R=u+M,++S}else b[k++]=t[u],++x[t[u]]}}l=Cs(t,h,!0,b,x,E,T,k,P,u-P,l)}return Es(a,0,r+xs(l)+s)}(n=t,null==(o=e).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,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ms(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),Ms(l,u-8,i.d()),Ms(l,u-4,r),l}var Us=!!o||!!n,Fs="text/plain",Bs=!1,Ls=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},js=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return pi(t,(function(t,e){O(t)||O(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},zs=t=>{if(t.ga)return t.ga;var e=t.data,i=t.compression;if(e){if(i===Fr.GZipJS){var r=Ns(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ns(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new ns(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return Es(r,0,s)}(lr(e)),{mtime:0});return{contentType:Fs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Fr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(lr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:lr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=lr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},qs=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:js(t.url,{compression:Fr.Base64}),encodedBody:zs(p({},t,{compression:Fr.Base64,ga:void 0}))}:{url:Ls(t.url,"compression"),encodedBody:zs(p({},t,{compression:void 0,ga:void 0}))};try{e=zs(t)}catch(e){if(he(t.compression,dr(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&he(t.compression,dr(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?ae(new Uint8Array(i)):ArrayBuffer.isView(i)&&ae(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Bs=!0,r()):{url:t.url,encodedBody:e}},Hs=t=>{try{return qs(t)}catch(e){return _e.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Gs=function(){var t=_((function*(t){var e=lr(t.data),i=yield function(t,e,i){return ve.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{ga:{contentType:Fs,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Ws=/Failed to fetch|NetworkError|Load failed/i,Vs=t=>"TypeError"===(null==t?void 0:t.name)&&Ws.test((null==t?void 0:t.message)||""),Js=t=>{var e=Hs(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;pi(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e;v=!0,c.abort(ie("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||Vs(e)?_e.warn(e):_e.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.ma&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){_e.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Ys=t=>{try{var e,r=qs(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=k(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(k(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>k(t.data)?e:p({},t.data,{batch:e});return Ys(p({},t,{data:v(u.slice(0,d))})),void Ys(p({},t,{data:v(u.slice(d))}))}_e.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),Js(p({},t,{ma:!0}))}catch(t){_e.warn("Beacon send failed",t)}},Ks=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return js(i===Fr.GZipJS?Ls(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Fr.GZipJS?{}:{compression:i}))},Xs=[];n&&Xs.push({transport:"fetch",method:Js}),o&&Xs.push({transport:"XHR",method(t){var e=Hs(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;pi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Xs.push({transport:"sendBeacon",method:Ys});var Qs=3e3;class Zs{constructor(t,e){this.ya=!0,this.ba=[],this._a=G((null==e?void 0:e.flush_interval_ms)||Qs,250,5e3,_e.createLogger("flush interval"),Qs),this.wa=t}enqueue(t){this.ba.push(t),this.ka||this.Sa()}unload(){this.xa();var t=this.ba.length>0?this.Ca():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ta(p({},t,{transport:"sendBeacon"}))}))}enable(){this.ya=!1,this.Sa()}Sa(){var t=this;this.ya||(this.ka=setTimeout((()=>{if(this.xa(),this.ba.length>0){var e=this.Ca(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&k(i.data)&&pi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ta(i)};for(var r in e)i()}}),this._a))}Ta(t){try{this.wa(t)}catch(t){_e.error(t)}}xa(){clearTimeout(this.ka),this.ka=void 0}Ca(){var t={};return pi(this.ba,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;O(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ba=[],t}}var tn=["retriesPerformedSoFar"];class en{constructor(e){this.Ma=!1,this.Ia=3e3,this.ba=[],this._instance=e,this.ba=[],this.Ea=!0,!O(t)&&"onLine"in t.navigator&&(this.Ea=t.navigator.onLine,this.Ra=()=>{this.Ea=!0,this.Pa()},this.Aa=()=>{this.Ea=!1},bi(t,"online",this.Ra),bi(t,"offline",this.Aa))}get length(){return this.ba.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,tn);U(e)&&(i.url=js(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.os(p({retriesPerformedSoFar:e},i));0===t.statusCode&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}os(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ba.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),_e.warn(s),this.Ma||(this.Ma=!0,this.Fa())}Fa(){if(this.Oa&&clearTimeout(this.Oa),0===this.ba.length)return this.Ma=!1,void(this.Oa=void 0);this.Oa=setTimeout((()=>{this.Ea&&this.ba.length>0&&this.Pa(),this.Fa()}),this.Ia)}Pa(){var t=Date.now(),e=[],i=this.ba.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ba=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Oa&&(clearTimeout(this.Oa),this.Oa=void 0),this.Ma=!1,O(t)||(this.Ra&&(t.removeEventListener("online",this.Ra),this.Ra=void 0),this.Aa&&(t.removeEventListener("offline",this.Aa),this.Aa=void 0)),this.ba)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){_e.error(t)}}this.ba=[]}}class rn{constructor(t){this.La=()=>{var t,e,i,r;this.Da||(this.Da={});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),h=(null==s?void 0:s.scrollHeight)||0;this.Da.lastScrollY=Math.ceil(n),this.Da.maxScrollY=Math.max(n,null!==(t=this.Da.maxScrollY)&&void 0!==t?t:0),this.Da.maxScrollHeight=Math.max(o,null!==(e=this.Da.maxScrollHeight)&&void 0!==e?e:0),this.Da.lastContentY=a,this.Da.maxContentY=Math.max(a,null!==(i=this.Da.maxContentY)&&void 0!==i?i:0),this.Da.maxContentHeight=Math.max(h,null!==(r=this.Da.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get $a(){return this._instance.config.scroll_root_selector}getContext(){return this.Da}resetContext(){var t=this.Da;return setTimeout(this.La,0),t}startMeasuringScrollPosition(){bi(t,"scroll",this.La,{capture:!0}),bi(t,"scrollend",this.La,{capture:!0}),bi(t,"resize",this.La)}scrollElement(){var e;if(!this.$a)return null==t||null==(e=t.document)?void 0:e.documentElement;var i=k(this.$a)?this.$a:[this.$a];for(var r of i){var s,n=null==t||null==(s=t.document)?void 0:s.querySelector(r);if(n)return n}}Na(e){var i,r,s="y"===e?"scrollTop":"scrollLeft";if(this.$a){var n=this.scrollElement();return n&&n[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null==(i=t.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null==(r=t.document)||null==(r=r.documentElement)?void 0:r.scrollLeft)||0:0}scrollY(){return this.Na("y")}scrollX(){return this.Na("x")}}var sn=t=>xr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class nn{constructor(t,e,i,r){this.Te=t=>{var e=this.qa();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ja(this._instance)};this.Ba.register({[Ve]:i})}},this._instance=t,this.Ha=e,this.Ba=i,this.ja=r||sn,this.Ha.onSessionId(this.Te)}qa(){return this.Ba.props[Ve]}getSetOnceProps(){var t,e=null==(t=this.qa())?void 0:t.props;return e?"r"in e?Er(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return pi(mi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+w(i)]=e})),t}}class on{on(t,e){return this.za[t]||(this.za[t]=[]),this.za[t].push(e),()=>{this.za[t]=this.za[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.za[t]||[])i(e);for(var r of this.za["*"]||[])r(t,e)}constructor(){this.za={}}}var an=pe("[SessionId]"),hn=864e5;class ln{on(t,e){return this.Ua.on(t,e)}constructor(t,e,i){var r;if(this.Wa=null,this.Va=null,this.Ga=[],this.Za=void 0,this.Qa=!1,this.Ua=new on,this.Ja=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===si)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Ba=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.Ka=void 0,this._sessionActivityTimestamp=null,this.Ya=e||Ri,this.Xa=i||Ri;var s=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*G(this.mn.session_idle_timeout_seconds||1800,60,36e3,an.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+s+"_window_id",this.il="ph_"+s+"_primary_window_exists",this.rl()){var n=Yi.ui(this.el),o=Yi.ui(this.il);n&&!o?this.Ie=n:Yi.oi(this.el),Yi.ni(this.il,!0)}null!=(r=this.mn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return O(this.Ga)&&(this.Ga=[]),this.Ga.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ga=this.Ga.filter((e=>e!==t))}}rl(){return"memory"!==this.mn.persistence&&!this.Ba.Eo&&Yi.ii()}sl(t){t!==this.Ie&&(this.Ie=t,this.rl()&&Yi.ni(this.el,t))}ol(){return this.Ie?this.Ie:this.rl()?Yi.ui(this.el):null}al(t){var e=this.Wa;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}ll(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Bt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Bt=t,s&&!r||s&&this.al(e)||(this.Wa=e,this.Ba.register({[Oe]:[e,t,i]}))}ul(){var t,e=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}hl(){this.ul()?this.Ba.refreshKey(Oe):(this.Ba.flush(),this.Ba.load())}dl(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wa){this.hl();var e=this.vl();e[1]===this.Bt&&e[2]===this._sessionStartTimestamp&&(this.Wa=this._sessionActivityTimestamp,this.Ba.register({[Oe]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ba.flush())}}cl(){var t=this.vl()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}fl(t){return this.hl(),this.Ja(t,this.cl())}vl(){var t=this.Ba.props[Oe];return k(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wa=null,this.Ka=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void an.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void an.error("Invalid sessionID in bootstrap",t)}}(t);return!O(i)&&(e?this.Ka={sessionId:t,sessionStartTimestamp:i}:this.ll(t,(new Date).getTime(),i),!0)}destroy(){this.Qa=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Za&&t&&(t.removeEventListener(li,this.Za,{capture:!1}),this.Za=void 0),this.Ga=[]}nl(){this.Za=()=>{this.dl(),this.rl()&&Yi.oi(this.il)},bi(t,li,this.Za,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.mn.cookieless_mode===si)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Bt;if(i)this.Va=r;else if(D(this.Va)||this.Va>r||r-this.Va>=1e3){var n,o;null==(n=(o=this.Ba).syncCookieProperties)||n.call(o),this.Va=r}var a=this.vl(),h=a[1],l=a[2],u=!O(s)&&h!==s,d=this.cl(),v=this.ol(),c=this.Ka,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>hn),p=c?_:U(l)&&Math.abs(r-l)>hn,f=!1,g=u,m=!h||!!c,w=h,y=!m&&!t&&this.Ja(r,d);if(y){(y=this.fl(r))||an.info("cross-tab refresh kept the session alive",{sessionId:h});var b=this.vl();h=b[1],l=b[2]}if(m||y||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.Ya(),v=this.Xa(),an.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.Ka=void 0,f=!0}else v||(v=this.Xa(),f=!0),(g=g||h!==w)&&(an.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=U(d)&&t&&!p?d:r,S=U(l)?l:(new Date).getTime();this.sl(v),this.ll(h,E,S),t||this.tl();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ga.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}tl(){this.Qa||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qa)if(this.fl((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.Ua.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}function un(){return(un=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return C(r)&&r.length>0?r:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function dn(t,e,i){return lr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var vn="custom",cn="i.posthog.com",_n=/^\/static\//,pn=["/s/","/e/","/i/"];class fn{constructor(t){this.gl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+cn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.gl[this.apiHost]||(this.gl[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":vn),this.gl[this.apiHost]}ml(t){if(_n.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}yl(t){var e=ur(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}bl(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ur(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&pn.some((t=>0===e.indexOf(t)))){var a=this.yl(r);if(a){var h,l=this.apiHost,u=this._l;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this._l=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this._l,i=this.yl(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.bl(t,e,this.uiHost+e);if("flags"===t)return this.bl(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ml(e);if(i)return this.bl(t,e,""+i+e)}if(this.region===vn)return this.bl(t,e,this.apiHost+e);var r=cn+e;switch(t){case"assets":return this.bl(t,e,"https://"+this.region+"-assets."+r);case"api":return this.bl(t,e,"https://"+this.region+"."+r)}}}var gn=pe("[Surveys]"),mn={ignoreConditions:!1,ignoreDelay:!1,displayType:Yr.Popover},wn=pe("[PostHog ExternalIntegrations]"),yn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class bn{constructor(t){this._instance=t}Ys(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return wn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ys(yn[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class $n{constructor(t,e){this.A=t,this.Ns=e,this.wl=new Map,this.Os=!1}add(t){var e=this;return _((function*(){if(e.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.wl.set(t.name,t);try{var i=t.setup(e.Ns);i&&(yield i)}catch(i){var r=e.wl.get(t.name)===t;r&&e.wl.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var e of(this.wl.clear(),t))this.kl(e)}}kl(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,(e=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.A.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class xn{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);O(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var En="extensionsRemoteConfig";class Sn{constructor(t){this.Os=!1,this.instance=t,this.A=_e,this.Sl=t.xl,this.kv=new xn(t),this.onEvent=t=>Kr(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Os)return Kr((()=>{}));var e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.Cl.on(En,e);return this.Sl&&e(this.Sl),Kr(i)},this.Tl=new $n(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(xe))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(xe);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Kr(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(En,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?js(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?y.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var Tn,kn={},Rn=0,Pn=()=>{},In='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',On="Surveys module not available",Cn="sanitize_properties is deprecated. Use before_send instead",An="Invalid value for property_denylist config: ",Dn=/^[A-Za-z0-9_-]{1,400}$/,Mn=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Nn=["token","distinct_id",ti],Un="posthog",Fn=!Us&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),Bn=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Ln=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:yi(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&C(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){_e.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ai,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Qs},error_tracking:{},_onCapture:Pn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Xi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Bn(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},jn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],zn=t=>{var e={};for(var i of jn){var r=i[0],s=i[1];O(t[r])||(e[s]=t[r])}var n=fi({},e,t),o=t.__preview_external_dependency_versioned_paths;return O(o)||(O(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),C(o)&&O(t.asset_host)&&(n.asset_host=o)),k(t.property_blacklist)&&(O(t.property_denylist)?n.property_denylist=t.property_blacklist:k(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(An+t.property_denylist)),n};class qn{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Hn{El(t){if(t){var e=this.wl.indexOf(t);-1!==e&&this.wl.splice(e,1)}}Rl(t,e){return this.El(t),this.wl.push(e),null==e.initialize||e.initialize(),e}Pl(){return this.config.cookieless_mode===si||this.config.cookieless_mode===ri&&this.consent.isRejected()}Al(){if(!(this.Fl||this.config.reuseAnonymousId||this.config.segment||this.Pl())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Ol||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===Ze){var t=this.persistence;if(t){this.Dl()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Ze){var i=this.config.get_device_id(Ri());this.register({distinct_id:i,$device_id:i}),t.set_property(We,ni)}this.$l()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new qn,this.Nl=!1,this.version=v.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new on,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ln(),this.SentryIntegration=rr,this.sentryIntegration=t=>function(t,e){var i=ir(t,e);return{name:er,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new rn(this),this.pageViewManager=new sr(this),this.rateLimiter=new es(this),this.requestRouter=new fn(this),this.consent=new Ki(this),this.externalIntegrations=new bn(this);var e=null!==(t=Hn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=C(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=C(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>_e.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Un){var r,s=null!==(r=kn[i])&&void 0!==r?r:new Hn;return s._init(t,e,i),kn[i]=s,kn[Un][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n,o;void 0===i&&(i={});var a,h=C(e)?e.trim():"";if(!h)return _e.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ln(i.defaults),i.debug=this.Vl(i.debug),this.Gl=i,this.Zl=[],i.person_profiles?this.Ul=i.person_profiles:i.process_person&&(this.Ul=i.process_person);var l=Ln(i.defaults),u=zn(i),d=fi({},l,u,{name:r,token:h});P(l.rageclick)&&P(u.rageclick)&&(d.rageclick=fi({},l.rageclick,u.rageclick)),P(l.session_recording)&&P(u.session_recording)&&(d.session_recording=fi({},l.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fr.GZipJS;var c=this.Dl();if(this.persistence=new Ur(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ur(p({},this.config,{persistence:"sessionStorage"}),c,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Yi.ii()){var _=Yi.ui(this.jl);k(_)&&_.forEach((t=>{C(t)&&this.ql.add(t)}))}else Yi.oi(this.jl);var f=p({},this.persistence.props),g=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ql=new Zs((t=>this.Jl(t)),this.config.request_queue_config),this.Kl=new en(this),this.__request_queue=[];var m=this.Pl();m||(this.sessionManager=new ln(this),this.sessionPropsManager=new nn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(m)}),0)):(_e.info("Initializing extensions synchronously"),this.tu(m)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&_e.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Ol=!!w&&!A(w),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,b=this.get_distinct_id(),x=this.persistence.get_property(We);if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===ni)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&x===oi)_e.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 E=this.config.get_device_id(Ri()),S=i.bootstrap.isIdentifiedID?E:y;this.persistence.set_property(We,i.bootstrap.isIdentifiedID?oi:ni),this.register({distinct_id:y,$device_id:S})}}if(m)this.register_once({distinct_id:Ze,$device_id:null},"");else if(!this.get_distinct_id()){var T=this.config.get_device_id(Ri());this.register_once({distinct_id:T,$device_id:T},""),this.persistence.set_property(We,ni)}return bi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?tr(this,(()=>this.eu())):this.eu(),R(this.config._onCapture)&&this.config._onCapture!==Pn&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&_e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return un.apply(this,arguments)}().then((t=>{t&&this.register({[Ee]:t})})).catch(Pn),this}iu(t){var e=t;return C(e.name)&&R(e.setup)}ru(t,e){this.iu(t)?e.push((()=>{this.nu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{_e.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.wl.push(t)}Xl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Hn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.su)||r.call(this),this.su=void 0,this.featureFlags=new o(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}tu(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Hn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.wl.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.wl.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.wl.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.wl.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.wl.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.ru(this.autocapture=new l.autocapture(this),u),l.surveys&&this.ru(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.ru(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this),u),l.metrics&&this.wl.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.wl.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.wl.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.wl.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.wl.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Qi)),l.toolbar&&this.wl.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.wl.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.wl.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ou){var t=this.ou;this.ou=void 0,this.wl.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.au(u,h)}au(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.au(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){_e.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ei]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ii]:r}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+r+"ms)")}fa(t){var e;if(!r||!r.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ou=t),this.xl=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=m(s.supportedCompression,Fr.GZipJS)?Fr.GZipJS:m(s.supportedCompression,Fr.Base64)?Fr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:ai}),null==(e=this.lu)||e.handleRemoteConfig(t),this.wl.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.uu(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Pl())&&this.hu()}),1),this.du=new rs(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ql)||t.enable())}_dom_loaded(){this.is_capturing()&&_i(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(di),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Ql)||r.unload(),null==(s=this.Kl)||s.unload()):this.vu()&&this.capture(di,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?Fn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(O(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&O(s.compression)&&s.data&&(s.compression=Fr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(k(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),k(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ks(s.url,s.method,s.compression,s.timestampMode);var v=Xs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){Vs(t)?_e.warn(t):_e.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Fr.GZipJS&&h&&"undefined"!=typeof Promise&&!Bs?Gs(s).then((t=>{_(t)})).catch((e=>{if(le(e))return Bs=!0,void _(p({},s,{compression:void 0,url:Ks(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return le(t)||e===oe})(e)&&(Bs=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){Rn++;try{var e,i=[],r=[],s=[];_i(t,(t=>{if(t)if(k(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){_e.error("Error executing queued PostHog call",t,e)}else k(t)&&"alias"===e?i.push(t):k(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)}));var n=function(t,e){_i(t,(function(t){try{if(k(t[0])){var i=e;pi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){_e.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Rn--}}push(t){if(Rn>0&&k(t)&&C(t[0])){var e=Hn.prototype[t[0]];R(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(ke);return C(e)&&Mn.test(e)?{value:e,delivered:!1}:P(e)&&C(e.value)&&Mn.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}fu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(ke);var s=this.cu();if(!r){if(i)return C(e)&&Mn.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[ke]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(ke);if(C(t)&&Dn.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[ke]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(ke)}}pu(t){if(this.persistence){this.persistence.refreshKey(ke);var e=this.cu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[ke]:{value:t,delivered:!0}})}}capture(t,e,i){var r,s,n,o,a,h,l,u,d,v;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!O(t)&&C(t)){this.Ll();var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var _=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){var f;null!=e&&e.$current_url&&!C(null==e?void 0:e.$current_url)&&(_e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||_e.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&&(f=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 g=new Date,m=(null==i?void 0:i.timestamp)||g,w=ee(null==i?void 0:i.uuid,Ri),y={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},m,w)};t===ui&&this.config.__preview_capture_bot_pageviews&&c&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),_&&(y.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var b="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(Fe);(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);var x=P(null==e?void 0:e.$set)?e.$set:void 0,E=!(null==i||!i.$set)&&Te in i.$set,S=E||!!x&&Te in x,T=E?null==i||null==(r=i.$set)?void 0:r[Te]:null==x?void 0:x[Te],R=k(null==e?void 0:e.$unset)?e.$unset:[],A=(null==i?void 0:i.$unset)||[],D=-1!==R.indexOf(Te)||-1!==A.indexOf(Te),N=this.fu(null==(s=f)?void 0:s.fbclid,T,S,D);N&&!0===y.properties.$process_person_profile&&N.pending&&!S&&!b&&(y.$set=p({[Te]:N.value},y.$set));var U=null==i?void 0:i.$unset;U&&(y.$unset=U);var F,B,L,j=b?void 0:this.mu(null==i?void 0:i.$set_once,t!==ci,t===vi);if(j&&(y.$set_once=j),null!=i&&i._noTruncate||(l=this.config.properties_string_max_length,u=y,d=t=>C(t)?t.slice(0,l):t,v=new Set,y=function t(e,i){if(e!==Object(e))return d?d(e):e;if(!v.has(e)){var r;if(v.add(e),k(e))r=[],_i(e,(e=>{r.push(t(e))}));else{var s={};pi(e,((e,i)=>{v.has(e)||(s[i]=t(e,i))})),r=s}return r}}(u)),y.timestamp=m,O(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=g),b&&(y.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ne.forEach(r),e.forEach(r),i}(y.properties,Nn)),t===Vr.DISMISSED||t===Vr.SENT){var z=null==e?void 0:e[Jr.SURVEY_ID],q=null==e?void 0:e[Jr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){gn.error("Failed to persist survey seen state",t)}})({id:z,current_iteration:q}),y.$set=p({},y.$set,{[(F={id:z,current_iteration:q},B=t===Vr.SENT?"responded":"dismissed",L="$survey_"+B+"/"+F.id,F.current_iteration&&F.current_iteration>0&&(L="$survey_"+B+"/"+F.id+"/"+F.current_iteration),L)]:!0})}else t===Vr.SHOWN&&(y.$set=p({},y.$set,{[Jr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Qr.SHOWN){var H=null==e?void 0:e[Zr.TOUR_TYPE];H&&(y.$set=p({},y.$set,{[Zr.TOUR_LAST_SEEN_DATE+"/"+H]:(new Date).toISOString()}))}var G=p({},y.properties.$set,y.$set);if(I(G)||this.setPersonPropertiesForFlags(G),!M(this.config.before_send)){var W=this.ns(y);if(!W)return;(y=W).uuid=ee(y.uuid,Ri)}var V=null!==(n=null==(o=y.$set)?void 0:o[Te])&&void 0!==n?n:P(null==(a=y.properties)?void 0:a.$set)?y.properties.$set[Te]:void 0,J=null!=N&&N.pending&&V===N.value?N.value:void 0;this.Cl.emit("eventCaptured",y);var Y=null!==(h=null==i?void 0:i._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),K=p({method:"POST",url:Y,data:y,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(Y)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},null!=i&&i.transport?{transport:i.transport}:{},J?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.pu(J)}}:{});return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly||J?this.Jl(K):this.Ql.enqueue(K),y}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.lu)?void 0:e.getExtension(t)}nu(){var t;return null!==(t=this.lu)&&void 0!==t?t:this.lu=new Sn(this)}Ml(t){this.Bl.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Bl.indexOf(t);-1!==i&&this.Bl.splice(i,1)}}}yu(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(We)===ni&&(null==(r=this.sessionPersistence)||r.clear(),this.ql.clear(),this.bu()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.yu();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Pl()&&(u[ti]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!C(u.distinct_id)&&!N(u.distinct_id)||A(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[..._r,...i||[]]:[],_=function(t){for(var e=0;Qt.length>e;e++){var i=Qt[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="u">typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};O(r)||(m.detectGoogleSearchApp=r);var w={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;O(y)||(w.userAgentDataPlatform=y),O(b)||(w.maxTouchPoints=b),O(x)||(w.screenWidth=x),O(E)||(w.screenHeight=E),O(S)||(w.devicePixelRatio=S);var T,k,P,I,C,A,D,M,N=fi(mi({$os:p,$os_version:f,$browser:Yt(l,navigator.vendor,g,m),$device:Zt(l),$device_type:(k=l,P=w,M=Zt(k),M===X||M===K||"Kobo"===M||"Kindle Fire"===M||M===kt?Y:M===ft||M===mt||M===gt||M===Et?"Console":M===Z?"Wearable":M?W:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(I=null==P?void 0:P.maxTouchPoints)&&void 0!==I?I:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(A=null==P?void 0:P.screenHeight)&&void 0!==A?A:0)/(null!==(D=null==P?void 0:P.devicePixelRatio)&&void 0!==D?D:1)?W:Y:"Desktop"),$timezone:Sr(),$timezone_offset:Tr()}),{$current_url:vr(n?re(null==s?void 0:s.href):null==s?void 0:s.href,c,fr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:Xt(l,navigator.vendor,g,m),$browser_language:yr(),$browser_language_prefix:(T=yr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=v.SDK_DIST_CHANNEL),N}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&fi(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&fi(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Kl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===vn&&(u.$lib_custom_api_host=this.config.api_host),c=e!==ui||a?e!==di||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=fi(u,c),e===ui&&r&&(u.title=r.title),!O(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties(),x=u.$groups,E=y.$groups;P(x)&&!I(x)&&(u.$groups=p({},P(E)?E:{},x)),pi(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var S={};if(this.Bl.length>0)for(var T of this.Bl.slice())try{fi(S,T())}catch(t){_e.error("Failed to produce browser extension event properties",t)}(u=fi({},_,y,b,p({},S,u))).$is_identified=this._isIdentified(),k(this.config.property_denylist)?pi(this.config.property_denylist,(function(t){delete u[t]})):_e.error(An+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var D=this.config.sanitize_properties;D&&(_e.error(Cn),u=D(u,e));var M=this._u();return u.$process_person_profile=M,M&&!a&&this.wu("_calculate_event_properties"),u}mu(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this._u())return t;if(this.Nl&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=fi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(_e.error(Cn),o=a(o,"$set_once")),e&&(this.Nl=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.yu(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.ql.add(t))),this.bu()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.ql.delete(t),this.bu()}ku(t,e){this.register({[t]:e})}Yl(){this.ql.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Eo||!Yi.ii())Yi.oi(this.jl);else{var e=[];this.ql.forEach((t=>e.push(t))),e.length>0?Yi.ni(this.jl,e):Yi.oi(this.jl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Cl.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:On}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:On})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:On})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=mn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:On}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:On})}Su(t){return!t||A(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t===Ze?(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_e.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(N(t)&&(t=t.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Su(t)&&this.wu("posthog.identify")){this.Ll();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.yu(!1),o=this.persistence.Zo(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(xe)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(Se)&&(this.unregister(Se),this.register({distinct_id:t}));var l=(this.persistence.get_property(We)||ni)===ni,u=t!==h,d=!u&&l;if(u&&l){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:h};this.persistence.set_property(We,oi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture(vi,c,{$set:e||{},$set_once:i||{}}),this.Wl=dn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(We,oi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture("$set",{$set:_,$set_once:p}),this.Wl=dn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(qe)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Yo(a)}}}setPersonProperties(t,e){if((t||e)&&this.wu("posthog.setPersonProperties")){var i=dn(this.get_distinct_id(),t,e);this.Wl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Wl=i):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(k(t)?t:[t]).filter((t=>C(t)&&t.length>0));0!==i.length&&this.wu("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Wl=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.yu();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),(n||i)&&this._u()){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(ci,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.wu("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=F(t)?t:null==t?void 0:t.resetDeviceID,i=F(t)||null==t?void 0:t.bootstrap;this.xu(e,!1,i)}xu(t,e,i){var r,s,n;if(void 0===e&&(e=!1),_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Gl)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(xe),h=this.get_property(Ee),l=this.get_property(Ie),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Zo?void 0:n.Zo(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.ql.clear(),this.bu(),O(l)||null==(E=this.persistence)||E.register({[Ie]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(y=this.metrics)||y.reset(),null==(b=this.persistence)||b.set_property(We,ni),null==(x=this.sessionManager)||x.resetSessionId(),this.Wl=null,this.config.cookieless_mode===si)this.register_once({distinct_id:Ze,$device_id:null},"");else{var R=this.config.get_device_id(Ri());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||O(h)||this.register({[Ee]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Pl()||(null==(k=this.persistence)||k.set_property(We,i.isIdentifiedID?oi:ni),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(O(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var I;d&&(null==(I=this.persistence)||null==I.Yo||I.Yo(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.nu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Ql)||s.unload(),null==(n=e.Kl)||n.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){_e.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else _e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.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(t,e){return t===this.get_property(be)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(O(e)&&(e=this.get_distinct_id()),t!==e?(this.ku(Se,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(P(t)){var i,r,s,n,o,a,h,l,u,d,c,_;fi(this.config,zn(t));var f=this.Dl();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ur(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Vl(this.config.debug);F(m)&&(this.config.debug=m),F(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Mi.ii()&&Mi.ni("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Mi.ii()&&Mi.oi("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.$l(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&tr(this,Pn,!1)}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){try{if(!this.exceptions)return;var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}catch(t){return}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Hn.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Un;return e!==Un&&(e=Un+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(We))===oi||(null==(e=this.sessionPersistence)?void 0:e.get_property(We))===oi}_u(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ai&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Se])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Qe]))}vu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(t){return"never"===this.config.person_profiles?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Al(),this.ku(Qe,!0),!0)}Dl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ri)}$l(){var t,e,i,r,s,n=this.Dl();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(t=this.persistence)?void 0:t.Eo)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.Eo)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.ql.clear(),this.bu()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==si){if(this.Pl()){var i,r,s,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new ln(this),this.pageViewManager=new sr(this),this.persistence&&(this.sessionPropsManager=new nn(this,this.sessionManager,this.persistence));var h,l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Hn.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Rl(this.sessionRecording,new l(this)),this.xl&&(null==(h=this.sessionRecording)||null==h.onRemoteConfig||h.onRemoteConfig(this.xl)))}var u,d;this.consent.optInOut(!0),this.$l(),this.uu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ri&&(null==(u=this.surveys)||u.loadIfEnabled()),(O(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else _e.warn(In)}opt_out_capturing(){if(this.config.cookieless_mode!==si){var t,e,i=this.config.cookieless_mode===ri?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ri&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===ri&&(this.register({distinct_id:Ze,$device_id:null}),this.El(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else _e.warn(In)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===si||(this.config.cookieless_mode===ri?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&g(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>g(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}hu(){r&&("visible"===r.visibilityState?this.Hl||(this.Hl=!0,this.capture(ui,{title:r.title},{send_instantly:!0}),this.zl&&(r.removeEventListener(hi,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),bi(r,hi,this.zl)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var t=this.Gl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(_e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!M(t[e]),o=i in t&&!M(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}ns(t){var e;if(M(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=k(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),M(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?_e.warn(o+". This can cause unexpected behavior."):_e.info(o),null}s.properties&&!I(s.properties)||_e.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return _e.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&M(s.properties[a]))return _e.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.io)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Vl(t){var e=F(t)&&!t,i=Mi.ii()&&"true"===Mi.ai("ph_debug");return!e&&(!!i||t)}}Hn.__defaultExtensionClasses={},Hn.Mu={trace:Tn=()=>{},debug:Tn,info:Tn,warn:Tn,error:Tn,fatal:Tn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=gi(t.prototype[e[i]])}(Hn,["identify"]);var Gn=function(){v.SDK_DIST_CHANNEL="npm";var e=kn[Un]=new Hn;return function(){function e(){e.done||(e.done=!0,Fn=!1,pi(kn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():bi(r,"DOMContentLoaded",e,{capture:!1}):t&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Fr as Compression,Xr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Yr as DisplaySurveyType,Hn as PostHog,Qr as ProductTourEventName,Zr as ProductTourEventProperties,Vr as SurveyEventName,Jr as SurveyEventProperties,Br as SurveyEventType,jr as SurveyPosition,Gr as SurveyQuestionBranchingType,Hr as SurveyQuestionType,Wr as SurveySchedule,zr as SurveyTabPosition,qr as SurveyType,Lr as SurveyWidgetType,Gn as default,Gn as posthog,ss as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.js.map
|