@mcp-use/inspector 0.13.0-canary.9 → 0.13.0

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.
Files changed (43) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/client/assets/{browser-BQobyIK6.js → browser-I_PMdsM0.js} +55 -55
  3. package/dist/client/assets/{display-A5IEINAP-Bphg5r43.js → display-A5IEINAP-5VPyRE5O.js} +2 -2
  4. package/dist/client/assets/embeddings-BNrmfKFy.js +1 -0
  5. package/dist/client/assets/fs-u42MReIY.js +1 -0
  6. package/dist/client/assets/index-BSdThYb2.js +7 -0
  7. package/dist/client/assets/index-BeJAljgp.js +1676 -0
  8. package/dist/client/assets/index-C5URJhI3.js +33 -0
  9. package/dist/client/assets/index-C74O6YE7.js +49 -0
  10. package/dist/client/assets/index-C8I8qFXo.js +80 -0
  11. package/dist/client/assets/index-CGBDt1uT.js +71 -0
  12. package/dist/client/assets/{index-B7dFQyCF.js → index-CJtjIp1D.js} +1 -1
  13. package/dist/client/assets/index-DQ7i0BFM.css +1 -0
  14. package/dist/client/assets/index-VuReKekR.js +40 -0
  15. package/dist/client/assets/{index-DM_CsqXJ.js → index-rCIx5_U5.js} +2 -2
  16. package/dist/client/assets/llms-Bhs98QIx.js +2 -0
  17. package/dist/client/assets/module-D4IOASh4.js +4 -0
  18. package/dist/client/assets/path-B4EKd5uv.js +1 -0
  19. package/dist/client/assets/{winston-BjoXIpxW.js → winston-CO4zA-JC.js} +24 -24
  20. package/dist/client/index.html +3 -3
  21. package/dist/server/{chunk-OS2WTNLR.js → chunk-JEKCWLHD.js} +1 -1
  22. package/dist/server/{chunk-Z5QIR3IS.js → chunk-MCMZDGO6.js} +2 -2
  23. package/dist/server/{chunk-WLIY2SQG.js → chunk-XGILHZOF.js} +1 -1
  24. package/dist/server/cli.js +2 -2
  25. package/dist/server/index.js +3 -3
  26. package/dist/server/middleware.js +3 -3
  27. package/dist/server/server.js +2 -2
  28. package/dist/server/shared-routes.js +2 -2
  29. package/dist/server/shared-utils-browser.d.ts.map +1 -1
  30. package/dist/server/shared-utils-browser.js +1 -1
  31. package/package.json +29 -33
  32. package/dist/client/assets/embeddings-D-HjAwPc.js +0 -1
  33. package/dist/client/assets/index-BVmmyuLq.js +0 -80
  34. package/dist/client/assets/index-BZZlqPm9.js +0 -71
  35. package/dist/client/assets/index-BjAxStCG.js +0 -1707
  36. package/dist/client/assets/index-Bt-jwpdu.js +0 -7
  37. package/dist/client/assets/index-CRD_BvVM.js +0 -8
  38. package/dist/client/assets/index-D-zrynRj.css +0 -1
  39. package/dist/client/assets/index-D3ImdHen.js +0 -25
  40. package/dist/client/assets/index-DG-emU6S.js +0 -33
  41. package/dist/client/assets/langfuse-74RGPTAH-CvwykqK3.js +0 -1
  42. package/dist/client/assets/module-DXhXtM9n.js +0 -4
  43. package/dist/client/assets/path-BlMBua_C.js +0 -1
@@ -1,4 +0,0 @@
1
- var d=typeof window<"u"?window:void 0,U=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(U.self=U),typeof File>"u"&&(U.File=function(){});var ns=Array.prototype,ar=ns.forEach,or=ns.indexOf,Z=U?.navigator,m=U?.document,z=U?.location,bi=U?.fetch,wi=U!=null&&U.XMLHttpRequest&&"withCredentials"in new U.XMLHttpRequest?U.XMLHttpRequest:void 0,lr=U?.AbortController,W=Z?.userAgent,x=d??{},ge={DEBUG:!1,LIB_VERSION:"1.302.2"};function ur(r,e,t,i,s,n,a){try{var o=r[n](a),l=o.value}catch(c){return void t(c)}o.done?e(l):Promise.resolve(l).then(i,s)}function cr(r){return function(){var e=this,t=arguments;return new Promise((function(i,s){var n=r.apply(e,t);function a(l){ur(n,i,s,a,o,"next",l)}function o(l){ur(n,i,s,a,o,"throw",l)}a(void 0)}))}}function b(){return b=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},b.apply(null,arguments)}function as(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var yn=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],hr=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return yn.concat(e).some((i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1}))},bn=["$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"];function S(r,e){return r.indexOf(e)!==-1}var Zt=function(r){return r.trim()},Ei=function(r){return r.replace(/^\$/,"")},wn=Array.isArray,os=Object.prototype,ls=os.hasOwnProperty,Qt=os.toString,T=wn||function(r){return Qt.call(r)==="[object Array]"},Ie=r=>typeof r=="function",j=r=>r===Object(r)&&!T(r),We=r=>{if(j(r)){for(var e in r)if(ls.call(r,e))return!1;return!0}return!1},_=r=>r===void 0,N=r=>Qt.call(r)=="[object String]",xi=r=>N(r)&&r.trim().length===0,be=r=>r===null,O=r=>_(r)||be(r),pe=r=>Qt.call(r)=="[object Number]",Oe=r=>Qt.call(r)==="[object Boolean]",En=r=>r instanceof FormData,xn=r=>S(bn,r);function ki(r){return r===null||typeof r!="object"}function Lt(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function us(r){return!_(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var kn=[!0,"true",1,"1","yes"],si=r=>S(kn,r),Sn=[!1,"false",0,"0","no"];function ce(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),pe(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),ce(s||t,e,t,i))}class Pn{constructor(e){this.t={},this.i=e.i,this.o=ce(e.bucketSize,0,100,e.h),this.m=ce(e.refillRate,0,this.o,e.h),this.S=ce(e.refillInterval,0,864e5,e.h)}$(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.S);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.S}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.$(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}}var Ft,dr,ni,Fn=r=>r instanceof Error;function $n(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ni&&t.length===dr||(dr=t.length,ni=t.reduce(((i,s)=>{Ft||(Ft={});var n=Ft[s];if(n)i[n[0]]=n[1];else for(var a=r(s),o=a.length-1;o>=0;o--){var l=a[o],c=l?.filename,u=e[s];if(c&&u){i[c]=u,Ft[s]=[c,u];break}}return i}),{})),ni}}class In{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return cr((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&T(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),b({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return cr((function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i}))()}convertToExceptionList(e,t){var i,s,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:$n(this.stackParser)}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,a)=>{if(a<=4){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return b({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}}var Je="?";function Si(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?Je:t,in_app:!0};return _(i)||(n.lineno=i),_(s)||(n.colno=s),n}var cs=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:Je,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},On=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Cn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Rn=(r,e)=>{var t=On.exec(r);if(t){var[,i,s,n]=t;return Si(e,i,Je,+s,+n)}var a=Tn.exec(r);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=Cn.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=cs(a[1]||Je,a[2]);return Si(e,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},Mn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,An=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dn=(r,e)=>{var t=Mn.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=An.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var s=t[3],n=t[1]||Je;return[n,s]=cs(n,s),Si(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},pr=/\(error: (.*)\)/,fr=50;function Ln(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return function(s,n){n===void 0&&(n=0);for(var a=[],o=s.split(`
2
- `),l=n;l<o.length;l++){var c=o[l];if(!(c.length>1024)){var u=pr.test(c)?c.replace(pr,"$1"):c;if(!u.match(/\S*Error: /)){for(var h of t){var p=h(u,r);if(p){a.push(p);break}}if(a.length>=fr)break}}}return(function(f){if(!f.length)return[];var g=Array.from(f);return g.reverse(),g.slice(0,fr).map((v=>{return b({},v,{filename:v.filename||(E=g,E[E.length-1]||{}).filename,function:v.function||Je});var E}))})(a)}}class Nn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=N(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Lt(e,"DOMException")}isDOMError(e){return Lt(e,"DOMError")}}class Hn{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class jn{constructor(){}match(e){return Lt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var qn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Un{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(qn);return s&&(t=s[1],i=s[2]),[t,i]}}var Bn=["fatal","error","warning","log","info","debug"];function hs(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class Vn{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return us(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+hs(e)}isSeverityLevel(e){return N(e)&&!xi(e)&&Bn.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Fn(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class Gn{match(e){return us(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+hs(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Wn{match(e){return ki(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class zn{match(e){return Lt(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return ki(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(ki(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var ds=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(ge.DEBUG||x.POSTHOG_DEBUG||t)&&!_(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],a=arguments.length,o=new Array(a>1?a-1:0),l=1;l<a;l++)o[l-1]=arguments[l];n(r,...o)}},info:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];console.error(r,...n)},uninitializedWarning:s=>{i.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>ds(r+" "+s,n)};return i},y=ds("[PostHog.js]"),H=y.createLogger,Yn=H("[ExternalScriptsLoader]"),vr=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Yn.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=m?.querySelectorAll("script");if(i){for(var s,n=function(){if(i[a].src===e){var l=i[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},a=0;a<i.length;a++)if(s=n())return s.v}var o=()=>{if(!m)return t("document not found");var l=m.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");var c,u=m.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):m.body.appendChild(l)};m!=null&&m.body?o():m?.addEventListener("DOMContentLoaded",o)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);vr(r,n,t)},x.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);vr(r,i,t)};var Nt={};function Te(r,e,t){if(T(r)){if(ar&&r.forEach===ar)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Nt)return}}}function C(r,e,t){if(!O(r)){if(T(r))return Te(r,e,t);if(En(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Nt)return}else for(var s in r)if(ls.call(r,s)&&e.call(t,r[s],s)===Nt)return}}var D=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Te(t,(function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])})),r},Qe=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Te(t,(function(s){Te(s,(function(n){r.push(n)}))})),r};function Mt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var gr=function(r){try{return r()}catch{return}},Xn=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),y.critical(s)}}},Gi=function(r){var e={};return C(r,(function(t,i){(N(t)&&t.length>0||pe(t))&&(e[i]=t)})),e};function Jn(r,e){return t=r,i=n=>N(n)&&!be(e)?n.slice(0,e):n,s=new Set,(function n(a,o){return a!==Object(a)?i?i(a,o):a:s.has(a)?void 0:(s.add(a),T(a)?(l=[],Te(a,(c=>{l.push(n(c))}))):(l={},C(a,((c,u)=>{s.has(c)||(l[u]=n(c,u))}))),l);var l})(t);var t,i,s}var Kn=["herokuapp.com","vercel.app","netlify.app"];function Zn(r){var e=r?.hostname;if(!N(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Kn)if(t===i)return!1;return!0}function ps(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function L(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r?.addEventListener(e,t,{capture:s,passive:n})}var fs="$people_distinct_id",ct="__alias",ht="__timers",_r="$autocapture_disabled_server_side",Pi="$heatmaps_enabled_server_side",mr="$exception_capture_enabled_server_side",Fi="$error_tracking_suppression_rules",yr="$error_tracking_capture_extension_exceptions",br="$web_vitals_enabled_server_side",vs="$dead_clicks_enabled_server_side",wr="$web_vitals_allowed_metrics",ai="$session_recording_remote_config",Ht="$sesid",gs="$session_is_sampled",ze="$enabled_feature_flags",dt="$early_access_features",$i="$feature_flag_details",pt="$stored_person_properties",Le="$stored_group_properties",Ii="$surveys",$t="$surveys_activated",jt="$flag_call_reported",_e="$user_state",Oi="$client_session_props",Ti="$capture_rate_limit",Ci="$initial_campaign_params",Ri="$initial_referrer_info",qt="$initial_person_info",Ut="$epp",_s="__POSTHOG_TOOLBAR__",tt="$posthog_cookieless",Qn=[fs,ct,"__cmpns",ht,"$session_recording_enabled_server_side",Pi,Ht,ze,Fi,_e,dt,$i,Le,pt,Ii,jt,Oi,Ti,Ci,Ri,Ut,qt];function Er(r){return r instanceof Element&&(r.id===_s||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function ei(r){return!!r&&r.nodeType===1}function Ce(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function ms(r){return!!r&&r.nodeType===3}function ys(r){return!!r&&r.nodeType===11}function Wi(r){return r?Zt(r).split(/\s+/):[]}function xr(r){var e=d?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Bt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Wi(e)}function bs(r){return O(r)?null:Zt(r).split(/(\s+)/).filter((e=>yt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function kt(r){var e="";return Mi(r)&&!Ss(r)&&r.childNodes&&r.childNodes.length&&C(r.childNodes,(function(t){var i;ms(t)&&t.textContent&&(e+=(i=bs(t.textContent))!==null&&i!==void 0?i:"")})),Zt(e)}function ws(r){return _(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var zi=["a","button","form","input","select","textarea","label"];function Es(r,e){if(_(e))return!0;var t,i=function(n){if(e.some((a=>n.matches(a))))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function xs(r){var e=r.parentNode;return!(!e||!ei(e))&&e}var ea=["next","previous","prev",">","<"],kr=10,Sr=[".ph-no-rageclick",".ph-no-capture"];function ta(r,e){if(!d||Yi(r))return!1;var t,i,s;if(Oe(e)?(t=!!e&&Sr,i=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Sr,i=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=ks(r,!1);return!(function(a,o){if(a===!1||_(a))return!1;var l;if(a===!0)l=ea;else{if(!T(a))return!1;if(a.length>kr)return y.error("[PostHog] content_ignorelist array cannot exceed "+kr+" items. Use css_selector_ignorelist for more complex matching."),!1;l=a.map((c=>c.toLowerCase()))}return o.some((c=>{var{safeText:u,ariaLabel:h}=c;return l.some((p=>u.includes(p)||h.includes(p)))}))})(i,n.map((a=>{var o;return{safeText:kt(a).toLowerCase(),ariaLabel:((o=a.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}})))&&!Es(n,t)}var Yi=r=>!r||Ce(r,"html")||!ei(r),ks=(r,e)=>{if(!d||Yi(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Ce(s,"body");)if(ys(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=xs(s);if(!n)break;if(e||zi.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=d.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function ia(r,e,t,i,s){var n,a,o,l;if(t===void 0&&(t=void 0),!d||Yi(r)||(n=t)!=null&&n.url_allowlist&&!xr(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&xr(t.url_ignorelist))return!1;if((o=t)!=null&&o.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((g=>e.type===g)))return!1}var{parentIsUsefulElement:u,targetElementList:h}=ks(r,i);if(!(function(g,v){var E=v?.element_allowlist;if(_(E))return!0;var w,k=function(P){if(E.some((R=>P.tagName.toLowerCase()===R)))return{v:!0}};for(var $ of g)if(w=k($))return w.v;return!1})(h,t)||!Es(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(r);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(zi.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Mi(r){for(var e=r;e.parentNode&&!Ce(e,"body");e=e.parentNode){var t=Bt(e);if(S(t,"ph-sensitive")||S(t,"ph-no-capture"))return!1}if(S(Bt(r),"ph-include"))return!0;var i=r.type||"";if(N(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(N(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Ss(r){return!!(Ce(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Ce(r,"select")||Ce(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Ps="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",ra=new RegExp("^(?:"+Ps+")$"),sa=new RegExp(Ps),Fs="\\d{3}-?\\d{2}-?\\d{4}",na=new RegExp("^("+Fs+")$"),aa=new RegExp("("+Fs+")");function yt(r,e){return e===void 0&&(e=!0),!(O(r)||N(r)&&(r=Zt(r),(e?ra:sa).test((r||"").replace(/[- ]/g,""))||(e?na:aa).test(r)))}function $s(r){var e=kt(r);return yt(e=(e+" "+Is(r)).trim())?e:""}function Is(r){var e="";return r&&r.childNodes&&r.childNodes.length&&C(r.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=kt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Is(t)).trim())}catch(n){y.error("[AutoCapture]",n)}})),e}function oa(r){return(function(e){var t=e.map((i=>{var s,n,a="";if(i.tag_name&&(a+=i.tag_name),i.attr_class)for(var o of(i.attr_class.sort(),i.attr_class))a+="."+o.replace(/"/g,"");var l=b({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),c={};return Mt(l).sort(((u,h)=>{var[p]=u,[f]=h;return p.localeCompare(f)})).forEach((u=>{var[h,p]=u;return c[Pr(h.toString())]=Pr(p.toString())})),a+=":",a+=Mt(c).map((u=>{var[h,p]=u;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:la(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Mt(t).filter((a=>{var[o]=a;return o.indexOf("attr__")===0})).forEach((a=>{var[o,l]=a;return n.attributes[o]=l})),n}))})(r))}function Pr(r){return r.replace(/"|\\"/g,'\\"')}function la(r){var e=r.attr__class;return e?T(e)?e:Wi(e):void 0}class Os{constructor(e){this.disabled=e===!1;var t=j(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var oi="$copy_autocapture",ye=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Co=["fatal","error","warning","log","info","debug"],Vt=r=>{var e=m?.createElement("a");return _(e)?null:(e.href=r,e)},ua=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return C(r,(function(n,a){_(n)||_(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t)})),s.join(e)},Gt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!T(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{y.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},St=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],a=s.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),u=[],h=0;h<c.length;h++){var p=c[h].split("=");T(p)&&(e.includes(p[0])?u.push(p[0]+"="+t):u.push(c[h]))}var f=l;return o!=null&&(f+="?"+u.join("&")),n!=null&&(f+="#"+n),f},Wt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Fr=H("[AutoCapture]");function li(r,e){return e.length>r?e.slice(0,r)+"...":e}function ca(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!ei(e));return e}function ha(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};zi.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=li(1024,$s(r)):n.$el_text=li(1024,kt(r)));var a=Bt(r);a.length>0&&(n.classes=a.filter((function(u){return u!==""}))),C(r.attributes,(function(u){var h;if((!Ss(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(i==null||!i.includes(u.name))&&!e&&yt(u.value)&&(h=u.name,!N(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=u.value;u.name==="class"&&(p=Wi(p).join(" ")),n["attr__"+u.name]=li(1024,p)}}));for(var o=1,l=1,c=r;c=ca(c);)o++,c.tagName===r.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}function da(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Ce(u,"body");)ys(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var h,p=[],f={},g=!1,v=!1;if(C(c,(P=>{var R=Mi(P);P.tagName.toLowerCase()==="a"&&(g=P.getAttribute("href"),g=R&&g&&yt(g)&&g),S(Bt(P),"ph-no-capture")&&(v=!0),p.push(ha(P,n,a,o));var re=(function(X){if(!Mi(X))return{};var F={};return C(X.attributes,(function(ae){if(ae.name&&ae.name.indexOf("data-ph-capture-attribute")===0){var J=ae.name.replace("data-ph-capture-attribute-",""),se=ae.value;J&&se&&yt(se)&&(F[J]=se)}})),F})(P);D(f,re)})),v)return{props:{},explicitNoCapture:v};if(a||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=$s(r):p[0].$el_text=kt(r)),g){var E,w;p[0].attr__href=g;var k=(E=Vt(g))==null?void 0:E.host,$=d==null||(w=d.location)==null?void 0:w.host;k&&$&&k!==$&&(h=g)}return{props:D({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:oa(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(i=p[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},f)}}class pa{constructor(e){this.P=!1,this.T=null,this.R=!1,this.instance=e,this.rageclicks=new Os(e.config.rageclick),this.I=null}get F(){var e,t,i=j(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),i}C(){if(this.isBrowserSupported()){if(d&&m){var e=i=>{i=i||d?.event;try{this.M(i)}catch(s){Fr.error("Failed to capture event",s)}};if(L(m,"submit",e,{capture:!0}),L(m,"change",e,{capture:!0}),L(m,"click",e,{capture:!0}),this.F.capture_copied_text){var t=i=>{i=i||d?.event,this.M(i,oi)};L(m,"copy",t,{capture:!0}),L(m,"cut",t,{capture:!0})}}}else Fr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.C(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.R=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[_r]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.I=e}getElementSelectors(e){var t,i=[];return(t=this.I)==null||t.forEach((s=>{var n=m?.querySelectorAll(s);n?.forEach((a=>{e===a&&i.push(s)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[_r],s=this.T;if(be(s)&&!Oe(i)&&!this.instance.O())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}M(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=ws(e);ms(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&ta(s,this.instance.config.rageclick)&&this.M(e,"$rageclick");var n=t===oi;if(s&&ia(s,e,this.F,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=da(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.F.element_attribute_ignorelist,elementsChainAsString:this.R});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===oi){var c,u=bs(d==null||(c=d.getSelection())==null?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Ie(m?.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return pe(r)&&isFinite(r)&&Math.floor(r)===r});var $r="0123456789abcdef";class zt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new zt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+$r.charAt(this.bytes[t]>>>4)+$r.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new zt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class fa{constructor(){this.A=0,this.D=0,this.j=new va}generate(){var e=this.generateOrAbort();if(_(e)){this.A=0;var t=this.generateOrAbort();if(_(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return zt.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var Ir,Ts=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!_(d.crypto)&&crypto.getRandomValues&&(Ts=r=>crypto.getRandomValues(r));class va{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Ts(this.N),this.U=0),this.N[this.U++]}}var $e=()=>ga().toString(),ga=()=>(Ir||(Ir=new fa)).generate(),it="",_a=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function ma(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=m),it)return it;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+$e();!it&&o--;){var c=a.slice(o).join("."),u=l+"=1;domain=."+c+";path=/";n.cookie=u+";max-age=3",n.cookie.includes(l)&&(n.cookie=u+";max-age=0",it=c)}return it})(r);if(!t){var i=(s=>{var n=s.match(_a);return n?n[0]:""})(r);i!==t&&y.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var de={H:()=>!!m,B:function(r){y.error("cookieStore error: "+r)},q:function(r){if(m){try{for(var e=r+"=",t=m.cookie.split(";").filter((n=>n.length)),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(de.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(m)try{var n="",a="",o=ma(m.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&y.warn("cookieStore warning: large cookie, len="+c.length),m.cookie=c,c}catch{return}},V:function(r,e){if(m!=null&&m.cookie)try{de.G(r,"",-1,e)}catch{return}}},ui=null,A={H:function(){if(!be(ui))return ui;var r=!0;if(_(d))r=!1;else try{var e="__mplssupport__";A.G(e,"xyz"),A.q(e)!=='"xyz"'&&(r=!1),A.V(e)}catch{r=!1}return r||y.error("localStorage unsupported; falling back to cookie store"),ui=r,r},B:function(r){y.error("localStorage error: "+r)},q:function(r){try{return d?.localStorage.getItem(r)}catch(e){A.B(e)}return null},W:function(r){try{return JSON.parse(A.q(r))||{}}catch{}return null},G:function(r,e){try{d?.localStorage.setItem(r,JSON.stringify(e))}catch(t){A.B(t)}},V:function(r){try{d?.localStorage.removeItem(r)}catch(e){A.B(e)}}},ya=["distinct_id",Ht,gs,Ut,qt],It=b({},A,{W:function(r){try{var e={};try{e=de.W(r)||{}}catch{}var t=D(e,JSON.parse(A.q(r)||"{}"));return A.G(r,t),t}catch{}return null},G:function(r,e,t,i,s,n){try{A.G(r,e,void 0,void 0,n);var a={};ya.forEach((o=>{e[o]&&(a[o]=e[o])})),Object.keys(a).length&&de.G(r,a,t,i,s,n)}catch(o){A.B(o)}},V:function(r,e){try{d?.localStorage.removeItem(r),de.V(r,e)}catch(t){A.B(t)}}}),Ot={},ba={H:function(){return!0},B:function(r){y.error("memoryStorage error: "+r)},q:function(r){return Ot[r]||null},W:function(r){return Ot[r]||null},G:function(r,e){Ot[r]=e},V:function(r){delete Ot[r]}},Me=null,q={H:function(){if(!be(Me))return Me;if(Me=!0,_(d))Me=!1;else try{var r="__support__";q.G(r,"xyz"),q.q(r)!=='"xyz"'&&(Me=!1),q.V(r)}catch{Me=!1}return Me},B:function(r){y.error("sessionStorage error: ",r)},q:function(r){try{return d?.sessionStorage.getItem(r)}catch(e){q.B(e)}return null},W:function(r){try{return JSON.parse(q.q(r))||null}catch{}return null},G:function(r,e){try{d?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){q.B(t)}},V:function(r){try{d?.sessionStorage.removeItem(r)}catch(e){q.B(e)}}},me=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({});class wa{constructor(e){this._instance=e}get F(){return this._instance.config}get consent(){return this.J()?me.DENIED:this.K}isOptedOut(){return this.F.cookieless_mode==="always"||this.consent===me.DENIED||this.consent===me.PENDING&&(this.F.opt_out_capturing_by_default||this.F.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===me.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.F.cookie_expiration,this.F.cross_subdomain_cookie,this.F.secure_cookie)}reset(){this.Y.V(this.X,this.F.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return si(e)?me.GRANTED:S(Sn,e)?me.DENIED:me.PENDING}get Y(){if(!this.Z){var e=this.F.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?A:de;var t=e==="localStorage"?de:A;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(si(t.q(this.X))),t.V(this.X,this.F.cross_subdomain_cookie))}return this.Z}J(){return!!this.F.respect_dnt&&!!ps([Z?.doNotTrack,Z?.msDoNotTrack,x.doNotTrack],(e=>si(e)))}}var Tt=H("[Dead Clicks]"),Ea=()=>!0,xa=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(vs)),i=r.instance.config.capture_dead_clicks;return Oe(i)?i:!!j(i)||t};class Cs{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[vs]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Tt.error("failed to load script",s):e()}))}et(){var e;if(m){if(!this.tt&&(e=x.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=j(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(m),Tt.info("starting...")}}else Tt.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Tt.info("stopping..."))}}var rt=H("[ExceptionAutocapture]");class ka{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=x.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=x.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.F.capture_unhandled_errors&&(this.st=a(this.captureException.bind(this))),!this.nt&&this.F.capture_unhandled_rejections&&(this.nt=o(this.captureException.bind(this))),!this.ot&&this.F.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){rt.error("failed to start",c),this.lt()}}},this._instance=e,this.ut=!((t=this._instance.persistence)==null||!t.props[mr]),this.F=this.ht(),this.vt=new Pn({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:rt}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(e)?t=b({},t,e):(_(e)?this.ut:e)&&(t=b({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.F.capture_console_errors||this.F.capture_unhandled_errors||this.F.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(rt.info("enabled"),this.it(this.rt))}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return rt.error("failed to load script",s);e()}))}lt(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ut=!!t||!1,this.F=this.ht(),this._instance.persistence&&this._instance.persistence.register({[mr]:this.ut}),this.startIfEnabled()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.vt.consumeRateLimit(s)?rt.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function Or(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Ie(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class Sa{constructor(e){var t;this._instance=e,this.dt=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(y.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,y.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||Or(d.history,"pushState",(s=>function(n,a,o){s.call(this,n,a,o),i.ft("pushState")})),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||Or(d.history,"replaceState",(s=>function(n,a,o){s.call(this,n,a,o),i.ft("replaceState")})),this.gt()}}ft(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this.dt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.dt=i}catch(s){y.error("Error capturing "+e+" pageview",s)}}gt(){if(!this.ct){var e=()=>{this.ft("popstate")};L(d,"popstate",e),this.ct=()=>{d&&d.removeEventListener("popstate",e)}}}}var ci=H("[SegmentIntegration]");function Pa(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var a=l=>{var c=()=>l.anonymousId()||$e();i.config.get_device_id=c,l.id()&&(i.register({distinct_id:l.id(),$device_id:c()}),i.persistence.set_property(_e,"identified")),s()},o=n.user();"then"in o&&Ie(o.then)?o.then((l=>a(l))):a(o)})(r,(()=>{t.register((i=>{Promise&&Promise.resolve||ci.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,a)=>{if(!a)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(ci.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(ci.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var o=i.calculateEventProperties(a,n.event.properties);return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then((()=>{e()}))}))}var Rs="posthog-js";function Ms(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,c,u,h,p;if(!(n==="*"||n.includes(o.level))||!r.__loaded)return o;o.tags||(o.tags={});var f=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());o.tags["PostHog Person URL"]=f,r.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var g=((l=o.exception)==null?void 0:l.values)||[],v=g.map((w=>b({},w,{stacktrace:w.stacktrace?b({},w.stacktrace,{type:"raw",frames:(w.stacktrace.frames||[]).map((k=>b({},k,{platform:"web:javascript"})))}):void 0}))),E={$exception_message:((c=g[0])==null?void 0:c.value)||o.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:o.tags};return t&&i&&(E.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),a&&r.exceptions.sendExceptionEvent(E),o}}class Fa{constructor(e,t,i,s,n,a){this.name=Rs,this.setupOnce=function(o){o(Ms(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}var $a=d!=null&&d.location?Wt(d.location.hash,"__posthog")||Wt(location.hash,"state"):null,Tr="_postHogToolbarParams",Cr=H("[Toolbar]"),Fe=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Fe||{});class Ia{constructor(e){this.instance=e}_t(e){x.ph_toolbar_state=e}yt(){var e;return(e=x.ph_toolbar_state)!==null&&e!==void 0?e:Fe.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!d||!m)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d?.localStorage}var s,n=$a||Wt(e.hash,"__posthog")||Wt(e.hash,"state"),a=n?gr((()=>JSON.parse(atob(decodeURIComponent(n)))))||gr((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Tr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}bt(e){var t=x.ph_load_toolbar||x.ph_load_editor;!O(t)&&Ie(t)?t(e,this.instance):Cr.warn("No toolbar load function found")}loadToolbar(e){var t=!(m==null||!m.getElementById(_s));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=b({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Tr,JSON.stringify(b({},s,{source:void 0}))),this.yt()===Fe.LOADED)this.bt(s);else if(this.yt()===Fe.UNINITIALIZED){var n;this._t(Fe.LOADING),(n=x.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(a=>{if(a)return Cr.error("[Toolbar] Failed to load",a),void this._t(Fe.UNINITIALIZED);this._t(Fe.LOADED),this.bt(s)})),L(d,"turbolinks:load",(()=>{this._t(Fe.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Oa=H("[TracingHeaders]");class Ta{constructor(e){this.xt=void 0,this.St=void 0,this.rt=()=>{var t,i;_(this.xt)&&((t=x.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),_(this.St)&&((i=x.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Oa.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.xt)==null||e.call(this),(t=this.St)==null||t.call(this),this.xt=void 0,this.St=void 0)}}var te="Mobile",Yt="iOS",he="Android",bt="Tablet",As=he+" "+bt,Ds="iPad",Ls="Apple",Ns=Ls+" Watch",wt="Safari",Ke="BlackBerry",Hs="Samsung",js=Hs+"Browser",qs=Hs+" Internet",Ne="Chrome",Ca=Ne+" OS",Us=Ne+" "+Yt,Xi="Internet Explorer",Bs=Xi+" "+te,Ji="Opera",Ra=Ji+" Mini",Ki="Edge",Vs="Microsoft "+Ki,Ye="Firefox",Gs=Ye+" "+Yt,Et="Nintendo",xt="PlayStation",Xe="Xbox",Ws=he+" "+te,zs=te+" "+wt,ft="Windows",Ai=ft+" Phone",Rr="Nokia",Di="Ouya",Ys="Generic",Ma=Ys+" "+te.toLowerCase(),Xs=Ys+" "+bt.toLowerCase(),Li="Konqueror",G="(\\d+(\\.\\d+)?)",hi=new RegExp("Version/"+G),Aa=new RegExp(Xe,"i"),Da=new RegExp(xt+" \\w+","i"),La=new RegExp(Et+" \\w+","i"),Zi=new RegExp(Ke+"|PlayBook|BB10","i"),Na={"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"},Ha=(r,e)=>e&&S(e,Ls)||(function(t){return S(t,wt)&&!S(t,Ne)&&!S(t,he)})(r),Js=function(r,e){return e=e||"",S(r," OPR/")&&S(r,"Mini")?Ra:S(r," OPR/")?Ji:Zi.test(r)?Ke:S(r,"IE"+te)||S(r,"WPDesktop")?Bs:S(r,js)?qs:S(r,Ki)||S(r,"Edg/")?Vs:S(r,"FBIOS")?"Facebook "+te:S(r,"UCWEB")||S(r,"UCBrowser")?"UC Browser":S(r,"CriOS")?Us:S(r,"CrMo")||S(r,Ne)?Ne:S(r,he)&&S(r,wt)?Ws:S(r,"FxiOS")?Gs:S(r.toLowerCase(),Li.toLowerCase())?Li:Ha(r,e)?S(r,te)?zs:wt:S(r,Ye)?Ye:S(r,"MSIE")||S(r,"Trident/")?Xi:S(r,"Gecko")?Ye:""},ja={[Bs]:[new RegExp("rv:"+G)],[Vs]:[new RegExp(Ki+"?\\/"+G)],[Ne]:[new RegExp("("+Ne+"|CrMo)\\/"+G)],[Us]:[new RegExp("CriOS\\/"+G)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+G)],[wt]:[hi],[zs]:[hi],[Ji]:[new RegExp("(Opera|OPR)\\/"+G)],[Ye]:[new RegExp(Ye+"\\/"+G)],[Gs]:[new RegExp("FxiOS\\/"+G)],[Li]:[new RegExp("Konqueror[:/]?"+G,"i")],[Ke]:[new RegExp(Ke+" "+G),hi],[Ws]:[new RegExp("android\\s"+G,"i")],[qs]:[new RegExp(js+"\\/"+G)],[Xi]:[new RegExp("(rv:|MSIE )"+G)],Mozilla:[new RegExp("rv:"+G)]},qa=function(r,e){var t=Js(r,e),i=ja[t];if(_(i))return null;for(var s=0;s<i.length;s++){var n=i[s],a=r.match(n);if(a)return parseFloat(a[a.length-2])}return null},Mr=[[new RegExp(Xe+"; "+Xe+" (.*?)[);]","i"),r=>[Xe,r&&r[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(xt,"i"),[xt,""]],[Zi,[Ke,""]],[new RegExp(ft,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ai,""];if(new RegExp(te).test(e)&&!/IEMobile\b/.test(e))return[ft+" "+te,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Na[i]||"";return/arm/i.test(e)&&(s="RT"),[ft,s]}return[ft,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Yt,e.join(".")]}return[Yt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=_(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+he+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+he+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[he,e.join(".")]}return[he,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ca,""]],[/Linux|debian/i,["Linux",""]]],Ar=function(r){return La.test(r)?Et:Da.test(r)?xt:Aa.test(r)?Xe:new RegExp(Di,"i").test(r)?Di:new RegExp("("+Ai+"|WPDesktop)","i").test(r)?Ai:/iPad/.test(r)?Ds:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Ns:Zi.test(r)?Ke:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Rr,"i").test(r)?Rr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(te).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?he:As:he:new RegExp("(pda|"+te+")","i").test(r)?Ma:new RegExp(bt,"i").test(r)&&!new RegExp(bt+" pc","i").test(r)?Xs:""},Ct="https?://(.*)",et=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ua=Qe(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],et),Pt="<masked>",Ba=["li_fat_id"];function Ks(r,e,t){if(!m)return{};var i,s=e?Qe([],et,t||[]):[],n=Zs(St(m.URL,s,Pt),r),a=(i={},C(Ba,(function(o){var l=de.q(o);i[o]=l||null})),i);return D(a,n)}function Zs(r,e){var t=Ua.concat(e||[]),i={};return C(t,(function(s){var n=Gt(r,s);i[s]=n||null})),i}function Qs(r){var e=(function(n){return n?n.search(Ct+"google.([^/?]*)")===0?"google":n.search(Ct+"bing.com")===0?"bing":n.search(Ct+"yahoo.com")===0?"yahoo":n.search(Ct+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!be(e)){i.$search_engine=e;var s=m?Gt(m.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Dr(){return navigator.language||navigator.userLanguage}function en(){return m?.referrer||"$direct"}function tn(r,e){var t=r?Qe([],et,e||[]):[],i=z?.href.substring(0,1e3);return{r:en().substring(0,1e3),u:i?St(i,t,Pt):void 0}}function rn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Vt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Vt(i);s.$host=n?.host,s.$pathname=n?.pathname;var a=Zs(i);D(s,a)}if(t){var o=Qs(t);D(s,o)}return s}function sn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Va(){try{return new Date().getTimezoneOffset()}catch{return}}function Ga(r,e){if(!W)return{};var t,i,s,n=r?Qe([],et,e||[]):[],[a,o]=(function(l){for(var c=0;c<Mr.length;c++){var[u,h]=Mr[c],p=u.exec(l),f=p&&(Ie(h)?h(p,l):h);if(f)return f}return["",""]})(W);return D(Gi({$os:a,$os_version:o,$browser:Js(W,navigator.vendor),$device:Ar(W),$device_type:(i=W,s=Ar(i),s===Ds||s===As||s==="Kobo"||s==="Kindle Fire"||s===Xs?bt:s===Et||s===Xe||s===xt||s===Di?"Console":s===Ns?"Wearable":s?te:"Desktop"),$timezone:sn(),$timezone_offset:Va()}),{$current_url:St(z?.href,n,Pt),$host:z?.host,$pathname:z?.pathname,$raw_user_agent:W.length>1e3?W.substring(0,997)+"...":W,$browser_version:qa(W,navigator.vendor),$browser_language:Dr(),$browser_language_prefix:(t=Dr(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:ge.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Se=H("[Web Vitals]"),Lr=9e5;class Wa{constructor(e){var t;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((i,s)=>b({},i,{["$web_vitals_"+s.name+"_event"]:b({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(_(n))Se.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Tt();_(a)||(O(i?.name)||O(i?.value)?Se.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Se.error("Ignoring metric with value >= "+this.Rt,i):(this.N.url!==a&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),_(this.N.url)&&(this.N.url=a),this.N.firstMetricTimestamp=_(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(b({},i,{$current_url:a,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var i,s,n,a,o=x.__PosthogExtensions__;_(o)||_(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:a}=o.postHogWebVitalsCallbacks),i&&s&&n&&a?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.Pt.bind(this)),this.P=!0):Se.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Et=!((t=this._instance.persistence)==null||!t.props[br]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=j(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return _(i)?((t=this._instance.persistence)==null?void 0:t.props[wr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(j(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=j(this._instance.config.capture_performance)&&pe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Lr;return 0<e&&e<=6e4?Lr:e}get isEnabled(){var e=z?.protocol;if(e!=="http:"&&e!=="https:")return Se.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=j(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Oe(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Oe(t)?t:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(Se.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=j(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=j(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[br]:t}),this._instance.persistence.register({[wr]:i})),this.Et=t,this.startIfEnabled()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"web-vitals",(s=>{s?Se.error("failed to load script",s):e()}))}Tt(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?Qe([],et,i||[]):[];return St(e,s,Pt)}Se.error("Could not determine current URL")}}var za=H("[Heatmaps]");function Nr(r){return j(r)&&"clientX"in r&&"clientY"in r&&pe(r.clientX)&&pe(r.clientY)}class Ya{constructor(e){var t;this.Et=!1,this.P=!1,this.It=null,this.instance=e,this.Et=!((t=this.instance.persistence)==null||!t.props[Pi]),this.rageclicks=new Os(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return j(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return _(this.instance.config.capture_heatmaps)?_(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;za.info("starting..."),this.Ft(),this.Ct()}else{var e;clearInterval((e=this.It)!==null&&e!==void 0?e:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Pi]:t}),this.Et=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Ot(e){this.At(e.originalEvent,"deadclick")}Ct(){this.It&&clearInterval(this.It),this.It=(function(e){return e?.visibilityState==="visible"})(m)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ft(){d&&m&&(this.jt=this.Dt.bind(this),L(d,"beforeunload",this.jt),this.Lt=e=>this.At(e||d?.event),L(m,"click",this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||d?.event),L(m,"mousemove",this.Nt,{capture:!0}),this.zt=new Cs(this.instance,Ea,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ct.bind(this),L(m,"visibilitychange",this.Ht),this.P=!0)}Mt(){var e;d&&m&&(this.jt&&d.removeEventListener("beforeunload",this.jt),this.Lt&&m.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&m.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&m.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),(e=this.zt)==null||e.stop(),this.P=!1)}qt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=(function(o,l,c){for(var u=o;u&&ei(u)&&!Ce(u,"body");){if(u===c)return!1;if(S(l,d?.getComputedStyle(u).position))return!0;u=xs(u)}return!1})(ws(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}At(e,t){var i;if(t===void 0&&(t="click"),!Er(e.target)&&Nr(e)){var s=this.qt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Wt(b({},s,{type:"rageclick"})),this.Wt(s)}}Ut(e){!Er(e.target)&&Nr(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(e,"mousemove"))}),500))}Wt(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?Qe([],et,s||[]):[],a=St(t,n,Pt);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(e)}}Dt(){this.N&&!We(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Xa{constructor(e){this._instance=e}doPageView(e,t){var i,s=this.Gt(e,t);return this.Vt={pathname:(i=d?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Gt(e,(t=this.Vt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vt)==null?void 0:e.pageViewId}}Gt(e,t){var i=this.Vt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(_(a)||_(o)||_(l)||_(c)||_(u)||_(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var p=a<=1?1:ce(o/a,0,1,y),f=a<=1?1:ce(l/a,0,1,y),g=c<=1?1:ce(u/c,0,1,y),v=c<=1?1:ce(h/c,0,1,y);s=D(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var ie=Uint8Array,Y=Uint16Array,Ze=Uint32Array,Qi=new ie([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]),er=new ie([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]),Hr=new ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(r,e){for(var t=new Y(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new Ze(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},an=nn(Qi,2),Ja=an[0],Ni=an[1];Ja[28]=258,Ni[258]=28;for(var jr=nn(er,0)[1],on=new Y(32768),M=0;M<32768;++M){var Ae=(43690&M)>>>1|(21845&M)<<1;Ae=(61680&(Ae=(52428&Ae)>>>2|(13107&Ae)<<2))>>>4|(3855&Ae)<<4,on[M]=((65280&Ae)>>>8|(255&Ae)<<8)>>>1}var _t=function(r,e,t){for(var i=r.length,s=0,n=new Y(e);s<i;++s)++n[r[s]-1];var a,o=new Y(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;for(a=new Y(i),s=0;s<i;++s)a[s]=on[o[r[s]-1]++]>>>15-r[s];return a},He=new ie(288);for(M=0;M<144;++M)He[M]=8;for(M=144;M<256;++M)He[M]=9;for(M=256;M<280;++M)He[M]=7;for(M=280;M<288;++M)He[M]=8;var Xt=new ie(32);for(M=0;M<32;++M)Xt[M]=5;var Ka=_t(He,9),Za=_t(Xt,5),ln=function(r){return(r/8>>0)+(7&r&&1)},un=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Y?Y:r instanceof Ze?Ze:ie)(t-e);return i.set(r.subarray(e,t)),i},ve=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},st=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},di=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new ie(0),0];if(s==1){var a=new ie(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(R,re){return R.f-re.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=s-1;)o=t[t[c].f<t[h].f?c++:h++],l=t[c!=u&&t[c].f<t[h].f?c++:h++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var p=n[0].s;for(i=1;i<s;++i)n[i].s>p&&(p=n[i].s);var f=new Y(p+1),g=Hi(t[u-1],f,0);if(g>e){i=0;var v=0,E=g-e,w=1<<E;for(n.sort((function(R,re){return f[re.s]-f[R.s]||R.f-re.f}));i<s;++i){var k=n[i].s;if(!(f[k]>e))break;v+=w-(1<<g-f[k]),f[k]=e}for(v>>>=E;v>0;){var $=n[i].s;f[$]<e?v-=1<<e-f[$]++-1:++i}for(;i>=0&&v;--i){var P=n[i].s;f[P]==e&&(--f[P],++v)}g=e}return[new ie(f),g]},Hi=function(r,e,t){return r.s==-1?Math.max(Hi(r.l,e,t+1),Hi(r.r,e,t+1)):e[r.s]=t},qr=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Y(++e),i=0,s=r[0],n=1,a=function(l){t[i++]=l},o=1;o<=e;++o)if(r[o]==s&&o!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=r[o]}return[t.subarray(0,i),e]},nt=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},ji=function(r,e,t){var i=t.length,s=ln(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Ur=function(r,e,t,i,s,n,a,o,l,c,u){ve(e,u++,t),++s[256];for(var h=di(s,15),p=h[0],f=h[1],g=di(n,15),v=g[0],E=g[1],w=qr(p),k=w[0],$=w[1],P=qr(v),R=P[0],re=P[1],X=new Y(19),F=0;F<k.length;++F)X[31&k[F]]++;for(F=0;F<R.length;++F)X[31&R[F]]++;for(var ae=di(X,7),J=ae[0],se=ae[1],Q=19;Q>4&&!J[Hr[Q-1]];--Q);var fe,oe,le,je,we=c+5<<3,Re=nt(s,He)+nt(n,Xt)+a,ue=nt(s,p)+nt(n,v)+a+14+3*Q+nt(X,J)+(2*X[16]+3*X[17]+7*X[18]);if(we<=Re&&we<=ue)return ji(e,u,r.subarray(l,l+c));if(ve(e,u,1+(ue<Re)),u+=2,ue<Re){fe=_t(p,f),oe=p,le=_t(v,E),je=v;var Ee=_t(J,se);for(ve(e,u,$-257),ve(e,u+5,re-1),ve(e,u+10,Q-4),u+=14,F=0;F<Q;++F)ve(e,u+3*F,J[Hr[F]]);u+=3*Q;for(var qe=[k,R],V=0;V<2;++V){var ee=qe[V];for(F=0;F<ee.length;++F){var K=31&ee[F];ve(e,u,Ee[K]),u+=J[K],K>15&&(ve(e,u,ee[F]>>>5&127),u+=ee[F]>>>12)}}}else fe=Ka,oe=He,le=Za,je=Xt;for(F=0;F<o;++F)if(i[F]>255){K=i[F]>>>18&31,st(e,u,fe[K+257]),u+=oe[K+257],K>7&&(ve(e,u,i[F]>>>23&31),u+=Qi[K]);var Ue=31&i[F];st(e,u,le[Ue]),u+=je[Ue],Ue>3&&(st(e,u,i[F]>>>5&8191),u+=er[Ue])}else st(e,u,fe[i[F]]),u+=oe[i[F]];return st(e,u,fe[256]),u+oe[256]},Qa=new Ze([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eo=(function(){for(var r=new Ze(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),to=function(r,e,t,i,s){return(function(n,a,o,l,c,u){var h=n.length,p=new ie(l+h+5*(1+Math.floor(h/7e3))+c),f=p.subarray(l,p.length-c),g=0;if(!a||h<8)for(var v=0;v<=h;v+=65535){var E=v+65535;E<h?g=ji(f,g,n.subarray(v,E)):(f[v]=u,g=ji(f,g,n.subarray(v,h)))}else{for(var w=Qa[a-1],k=w>>>13,$=8191&w,P=(1<<o)-1,R=new Y(32768),re=new Y(P+1),X=Math.ceil(o/3),F=2*X,ae=function(ri){return(n[ri]^n[ri+1]<<X^n[ri+2]<<F)&P},J=new Ze(25e3),se=new Y(288),Q=new Y(32),fe=0,oe=0,le=(v=0,0),je=0,we=0;v<h;++v){var Re=ae(v),ue=32767&v,Ee=re[Re];if(R[ue]=Ee,re[Re]=ue,je<=v){var qe=h-v;if((fe>7e3||le>24576)&&qe>423){g=Ur(n,f,0,J,se,Q,oe,le,we,v-we,g),le=fe=oe=0,we=v;for(var V=0;V<286;++V)se[V]=0;for(V=0;V<30;++V)Q[V]=0}var ee=2,K=0,Ue=$,xe=ue-Ee&32767;if(qe>2&&Re==ae(v-xe))for(var vn=Math.min(k,qe)-1,gn=Math.min(32767,v),_n=Math.min(258,qe);xe<=gn&&--Ue&&ue!=Ee;){if(n[v+ee]==n[v+ee-xe]){for(var ke=0;ke<_n&&n[v+ke]==n[v+ke-xe];++ke);if(ke>ee){if(ee=ke,K=xe,ke>vn)break;var mn=Math.min(xe,ke-2),ir=0;for(V=0;V<mn;++V){var ii=v-xe+V+32768&32767,rr=ii-R[ii]+32768&32767;rr>ir&&(ir=rr,Ee=ii)}}}xe+=(ue=Ee)-(Ee=R[ue])+32768&32767}if(K){J[le++]=268435456|Ni[ee]<<18|jr[K];var sr=31&Ni[ee],nr=31&jr[K];oe+=Qi[sr]+er[nr],++se[257+sr],++Q[nr],je=v+ee,++fe}else J[le++]=n[v],++se[n[v]]}}g=Ur(n,f,u,J,se,Q,oe,le,we,v-we,g)}return un(p,0,l+ln(g)+c)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},pi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function io(r,e){e===void 0&&(e={});var t=(function(){var o=4294967295;return{p:function(l){for(var c=o,u=0;u<l.length;++u)c=eo[255&c^l[u]]^c>>>8;o=c},d:function(){return 4294967295^o}}})(),i=r.length;t.p(r);var s,n=to(r,e,10+((s=e).filename&&s.filename.length+1||0),8),a=n.length;return(function(o,l){var c=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&pi(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){o[3]=8;for(var u=0;u<=c.length;++u)o[u+10]=c.charCodeAt(u)}})(n,e),pi(n,a-8,t.d()),pi(n,a-4,i),n}var ro=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
3
- `).replace(/\r/g,`
4
- `)).length,s=0;s<i;s++){var a=r.charCodeAt(s),o=null;a<128?t++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),be(o)||(t>e&&(n+=r.substring(e,t)),n+=o,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},so=!!wi||!!bi,Br="text/plain",Jt=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),a=b({},e),o=(i=n?.split("&").map((c=>{var u,[h,p]=c.split("="),f=t&&(u=a[h])!==null&&u!==void 0?u:p;return delete a[h],h+"="+f})))!==null&&i!==void 0?i:[],l=ua(a);return l&&o.push(l),s+"?"+o.join("&")},vt=(r,e)=>JSON.stringify(r,((t,i)=>typeof i=="bigint"?i.toString():i),e),fi=r=>{var{data:e,compression:t}=r;if(e){if(t===ye.GZipJS){var i=io((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new ie(l.length+(l.length>>>1)),p=0,f=function(w){h[p++]=w},g=0;g<u;++g){if(p+5>h.length){var v=new ie(p+8+(u-g<<1));v.set(h),h=v}var E=l.charCodeAt(g);E<128||c?f(E):E<2048?(f(192|E>>>6),f(128|63&E)):E>55295&&E<57344?(f(240|(E=65536+(1047552&E)|1023&l.charCodeAt(++g))>>>18),f(128|E>>>12&63),f(128|E>>>6&63),f(128|63&E)):(f(224|E>>>12),f(128|E>>>6&63),f(128|63&E))}return un(h,0,p)})(vt(e)),{mtime:0}),s=new Blob([i],{type:Br});return{contentType:Br,body:s,estimatedSize:s.size}}if(t===ye.Base64){var n=(function(l){var c,u,h,p,f,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,E=0,w="",k=[];if(!l)return l;l=ro(l);do c=(f=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,u=f>>12&63,h=f>>6&63,p=63&f,k[E++]=g.charAt(c)+g.charAt(u)+g.charAt(h)+g.charAt(p);while(v<l.length);switch(w=k.join(""),l.length%3){case 1:w=w.slice(0,-2)+"==";break;case 2:w=w.slice(0,-1)+"="}return w})(vt(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:vt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=vt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},At=[];bi&&At.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=fi(r))!==null&&e!==void 0?e:{},a=new Headers;C(r.headers,(function(u,h){a.append(h,u)})),i&&a.append("Content-Type",i);var o=r.url,l=null;if(lr){var c=new lr;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}bi(o,b({method:r?.method||"GET",headers:a,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((u=>u.text().then((h=>{var p={statusCode:u.status,text:h};if(u.status===200)try{p.json=JSON.parse(h)}catch(f){y.error(f)}r.callback==null||r.callback(p)})))).catch((u=>{y.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),wi&&At.push({transport:"XHR",method:r=>{var e,t=new wi;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=fi(r))!==null&&e!==void 0?e:{};C(r.headers,(function(n,a){t.setRequestHeader(a,n)})),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),Z!=null&&Z.sendBeacon&&At.push({transport:"sendBeacon",method:r=>{var e=Jt(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=fi(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;Z.sendBeacon(e,n)}catch{}}});var Kt=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function Vr(r,e,t){return vt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var cn={exact:(r,e)=>e.some((t=>r.some((i=>t===i)))),is_not:(r,e)=>e.every((t=>r.every((i=>t!==i)))),regex:(r,e)=>e.some((t=>r.some((i=>Kt(t,i))))),not_regex:(r,e)=>e.every((t=>r.every((i=>!Kt(t,i))))),icontains:(r,e)=>e.map(Rt).some((t=>r.map(Rt).some((i=>t.includes(i))))),not_icontains:(r,e)=>e.map(Rt).every((t=>r.map(Rt).every((i=>!t.includes(i)))))},Rt=r=>r.toLowerCase();function hn(r,e){return!r||Object.entries(r).every((t=>{var[i,s]=t,n=e?.[i];if(_(n)||be(n))return!1;var a=[String(n)],o=cn[s.operator];return!!o&&o(s.values,a)}))}var vi=H("[Error tracking]");class no{constructor(e){var t,i;this.Jt=[],this.Kt=new In([new Nn,new zn,new jn,new Hn,new Gn,new Vn,new Un,new Wn],Ln("web:javascript",Rn,Dn)),this._instance=e,this.Jt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Fi))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Jt=n,this._instance.persistence&&this._instance.persistence.register({[Fi]:this.Jt,[yr]:a})}get Yt(){var e,t=!!this._instance.get_property(yr),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Kt.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Xt(t)){if(this.Qt(t))return void vi.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(t))return void vi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(t))return void vi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(e){if(e.length===0)return!1;var t=e.reduce(((i,s)=>{var{type:n,value:a}=s;return N(n)&&n.length>0&&i.$exception_types.push(n),N(a)&&a.length>0&&i.$exception_values.push(a),i}),{$exception_types:[],$exception_values:[]});return this.Jt.some((i=>{var s=i.values.map((n=>{var a,o=cn[n.operator],l=T(n.value)?n.value:[n.value],c=(a=t[n.key])!==null&&a!==void 0?a:[];return l.length>0&&o(l,c)}));return i.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Zt(e){return e.flatMap((t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ti(e){if(e.length>0){var t,i,s,n,a=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],o=a[a.length-1];return(s=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Xt(e){return!O(e)&&T(e)}}var ne=H("[FeatureFlags]"),at=H("[FeatureFlags]",{debugEnabled:!0}),gi="$active_feature_flags",Be="$override_feature_flags",Gr="$feature_flag_payloads",ot="$override_feature_flag_payloads",Wr="$feature_flag_request_id",zr="$feature_flag_evaluated_at",Yr=r=>{var e={};for(var[t,i]of Mt(r||{}))i&&(e[t]=i);return e},ao=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},oo=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({});class lo{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter((t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||ne.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.vi({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property($i),t=this._instance.get_property(Be),i=this._instance.get_property(ot);if(!i&&!t)return e||{};var s=D({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var a of n){var o,l,c=s[a],u=t?.[a],h=_(u)?(o=c?.enabled)!==null&&o!==void 0&&o:!!u,p=_(u)?c.variant:typeof u=="string"?u:void 0,f=i?.[a],g=b({},c,{enabled:h,variant:h?p??c?.variant:void 0});h!==c?.enabled&&(g.original_enabled=c?.enabled),p!==c?.variant&&(g.original_variant=c?.variant),f&&(g.metadata=b({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),s[a]=g}return this.ii||(ne.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ii=!0),s}getFlagVariants(){var e=this._instance.get_property(ze),t=this._instance.get_property(Be);if(!t)return e||{};for(var i=D({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.ii||(ne.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ii=!0),i}getFlagPayloads(){var e=this._instance.get_property(Gr),t=this._instance.get_property(ot);if(!t)return e||{};for(var i=D({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.ii||(ne.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ii=!0),i}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.vi()}),5))}di(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}vi(e){var t;if(this.di(),!this._instance.O())if(this.ri)this.ni=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(pt)||{}),group_properties:this._instance.get_property(Le)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ui()&&(i.evaluation_environments=this.li());var s=this._instance.config.__preview_remote_config,n=s?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags",n+a);s&&(i.timezone=sn()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:i,compression:this._instance.config.disable_compression?void 0:ye.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,h=!0;if(l.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),h=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((u=l.json)!==null&&u!==void 0?u:{})),!i.disable_flags||this.ni)if(this.ai=!h,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(oo.FeatureFlags))ne.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var p;i.disable_flags||this.receivedFeatureFlags((p=l.json)!==null&&p!==void 0?p:{},h),this.ni&&(this.ni=!1,this.vi())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],s=""+i,n=this._instance.get_property(Wr)||void 0,a=this._instance.get_property(zr)||void 0,o=this._instance.get_property(jt)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(s))){var l,c,u,h,p,f,g,v,E;T(o[e])?o[e].push(s):o[e]=[s],(l=this._instance.persistence)==null||l.register({[jt]:o});var w=this.getFeatureFlagDetails(e),k={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.ai};_(w==null||(h=w.metadata)==null?void 0:h.version)||(k.$feature_flag_version=w.metadata.version);var $,P=(p=w==null||(f=w.reason)==null?void 0:f.description)!==null&&p!==void 0?p:w==null||(g=w.reason)==null?void 0:g.code;P&&(k.$feature_flag_reason=P),w!=null&&(v=w.metadata)!=null&&v.id&&(k.$feature_flag_id=w.metadata.id),_(w?.original_variant)&&_(w?.original_enabled)||(k.$feature_flag_original_response=_(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(E=w.metadata)!=null&&E.original_payload&&(k.$feature_flag_original_payload=w==null||($=w.metadata)==null?void 0:$.original_payload),this._instance.capture("$feature_flag_called",k)}return i}ne.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.ui()&&(s.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:ye.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t(o?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return _(i)?void 0:!!i}ne.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ei=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var h=ao(a),p=h.flags,f=h.featureFlags,g=h.featureFlagPayloads;if(f){var v=a.requestId,E=a.evaluatedAt;if(T(f)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(f)for(var k=0;k<f.length;k++)w[f[k]]=!0;o&&o.register({[gi]:f,[ze]:w})}else{var $=f,P=g,R=p;a.errorsWhileComputingFlags&&($=b({},l,$),P=b({},c,P),R=b({},u,R)),o&&o.register(b({[gi]:Object.keys(Yr($)),[ze]:$||{},[Gr]:P||{},[$i]:R||{}},v?{[Wr]:v}:{},E?{[zr]:E}:{}))}}})(e,this._instance.persistence,i,s,n),this.pi(t)}}override(e,t){t===void 0&&(t=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Be),this._instance.persistence.unregister(ot),this.pi(),at.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ii=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(Be),at.info("Flag overrides cleared");else if(i.flags){if(T(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Be]:s})}else this._instance.persistence.register({[Be]:i.flags});at.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(ot),at.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[ot]:i.payloads}),at.info("Payload overrides set",{payloads:i.payloads}))),void this.pi()}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:t,flagVariants:i}=this.gi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(dt)||[]).find((c=>c.flagKey===e)),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=b({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[gi]:Object.keys(Yr(l)),[ze]:l}),this.pi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(dt),n=i?"&"+i.map((a=>"stage="+a)).join("&"):"";if(s&&!t)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:a=>{var o,l;if(a.json){var c=a.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(dt),(l=this._instance.persistence)==null||l.register({[dt]:c}),e(c)}}})}gi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,s)=>(i[s]=t[s],i)),{})}}pi(e){var{flags:t,flagVariants:i}=this.gi();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(pt)||{};this._instance.register({[pt]:b({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(pt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Le)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((s=>{i[s]=b({},i[s],e[s]),delete e[s]})),this._instance.register({[Le]:b({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Le)||{};this._instance.register({[Le]:b({},t,{[e]:{}})})}else this._instance.unregister(Le)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.di(),this.ii=!1}}var uo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class _i{constructor(e,t){this.F=e,this.props={},this.mi=!1,this.yi=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.bi(e),this.load(),e.debug&&y.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.wi}bi(e){uo.indexOf(e.persistence.toLowerCase())===-1&&(y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&A.H()?A:t==="localstorage+cookie"&&It.H()?It:t==="sessionstorage"&&q.H()?q:t==="memory"?ba:t==="cookie"?de:It.H()?It:de}properties(){var e={};return C(this.props,(function(t,i){if(i===ze&&j(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else o=i,l=!1,(be(a=Qn)?l:or&&a.indexOf===or?a.indexOf(o)!=-1:(C(a,(function(c){if(l||(l=c===o))return Nt})),l))||(e[i]=t);var a,o,l})),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=D({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.F.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(j(e)){_(t)&&(t="None"),this.xi=_(i)?this.$i:i;var s=!1;if(C(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(j(e)){this.xi=_(t)?this.$i:t;var i=!1;if(C(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=Ks(this.F.custom_campaign_params,this.F.mask_personal_data_properties,this.F.custom_personal_data_properties);We(Gi(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=m?.referrer)?Qs(e):{})}update_referrer_info(){var e;this.register_once({$referrer:en(),$referring_domain:m!=null&&m.referrer&&((e=Vt(m.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ci]||this.props[Ri]||this.register_once({[qt]:tn(this.F.mask_personal_data_properties,this.F.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};C([Ri,Ci],(a=>{var o=this.props[a];o&&C(o,(function(l,c){e["$initial_"+Ei(c)]=l}))}));var t,i,s=this.props[qt];if(s){var n=(t=rn(s),i={},C(t,(function(a,o){i["$initial_"+Ei(o)]=a})),i);D(e,n)}return e}safe_merge(e){return C(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.$i=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var s=this.bi(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_secure(e){e!==this.Ei&&(this.Ei=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[ht]||{};i[e]=t,this.props[ht]=i,this.save()}remove_event_timer(e){var t=(this.props[ht]||{})[e];return _(t)||(delete this.props[ht][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var lt=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),Ro=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),Mo=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),Ao=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),mi=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),Do=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),Lo=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),No=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),Dt=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r})({}),Xr=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r})({}),dn=(function(r){return r.Popover="popover",r.Inline="inline",r})({});class tr{constructor(){this.ki={},this.ki={}}on(e,t){return this.ki[e]||(this.ki[e]=[]),this.ki[e].push(t),()=>{this.ki[e]=this.ki[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.ki[e]||[])i(t);for(var s of this.ki["*"]||[])s(e,t)}}function Ve(r,e,t){if(O(r))return!1;switch(t){case"exact":return r===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}class co{constructor(e){this.Pi=new tr,this.Ti=(t,i)=>this.Ri(t,i)&&this.Ii(t,i)&&this.Fi(t,i)&&this.Ci(t,i),this.Ri=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Mi=new Set,this.Oi=new Set}init(){var e;if(!_((e=this._instance)==null?void 0:e.Ai)){var t;(t=this._instance)==null||t.Ai(((i,s)=>{this.on(i,s)}))}}register(e){var t,i;if(!_((t=this._instance)==null?void 0:t.Ai)&&(e.forEach((a=>{var o,l;(o=this.Oi)==null||o.add(a),(l=a.steps)==null||l.forEach((c=>{var u;(u=this.Mi)==null||u.add(c?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Mi.has(e)||this.Mi.has(t?.event))&&this.Oi&&((i=this.Oi)==null?void 0:i.size)>0&&this.Oi.forEach((s=>{this.Di(t,s)&&this.Pi.emit("actionCaptured",s.name)}))}ji(e){this.onAction("actionCaptured",(t=>e(t)))}Di(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.Ti(e,i))return!0;return!1}onAction(e,t){return this.Pi.on(e,t)}Ii(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!Ve(s,t.url,t.url_matching||"contains"))return!1}return!0}Fi(e,t){return!!this.Li(e,t)&&!!this.Ni(e,t)&&!!this.Ui(e,t)}Li(e,t){var i;if(t==null||!t.href)return!0;var s=this.zi(e);if(s.length>0)return s.some((o=>Ve(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!a&&Ve((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Ni(e,t){var i;if(t==null||!t.text)return!0;var s=this.zi(e);if(s.length>0)return s.some((c=>Ve(c.text,t.text,t.text_matching||"exact")||Ve(c.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],p=/(?::|")text="(.*?)"/g;!O(u=p.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some((c=>Ve(c,a,o))))}Ui(e,t){var i,s;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}zi(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ci(e,t){return t==null||!t.properties||t.properties.length===0||hn(t.properties.reduce(((i,s)=>{var n=T(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i}),{}),e?.properties)}}var I=H("[Surveys]"),qi="seenSurvey_",ho=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},Jr=r=>{var e=""+qi+r.id;return r.current_iteration&&r.current_iteration>0&&(e=""+qi+r.id+"_"+r.current_iteration),e},po=[mi.Popover,mi.Widget,mi.API],fo={ignoreConditions:!1,ignoreDelay:!1,displayType:dn.Popover};class vo{constructor(e){this._instance=e,this.Hi=new Map,this.Bi=new Map,this.qi=new Map}Wi(e,t){return!!e&&hn(e.propertyFilters,t?.properties)}Gi(e,t){var i=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=i.get(a.name)||[];o.push(s.id),i.set(a.name,o)}}))})),i}Vi(e,t,i){var s,n=(i===lt.Activation?this.Hi:this.Bi).get(e),a=[];return(s=this._instance)==null||s.getSurveys((o=>{a=o.filter((l=>n?.includes(l.id)))})),a.filter((o=>{var l,c=(l=o.conditions)==null||(l=l[i])==null||(l=l.values)==null?void 0:l.find((u=>u.name===e));return this.Wi(c,t)}))}register(e){var t;_((t=this._instance)==null?void 0:t.Ai)||(this.Ji(e),this.Ki(e))}Ki(e){var t=e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Yi==null&&(this.Yi=new co(this._instance),this.Yi.init(),this.Yi.ji((i=>{this.onAction(i)}))),t.forEach((i=>{var s,n,a,o,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.Yi)==null||o.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.qi.get(c.name);u&&u.push(i.id),this.qi.set(c.name,u||[i.id])}})))})))}Ji(e){var t,i=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));(i.length!==0||s.length!==0)&&((t=this._instance)==null||t.Ai(((n,a)=>{this.onEvent(n,a)})),this.Hi=this.Gi(e,lt.Activation),this.Bi=this.Gi(e,lt.Cancellation))}onEvent(e,t){var i,s=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[$t])||[];if(Dt.SHOWN===e&&t&&s.length>0){var n;I.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:s});var a=t==null||(n=t.properties)==null?void 0:n.$survey_id;if(a){var o=s.indexOf(a);o>=0&&(s.splice(o,1),this.Xi(s))}}else{if(this.Bi.has(e)){var l=this.Vi(e,t,lt.Cancellation);l.length>0&&(I.info("cancel event matched, cancelling surveys",{event:e,surveysToCancel:l.map((u=>u.id))}),l.forEach((u=>{var h,p=s.indexOf(u.id);p>=0&&s.splice(p,1),(h=this._instance)==null||h.cancelPendingSurvey(u.id)})),this.Xi(s))}if(this.Hi.has(e)){I.info("survey event name matched",{event:e,eventPayload:t,surveys:this.Hi.get(e)});var c=this.Vi(e,t,lt.Activation);this.Xi(s.concat(c.map((u=>u.id))||[]))}}}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[$t])||[];this.qi.has(e)&&this.Xi(i.concat(this.qi.get(e)||[]))}Xi(e){var t;I.info("updating activated surveys",{activatedSurveys:e}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[$t]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[$t];return t||[]}getEventToSurveys(){return this.Hi}Qi(){return this.Yi}}class go{constructor(e){this.Zi=void 0,this._surveyManager=null,this.te=!1,this.ie=!1,this.ee=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(O(t))return I.warn("Flags not loaded yet. Not loading surveys.");var i=T(t);this.Zi=i?t.length>0:t,I.info("flags response received, isSurveysEnabled: "+this.Zi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(qi)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.ie)I.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)I.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())I.info("Not loading surveys in cookieless mode without consent.");else{var e=x?.__PosthogExtensions__;if(e){if(!_(this.Zi)||this._instance.config.advanced_enable_surveys){var t=this.Zi||this._instance.config.advanced_enable_surveys;this.ie=!0;try{var i=e.generateSurveys;if(i)return void this.re(i,t);var s=e.loadExternalDependency;if(!s)return void this.se("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.se("Could not load surveys script",n):this.re(e.generateSurveys,t)}))}catch(n){throw this.se("Error initializing surveys",n),n}finally{this.ie=!1}}}else I.error("PostHog Extensions not found.")}}re(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new vo(this._instance),I.info("Surveys loaded successfully"),this.ne({isLoaded:!0})}se(e,t){I.error(e,t),this.ne({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ee.push(e),this._surveyManager&&this.ne({isLoaded:!0}),()=>{this.ee=this.ee.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return I.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(Ii);if(i&&!t)return e(i,{isLoaded:!0});if(this.te)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.te=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var n;this.te=!1;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: "+a;return I.error(o),e([],{isLoaded:!1,error:o})}var l,c=s.json.surveys||[],u=c.filter((h=>(function(p){return!(!p.start_date||p.end_date)})(h)&&((function(p){var f;return!((f=p.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)})(h)||(function(p){var f;return!((f=p.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(h))));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(n=this._instance.persistence)==null||n.register({[Ii]:c}),e(c,{isLoaded:!0})}})}catch(s){throw this.te=!1,s}}ne(e){for(var t of this.ee)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){I.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);I.warn("init was not called")}oe(e){var t=null;return this.getSurveys((i=>{var s;t=(s=i.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}ae(e){if(O(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.oe(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(O(this._surveyManager))return I.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ae(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return O(this._surveyManager)?(I.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((s=>{var n,a=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(a){var o=this.ae(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){var i;if(O(this._surveyManager))I.warn("init was not called");else{var s=typeof e=="string"?this.oe(e):e;if(s!=null&&s.id)if(po.includes(s.type)){var n=m?.querySelector(t);if(n)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(I.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;I.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,n),I.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n);I.warn("Survey element not found")}else I.warn("Surveys of type "+s.type+" cannot be rendered in the app");else I.warn("Survey not found")}}displaySurvey(e,t){var i;if(O(this._surveyManager))I.warn("init was not called");else{var s=this.oe(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=b({},s,{appearance:b({},s.appearance,{surveyPopupDelaySeconds:0})})),t.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void I.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==dn.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else I.warn("Survey not found")}}cancelPendingSurvey(e){O(this._surveyManager)?I.warn("init was not called"):this._surveyManager.cancelSurvey(e)}}var Kr=H("[RateLimiter]");class _o{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var n=s.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((a=>{Kr.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Kr.warn('could not rate limit - continuing. Error: "'+a?.message+'"',{text:n})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,s;e===void 0&&(e=!1);var n=new Date().getTime(),a=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Ti))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:n};a.tokens+=(n-a.last)/1e3*this.captureEventsPerSecond,a.last=n,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)==null||s.set_property(Ti,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var De=H("[RemoteConfig]");class mo{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}le(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(De.error("PostHog Extensions not found. Cannot load remote config."),e())}ue(e){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return De.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void De.warn("Remote config is disabled. Falling back to local config.");this.le((e=>{if(!e)return De.info("No config found after loading remote JS config. Falling back to JSON."),void this.ue((t=>{this.fi(t)}));this.fi(e)}))}catch(e){De.error("Error loading remote config",e)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):De.info("__preview_remote_config is disabled. Logging config instead",e):De.error("Failed to fetch remote config from PostHog.")}}var Ui=3e3;class yo{constructor(e,t){this.he=!0,this.ve=[],this.de=ce(t?.flush_interval_ms||Ui,250,5e3,y.createLogger("flush interval"),Ui),this.ce=e}enqueue(e){this.ve.push(e),this.fe||this.pe()}unload(){this.ge();var e=this.ve.length>0?this._e():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ce(b({},i,{transport:"sendBeacon"}))}))}enable(){this.he=!1,this.pe()}pe(){var e=this;this.he||(this.fe=setTimeout((()=>{if(this.ge(),this.ve.length>0){var t=this._e(),i=function(){var n=t[s],a=new Date().getTime();n.data&&T(n.data)&&C(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.ce(n)};for(var s in t)i()}}),this.de))}ge(){clearTimeout(this.fe),this.fe=void 0}_e(){var e={};return C(this.ve,(t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;_(e[n])&&(e[n]=b({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)})),this.ve=[],e}}var bo=["retriesPerformedSoFar"];class wo{constructor(e){this.me=!1,this.ye=3e3,this.ve=[],this._instance=e,this.ve=[],this.be=!0,!_(d)&&"onLine"in d.navigator&&(this.be=d.navigator.onLine,this.we=()=>{this.be=!0,this.Dt()},this.xe=()=>{this.be=!1},L(d,"online",this.we),L(d,"offline",this.xe))}get length(){return this.ve.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=as(e,bo);pe(t)&&t>0&&(i.url=Jt(i.url,{retry_count:t})),this._instance.ci(b({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.Se(b({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}Se(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(t),s=Date.now()+i;this.ve.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),y.warn(n),this.me||(this.me=!0,this.Ee())}Ee(){if(this.$e&&clearTimeout(this.$e),this.ve.length===0)return this.me=!1,void(this.$e=void 0);this.$e=setTimeout((()=>{this.be&&this.ve.length>0&&this.Dt(),this.Ee()}),this.ye)}Dt(){var e=Date.now(),t=[],i=this.ve.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.ve=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.$e&&(clearTimeout(this.$e),this.$e=void 0),this.me=!1,_(d)||(this.we&&(d.removeEventListener("online",this.we),this.we=void 0),this.xe&&(d.removeEventListener("offline",this.xe),this.xe=void 0)),this.ve))try{this._instance.ci(b({},e,{transport:"sendBeacon"}))}catch(t){y.error(t)}this.ve=[]}}class Eo{constructor(e){this.ke=()=>{var t,i,s,n;this.Pe||(this.Pe={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.Pe.lastScrollY=Math.ceil(o),this.Pe.maxScrollY=Math.max(o,(t=this.Pe.maxScrollY)!==null&&t!==void 0?t:0),this.Pe.maxScrollHeight=Math.max(l,(i=this.Pe.maxScrollHeight)!==null&&i!==void 0?i:0),this.Pe.lastContentY=c,this.Pe.maxContentY=Math.max(c,(s=this.Pe.maxContentY)!==null&&s!==void 0?s:0),this.Pe.maxContentHeight=Math.max(u,(n=this.Pe.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Pe}resetContext(){var e=this.Pe;return setTimeout(this.ke,0),e}startMeasuringScrollPosition(){L(d,"scroll",this.ke,{capture:!0}),L(d,"scrollend",this.ke,{capture:!0}),L(d,"resize",this.ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}}var xo=r=>tn(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties);class Zr{constructor(e,t,i,s){this.Te=n=>{var a=this.Re();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Ie(this._instance)};this.Fe.register({[Oi]:o})}},this._instance=e,this.Ce=t,this.Fe=i,this.Ie=s||xo,this.Ce.onSessionId(this.Te)}Re(){return this.Fe.props[Oi]}getSetOnceProps(){var e,t=(e=this.Re())==null?void 0:e.props;return t?"r"in t?rn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return C(Gi(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Ei(i)]=t})),e}}var yi=H("[SessionId]");class Qr{on(e,t){return this.Me.on(e,t)}constructor(e,t,i){var s;if(this.Oe=[],this.Ae=void 0,this.Me=new tr,this.De=(u,h)=>Math.abs(u-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.F=e.config,this.Fe=e.persistence,this.je=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ne=t||$e,this.Ue=i||$e;var n=this.F.persistence_name||this.F.token,a=this.F.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ce(a,60,36e3,yi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ze(),this.He="ph_"+n+"_window_id",this.Be="ph_"+n+"_primary_window_exists",this.qe()){var o=q.W(this.He),l=q.W(this.Be);o&&!l?this.je=o:q.V(this.He),q.G(this.Be,!0)}if((s=this.F.bootstrap)!=null&&s.sessionID)try{var c=(u=>{var h=u.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.F.bootstrap.sessionID);this.We(this.F.bootstrap.sessionID,new Date().getTime(),c)}catch(u){yi.error("Invalid sessionID in bootstrap",u)}this.Ge()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return _(this.Oe)&&(this.Oe=[]),this.Oe.push(e),this.Le&&e(this.Le,this.je),()=>{this.Oe=this.Oe.filter((t=>t!==e))}}qe(){return this.F.persistence!=="memory"&&!this.Fe.wi&&q.H()}Ve(e){e!==this.je&&(this.je=e,this.qe()&&q.G(this.He,e))}Je(){return this.je?this.je:this.qe()?q.W(this.He):null}We(e,t,i){e===this.Le&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Le=e,this.Fe.register({[Ht]:[t,e,i]}))}Ke(){var e=this.Fe.props[Ht];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.We(null,null,null)}destroy(){clearTimeout(this.Ye),this.Ye=void 0,this.Ae&&d&&(d.removeEventListener("beforeunload",this.Ae,{capture:!1}),this.Ae=void 0),this.Oe=[]}Ge(){this.Ae=()=>{this.qe()&&q.V(this.Be)},L(d,"beforeunload",this.Ae,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.F.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,a]=this.Ke(),o=this.Je(),l=pe(a)&&a>0&&Math.abs(i-a)>864e5,c=!1,u=!n,h=!u&&!e&&this.De(i,s);u||h||l?(n=this.Ne(),o=this.Ue(),yi.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),a=i,c=!0):o||(o=this.Ue(),c=!0);var p=s===0||!e||l?i:s,f=a===0?new Date().getTime():a;return this.Ve(o),this.We(n,p,f),e||this.ze(),c&&this.Oe.forEach((g=>g(n,o,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ze(){clearTimeout(this.Ye),this.Ye=setTimeout((()=>{var[e]=this.Ke();if(this.De(new Date().getTime(),e)){var t=this.Le;this.resetSessionId(),this.Me.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var ko=["$set_once","$set"],Pe=H("[SiteApps]");class So{constructor(e){this._instance=e,this.Xe=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qe(e,t){if(t){var i=this.globalsForEvent(t);this.Xe.push(i),this.Xe.length>1e3&&(this.Xe=this.Xe.slice(10))}}get siteAppLoaders(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ai(this.Qe.bind(this));this.Ze=()=>{e(),this.Xe=[],this.Ze=void 0}}}globalsForEvent(e){var t,i,s,n,a,o,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[p,f]of Object.entries(h))c[p]={id:u[p],type:p,properties:f};var{$set_once:g,$set:v}=e;return{event:b({},as(e,ko),{properties:b({},e.properties,v?{$set:b({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},v)}:{},g?{$set_once:b({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var o;!t.errored&&this.Xe.length&&(Pe.info("Processing "+this.Xe.length+" events for site app with id "+e.id),this.Xe.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((o=this.Ze)==null||o.call(this))},s=!1,n=o=>{t.errored=!o,t.loaded=!0,Pe.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),s&&i()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:o=>{n(o)}});a&&(t.processEvent=a),s=!0}catch(o){Pe.error("Error while initializing PostHog app with config id "+e.id,o),n(!1)}if(s&&t.loaded)try{i()}catch(o){Pe.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}tr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}ir(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Pe.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.tr(),void this._instance.on("eventCaptured",(c=>this.ir(c)))):void Pe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Ze)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(c){var u;x["__$$ph_site_app_"+c]=n._instance,(u=x.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(n._instance,l,(h=>{if(h)return Pe.error("Error while initializing PostHog app with config id "+c,h)}))};for(var{id:o,url:l}of e.siteApps)a(o)}else Pe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var pn=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&hr(t,e))return!0;try{var i=r?.userAgentData;if(i!=null&&i.brands&&i.brands.some((s=>hr(s?.brand,e))))return!0}catch{}return!!r.webdriver},gt=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),es="i.posthog.com";class Po{constructor(e){this.er={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+es,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=gt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=gt.EU:this.er[this.apiHost]=gt.CUSTOM),this.er[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===gt.CUSTOM)return this.apiHost+t;var i=es+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Fo={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&Kt(e.href,r),not_regex:(r,e)=>!!d&&!Kt(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class B{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((s=>{B.rr("retrieved web experiments from the server"),t.sr=new Map,s.forEach((n=>{if(n.feature_flag_key){var a;t.sr&&(B.rr("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.sr)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);N(o)&&n.variants[o]&&t.nr(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];B.ar(c)&&t.nr(n.name,l,c.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())B.rr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(O(this.sr))return this.sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();B.rr("applying feature flags",e),e.forEach((t=>{var i;if(this.sr&&(i=this.sr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.sr)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.nr(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=B.getWindowLocation();if(e!=null&&e.search){var t=Gt(e?.search,"__experiment_id"),i=Gt(e?.search,"__experiment_variant");t&&i&&(B.rr("previewing web experiments "+t+" && "+i),this.getWebExperiments((s=>{this.lr(parseInt(t),i,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var a=n.json.experiments||[];return e(a)}})}lr(e,t,i){var s=i.filter((n=>n.id===e));s&&s.length>0&&(B.rr("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.nr(s[0].name,t,s[0].variants[t].transforms))}static ar(e){return!O(e.conditions)&&B.ur(e)&&B.hr(e)}static ur(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,a=B.getWindowLocation();return!!a&&((i=e.conditions)==null||!i.url||Fo[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return d?.location}static hr(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.utm))return!0;var i=Ks();if(i.utm_source){var s,n,a,o,l,c,u,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,f=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==i.utm_medium,v=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return p&&g&&v&&f}return!1}static rr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];y.info("[WebExperiments] "+e,i)}nr(e,t,i){this._is_bot()?B.rr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((s=>{if(s.selector){var n;B.rr("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a?.forEach((o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):B.rr("Control variants leave the page unmodified.")}_is_bot(){return Z&&this._instance?pn(Z,this._instance.config.custom_blocked_useragents):void 0}}var $o=H("[PostHog ExternalIntegrations]"),Io={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Oo{constructor(e){this._instance=e}it(e,t){var i;(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(s=>{if(s)return $o.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,c;!s||(o=x.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.it(Io[a],(()=>{var u;(u=x.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)})),!s&&(l=x.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=x.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}}var Bi="[SessionRecording]",ut=H(Bi);class ts{get started(){var e;return!((e=this.vr)==null||!e.isStarted)}get status(){return this.vr?this.vr.status:this.dr&&!this.cr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.dr=!1,this.pr=void 0,this._instance=e,!this._instance.sessionManager)throw ut.error("started without valid sessionManager"),new Error(Bi+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Bi+' cannot be used with cookieless_mode="always"')}get cr(){var e,t=!((e=this._instance.get_property(ai))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.cr||(t=this.vr)==null||!t.isStarted){var i=!_(Object.assign)&&!_(Array.from);this.cr&&i?(this.gr(e),ut.info("starting")):this.stopRecording()}}gr(e){var t,i,s;this.cr&&(x!=null&&(t=x.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=x.__PosthogExtensions__)!=null&&i.initSessionRecording?this._r(e):(s=x.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.mr,(n=>{if(n)return ut.error("could not load recorder",n);this._r(e)})))}stopRecording(){var e,t;(e=this.pr)==null||e.call(this),this.pr=void 0,(t=this.vr)==null||t.stop()}yr(){var e;(e=this._instance.persistence)==null||e.unregister(gs)}br(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,o=a?.sampleRate,l=O(o)?null:parseFloat(o);O(l)&&this.yr();var c=a?.minimumDurationMilliseconds;s.register({[ai]:b({enabled:!!a},a,{networkPayloadCapture:b({capturePerformance:e.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:_(c)?null:c,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers})})};n(),(t=this.pr)==null||t.call(this),this.pr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.br(e),this.dr=!0,this.startIfEnabledOrStop()):this.dr=!0:ut.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.vr)!=null&&i.log?this.vr.log(e,t):ut.warn("log called before recorder was ready")}get mr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ai);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}_r(e){var t,i;if((t=x.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.vr||(this.vr=(i=x.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.vr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.vr.start(e)}onRRwebEmit(e){var t;(t=this.vr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.vr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.vr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.vr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.vr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.vr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.vr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.vr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.vr)==null||!i.tryAddCustomEvent(e,t))}}var mt={},Vi=()=>{},Ge="posthog",fn=!so&&W?.indexOf("MSIE")===-1&&W?.indexOf("Mozilla")===-1,is=r=>{var e;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Zn(m?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Vi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:z&&N(z?.search)&&z.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;y.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ui},error_tracking:{},_onCapture:Vi,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(r))},rs=r=>{var e={};_(r.process_person)||(e.person_profiles=r.process_person),_(r.xhr_headers)||(e.request_headers=r.xhr_headers),_(r.cookie_name)||(e.persistence_name=r.cookie_name),_(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),_(r.store_google)||(e.save_campaign_params=r.store_google),_(r.verbose)||(e.debug=r.verbose);var t=D({},e,r);return T(r.property_blacklist)&&(_(r.property_denylist)?t.property_denylist=r.property_blacklist:T(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:y.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class To{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(e){y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ti{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new To,this.Sr=!1,this.version=ge.LIB_VERSION,this.Er=new tr,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=is(),this.SentryIntegration=Fa,this.sentryIntegration=e=>(function(t,i){var s=Ms(t,i);return{name:Rs,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.$r=!1,this.kr=null,this.Pr=null,this.Tr=null,this.featureFlags=new lo(this),this.toolbar=new Ia(this),this.scrollManager=new Eo(this),this.pageViewManager=new Xa(this),this.surveys=new go(this),this.experiments=new B(this),this.exceptions=new no(this),this.rateLimiter=new _o(this),this.requestRouter=new Po(this),this.consent=new wa(this),this.externalIntegrations=new Oo(this),this.people={set:(e,t,i)=>{var s=N(e)?{[e]:t}:e;this.setPersonProperties(s),i?.({})},set_once:(e,t,i)=>{var s=N(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i?.({})}},this.on("eventCaptured",(e=>y.info('send "'+e?.event+'"',e)))}init(e,t,i){if(i&&i!==Ge){var s,n=(s=mt[i])!==null&&s!==void 0?s:new ti;return n._init(e,t,i),mt[i]=n,mt[Ge][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),_(e)||xi(e))return y.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Rr(t.debug),this.Ir=t,this.Fr=[],t.person_profiles&&(this.Pr=t.person_profiles),this.set_config(D({},is(t.defaults),rs(t),{name:i,token:e})),this.config.on_xhr_error&&y.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ye.GZipJS;var n=this.Cr();this.persistence=new _i(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _i(b({},this.config,{persistence:"sessionStorage"}),n);var a=b({},this.persistence.props),o=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mr=new yo((k=>this.Or(k)),this.config.request_queue_config),this.Ar=new wo(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Qr(this),this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(y.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(l)}),0)):(y.info("Initializing extensions synchronously"),this.Dr(l)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&y.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p:a,s:o}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,u,h=this.config.get_device_id($e()),p=(c=t.bootstrap)!=null&&c.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(_e,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.jr()){var f,g,v=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((k=>{var $;return!(($=t.bootstrap)==null||($=$.featureFlags)==null||!$[k])})).reduce(((k,$)=>{var P;return k[$]=((P=t.bootstrap)==null||(P=P.featureFlags)==null?void 0:P[$])||!1,k}),{}),E=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter((k=>v[k])).reduce(((k,$)=>{var P,R;return(P=t.bootstrap)!=null&&(P=P.featureFlagPayloads)!=null&&P[$]&&(k[$]=(R=t.bootstrap)==null||(R=R.featureFlagPayloads)==null?void 0:R[$]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:E})}if(l)this.register_once({distinct_id:tt,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id($e());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(_e,"anonymous")}return L(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Pa(this,(()=>this.Lr())):this.Lr(),Ie(this.config._onCapture)&&this.config._onCapture!==Vi&&(y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&y.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}Dr(e){var t=performance.now();this.historyAutocapture=new Sa(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new Ta(this).startIfEnabledOrStop()})),i.push((()=>{var s;this.siteApps=new So(this),(s=this.siteApps)==null||s.init()})),e||i.push((()=>{this.sessionRecording=new ts(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new pa(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.heatmaps=new Ya(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new Wa(this)})),i.push((()=>{this.exceptionObserver=new ka(this),this.exceptionObserver.startIfEnabled()})),i.push((()=>{this.deadClicksAutocapture=new Cs(this,xa),this.deadClicksAutocapture.startIfEnabled()})),i.push((()=>{if(this.Nr){var s=this.Nr;this.Nr=void 0,this.fi(s)}})),this.Ur(i,t)}Ur(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Ur(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){y.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&y.info("PostHog extensions initialized ("+s+"ms)")}fi(e){var t,i,s,n,a,o,l,c;if(!m||!m.body)return y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Nr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=S(e.supportedCompression,ye.GZipJS)?ye.GZipJS:S(e.supportedCompression,ye.Base64)?ye.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Pr?this.Pr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(o=this.webVitalsAutocapture)==null||o.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}Lr(){try{this.config.loaded(this)}catch(e){y.critical("`loaded` function failed",e)}this.zr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Hr()}),1),new mo(this).load(),this.featureFlags.flags()}zr(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Mr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Te(this.__request_queue,(e=>this.Or(e))),this.__request_queue=[],this.zr()}_handle_unload(){var e,t;this.config.request_batching?(this.Br()&&this.capture("$pageleave"),(e=this.Mr)==null||e.unload(),(t=this.Ar)==null||t.unload()):this.Br()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(e){this.__loaded&&(fn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Jt(e.url,{ip:this.config.ip?1:0}),e.headers=b({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,a=b({},t);a.timeout=a.timeout||6e4,a.url=Jt(a.url,{_:new Date().getTime().toString(),ver:ge.LIB_VERSION,compression:a.compression});var o=(i=a.transport)!==null&&i!==void 0?i:"fetch",l=At.filter((u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport))),c=(s=(n=ps(l,(u=>u.transport===o)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");c(a)})(b({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}Or(e){this.Ar?this.Ar.retriableRequest(e):this.ci(e)}_execute_array(e){var t,i=[],s=[],n=[];Te(e,(o=>{o&&(t=o[0],T(t)?n.push(o):Ie(o)?o.call(this):T(o)&&t==="alias"?i.push(o):T(o)&&t.indexOf("capture")!==-1&&Ie(this[t])?n.push(o):s.push(o))}));var a=function(o,l){Te(o,(function(c){if(T(c[0])){var u=l;C(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};a(i,this),a(s,this),a(n,this)}jr(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mr){if(this.is_capturing())if(!_(e)&&N(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var a=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!N(t?.$current_url)&&(y.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,l=i?.timestamp||o,c=$e(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),i?.$set&&(u.$set=i?.$set);var h,p=this.qr(i?.$set_once);if(p&&(u.$set_once=p),(u=Jn(u,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,_(i?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Dt.DISMISSED||e===Dt.SENT){var f=t?.[Xr.SURVEY_ID],g=t?.[Xr.SURVEY_ITERATION];h={id:f,current_iteration:g},localStorage.getItem(Jr(h))||localStorage.setItem(Jr(h),"true"),u.$set=b({},u.$set,{[ho({id:f,current_iteration:g},e===Dt.SENT?"responded":"dismissed")]:!0})}var v=b({},u.properties.$set,u.$set);if(We(v)||this.setPersonPropertiesForFlags(v),!O(this.config.before_send)){var E=this.Wr(u);if(!E)return;u=E}this.Er.emit("eventCaptured",u);var w={method:"POST",url:(s=i?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Or(w):this.Mr.enqueue(w),u}y.critical("This capture call is ignored due to client rate limiting.")}}else y.error("No event name provided to posthog.capture")}else y.uninitializedWarning("posthog.capture")}Ai(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=b({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=b({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!N(o.distinct_id)&&!pe(o.distinct_id)||xi(o.distinct_id))&&y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=Ga(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=h,o.$window_id=p}this.sessionPropsManager&&D(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&D(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(f=this.Ar)==null?void 0:f.length}catch(w){o.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===gt.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=D(o,c),e==="$pageview"&&m&&(o.title=m.title),!_(a)){var g=i.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}W&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=D({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?C(this.config.property_denylist,(function(w){delete o[w]})):y.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(y.error("sanitize_properties is deprecated. Use before_send instead"),o=v(o,e));var E=this.Gr();return o.$process_person_profile=E,E&&!n&&this.Vr("_calculate_event_properties"),o}qr(e){var t;if(!this.persistence||!this.Gr()||this.Sr)return e;var i=this.persistence.get_initial_props(),s=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),n=D({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(y.error("sanitize_properties is deprecated. Use before_send instead"),n=a(n,"$set_once")),this.Sr=!0,We(n)?void 0:n}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Jr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Er.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=fo),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return y.uninitializedWarning("posthog.identify");if(pe(e)&&(e=e.toString(),y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))y.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==tt){if(this.Vr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(ct)&&(this.unregister(ct),this.register({distinct_id:e}));var a=(this.persistence.get_property(_e)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(_e,"identified"),this.setPersonPropertiesForFlags(b({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Tr=Vr(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(jt))}}else y.critical('The string "'+tt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else y.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Vr("posthog.setPersonProperties")){var i=Vr(this.get_distinct_id(),e,t);this.Tr!==i?(this.setPersonPropertiesForFlags(b({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Tr=i):y.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Vr("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}}else y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Vr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(y.info("reset"),!this.__loaded)return y.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(_e,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Tr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:tt,$device_id:null},"");else{var o=this.config.get_device_id($e());this.register_once({distinct_id:o,$device_id:e?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property(fs)?(y.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vr("posthog.alias")?(_(t)&&(t=this.get_distinct_id()),e!==t?(this.Jr(ct,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(j(e)){var i,s,n,a,o;D(this.config,rs(e));var l=this.Cr();(i=this.persistence)==null||i.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _i(b({},this.config,{persistence:"sessionStorage"}),l);var c=this.Rr(this.config.debug);Oe(c)&&(this.config.debug=c),Oe(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,A.H()&&A.G("ph_debug","true"),y.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(ge.DEBUG=!1,A.H()&&A.V("ph_debug"))),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(n=this.autocapture)==null||n.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Kr(),(o=this.externalIntegrations)==null||o.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,a,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),i.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(b({},s,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Ge;return t!==Ge&&(t=Ge+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(_e))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(_e))==="identified"}Gr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&We(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ct])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ut]))}Br(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gr()||this.Vr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vr(e){return this.config.person_profiles==="never"?(y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Jr(Ut,!0),!0)}Cr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Kr(){var e,t,i,s,n=this.Cr();return((e=this.persistence)==null?void 0:e.wi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.wi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(i=this.sessionManager)==null||i.destroy(),this.sessionManager=new Qr(this),this.persistence&&(this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence)),this.sessionRecording=new ts(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Kr(),this.zr(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(_(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Hr()}else y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Kr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:tt,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,this.Hr())):y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===me.GRANTED?"granted":e===me.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Kr()}_is_bot(){return Z?pn(Z,this.config.custom_blocked_useragents):void 0}Hr(){m&&(m.visibilityState==="visible"?this.$r||(this.$r=!0,this.capture("$pageview",{title:m.title},{send_instantly:!0}),this.kr&&(m.removeEventListener("visibilitychange",this.kr),this.kr=null)):this.kr||(this.kr=this.Hr.bind(this),L(m,"visibilitychange",this.kr)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.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}))}O(){var e,t,i,s,n,a,o,l=this.Ir||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(y.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=y,a=(t="advanced_disable_flags")in(e=l)&&!_(e[t]),o=i in e&&!_(e[i]),a?e[t]:o?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}Wr(e){if(O(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),O(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return xn(e.event)?y.warn(n+". This can cause unexpected behavior."):y.info(n),null}i.properties&&!We(i.properties)||y.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Vt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Rr(e){var t=Oe(e)&&!e,i=A.H()&&A.q("ph_debug")==="true";return!t&&(!!i||e)}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Xn(r.prototype[e[t]])})(ti,["identify"]);var ss,Ho=(ss=mt[Ge]=new ti,(function(){function r(){r.done||(r.done=!0,fn=!1,C(mt,(function(e){e._dom_loaded()})))}m!=null&&m.addEventListener?m.readyState==="complete"?r():L(m,"DOMContentLoaded",r,{capture:!1}):d&&y.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),ss);export{oi as COPY_AUTOCAPTURE_EVENT,ye as Compression,dn as DisplaySurveyType,ti as PostHog,Dt as SurveyEventName,Xr as SurveyEventProperties,lt as SurveyEventType,Mo as SurveyPosition,Lo as SurveyQuestionBranchingType,Do as SurveyQuestionType,No as SurveySchedule,Ao as SurveyTabPosition,mi as SurveyType,Ro as SurveyWidgetType,Ho as default,Ho as posthog,Co as severityLevels};
@@ -1 +0,0 @@
1
- import{p as e}from"./path-MNZaYwxc.js";import{g as r}from"./index-BjAxStCG.js";const m=r(e);export{m as r};