!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,h=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,u=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.261.4"};function f(){return f=Object.assign?Object.assign.bind():function(t){for(var i=1;i"function"==typeof t,I=t=>t===Object(t)&&!x(t),R=t=>{if(I(t)){for(var i in t)if(S.call(t,i))return!1;return!0}return!1},P=t=>void 0===t,T=t=>"[object String]"==k.call(t),C=t=>T(t)&&0===t.trim().length,M=t=>null===t,O=t=>P(t)||M(t),F=t=>"[object Number]"==k.call(t),A=t=>"[object Boolean]"===k.call(t),D=t=>t instanceof FormData,j=t=>_(g,t),L=[!0,"true",1,"1","yes"],N=t=>_(L,t),z=[!1,"false",0,"0","no"];function U(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),F(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t{Object.keys(this.o).forEach((t=>{var i=this.m(t)+this.S;i>=this.$?delete this.o[t]:this.k(t,i)}))},this.m=t=>this.o[String(t)],this.k=(t,i)=>{this.o[String(t)]=i},this.consumeRateLimit=t=>{var i,e=null!=(i=this.m(t))?i:this.$;if(0===(e=Math.max(e-1,0)))return!0;this.k(t,e);var r,s=0===e;s&&(null==(r=this.I)||r.call(this,t));return s},this.I=this.i.I,this.$=U(this.i.bucketSize,0,100,this.i.R),this.S=U(this.i.refillRate,0,this.$,this.i.R),this.P=U(this.i.refillInterval,0,864e5,this.i.R),this.t=setInterval((()=>{this.h()}),this.P)}}var q=i=>{var e={T:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG)&&!P(t.console)&&t.console){for(var r=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;o{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>q(i+" "+t)};return e},H=q("[PostHog.js]"),W=H.createLogger,G=W("[ExternalScriptsLoader]"),J=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return G.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);J(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);J(t,r,e)};var V={};function K(t,i,e){if(x(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s1?i-1:0),r=1;r1?i-1:0),r=1;r0||F(t))&&(i[e]=t)})),i};function rt(t,i){return e=t,r=t=>T(t)&&!M(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),x(i)?(n=[],K(i,(i=>{n.push(t(i))}))):(n={},Y(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var st=["herokuapp.com","vercel.app","netlify.app"];function nt(t){var i=null==t?void 0:t.hostname;if(!T(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of st)if(e===r)return!1;return!0}function ot(t,i){for(var e=0;ee.match(t))))}function ei(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return ti(i)}function ri(t){return O(t)?null:m(t).split(/(\s+)/).filter((t=>_i(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function si(t){var i="";return hi(t)&&!ui(t)&&t.childNodes&&t.childNodes.length&&Y(t.childNodes,(function(t){var e;Qt(t)&&t.textContent&&(i+=null!==(e=ri(t.textContent))&&void 0!==e?e:"")})),m(i)}function ni(t){return P(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var oi=["a","button","form","input","select","textarea","label"];function ai(t){var i=t.parentNode;return!(!i||!Yt(i))&&i}function li(i,e,r,s,n){var o,a,l;if(void 0===r&&(r=void 0),!t||!i||Xt(i,"html")||!Yt(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!ii(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&ii(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}for(var u=!1,d=[i],v=!0,c=i;c.parentNode&&!Xt(c,"body");)if(Zt(c.parentNode))d.push(c.parentNode.host),c=c.parentNode.host;else{if(!(v=ai(c)))break;if(s||oi.indexOf(v.tagName.toLowerCase())>-1)u=!0;else{var f=t.getComputedStyle(v);f&&"pointer"===f.getPropertyValue("cursor")&&(u=!0)}d.push(v),c=v}if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(P(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,r))return!1;if(!function(t,i){var e=null==i?void 0:i.css_selector_allowlist;if(P(e))return!0;var r,s=function(t){if(e.some((i=>t.matches(i))))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,r))return!1;var p=t.getComputedStyle(i);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===e.type)return!0;var g=i.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return u?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(oi.indexOf(g)>-1||"true"===i.getAttribute("contenteditable"))}}function hi(t){for(var i=t;i.parentNode&&!Xt(i,"body");i=i.parentNode){var e=ei(i);if(_(e,"ph-sensitive")||_(e,"ph-no-capture"))return!1}if(_(ei(t),"ph-include"))return!0;var r=t.type||"";if(T(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(T(s)){if(/^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,"")))return!1}return!0}function ui(t){return!!(Xt(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Xt(t,"select")||Xt(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var di="(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})",vi=new RegExp("^(?:"+di+")$"),ci=new RegExp(di),fi="\\d{3}-?\\d{2}-?\\d{4}",pi=new RegExp("^("+fi+")$"),gi=new RegExp("("+fi+")");function _i(t,i){if(void 0===i&&(i=!0),O(t))return!1;if(T(t)){if(t=m(t),(i?vi:ci).test((t||"").replace(/[- ]/g,"")))return!1;if((i?pi:gi).test(t))return!1}return!0}function mi(t){var i=si(t);return _i(i=(i+" "+bi(t)).trim())?i:""}function bi(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Y(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=si(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+bi(t)).trim())}catch(t){H.error("[AutoCapture]",t)}})),i}function yi(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=f({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Z(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[wi(i.toString())]=wi(e.toString())})),r+=":",r+=Z(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Si(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Z(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function wi(t){return t.replace(/"|\\"/g,'\\"')}function Si(t){var i=t.attr__class;return i?x(i)?i:ti(i):void 0}class $i{constructor(){this.clicks=[]}isRageClick(t,i,e){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<30&&e-r.timestamp<1e3){if(this.clicks.push({x:t,y:i,timestamp:e}),3===this.clicks.length)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ki="$copy_autocapture",xi=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Ei=["fatal","error","warning","log","info","debug"],Ii=["localhost","127.0.0.1"],Ri=t=>{var i=null==o?void 0:o.createElement("a");return P(i)?null:(i.href=t,i)},Pi=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Y(t,(function(t,i){P(t)||P(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},Ti=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;st?i.slice(0,t)+"...":i}function Ai(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Yt(i));return i}function Di(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};oi.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=Fi(1024,mi(t)):n.$el_text=Fi(1024,si(t)));var o=ei(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Y(t.attributes,(function(e){var s;if((!ui(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&_i(e.value)&&(s=e.name,!T(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=ti(o).join(" ")),n["attr__"+e.name]=Fi(1024,o)}}));for(var a=1,l=1,h=t;h=Ai(h);)a++,h.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ji(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:h}=e,u=[i],d=i;d.parentNode&&!Xt(d,"body");)Zt(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Y(u,(t=>{var i=hi(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&_i(p)&&p),_(ei(t),"ph-no-capture")&&(g=!0),c.push(Di(t,o,a,l));var e=function(t){if(!hi(t))return{};var i={};return Y(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&_i(r)&&(i[e]=r)}})),i}(t);X(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=mi(i):c[0].$el_text=si(i)),p){var m,b;c[0].attr__href=p;var y=null==(m=Ri(p))?void 0:m.host,w=null==t||null==(b=t.location)?void 0:b.host;y&&w&&y!==w&&(v=p)}return{props:X({$event_type:n.type,$ce_version:1},h?{}:{$elements:c},{$elements_chain:yi(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class Li{constructor(t){this.C=!1,this.M=null,this.rageclicks=new $i,this.O=!1,this.instance=t,this.F=null}get A(){var t,i,e=I(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}D(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.j(i)}catch(t){Oi.error("Failed to capture event",t)}};if(at(o,"submit",i,{capture:!0}),at(o,"change",i,{capture:!0}),at(o,"click",i,{capture:!0}),this.A.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.j(i,ki)};at(o,"copy",e,{capture:!0}),at(o,"cut",e,{capture:!0})}}}else Oi.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.O=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[dt]:!!t.autocapture_opt_out}),this.M=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.F=t}getElementSelectors(t){var i,e=[];return null==(i=this.F)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[dt],r=this.M;if(M(r)&&!A(e)&&!this.instance.L())return!1;var s=null!==(i=this.M)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}j(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=ni(i);if(Qt(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,(new Date).getTime())&&this.j(i,"$rageclick");var n=e===ki;if(s&&li(s,i,this.A,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ji(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ki){var h,u=ri(null==t||null==(h=t.getSelection())?void 0:h.toString()),d=i.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return E(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return F(t)&&isFinite(t)&&Math.floor(t)===t});var Ni="0123456789abcdef";class zi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||t<0||i<0||e<0||r<0||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new zi(s)}toString(){for(var t="",i=0;i>>4)+Ni.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new zi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Ui{constructor(){this.N=0,this.U=0,this.B=new Hi}generate(){var t=this.generateOrAbort();if(P(t)){this.N=0;var i=this.generateOrAbort();if(P(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.N)this.N=t,this.q();else{if(!(t+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.q())}return zi.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.B.nextUint32())}q(){this.U=1024*this.B.nextUint32()+(1023&this.B.nextUint32())}}var Bi,qi=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;icrypto.getRandomValues(t));class Hi{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(qi(this.H),this.W=0),this.H[this.W++]}}var Wi=()=>Gi().toString(),Gi=()=>(Bi||(Bi=new Ui)).generate(),Ji="";var Vi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ki(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Ji)return Ji;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Wi();!Ji&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Ji=n)}return Ji}(t);if(!e){var r=(t=>{var i=t.match(Vi);return i?i[0]:""})(t);r!==e&&H.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Yi={G:()=>!!o,J:function(t){H.error("cookieStore error: "+t)},V:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r3686.4&&H.warn("cookieStore warning: large cookie, len="+u.length),o.cookie=u,u}catch(t){return}},X:function(t,i){if(null!=o&&o.cookie)try{Yi.Y(t,"",-1,i)}catch(t){return}}},Xi=null,Qi={G:function(){if(!M(Xi))return Xi;var i=!0;if(P(t))i=!1;else try{var e="__mplssupport__";Qi.Y(e,"xyz"),'"xyz"'!==Qi.V(e)&&(i=!1),Qi.X(e)}catch(t){i=!1}return i||H.error("localStorage unsupported; falling back to cookie store"),Xi=i,i},J:function(t){H.error("localStorage error: "+t)},V:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Qi.J(t)}return null},K:function(t){try{return JSON.parse(Qi.V(t))||{}}catch(t){}return null},Y:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Qi.J(t)}},X:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Qi.J(t)}}},Zi=["distinct_id",It,Rt,Wt,Ht],te=f({},Qi,{K:function(t){try{var i={};try{i=Yi.K(t)||{}}catch(t){}var e=X(i,JSON.parse(Qi.V(t)||"{}"));return Qi.Y(t,e),e}catch(t){}return null},Y:function(t,i,e,r,s,n){try{Qi.Y(t,i,void 0,void 0,n);var o={};Zi.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Yi.Y(t,o,e,r,s,n)}catch(t){Qi.J(t)}},X:function(i,e){try{null==t||t.localStorage.removeItem(i),Yi.X(i,e)}catch(t){Qi.J(t)}}}),ie={},ee={G:function(){return!0},J:function(t){H.error("memoryStorage error: "+t)},V:function(t){return ie[t]||null},K:function(t){return ie[t]||null},Y:function(t,i){ie[t]=i},X:function(t){delete ie[t]}},re=null,se={G:function(){if(!M(re))return re;if(re=!0,P(t))re=!1;else try{var i="__support__";se.Y(i,"xyz"),'"xyz"'!==se.V(i)&&(re=!1),se.X(i)}catch(t){re=!1}return re},J:function(t){H.error("sessionStorage error: ",t)},V:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){se.J(t)}return null},K:function(t){try{return JSON.parse(se.V(t))||null}catch(t){}return null},Y:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){se.J(t)}},X:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){se.J(t)}}},ne=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class oe{constructor(t){this._instance=t}get A(){return this._instance.config}get consent(){return this.Z()?ne.DENIED:this.tt}isOptedOut(){return"always"===this.A.cookieless_mode||(this.consent===ne.DENIED||this.consent===ne.PENDING&&(this.A.opt_out_capturing_by_default||"on_reject"===this.A.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===ne.DENIED}optInOut(t){this.it.Y(this.et,t?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get tt(){var t=this.it.V(this.et);return N(t)?ne.GRANTED:_(z,t)?ne.DENIED:ne.PENDING}get it(){if(!this.rt){var t=this.A.opt_out_capturing_persistence_type;this.rt="localStorage"===t?Qi:Yi;var i="localStorage"===t?Yi:Qi;i.V(this.et)&&(this.rt.V(this.et)||this.optInOut(N(i.V(this.et))),i.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!ot([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>N(t)))}}var ae=W("[Dead Clicks]"),le=()=>!0,he=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(_t)),r=t.instance.config.capture_dead_clicks;return A(r)?r:e};class ue{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[_t]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?ae.error("failed to load script",i):t()}))}ot(){var t;if(o){if(!this.st&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=I(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.st=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.st.start(o),ae.info("starting...")}}else ae.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,ae.info("stopping..."))}}var de=W("[ExceptionAutocapture]");class ve{constructor(i){var e,r,s;this.lt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ht&&this.A.capture_unhandled_errors&&(this.ht=e(this.captureException.bind(this))),!this.ut&&this.A.capture_unhandled_rejections&&(this.ut=r(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=s(this.captureException.bind(this)))}catch(t){de.error("failed to start",t),this.vt()}}},this._instance=i,this.ct=!(null==(e=this._instance.persistence)||!e.props[ct]),this.A=this.ft(),this.gt=new B({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,R:de}),this.startIfEnabled()}ft(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return I(t)?i=f({},i,t):(P(t)?this.ct:t)&&(i=f({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(de.info("enabled"),this.nt(this.lt))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return de.error("failed to load script",i);t()}))}vt(){var t,i,e;null==(t=this.ht)||t.call(this),this.ht=void 0,null==(i=this.ut)||i.call(this),this.ut=void 0,null==(e=this.dt)||e.call(this),this.dt=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ct=!!i||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[ct]:this.ct}),this.startIfEnabled()}captureException(t){var i,e=this._instance.requestRouter.endpointFor("ui");t.$exception_personURL=e+"/project/"+this._instance.config.token+"/person/"+this._instance.get_distinct_id();var r=null!==(i=t.$exception_list[0].type)&&void 0!==i?i:"Exception";this.gt.consumeRateLimit(r)?de.info("Skipping exception capture because of client rate limiting.",{exception:t.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(t)}}function ce(t){return!P(Event)&&fe(t,Event)}function fe(t,i){try{return t instanceof i}catch(t){return!1}}function pe(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return fe(t,Error)}}function ge(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function _e(t){return ge(t,"DOMError")}var me=/\(error: (.*)\)/,be=50,ye="?";function we(t,i,e,r){var s={platform:"web:javascript",filename:t,function:""===i?ye:i,in_app:!0};return P(e)||(s.lineno=e),P(r)||(s.colno=r),s}var Se=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$e=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ke=/\((\S*)(?::(\d+))(?::(\d+))\)/,xe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ie=function(){for(var t=arguments.length,i=new Array(t),e=0;et[0]-i[0])).map((t=>t[1]));return function(t,i){void 0===i&&(i=0);for(var e=[],s=t.split("\n"),n=i;n1024)){var a=me.test(o)?o.replace(me,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of r){var h=l(a);if(h){e.push(h);break}}if(e.length>=be)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,be).map((t=>f({},t,{filename:t.filename||Re(i).filename,function:t.function||ye})))}(e)}}(...[[30,t=>{var i=Se.exec(t);if(i){var[,e,r,s]=i;return we(e,ye,+r,+s)}var n=$e.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=ke.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=Me(n[1]||ye,n[2]);return we(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{var i=xe.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var e=Ee.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}var r=i[3],s=i[1]||ye;return[s,r]=Me(s,r),we(r,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}}]]);function Re(t){return t[t.length-1]||{}}var Pe,Te,Ce,Me=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:ye,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]};var Oe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Fe(t,i){void 0===i&&(i=0);var e=t.stacktrace||t.stack||"",r=function(t){if(t&&Ae.test(t.message))return 1;return 0}(t);try{var s=Ie,n=function(t,i){var e=function(t){var i=globalThis._posthogChunkIds;if(!i)return{};var e=Object.keys(i);return Ce&&e.length===Te||(Te=e.length,Ce=e.reduce(((e,r)=>{Pe||(Pe={});var s=Pe[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Pe[r]=[l,h];break}}return e}),{})),Ce}(i);return t.forEach((t=>{t.filename&&(t.chunk_id=e[t.filename])})),t}(s(e,r),s);return n.slice(0,n.length-i)}catch(t){}return[]}var Ae=/Minified React error #\d+;/i;function De(t,i){var e,r,s=Fe(t),n=null===(e=null==i?void 0:i.handled)||void 0===e||e,o=null!==(r=null==i?void 0:i.synthetic)&&void 0!==r&&r;return{type:null!=i&&i.overrideExceptionType?i.overrideExceptionType:t.name,value:function(t){var i=t.message;if(i.error&&"string"==typeof i.error.message)return String(i.error.message);return String(i)}(t),stacktrace:{frames:s,type:"raw"},mechanism:{handled:n,synthetic:o}}}function je(t,i){var e=De(t,i);return t.cause&&pe(t.cause)&&t.cause!==t?[e,...je(t.cause,{handled:null==i?void 0:i.handled,synthetic:null==i?void 0:i.synthetic})]:[e]}function Le(t,i){return{$exception_list:je(t,i),$exception_level:"error"}}function Ne(t,i){var e,r,s,n=null===(e=null==i?void 0:i.handled)||void 0===e||e,o=null===(r=null==i?void 0:i.synthetic)||void 0===r||r,a={type:null!=i&&i.overrideExceptionType?i.overrideExceptionType:null!==(s=null==i?void 0:i.defaultExceptionType)&&void 0!==s?s:"Error",value:t||(null==i?void 0:i.defaultExceptionMessage),mechanism:{handled:n,synthetic:o}};if(null!=i&&i.syntheticException){var l=Fe(i.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function ze(t){return T(t)&&!C(t)&&Ei.indexOf(t)>=0}function Ue(t,i){var e,r,s=null===(e=null==i?void 0:i.handled)||void 0===e||e,n=null===(r=null==i?void 0:i.synthetic)||void 0===r||r,o=null!=i&&i.overrideExceptionType?i.overrideExceptionType:ce(t)?t.constructor.name:"Error",a="Non-Error 'exception' captured with keys: "+function(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}(t),l={type:o,value:a,mechanism:{handled:s,synthetic:n}};if(null!=i&&i.syntheticException){var h=Fe(null==i?void 0:i.syntheticException,1);h.length&&(l.stacktrace={frames:h,type:"raw"})}return{$exception_list:[l],$exception_level:ze(t.level)?t.level:"error"}}function Be(t,i){var{error:e,event:r}=t,s={$exception_list:[]},n=e||r;if(_e(n)||function(t){return ge(t,"DOMException")}(n)){var o=n;if(function(t){return"stack"in t}(n))s=Le(n,i);else{var a=o.name||(_e(o)?"DOMError":"DOMException"),l=o.message?a+": "+o.message:a;s=Ne(l,f({},i,{overrideExceptionType:_e(o)?"DOMError":"DOMException",defaultExceptionMessage:l}))}return"code"in o&&(s.$exception_DOMException_code=""+o.code),s}if(function(t){return ge(t,"ErrorEvent")}(n)&&n.error)return Le(n.error,i);if(pe(n))return Le(n,i);if(function(t){return ge(t,"Object")}(n)||ce(n))return Ue(n,i);if(P(e)&&T(r)){var h="Error",u=r,d=r.match(Oe);return d&&(h=d[1],u=d[2]),Ne(u,f({},i,{overrideExceptionType:h,defaultExceptionMessage:u}))}return Ne(n,i)}function qe(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return E(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class He{constructor(i){var e;this._instance=i,this._t=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(H.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.bt&&this.bt(),this.bt=void 0,H.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||qe(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.yt("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||qe(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.yt("replaceState")})),this.wt()}}yt(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this._t=r}catch(t){H.error("Error capturing "+i+" pageview",t)}}wt(){if(!this.bt){var i=()=>{this.yt("popstate")};at(t,"popstate",i),this.bt=()=>{t&&t.removeEventListener("popstate",i)}}}}function We(t){var i,e;return(null==(i=JSON.stringify(t,(e=[],function(t,i){if(I(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i})))?void 0:i.length)||0}function Ge(t,i){if(void 0===i&&(i=6606028.8),t.size>=i&&t.data.length>1){var e=Math.floor(t.data.length/2),r=t.data.slice(0,e),s=t.data.slice(e);return[Ge({size:We(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),Ge({size:We(s),data:s,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Je=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Je||{}),Ve=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(Ve||{}),Ke="[SessionRecording]",Ye="redacted",Xe={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Qe=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Ze=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],tr=["/s/","/e/","/i/"];function ir(t,i,e,r){if(O(t))return t;var s=(null==i?void 0:i["content-length"])||function(t){return new Blob([t]).size}(t);return T(s)&&(s=parseInt(s)),s>e?Ke+" "+r+" body too large to record ("+s+" bytes)":t}function er(t,i){if(O(t))return t;var e=t;return _i(e,!1)||(e=Ke+" "+i+" body "+Ye),Y(Ze,(t=>{var r,s;null!=(r=e)&&r.length&&-1!==(null==(s=e)?void 0:s.indexOf(t))&&(e=Ke+" "+i+" body "+Ye+" as might contain: "+t)})),e}var rr=(t,i)=>{var e,r,s,n={payloadSizeLimitBytes:Xe.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Xe.performanceEntryTypeToObserve],payloadHostDenyList:[...i.payloadHostDenyList||[],...Xe.payloadHostDenyList]},o=!1!==t.session_recording.recordHeaders&&i.recordHeaders,a=!1!==t.session_recording.recordBody&&i.recordBody,l=!1!==t.capture_performance&&i.recordPerformance,h=(e=n,s=Math.min(1e6,null!==(r=e.payloadSizeLimitBytes)&&void 0!==r?r:1e6),t=>(null!=t&&t.requestBody&&(t.requestBody=ir(t.requestBody,t.requestHeaders,s,"Request")),null!=t&&t.responseBody&&(t.responseBody=ir(t.responseBody,t.responseHeaders,s,"Response")),t)),u=i=>{return h(((t,i)=>{var e,r=Ri(t.name),s=0===i.indexOf("http")?null==(e=Ri(i))?void 0:e.pathname:i;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&tr.some((t=>0===n.indexOf(t)))))return t})((r=(e=i).requestHeaders,O(r)||Y(Object.keys(null!=r?r:{}),(t=>{Qe.includes(t.toLowerCase())&&(r[t]=Ye)})),e),t.api_host));var e,r},d=E(t.session_recording.maskNetworkRequestFn);return d&&E(t.session_recording.maskCapturedNetworkRequestFn)&&H.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(t.session_recording.maskCapturedNetworkRequestFn=i=>{var e=t.session_recording.maskNetworkRequestFn({url:i.name});return f({},i,{name:null==e?void 0:e.url})}),n.maskRequestFn=E(t.session_recording.maskCapturedNetworkRequestFn)?i=>{var e,r=u(i);return r&&null!==(e=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==e?e:void 0}:t=>function(t){if(!P(t))return t.requestBody=er(t.requestBody,"Request"),t.responseBody=er(t.responseBody,"Response"),t}(u(t)),f({},Xe,n,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class sr{constructor(t,i){var e,r;void 0===i&&(i={}),this.St={},this.$t=t=>{if(!this.St[t]){var i,e;this.St[t]=!0;var r=this.kt(t);null==(i=(e=this.i).onBlockedNode)||i.call(e,t,r)}},this.xt=t=>{var i=this.kt(t);if("svg"!==(null==i?void 0:i.nodeName)&&i instanceof Element){var e=i.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[t,i]},this.kt=t=>this._rrweb.mirror.getNode(t),this.Et=t=>{var i,e,r,s,n,o,a,l;return(null!==(i=null==(e=t.removes)?void 0:e.length)&&void 0!==i?i:0)+(null!==(r=null==(s=t.attributes)?void 0:s.length)&&void 0!==r?r:0)+(null!==(n=null==(o=t.texts)?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null==(l=t.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var i=t.data,e=this.Et(i);i.attributes&&(i.attributes=i.attributes.filter((t=>{var[i]=this.xt(t.id);return!this.gt.consumeRateLimit(i)&&t})));var r=this.Et(i);return 0!==r||e===r?t:void 0},this._rrweb=t,this.i=i,this.gt=new B({bucketSize:null!==(e=this.i.bucketSize)&&void 0!==e?e:100,refillRate:null!==(r=this.i.refillRate)&&void 0!==r?r:10,refillInterval:1e3,I:this.$t,R:H})}}var nr=Uint8Array,or=Uint16Array,ar=Uint32Array,lr=new nr([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]),hr=new nr([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]),ur=new nr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dr=function(t,i){for(var e=new or(31),r=0;r<31;++r)e[r]=i+=1<>>1|(21845&_r)<<1;mr=(61680&(mr=(52428&mr)>>>2|(13107&mr)<<2))>>>4|(3855&mr)<<4,gr[_r]=((65280&mr)>>>8|(255&mr)<<8)>>>1}var br=function(t,i,e){for(var r=t.length,s=0,n=new or(i);s>>l]=h}else for(o=new or(r),s=0;s>>15-t[s];return o},yr=new nr(288);for(_r=0;_r<144;++_r)yr[_r]=8;for(_r=144;_r<256;++_r)yr[_r]=9;for(_r=256;_r<280;++_r)yr[_r]=7;for(_r=280;_r<288;++_r)yr[_r]=8;var wr=new nr(32);for(_r=0;_r<32;++_r)wr[_r]=5;var Sr=br(yr,9,0),$r=br(wr,5,0),kr=function(t){return(t/8>>0)+(7&t&&1)},xr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof or?or:t instanceof ar?ar:nr)(e-i);return r.set(t.subarray(i,e)),r},Er=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Ir=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Rr=function(t,i){for(var e=[],r=0;rv&&(v=n[r].s);var c=new or(v+1),f=Pr(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<i))break;p+=_-(1<>>=g;p>0;){var b=n[r].s;c[b]=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new nr(c),f]},Pr=function(t,i,e){return-1==t.s?Math.max(Pr(t.l,i,e+1),Pr(t.r,i,e+1)):i[t.s]=e},Tr=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new or(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},Cr=function(t,i){for(var e=0,r=0;r>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n4&&!I[ur[P-1]];--P);var T,C,M,O,F=h+5<<3,A=Cr(s,yr)+Cr(n,wr)+o,D=Cr(s,v)+Cr(n,p)+o+14+3*P+Cr(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(F<=A&&F<=D)return Mr(i,u,t.subarray(l,l+h));if(Er(i,u,1+(D15&&(Er(i,u,z[x]>>>5&127),u+=z[x]>>>12)}}}else T=Sr,C=yr,M=$r,O=wr;for(x=0;x255){U=r[x]>>>18&31;Ir(i,u,T[U+257]),u+=C[U+257],U>7&&(Er(i,u,r[x]>>>23&31),u+=lr[U]);var B=31&r[x];Ir(i,u,M[B]),u+=O[B],B>3&&(Ir(i,u,r[x]>>>5&8191),u+=hr[B])}else Ir(i,u,T[r[x]]),u+=C[r[x]];return Ir(i,u,T[256]),u+C[256]},Fr=new ar([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ar=function(){for(var t=new ar(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Dr=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r>>8;t=e},d:function(){return 4294967295^t}}},jr=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new nr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d>>13,f=8191&v,p=(1<7e3||I>24576)&&O>423){h=Or(t,l,0,w,S,k,E,I,P,u-P,h),I=x=E=0,P=u;for(var F=0;F<286;++F)S[F]=0;for(F=0;F<30;++F)k[F]=0}var A=2,D=0,j=f,L=C-M&32767;if(O>2&&T==y(u-L))for(var N=Math.min(c,O)-1,z=Math.min(32767,u),U=Math.min(258,O);L<=z&&--j&&C!=M;){if(t[u+A]==t[u+A-L]){for(var B=0;BA){if(A=B,D=L,B>N)break;var q=Math.min(L,B-2),H=0;for(F=0;FH&&(H=G,M=W)}}}L+=(C=M)-(M=g[C])+32768&32767}if(D){w[I++]=268435456|fr[A]<<18|pr[D];var J=31&fr[A],V=31&pr[D];E+=lr[J]+hr[V],++S[257+J],++k[V],R=u+A,++x}else w[I++]=t[u],++S[t[u]]}}h=Or(t,l,n,w,S,k,E,I,P,u-P,h)}return xr(a,0,r+kr(h)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},Lr=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8},Nr=function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Lr(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}},zr=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Ur(t,i){void 0===i&&(i={});var e=Dr(),r=t.length;e.p(t);var s=jr(t,i,zr(i),8),n=s.length;return Nr(s,i),Lr(s,n-8,e.d()),Lr(s,n-4,r),s}function Br(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new nr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;or.length){var a=new nr(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return xr(r,0,s)}function qr(t,i){return function(t){for(var i=0,e=0;e"regex"===i.matching&&new RegExp(i.url).test(t)))}class ts{constructor(t){this.It=t}triggerStatus(t){var i=this.It.map((i=>i.triggerStatus(t)));return i.includes(Yr)?Yr:i.includes(Xr)?Xr:Qr}stop(){this.It.forEach((t=>t.stop()))}}class is{constructor(t){this.It=t}triggerStatus(t){var i=new Set;for(var e of this.It)i.add(e.triggerStatus(t));switch(i.delete(Qr),i.size){case 0:return Qr;case 1:return Array.from(i)[0];default:return Xr}}stop(){this.It.forEach((t=>t.stop()))}}class es{triggerStatus(){return Xr}stop(){}}class rs{constructor(t){this.Rt=[],this.Pt=[],this.urlBlocked=!1,this._instance=t}onRemoteConfig(t){var i,e;this.Rt=(null==(i=t.sessionRecording)?void 0:i.urlTriggers)||[],this.Pt=(null==(e=t.sessionRecording)?void 0:e.urlBlocklist)||[]}Tt(t){var i;return 0===this.Rt.length?Qr:(null==(i=this._instance)?void 0:i.get_property(Pt))===t?Yr:Xr}triggerStatus(t){var i=this.Tt(t),e=i===Yr?Yr:i===Xr?Xr:Qr;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:e}),e}checkUrlTriggerConditions(i,e,r){if(void 0!==t&&t.location.href){var s=t.location.href,n=this.urlBlocked,o=Zr(s,this.Pt);n&&o||(o&&!n?i():!o&&n&&e(),Zr(s,this.Rt)&&r("url"))}}stop(){}}class ss{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=t}triggerStatus(){var t=Xr;return O(this.linkedFlag)&&(t=Qr),this.linkedFlagSeen&&(t=Yr),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onRemoteConfig(t,i){var e;if(this.linkedFlag=(null==(e=t.sessionRecording)?void 0:e.linkedFlag)||null,!O(this.linkedFlag)&&!this.linkedFlagSeen){var r=T(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=T(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags(((t,e)=>{var n=!1;if(I(e)&&r in e){var o=e[r];n=A(o)?!0===o:s?o===s:!!o}this.linkedFlagSeen=n,n&&i(r,s)}))}}stop(){this.Ct()}}class ns{constructor(t){this.Mt=[],this._instance=t}onRemoteConfig(t){var i;this.Mt=(null==(i=t.sessionRecording)?void 0:i.eventTriggers)||[]}Ot(t){var i;return 0===this.Mt.length?Qr:(null==(i=this._instance)?void 0:i.get_property(Tt))===t?Yr:Xr}triggerStatus(t){var i=this.Ot(t),e=i===Yr?Yr:i===Xr?Xr:Qr;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:e}),e}stop(){}}function os(t){return t.isRecordingEnabled?Jr:Hr}function as(t){if(!t.receivedFlags)return Jr;if(!t.isRecordingEnabled)return Hr;if(t.urlTriggerMatching.urlBlocked)return Vr;var i=!0===t.isSampled,e=new ts([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return i?Wr:e===Yr?Gr:e===Xr?Jr:!1===t.isSampled?Hr:Gr}function ls(t){if(!t.receivedFlags)return Jr;if(!t.isRecordingEnabled)return Hr;if(t.urlTriggerMatching.urlBlocked)return Vr;var i=new is([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),e=i!==Qr,r=A(t.isSampled);return e&&i===Xr?Jr:e&&i===Qr||r&&!t.isSampled?Hr:!0===t.isSampled?Wr:Gr}var hs="[SessionRecording]",us=W(hs);function ds(){var t;return null==v||null==(t=v.__PosthogExtensions__)||null==(t=t.rrweb)?void 0:t.record}var vs=3e5,cs=[Ve.MouseMove,Ve.MouseInteraction,Ve.Scroll,Ve.ViewportResize,Ve.Input,Ve.TouchMove,Ve.MediaInteraction,Ve.Drag],fs=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function ps(t){return function(t,i){for(var e="",r=0;r{this.hi()},this.ui=()=>{this.di("browser offline",{})},this.vi=()=>{this.di("browser online",{})},this.ci=()=>{if(null!=o&&o.visibilityState){var t="window "+o.visibilityState;this.di(t,{})}},this._instance=t,this.Dt=!1,this.fi="/s/",this.pi=void 0,this.Kt=!1,!this._instance.sessionManager)throw us.error("started without valid sessionManager"),new Error(hs+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(hs+' cannot be used with cookieless_mode="always"');this.Zt=new ss(this._instance),this.Xt=new rs(this._instance),this.Qt=new ns(this._instance);var{sessionId:i,windowId:e}=this.jt.checkAndGetSessionAndWindowId();this.Ft=i,this.gi=e,this.H=this.mi(),this.At>=this.jt.sessionTimeoutMs&&us.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(i){this.Bt?(this.bi(i),at(t,"beforeunload",this.li),at(t,"offline",this.ui),at(t,"online",this.vi),at(t,"visibilitychange",this.ci),this.yi(),this.wi(),O(this.ri)&&(this.ri=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var i=null!=t&&t.properties.$current_url?this.Si(null==t?void 0:t.properties.$current_url):"";if(!i)return;this.di("$pageview",{href:i})}}catch(t){us.error("Could not add $pageview to rrweb session",t)}}))),this.si||(this.si=this.jt.onSessionId(((t,i,e)=>{var r,s;e&&(this.di("$session_id_change",{sessionId:t,windowId:i,changeReason:e}),null==(r=this._instance)||null==(r=r.persistence)||r.unregister(Tt),null==(s=this._instance)||null==(s=s.persistence)||s.unregister(Pt))})))):this.stopRecording()}stopRecording(){var i,e,r,s;this.Dt&&this.pi&&(this.pi(),this.pi=void 0,this.Dt=!1,null==t||t.removeEventListener("beforeunload",this.li),null==t||t.removeEventListener("offline",this.ui),null==t||t.removeEventListener("online",this.vi),null==t||t.removeEventListener("visibilitychange",this.ci),this.mi(),clearInterval(this.$i),null==(i=this.ri)||i.call(this),this.ri=void 0,null==(e=this.ai)||e.call(this),this.ai=void 0,null==(r=this.si)||r.call(this),this.si=void 0,null==(s=this.oi)||s.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),us.info("stopped"))}ki(){var t;null==(t=this._instance.persistence)||t.unregister(Rt)}xi(t){var i,e=this.Ft!==t,r=this.Jt;if(F(r)){var s=this.zt,n=e||!A(s),o=n?qr(t,r):s;n&&(o?this.Ei(Wr):us.warn("Sample rate ("+r+") has determined that this sessionId ("+t+") will not be sent to the server."),this.di("samplingDecisionMade",{sampleRate:r,isSampled:o})),null==(i=this._instance.persistence)||i.register({[Rt]:o})}else this.ki()}onRemoteConfig(t){var i,e,r,s;(this.di("$remote_config_received",t),this.Ii(t),null!=(i=t.sessionRecording)&&i.endpoint)&&(this.fi=null==(s=t.sessionRecording)?void 0:s.endpoint);this.yi(),"any"===(null==(e=t.sessionRecording)?void 0:e.triggerMatchType)?(this.Yt=as,this.Nt=new ts([this.Qt,this.Xt])):(this.Yt=ls,this.Nt=new is([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:null==(r=t.sessionRecording)?void 0:r.triggerMatchType}),this.Xt.onRemoteConfig(t),this.Qt.onRemoteConfig(t),this.Zt.onRemoteConfig(t,((t,i)=>{this.Ei("linked_flag_matched",{flag:t,variant:i})})),this.Kt=!0,this.startIfEnabledOrStop()}yi(){F(this.Jt)&&O(this.oi)&&(this.oi=this.jt.onSessionId((t=>{this.xi(t)})))}Ii(t){if(this._instance.persistence){var i,e=this._instance.persistence,r=()=>{var i,r,s,n,o,a,l,h,u,d=null==(i=t.sessionRecording)?void 0:i.sampleRate,v=O(d)?null:parseFloat(d);O(v)&&this.ki();var c=null==(r=t.sessionRecording)?void 0:r.minimumDurationMilliseconds;e.register({[bt]:!!t.sessionRecording,[yt]:null==(s=t.sessionRecording)?void 0:s.consoleLogRecordingEnabled,[wt]:f({capturePerformance:t.capturePerformance},null==(n=t.sessionRecording)?void 0:n.networkPayloadCapture),[St]:null==(o=t.sessionRecording)?void 0:o.masking,[$t]:{enabled:null==(a=t.sessionRecording)?void 0:a.recordCanvas,fps:null==(l=t.sessionRecording)?void 0:l.canvasFps,quality:null==(h=t.sessionRecording)?void 0:h.canvasQuality},[kt]:v,[xt]:P(c)?null:c,[Et]:null==(u=t.sessionRecording)?void 0:u.scriptConfig})};r(),null==(i=this.ni)||i.call(this),this.ni=this.jt.onSessionId(r)}}log(t,i){var e;void 0===i&&(i="log"),null==(e=this._instance.sessionRecording)||e.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}bi(t){if(!P(Object.assign)&&!P(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var i;if(this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),ds())this.Ri();else null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Pi,(t=>{if(t)return us.error("could not load recorder",t);this.Ri()}));us.info("starting"),this.status===Gr&&this.Ei(t||"recording_initialized")}}get Pi(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property(Et))?void 0:t.script)||"recorder"}Ti(t){var i;return 3===t.type&&-1!==cs.indexOf(null==(i=t.data)?void 0:i.source)}Ci(t){var i=this.Ti(t);i||this.ii||t.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.$i),this.di("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.hi());var e=!1;if(i&&(this.ei=t.timestamp,this.ii)){var r="unknown"===this.ii;this.ii=!1,r||(this.di("sessionNoLongerIdle",{reason:"user activity",type:t.type}),e=!0)}if(!this.ii){var{windowId:s,sessionId:n}=this.jt.checkAndGetSessionAndWindowId(!i,t.timestamp),o=this.Ft!==n,a=this.gi!==s;this.gi=s,this.Ft=n,o||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):e&&this.Mi()}}Oi(t){try{return t.rrwebMethod(),!0}catch(i){return this.ti.length<10?this.ti.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):us.warn("could not emit queued rrweb event.",i,t),!1}}di(t,i){return this.Oi(fs((()=>ds().addCustomEvent(t,i))))}Fi(){return this.Oi(fs((()=>ds().takeFullSnapshot())))}Ri(){var t,i,e,r,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},n=this._instance.config.session_recording;for(var[o,a]of Object.entries(n||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=f({password:!0},a):s[o]=a);(this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt)&&(s.maskAllInputs=null===(i=this.Gt.maskAllInputs)||void 0===i||i,s.maskTextSelector=null!==(e=this.Gt.maskTextSelector)&&void 0!==e?e:void 0,s.blockSelector=null!==(r=this.Gt.blockSelector)&&void 0!==r?r:void 0);var l=ds();if(l){this.Ai=null!==(t=this.Ai)&&void 0!==t?t:new sr(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,i)=>{var e="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";us.info(e,{node:i}),this.log(hs+" "+e,"warn")}});var h=this.Di();this.pi=l(f({emit:t=>{this.onRRwebEmit(t)},plugins:h},s)),this.ei=Date.now(),this.ii=A(this.ii)?this.ii:"unknown",this.di("$session_options",{sessionRecordingOptions:s,activePlugins:h.map((t=>null==t?void 0:t.name))}),this.di("$posthog_config",{config:this._instance.config})}else us.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Mi(){if(this.$i&&clearInterval(this.$i),!0!==this.ii){var t=this.Lt;t&&(this.$i=setInterval((()=>{this.Fi()}),t))}}Di(){var t,i,e=[],r=null==(t=v.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;r&&this.qt&&e.push(r());var s=null==(i=v.__PosthogExtensions__)||null==(i=i.rrwebPlugins)?void 0:i.getRecordNetworkPlugin;this.Wt&&E(s)&&(!Ii.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(s(rr(this._instance.config,this.Wt))):us.info("NetworkCapture not started because we are on localhost."));return e}onRRwebEmit(t){var i;if(this.ji(),t&&I(t)){if(t.type===Je.Meta){var e=this.Si(t.data.href);if(this.Li=e,!e)return;t.data.href=e}else this.Ni();if(this.Xt.checkUrlTriggerConditions((()=>this.zi()),(()=>this.Ui()),(t=>this.Bi(t))),!this.Xt.urlBlocked||(r=t).type===Je.Custom&&"recording paused"===r.data.tag){var r;t.type===Je.FullSnapshot&&this.Mi(),t.type===Je.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===Xr&&this.mi();var s=this.Ai?this.Ai.throttleMutations(t):t;if(s){var n=function(t){var i=t;if(i&&I(i)&&6===i.type&&I(i.data)&&"rrweb/console@1"===i.data.plugin){i.data.payload.payload.length>10&&(i.data.payload.payload=i.data.payload.payload.slice(0,10),i.data.payload.payload.push("...[truncated]"));for(var e=[],r=0;r2e3?e.push(i.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):e.push(i.data.payload.payload[r]);return i.data.payload.payload=e,t}return t}(s);if(this.Ci(n),!0!==this.ii||gs(n)){if(gs(n)){var o=n.data.payload;if(o){var a=o.lastActivityTimestamp,l=o.threshold;n.timestamp=a+l}}var h=null===(i=this._instance.config.session_recording.compress_events)||void 0===i||i?function(t){if(We(t)<1024)return t;try{if(t.type===Je.FullSnapshot)return f({},t,{data:ps(t.data),cv:"2024-10"});if(t.type===Je.IncrementalSnapshot&&t.data.source===Ve.Mutation)return f({},t,{cv:"2024-10",data:f({},t.data,{texts:ps(t.data.texts),attributes:ps(t.data.attributes),removes:ps(t.data.removes),adds:ps(t.data.adds)})});if(t.type===Je.IncrementalSnapshot&&t.data.source===Ve.StyleSheetRule)return f({},t,{cv:"2024-10",data:f({},t.data,{adds:t.data.adds?ps(t.data.adds):void 0,removes:t.data.removes?ps(t.data.removes):void 0})})}catch(t){us.error("could not compress event - will use uncompressed event",t)}return t}(n):n,u={$snapshot_bytes:We(h),$snapshot_data:h,$session_id:this.Ft,$window_id:this.gi};this.status!==Hr?this.qi(u):this.mi()}}}}}Ni(){if(!this._instance.config.capture_pageview&&t){var i=this.Si(t.location.href);this.Li!==i&&(this.di("$url_changed",{href:i}),this.Li=i)}}ji(){if(this.ti.length){var t=[...this.ti];this.ti=[],t.forEach((t=>{Date.now()-t.enqueuedAt<=2e3&&this.Oi(t)}))}}Si(t){var i=this._instance.config.session_recording;if(i.maskNetworkRequestFn){var e,r={url:t};return null==(e=r=i.maskNetworkRequestFn(r))?void 0:e.url}return t}mi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.gi},this.H}hi(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var t=this.Vt,i=this.Ut,e=F(i)&&i>=0,r=F(t)&&e&&i{this.hi()}),2e3),this.H;this.H.data.length>0&&Ge(this.H).forEach((t=>{this.Wi({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:"web",$lib_version:c.LIB_VERSION})}));return this.mi()}qi(t){var i,e=2+((null==(i=this.H)?void 0:i.data.length)||0);!this.ii&&(this.H.size+t.$snapshot_bytes+e>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.hi()),this.H.size+=t.$snapshot_bytes,this.H.data.push(t.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout((()=>{this.hi()}),2e3))}Wi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.fi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}Bi(t){var i;this.Nt.triggerStatus(this.sessionId)===Xr&&(null==(i=this._instance)||null==(i=i.persistence)||i.register({["url"===t?Pt:Tt]:this.Ft}),this.hi(),this.Ei(t+"_trigger_matched"))}zi(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.$i),us.info("recording paused due to URL blocker"),this.di("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Fi(),this.Mi(),this.di("recording resumed",{reason:"left blocked url"}),us.info("recording resumed"))}wi(){0!==this.Qt.Mt.length&&O(this.ai)&&(this.ai=this._instance.on("eventCaptured",(t=>{try{this.Qt.Mt.includes(t.event)&&this.Bi("event")}catch(t){us.error("Could not activate event trigger",t)}})))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Fi(),this.Ei("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[Rt]:!0}),this.Fi(),this.Ei("sampling_overridden")}overrideTrigger(t){this.Bi(t)}Ei(t,i){this._instance.register_for_session({$session_recording_start_reason:t}),us.info(t.replace("_"," "),i),_(["recording_initialized","session_id_changed"],t)||this.di(t,i)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.Ut,$sdk_debug_session_start:t}}}var ms=W("[SegmentIntegration]");function bs(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Wi();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Nt,"identified")),i()},s=e.user();"then"in s&&E(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||ms.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(ms.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(ms.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var ys="posthog-js";function ws(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"]}=void 0===i?{}:i;return i=>{var o,a,l,h,u;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var d=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var v=(null==(o=i.exception)?void 0:o.values)||[],c=v.map((t=>f({},t,{stacktrace:t.stacktrace?f({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>f({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(a=v[0])?void 0:a.value)||i.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_personURL:d,$exception_level:i.level,$exception_list:c,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=v[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(u=v[0])?void 0:u.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),t.exceptions.sendExceptionEvent(p),i}}class Ss{constructor(t,i,e,r,s){this.name=ys,this.setupOnce=function(n){n(ws(t,{organization:i,projectId:e,prefix:r,severityAllowList:s}))}}}var $s=null!=t&&t.location?Mi(t.location.hash,"__posthog")||Mi(location.hash,"state"):null,ks="_postHogToolbarParams",xs=W("[Toolbar]"),Es=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Es||{});class Is{constructor(t){this.instance=t}Gi(t){v.ph_toolbar_state=t}Ji(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Es.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=$s||Mi(i.hash,"__posthog")||Mi(i.hash,"state"),a=n?tt((()=>JSON.parse(atob(decodeURIComponent(n)))))||tt((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(ks)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}Vi(t){var i=v.ph_load_toolbar||v.ph_load_editor;!O(i)&&E(i)?i(t,this.instance):xs.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(Gt));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=f({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(ks,JSON.stringify(f({},s,{source:void 0}))),this.Ji()===Es.LOADED)this.Vi(s);else if(this.Ji()===Es.UNINITIALIZED){var n;this.Gi(Es.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return xs.error("[Toolbar] Failed to load",t),void this.Gi(Es.UNINITIALIZED);this.Gi(Es.LOADED),this.Vi(s)})),at(t,"turbolinks:load",(()=>{this.Gi(Es.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Ki(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}var Rs=W("[TracingHeaders]");class Ps{constructor(t){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var t,i;P(this.Yi)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));P(this.Xi)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Rs.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.nt(this.lt):(null==(t=this.Yi)||t.call(this),null==(i=this.Xi)||i.call(this),this.Yi=void 0,this.Xi=void 0)}}var Ts=W("[Web Vitals]"),Cs=9e5;class Ms{constructor(t){var i;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),0!==this.H.metrics.length&&(this._instance.capture("$web_vitals",this.H.metrics.reduce(((t,i)=>f({},t,{["$web_vitals_"+i.name+"_event"]:f({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(P(e))Ts.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.ee();if(!P(r))if(O(null==t?void 0:t.name)||O(null==t?void 0:t.value))Ts.error("Invalid metric received",t);else if(this.re&&t.value>=this.re)Ts.error("Ignoring metric with value >= "+this.re,t);else this.H.url!==r&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),P(this.H.url)&&(this.H.url=r),this.H.firstMetricTimestamp=P(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.H.metrics.push(f({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()}},this.lt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;P(s)||P(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ie.bind(this)),this.C=!0):Ts.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Qi=!(null==(i=this._instance.persistence)||!i.props[gt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=I(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return P(e)?(null==(i=this._instance.persistence)?void 0:i.props[mt])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(I(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var t=I(this._instance.config.capture_performance)&&F(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Cs;return 0{i?Ts.error("failed to load script",i):t()}))}ee(){var i=t?t.location.href:void 0;return i||Ts.error("Could not determine current URL"),i}}var Os=W("[Heatmaps]");function Fs(t){return I(t)&&"clientX"in t&&"clientY"in t&&F(t.clientX)&&F(t.clientY)}class As{constructor(t){var i;this.rageclicks=new $i,this.Qi=!1,this.C=!1,this.se=null,this.instance=t,this.Qi=!(null==(i=this.instance.persistence)||!i.props[vt])}get flushIntervalMilliseconds(){var t=5e3;return I(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return P(this.instance.config.capture_heatmaps)?P(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.C)return;Os.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var t,i;clearInterval(null!==(t=this.se)&&void 0!==t?t:void 0),null==(i=this.ae)||i.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[vt]:i}),this.Qi=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.H;return this.H=void 0,t}le(t){this.he(t.originalEvent,"deadclick")}ne(){t&&o&&(at(t,"beforeunload",this.oe.bind(this)),at(o,"click",(i=>this.he(i||(null==t?void 0:t.event))),{capture:!0}),at(o,"mousemove",(i=>this.ue(i||(null==t?void 0:t.event))),{capture:!0}),this.ae=new ue(this.instance,le,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Yt(s)&&!Xt(s,"body");){if(s===r)return!1;if(_(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=ai(s)}return!1}(ni(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}he(t,i){var e;if(void 0===i&&(i="click"),!Kt(t.target)&&Fs(t)){var r=this.de(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.ve(f({},r,{type:"rageclick"})),this.ve(r)}}ue(t){!Kt(t.target)&&Fs(t)&&(clearTimeout(this.ce),this.ce=setTimeout((()=>{this.ve(this.de(t,"mousemove"))}),500))}ve(i){if(t){var e=t.location.href;this.H=this.H||{},this.H[e]||(this.H[e]=[]),this.H[e].push(i)}}oe(){this.H&&!R(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ds{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.fe(i,e);return this.pe={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.fe(t,null==(i=this.pe)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.pe)?void 0:t.pageViewId}}fe(t,i){var e=this.pe;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:h,maxContentY:u}=s;if(!(P(n)||P(o)||P(a)||P(l)||P(h)||P(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n<=1?1:U(o/n,0,1,H),v=n<=1?1:U(a/n,0,1,H),c=l<=1?1:U(h/l,0,1,H),f=l<=1?1:U(u/l,0,1,H);r=X(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var js=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),M(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},Ls=!!h||!!l,Ns="text/plain",zs=(t,i)=>{var[e,r]=t.split("?"),s=f({},i);null==r||r.split("&").forEach((t=>{var[i]=t.split("=");delete s[i]}));var n=Pi(s);return e+"?"+(n=n?(r?r+"&":"")+n:r)},Us=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),Bs=t=>{var{data:i,compression:e}=t;if(i){if(e===xi.GZipJS){var r=Ur(Br(Us(i)),{mtime:0}),s=new Blob([r],{type:Ns});return{contentType:Ns,body:s,estimatedSize:s.size}}if(e===xi.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,h="",u=[];if(!t)return t;t=js(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a"data="+encodeURIComponent("string"==typeof t?t:Us(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Us(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},qs=[];l&&qs.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=Bs(t))&&void 0!==i?i:{},o=new Headers;Y(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,h=null;if(u){var d=new u;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,f({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){H.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{H.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),h&&qs.push({transport:"XHR",method:t=>{var i,e=new h;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=Bs(t))&&void 0!==i?i:{};Y(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.withCredentials=!0,e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&qs.push({transport:"sendBeacon",method:t=>{var i=zs(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=Bs(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var Hs=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Ws(t,i,e){return Us({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Gs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Hs(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Hs(i,t))))),icontains:(t,i)=>i.map(Js).some((i=>t.map(Js).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Js).every((i=>t.map(Js).every((t=>!i.includes(t)))))},Js=t=>t.toLowerCase(),Vs=W("[Error tracking]");class Ks{constructor(t){var i,e;this.ge=[],this._instance=t,this.ge=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(ft))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[ft]:this.ge,[pt]:n})}get _e(){var t,i=!!this._instance.get_property(pt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}sendExceptionEvent(t){if(this.me(t))Vs.info("Skipping exception capture because a suppression rule matched");else{if(this._e||!this.be(t))return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"});Vs.info("Skipping exception capture because it was thrown by an extension")}}me(t){var i=t.$exception_list;if(!i||!x(i)||0===i.length)return!1;var e=i.reduce(((t,i)=>{var{type:e,value:r}=i;return T(e)&&e.length>0&&t.$exception_types.push(e),T(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ge.some((t=>{var i=t.values.map((t=>{var i,r=Gs[t.operator],s=x(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}be(t){var i=t.$exception_list;return!(!i||!x(i))&&i.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}}var Ys="Mobile",Xs="iOS",Qs="Android",Zs="Tablet",tn=Qs+" "+Zs,en="iPad",rn="Apple",sn=rn+" Watch",nn="Safari",on="BlackBerry",an="Samsung",ln=an+"Browser",hn=an+" Internet",un="Chrome",dn=un+" OS",vn=un+" "+Xs,cn="Internet Explorer",fn=cn+" "+Ys,pn="Opera",gn=pn+" Mini",_n="Edge",mn="Microsoft "+_n,bn="Firefox",yn=bn+" "+Xs,wn="Nintendo",Sn="PlayStation",$n="Xbox",kn=Qs+" "+Ys,xn=Ys+" "+nn,En="Windows",In=En+" Phone",Rn="Nokia",Pn="Ouya",Tn="Generic",Cn=Tn+" "+Ys.toLowerCase(),Mn=Tn+" "+Zs.toLowerCase(),On="Konqueror",Fn="(\\d+(\\.\\d+)?)",An=new RegExp("Version/"+Fn),Dn=new RegExp($n,"i"),jn=new RegExp(Sn+" \\w+","i"),Ln=new RegExp(wn+" \\w+","i"),Nn=new RegExp(on+"|PlayBook|BB10","i"),zn={"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"};var Un=(t,i)=>i&&_(i,rn)||function(t){return _(t,nn)&&!_(t,un)&&!_(t,Qs)}(t),Bn=function(t,i){return i=i||"",_(t," OPR/")&&_(t,"Mini")?gn:_(t," OPR/")?pn:Nn.test(t)?on:_(t,"IE"+Ys)||_(t,"WPDesktop")?fn:_(t,ln)?hn:_(t,_n)||_(t,"Edg/")?mn:_(t,"FBIOS")?"Facebook "+Ys:_(t,"UCWEB")||_(t,"UCBrowser")?"UC Browser":_(t,"CriOS")?vn:_(t,"CrMo")||_(t,un)?un:_(t,Qs)&&_(t,nn)?kn:_(t,"FxiOS")?yn:_(t.toLowerCase(),On.toLowerCase())?On:Un(t,i)?_(t,Ys)?xn:nn:_(t,bn)?bn:_(t,"MSIE")||_(t,"Trident/")?cn:_(t,"Gecko")?bn:""},qn={[fn]:[new RegExp("rv:"+Fn)],[mn]:[new RegExp(_n+"?\\/"+Fn)],[un]:[new RegExp("("+un+"|CrMo)\\/"+Fn)],[vn]:[new RegExp("CriOS\\/"+Fn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Fn)],[nn]:[An],[xn]:[An],[pn]:[new RegExp("(Opera|OPR)\\/"+Fn)],[bn]:[new RegExp(bn+"\\/"+Fn)],[yn]:[new RegExp("FxiOS\\/"+Fn)],[On]:[new RegExp("Konqueror[:/]?"+Fn,"i")],[on]:[new RegExp(on+" "+Fn),An],[kn]:[new RegExp("android\\s"+Fn,"i")],[hn]:[new RegExp(ln+"\\/"+Fn)],[cn]:[new RegExp("(rv:|MSIE )"+Fn)],Mozilla:[new RegExp("rv:"+Fn)]},Hn=function(t,i){var e=Bn(t,i),r=qn[e];if(P(r))return null;for(var s=0;s[$n,t&&t[1]||""]],[new RegExp(wn,"i"),[wn,""]],[new RegExp(Sn,"i"),[Sn,""]],[Nn,[on,""]],[new RegExp(En,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[In,""];if(new RegExp(Ys).test(i)&&!/IEMobile\b/.test(i))return[En+" "+Ys,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=zn[r]||"";return/arm/i.test(i)&&(s="RT"),[En,s]}return[En,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[Xs,i.join(".")]}return[Xs,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=P(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Qs+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qs+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[Qs,i.join(".")]}return[Qs,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[dn,""]],[/Linux|debian/i,["Linux",""]]],Gn=function(t){return Ln.test(t)?wn:jn.test(t)?Sn:Dn.test(t)?$n:new RegExp(Pn,"i").test(t)?Pn:new RegExp("("+In+"|WPDesktop)","i").test(t)?In:/iPad/.test(t)?en:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?sn:Nn.test(t)?on:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Rn,"i").test(t)?Rn:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(Ys).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Qs:tn:Qs:new RegExp("(pda|"+Ys+")","i").test(t)?Cn:new RegExp(Zs,"i").test(t)&&!new RegExp(Zs+" pc","i").test(t)?Mn:""},Jn="https?://(.*)",Vn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Kn=Q(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Vn),Yn="",Xn=["li_fat_id"];function Qn(t,i,e){if(!o)return{};var r,s=i?Q([],Vn,e||[]):[],n=Zn(Ci(o.URL,s,Yn),t),a=(r={},Y(Xn,(function(t){var i=Yi.V(t);r[t]=i||null})),r);return X(a,n)}function Zn(t,i){var e=Kn.concat(i||[]),r={};return Y(e,(function(i){var e=Ti(t,i);r[i]=e||null})),r}function to(t){var i=function(t){return t?0===t.search(Jn+"google.([^/?]*)")?"google":0===t.search(Jn+"bing.com")?"bing":0===t.search(Jn+"yahoo.com")?"yahoo":0===t.search(Jn+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!M(i)){r.$search_engine=i;var s=o?Ti(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function io(){return navigator.language||navigator.userLanguage}function eo(){return(null==o?void 0:o.referrer)||"$direct"}function ro(t,i){var e=t?Q([],Vn,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:eo().substring(0,1e3),u:r?Ci(r,e,Yn):void 0}}function so(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=Ri(e))?void 0:i.host};if(r){s.$current_url=r;var n=Ri(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Zn(r);X(s,o)}if(e){var a=to(e);X(s,a)}return s}function no(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function oo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function ao(i,e){if(!d)return{};var r,s,n,o=i?Q([],Vn,e||[]):[],[l,h]=function(t){for(var i=0;i1e3?d.substring(0,997)+"...":d,$browser_version:Hn(d,navigator.vendor),$browser_language:io(),$browser_language_prefix:(r=io(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var lo=W("[FeatureFlags]"),ho="$active_feature_flags",uo="$override_feature_flags",vo="$feature_flag_payloads",co="$override_feature_flag_payloads",fo="$feature_flag_request_id",po=t=>{var i={};for(var[e,r]of Z(t||{}))r&&(i[e]=r);return i},go=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):lo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},_o=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class mo{constructor(t){this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this._instance=t,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.xe=!0;else{var t=!this.Ie&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Re({disableFlags:t})}}get hasLoadedFlags(){return this.we}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(Ot),i=this._instance.get_property(uo),e=this._instance.get_property(co);if(!e&&!i)return t||{};var r=X({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=P(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=P(h)?l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=f({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});if(u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=f({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.ye||(lo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ye=!0),r}getFlagVariants(){var t=this._instance.get_property(Ct),i=this._instance.get_property(uo);if(!i)return t||{};for(var e=X({},t),r=Object.keys(i),s=0;s{this.Re()}),5))}Pe(){clearTimeout(this.Ie),this.Ie=void 0}ensureFlagsLoaded(){this.we||this.Se||this.Ie||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.$e=t}Re(t){var i;if(this.Pe(),!this._instance.L())if(this.Se)this.ke=!0;else{var e={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:f({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(Ft)||{}),group_properties:this._instance.get_property(At)};(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(e.disable_flags=!0);var r=this._instance.config.__preview_remote_config,s=r?"/flags/?v=2":"/flags/?v=2&config=true",n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("api",s+n);r&&(e.timezone=no()),this.Se=!0,this._instance.Te({method:"POST",url:o,data:e,compression:this._instance.config.disable_compression?void 0:xi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,r,s=!0;(200===t.statusCode&&(this.ke||(this.$anon_distinct_id=void 0),s=!1),this.Se=!1,this.xe)||(this.xe=!0,this._instance.Ce(null!==(r=t.json)&&void 0!==r?r:{}));if(!e.disable_flags||this.ke)if(this.Ee=!s,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(_o.FeatureFlags))lo.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 n;if(!e.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},s);this.ke&&(this.ke=!1,this.Re())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.we||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property(fo)||void 0,n=this._instance.get_property(Lt)||{};if((i.send_event||!("send_event"in i))&&(!(t in n)||!n[t].includes(r))){var o,a,l,h,u,d,v,c,f;x(n[t])?n[t].push(r):n[t]=[r],null==(o=this._instance.persistence)||o.register({[Lt]:n});var p=this.getFeatureFlagDetails(t),g={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(a=a.featureFlags)?void 0:a[t])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[t])||null,$used_bootstrap_value:!this.Ee};P(null==p||null==(h=p.metadata)?void 0:h.version)||(g.$feature_flag_version=p.metadata.version);var _,m=null!==(u=null==p||null==(d=p.reason)?void 0:d.description)&&void 0!==u?u:null==p||null==(v=p.reason)?void 0:v.code;if(m&&(g.$feature_flag_reason=m),null!=p&&null!=(c=p.metadata)&&c.id&&(g.$feature_flag_id=p.metadata.id),P(null==p?void 0:p.original_variant)&&P(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=P(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(f=p.metadata)&&f.original_payload)g.$feature_flag_original_payload=null==p||null==(_=p.metadata)?void 0:_.original_payload;this._instance.capture("$feature_flag_called",g)}return e}lo.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token;this._instance.Te({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:e},compression:this._instance.config.disable_compression?void 0:xi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),this.we||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,i);lo.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.we=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=go(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var h=t.requestId;if(x(a)){lo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var d=0;dthis.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(Mt)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[ho]:Object.keys(po(a)),[Ct]:a}),this.Me()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(Mt),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(Mt),null==(r=this._instance.persistence)||r.register({[Mt]:s}),t(s)}}})}Oe(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Me(t){var{flags:i,flagVariants:e}=this.Oe();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(Ft)||{};this._instance.register({[Ft]:f({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Ft)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(At)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=f({},e[i],t[i]),delete t[i]})),this._instance.register({[At]:f({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(At)||{};this._instance.register({[At]:f({},i,{[t]:{}})})}else this._instance.unregister(At)}reset(){this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this.$anon_distinct_id=void 0,this.Pe(),this.ye=!1}}var bo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class yo{constructor(t,i){this.A=t,this.props={},this.Fe=!1,this.Ae=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.it=this.De(t),this.load(),t.debug&&H.info("Persistence loaded",t.persistence,f({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.je}De(t){-1===bo.indexOf(t.persistence.toLowerCase())&&(H.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Qi.G()?Qi:"localstorage+cookie"===i&&te.G()?te:"sessionstorage"===i&&se.G()?se:"memory"===i?ee:"cookie"===i?Yi:te.G()?te:Yi}properties(){var t={};return Y(this.props,(function(i,e){if(e===Ct&&I(i))for(var r=Object.keys(i),n=0;n{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(I(t)){this.Le=P(i)?this.Ue:i;var e=!1;if(Y(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.Fe){var t=Qn(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);R(et(t))||this.register(t),this.Fe=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?to(t):{})}update_referrer_info(){var t;this.register_once({$referrer:eo(),$referring_domain:null!=o&&o.referrer&&(null==(t=Ri(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Bt]||this.props[qt]||this.register_once({[Ht]:ro(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Y([qt,Bt],(i=>{var e=this.props[i];e&&Y(e,(function(i,e){t["$initial_"+b(e)]=i}))}));var i,e,r=this.props[Ht];if(r){var s=(i=so(r),e={},Y(i,(function(t,i){e["$initial_"+b(i)]=t})),e);X(t,s)}return t}safe_merge(t){return Y(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.Ue=this.Le=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence){var r=this.De(t),s=this.props;this.clear(),this.it=r,this.props=s,this.save()}}set_disabled(t){this.je=t,this.je?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ne&&(this.Ne=t,this.remove(),this.save())}set_secure(t){t!==this.ze&&(this.ze=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[ut]||{};e[t]=i,this.props[ut]=e,this.save()}remove_event_timer(t){var i=(this.props[ut]||{})[t];return P(i)||(delete this.props[ut][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}class wo{constructor(){this.Be={},this.Be={}}on(t,i){return this.Be[t]||(this.Be[t]=[]),this.Be[t].push(i),()=>{this.Be[t]=this.Be[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Be[t]||[])e(i);for(var r of this.Be["*"]||[])r(t,i)}}class So{constructor(t){this.qe=new wo,this.He=(t,i)=>this.We(t,i)&&this.Ge(t,i)&&this.Je(t,i),this.We=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Ve=new Set,this.Ke=new Set}init(){var t;if(!P(null==(t=this._instance)?void 0:t.Ye)){var i;null==(i=this._instance)||i.Ye(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!P(null==(i=this._instance)?void 0:i.Ye)&&(t.forEach((t=>{var i,e;null==(i=this.Ke)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Ve)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.Ve.has(t)||this.Ve.has(null==i?void 0:i.event))&&this.Ke&&(null==(e=this.Ke)?void 0:e.size)>0&&this.Ke.forEach((t=>{this.Xe(i,t)&&this.qe.emit("actionCaptured",t.name)}))}Qe(t){this.onAction("actionCaptured",(i=>t(i)))}Xe(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.He(t,e))return!0;return!1}onAction(t,i){return this.qe.on(t,i)}Ge(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!So.Ze(r,null==i?void 0:i.url,(null==i?void 0:i.url_matching)||"contains"))return!1}return!0}static Ze(i,e,r){switch(r){case"regex":return!!t&&Hs(i,e);case"exact":return e===i;case"contains":var s=So.tr(e).replace(/_/g,".").replace(/%/g,".*");return Hs(i,s);default:return!1}}static tr(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Je(t,i){if((null!=i&&i.href||null!=i&&i.tag_name||null!=i&&i.text)&&!this.ir(t).some((t=>!(null!=i&&i.href&&!So.Ze(t.href||"",null==i?void 0:i.href,(null==i?void 0:i.href_matching)||"exact"))&&((null==i||!i.tag_name||t.tag_name===(null==i?void 0:i.tag_name))&&!(null!=i&&i.text&&!So.Ze(t.text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact")&&!So.Ze(t.$el_text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact"))))))return!1;if(null!=i&&i.selector){var e,r=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(!r)return!1;if(!r.includes(null==i?void 0:i.selector))return!1}return!0}ir(t){return null==(null==t?void 0:t.properties.$elements)?[]:null==t?void 0:t.properties.$elements}}var $o=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),ko=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),xo=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),Eo=W("[Surveys]");var Io="seenSurvey_",Ro=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Po=t=>{var i=""+Io+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Io+t.id+"_"+t.current_iteration),i},To=[$o.Popover,$o.Widget,$o.API];class Co{constructor(t){this._instance=t,this.er=new Map,this.rr=new Map}register(t){var i;P(null==(i=this._instance)?void 0:i.Ye)||(this.sr(t),this.nr(t))}nr(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.ar){this.ar=new So(this._instance),this.ar.init();this.ar.Qe((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ar)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.rr.get(i.name);e&&e.push(t.id),this.rr.set(i.name,e||[t.id])}})))}))}}sr(t){var i;if(0!==t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})).length){null==(i=this._instance)||i.Ye(((t,i)=>{this.onEvent(t,i)})),t.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||i.forEach((i=>{if(i&&i.name){var e=this.er.get(i.name);e&&e.push(t.id),this.er.set(i.name,e||[t.id])}}))}))}}onEvent(t,i){var e,r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[jt])||[];if("survey shown"===t&&i&&r.length>0){var s;Eo.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:i,existingActivatedSurveys:r});var n=null==i||null==(s=i.properties)?void 0:s.$survey_id;if(n){var o=r.indexOf(n);o>=0&&(r.splice(o,1),this.lr(r))}}else this.er.has(t)&&(Eo.info("survey event matched, updating activated surveys",{event:t,surveys:this.er.get(t)}),this.lr(r.concat(this.er.get(t)||[])))}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[jt])||[];this.rr.has(t)&&this.lr(e.concat(this.rr.get(t)||[]))}lr(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[jt]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[jt];return i||[]}getEventToSurveys(){return this.er}hr(){return this.ar}}class Mo{constructor(t){this.ur=void 0,this._surveyManager=null,this.dr=!1,this.vr=!1,this.cr=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var i=t.surveys;if(O(i))return Eo.warn("Flags not loaded yet. Not loading surveys.");var e=x(i);this.ur=e?i.length>0:i,Eo.info("flags response received, isSurveysEnabled: "+this.ur),this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;ilocalStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.vr)Eo.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Eo.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode)Eo.info("Not loading surveys in cookieless mode.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!P(this.ur)||this._instance.config.advanced_enable_surveys){var i=this.ur||this._instance.config.advanced_enable_surveys;this.vr=!0;try{var e=t.generateSurveys;if(e)return void this.pr(e,i);var r=t.loadExternalDependency;if(!r)return void this.gr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.gr("Could not load surveys script",e):this.pr(t.generateSurveys,i)}))}catch(t){throw this.gr("Error initializing surveys",t),t}finally{this.vr=!1}}}else Eo.error("PostHog Extensions not found.")}}pr(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new Co(this._instance),Eo.info("Surveys loaded successfully"),this._r({isLoaded:!0})}gr(t,i){Eo.error(t,i),this._r({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.cr.push(t),this._surveyManager&&this._r({isLoaded:!0}),()=>{this.cr=this.cr.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return Eo.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(Dt);if(e&&!i)return t(e,{isLoaded:!0});if(this.dr)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.dr=!0,this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var e;this.dr=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return Eo.error(s),t([],{isLoaded:!1,error:s})}var n,o=i.json.surveys||[],a=o.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(e=this._instance.persistence)||e.register({[Dt]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.dr=!1,t}}_r(t){for(var i of this.cr)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Eo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Eo.warn("init was not called")}mr(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}br(t){if(O(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.mr(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(O(this._surveyManager))return Eo.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.br(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return O(this._surveyManager)?(Eo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.br(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){if(O(this._surveyManager))Eo.warn("init was not called");else{var e=this.mr(t);if(e)if(To.includes(e.type)){var r=null==o?void 0:o.querySelector(i);r?this._surveyManager.renderSurvey(e,r):Eo.warn("Survey element not found")}else Eo.warn("Surveys of type "+e.type+" cannot be rendered in the app");else Eo.warn("Survey not found")}}}var Oo=W("[RateLimiter]");class Fo{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Oo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Oo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Ut))&&void 0!==i?i:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||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,null==(r=this.instance.persistence)||r.set_property(Ut,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()t(this.remoteConfig))):(Ao.error("PostHog Extensions not found. Cannot load remote config."),t())}wr(t){this._instance.Te({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return Ao.info("Using preloaded remote config",this.remoteConfig),void this.Ce(this.remoteConfig);if(this._instance.L())return void Ao.warn("Remote config is disabled. Falling back to local config.");this.yr((t=>{if(!t)return Ao.info("No config found after loading remote JS config. Falling back to JSON."),void this.wr((t=>{this.Ce(t)}));this.Ce(t)}))}catch(t){Ao.error("Error loading remote config",t)}}Ce(t){t?this._instance.config.__preview_remote_config?(this._instance.Ce(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Ao.info("__preview_remote_config is disabled. Logging config instead",t):Ao.error("Failed to fetch remote config from PostHog.")}}var jo=3e3;class Lo{constructor(t,i){this.Sr=!0,this.$r=[],this.kr=U((null==i?void 0:i.flush_interval_ms)||jo,250,5e3,H.createLogger("flush interval"),jo),this.Er=t}enqueue(t){this.$r.push(t),this.Ir||this.Rr()}unload(){this.Pr();var t=this.$r.length>0?this.Tr():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Er(f({},t,{transport:"sendBeacon"}))}))}enable(){this.Sr=!1,this.Rr()}Rr(){var t=this;this.Sr||(this.Ir=setTimeout((()=>{if(this.Pr(),this.$r.length>0){var i=this.Tr(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&x(e.data)&&Y(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Er(e)};for(var r in i)e()}}),this.kr))}Pr(){clearTimeout(this.Ir),this.Ir=void 0}Tr(){var t={};return Y(this.$r,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;P(t[s])&&(t[s]=f({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.$r=[],t}}var No=["retriesPerformedSoFar"];class zo{constructor(i){this.Cr=!1,this.Mr=3e3,this.$r=[],this._instance=i,this.$r=[],this.Or=!0,!P(t)&&"onLine"in t.navigator&&(this.Or=t.navigator.onLine,at(t,"online",(()=>{this.Or=!0,this.oe()})),at(t,"offline",(()=>{this.Or=!1})))}get length(){return this.$r.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=p(t,No);F(i)&&i>0&&(e.url=zs(e.url,{retry_count:i})),this._instance.Te(f({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.Fr(f({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}Fr(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.$r.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),H.warn(s),this.Cr||(this.Cr=!0,this.Ar())}Ar(){this.Dr&&clearTimeout(this.Dr),this.Dr=setTimeout((()=>{this.Or&&this.$r.length>0&&this.oe(),this.Ar()}),this.Mr)}oe(){var t=Date.now(),i=[],e=this.$r.filter((e=>e.retryAt0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Dr&&(clearTimeout(this.Dr),this.Dr=void 0),this.$r))try{this._instance.Te(f({},t,{transport:"sendBeacon"}))}catch(t){H.error(t)}this.$r=[]}}class Uo{constructor(t){this.jr=()=>{var t,i,e,r;this.Lr||(this.Lr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Lr.lastScrollY=Math.ceil(n),this.Lr.maxScrollY=Math.max(n,null!==(t=this.Lr.maxScrollY)&&void 0!==t?t:0),this.Lr.maxScrollHeight=Math.max(o,null!==(i=this.Lr.maxScrollHeight)&&void 0!==i?i:0),this.Lr.lastContentY=a,this.Lr.maxContentY=Math.max(a,null!==(e=this.Lr.maxContentY)&&void 0!==e?e:0),this.Lr.maxContentHeight=Math.max(l,null!==(r=this.Lr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Lr}resetContext(){var t=this.Lr;return setTimeout(this.jr,0),t}startMeasuringScrollPosition(){at(t,"scroll",this.jr,{capture:!0}),at(t,"scrollend",this.jr,{capture:!0}),at(t,"resize",this.jr)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=x(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Bo=t=>ro(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class qo{constructor(t,i,e,r){this.Nr=t=>{var i=this.zr();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ur(this._instance)};this.Br.register({[zt]:e})}},this._instance=t,this.qr=i,this.Br=e,this.Ur=r||Bo,this.qr.onSessionId(this.Nr)}zr(){return this.Br.props[zt]}getSetOnceProps(){var t,i=null==(t=this.zr())?void 0:t.props;return i?"r"in i?so(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Y(et(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+b(e)]=i})),t}}var Ho=W("[SessionId]");class Wo{constructor(t,i,e){var r;if(this.Hr=[],this.Wr=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=t.config,this.Br=t.persistence,this.gi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Gr=i||Wi,this.Jr=e||Wi;var s=this.A.persistence_name||this.A.token,n=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*U(n,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Vr(),this.Kr="ph_"+s+"_window_id",this.Yr="ph_"+s+"_primary_window_exists",this.Xr()){var o=se.K(this.Kr),a=se.K(this.Yr);o&&!a?this.gi=o:se.X(this.Kr),se.Y(this.Yr,!0)}if(null!=(r=this.A.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Qr(this.A.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){Ho.error("Invalid sessionID in bootstrap",t)}this.Zr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return P(this.Hr)&&(this.Hr=[]),this.Hr.push(t),this.Ft&&t(this.Ft,this.gi),()=>{this.Hr=this.Hr.filter((i=>i!==t))}}Xr(){return"memory"!==this.A.persistence&&!this.Br.je&&se.G()}ts(t){t!==this.gi&&(this.gi=t,this.Xr()&&se.Y(this.Kr,t))}es(){return this.gi?this.gi:this.Xr()?se.K(this.Kr):null}Qr(t,i,e){t===this.Ft&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Ft=t,this.Br.register({[It]:[i,t,e]}))}rs(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var t=this.Br.props[It];return x(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Qr(null,null,null)}Zr(){at(t,"beforeunload",(()=>{this.Xr()&&se.X(this.Yr)}),{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.A.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.rs(),o=this.es(),a=F(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,h=!s,u=!t&&this.Wr(e,r);h||u||a?(s=this.Gr(),o=this.Jr(),Ho.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Jr(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.ts(o),this.Qr(s,d,v),t||this.Vr(),l&&this.Hr.forEach((t=>t(s,o,l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Vr(){clearTimeout(this.ss),this.ss=setTimeout((()=>{var[t]=this.rs();this.Wr((new Date).getTime(),t)&&this.resetSessionId()}),1.1*this.sessionTimeoutMs)}}var Go=["$set_once","$set"],Jo=W("[SiteApps]");class Vo{constructor(t){this._instance=t,this.ns=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}os(t,i){if(i){var e=this.globalsForEvent(i);this.ns.push(e),this.ns.length>1e3&&(this.ns=this.ns.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ye(this.os.bind(this));this.ls=()=>{t(),this.ns=[],this.ls=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(u))l[d]={id:h[d],type:d,properties:v};var{$set_once:c,$set:g}=t;return{event:f({},p(t,Go),{properties:f({},t.properties,g?{$set:f({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},g)}:{},c?{$set_once:f({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.ns.length&&(Jo.info("Processing "+this.ns.length+" events for site app with id "+t.id),this.ns.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.ls)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Jo.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){Jo.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Jo.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}hs(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}us(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){Jo.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",(t=>this.us(t)))):void Jo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.ls)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return Jo.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Jo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Ko=["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"],Yo=function(t,i){if(!t)return!1;var e=t.toLowerCase();return Ko.concat(i||[]).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},Xo=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&Yo(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Yo(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Qo=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),Zo="i.posthog.com";class ta{constructor(t){this.ds={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Zo,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.ds[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=Qo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=Qo.EU:this.ds[this.apiHost]=Qo.CUSTOM),this.ds[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if(this.region===Qo.CUSTOM)return this.apiHost+i;var e=Zo+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var ia={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&Hs(e.href,i),not_regex:(i,e)=>!!t&&!Hs(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class ea{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{ea.vs("retrieved web experiments from the server"),i.cs=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.cs)ea.vs("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.cs)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);T(r)&&t.variants[r]&&i.fs(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];ea.ps(n)&&i.fs(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())ea.vs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(O(this.cs))return this.cs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ea.vs("applying feature flags",t),t.forEach((t=>{var i;if(this.cs&&null!=(i=this.cs)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.cs)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.fs(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=ea.getWindowLocation();if(null!=t&&t.search){var i=Ti(null==t?void 0:t.search,"__experiment_id"),e=Ti(null==t?void 0:t.search,"__experiment_variant");i&&e&&(ea.vs("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.gs(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}gs(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(ea.vs("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.fs(r[0].name,i,r[0].variants[i].transforms))}static ps(t){return!O(t.conditions)&&(ea._s(t)&&ea.bs(t))}static _s(t){var i;if(O(t.conditions)||O(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=ea.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||ia[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static bs(t){var i;if(O(t.conditions)||O(null==(i=t.conditions)?void 0:i.utm))return!0;var e=Qn();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static vs(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r{if(e.selector){var r;ea.vs("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):ea.vs("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?Xo(n,this._instance.config.custom_blocked_useragents):void 0}}var ra=W("[PostHog ExternalIntegrations]"),sa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class na{constructor(t){this._instance=t}nt(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return ra.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.nt(sa[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var oa="[SessionRecording]",aa=W(oa);class la{get started(){var t;return!(null==(t=this.ys)||!t.isStarted)}get status(){var t;return this.Bt?(null==(t=this.ys)?void 0:t.status)||"lazy_loading":Hr}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this._instance=t,!this._instance.sessionManager)throw aa.error("started without valid sessionManager"),new Error(oa+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(oa+' cannot be used with cookieless_mode="always"')}get Bt(){var i=!!this._instance.get_property(bt),e=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!this.Bt||null==(i=this.ys)||!i.isStarted){var e=!P(Object.assign)&&!P(Array.from);this.Bt&&e?(this.ws(t),aa.info("starting")):this.stopRecording()}}ws(t){var i,e,r;this.Bt&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ri(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Pi,(i=>{if(i)return aa.error("could not load recorder",i);this.Ri(t)})))}stopRecording(){var t;null==(t=this.ys)||t.stop()}onRemoteConfig(t){this.Ss=t;var i,e=this._instance.persistence;e&&e.register({[bt]:!!t.sessionRecording,[Et]:null==(i=t.sessionRecording)?void 0:i.scriptConfig});this.ys?(this.ys.onRemoteConfig(t),this.Ss=void 0):this.ws(),this.startIfEnabledOrStop()}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.ys)&&e.log?this.ys.log(t,i):aa.warn("log called before recorder was ready")}get Pi(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property(Et))?void 0:t.script)||"lazy-recorder"}Ri(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.ys||(this.ys=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture,this.Ss&&(this.ys.onRemoteConfig(this.Ss),this.Ss=void 0));this.ys.start(t)}onRRwebEmit(t){var i;null==(i=this.ys)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t;null==(t=this.ys)||t.overrideLinkedFlag()}overrideSampling(){var t;null==(t=this.ys)||t.overrideSampling()}overrideTrigger(t){var i;null==(i=this.ys)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ys)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}}var ha={},ua=()=>{},da="posthog",va=!Ls&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),ca=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:nt(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:ua,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==i||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",debug:a&&T(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},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;H.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:jo},error_tracking:{},_onCapture:ua}},fa=t=>{var i={};P(t.process_person)||(i.person_profiles=t.process_person),P(t.xhr_headers)||(i.request_headers=t.xhr_headers),P(t.cookie_name)||(i.persistence_name=t.cookie_name),P(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),P(t.store_google)||(i.save_campaign_params=t.store_google),P(t.verbose)||(i.debug=t.verbose);var e=X({},i,t);return x(t.property_blacklist)&&(P(t.property_denylist)?e.property_denylist=t.property_blacklist:x(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:H.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class pa{constructor(){this.__forceAllowLocalhost=!1}get $s(){return this.__forceAllowLocalhost}set $s(t){H.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ga{get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){this.webPerformance=new pa,this.ks=!1,this.version=c.LIB_VERSION,this.xs=new wo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ca(),this.SentryIntegration=Ss,this.sentryIntegration=t=>function(t,i){var e=ws(t,i);return{name:ys,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Es=!1,this.Is=null,this.Rs=null,this.Ps=null,this.featureFlags=new mo(this),this.toolbar=new Is(this),this.scrollManager=new Uo(this),this.pageViewManager=new Ds(this),this.surveys=new Mo(this),this.experiments=new ea(this),this.exceptions=new Ks(this),this.rateLimiter=new Fo(this),this.requestRouter=new ta(this),this.consent=new oe(this),this.externalIntegrations=new na(this),this.people={set:(t,i,e)=>{var r=T(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=T(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>H.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==da){var r,s=null!==(r=ha[e])&&void 0!==r?r:new ga;return s._init(t,i,e),ha[e]=s,ha[da][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;if(void 0===e&&(e={}),P(i)||C(i))return H.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return H.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Ts=e,this.Cs=[],e.person_profiles&&(this.Rs=e.person_profiles),this.set_config(X({},ca(e.defaults),fa(e),{name:r,token:i})),this.config.on_xhr_error&&H.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:xi.GZipJS;var o=this.Ms();this.persistence=new yo(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yo(f({},this.config,{persistence:"sessionStorage"}),o);var a=f({},this.persistence.props),l=f({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Os=new Lo((t=>this.Fs(t)),this.config.request_queue_config),this.As=new zo(this),this.__request_queue=[];var h="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(h||(this.sessionManager=new Wo(this),this.sessionPropsManager=new qo(this,this.sessionManager,this.persistence)),new Ps(this).startIfEnabledOrStop(),this.siteApps=new Vo(this),null==(s=this.siteApps)||s.init(),h||(this.config.__preview_lazy_load_replay?this.sessionRecording=new la(this):this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Li(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new As(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Ms(this),this.exceptionObserver=new ve(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new ue(this,he),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new He(this),this.historyAutocapture.startIfEnabled(),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&H.info("Starting in debug mode",{this:this,config:e,thisC:f({},this.config),p:a,s:l}),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var u,d,v=this.config.get_device_id(Wi()),p=null!=(u=e.bootstrap)&&u.isIdentifiedID?v:e.bootstrap.distinctID;this.persistence.set_property(Nt,null!=(d=e.bootstrap)&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:p})}if(this.Ds()){var g,_,m=Object.keys((null==(g=e.bootstrap)?void 0:g.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),b=Object.keys((null==(_=e.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter((t=>m[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:b})}if(h)this.register_once({distinct_id:Jt,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Wi());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Nt,"anonymous")}return at(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?bs(this,(()=>this.js())):this.js(),E(this.config._onCapture)&&this.config._onCapture!==ua&&(H.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&H.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}Ce(t){var i,e,r,s,n,a,l,h;if(!o||!o.body)return H.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ce(t)}),500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=_(t.supportedCompression,xi.GZipJS)?xi.GZipJS:_(t.supportedCompression,xi.Base64)?xi.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Rs?this.Rs:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(t),null==(l=this.exceptionObserver)||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(h=this.deadClicksAutocapture)||h.onRemoteConfig(t)}js(){try{this.config.loaded(this)}catch(t){H.critical("`loaded` function failed",t)}this.Ls(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this.Ns()}),1),new Do(this).load(),this.featureFlags.flags()}Ls(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Os)||t.enable()))}_dom_loaded(){this.is_capturing()&&K(this.__request_queue,(t=>this.Fs(t))),this.__request_queue=[],this.Ls()}_handle_unload(){var t,i;this.config.request_batching?(this.zs()&&this.capture("$pageleave"),null==(t=this.Os)||t.unload(),null==(i=this.As)||i.unload()):this.zs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Te(t){this.__loaded&&(va?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=zs(t.url,{ip:this.config.ip?1:0}),t.headers=f({},this.config.request_headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=f({},t);s.timeout=s.timeout||6e4,s.url=zs(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=null!==(e=null==(r=ot(qs,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:qs[0].method;if(!o)throw new Error("No available transport method");o(s)})(f({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}Fs(t){this.As?this.As.retriableRequest(t):this.Te(t)}_execute_array(t){var i,e=[],r=[],s=[];K(t,(t=>{t&&(i=t[0],x(i)?s.push(t):E(t)?t.call(this):x(t)&&"alias"===i?e.push(t):x(t)&&-1!==i.indexOf("capture")&&E(this[i])?s.push(t):r.push(t))}));var n=function(t,i){K(t,(function(t){if(x(t[0])){var e=i;Y(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}Ds(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Os){if(this.is_capturing())if(!P(t)&&T(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){null!=i&&i.$current_url&&!T(null==i?void 0:i.$current_url)&&(H.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$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 n=new Date,o=(null==e?void 0:e.timestamp)||n,a=Wi(),l={uuid:a,event:t,properties:this.calculateEventProperties(t,i||{},o,a)};s&&(l.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==e?void 0:e.$set)&&(l.$set=null==e?void 0:e.$set);var h,u=this.Us(null==e?void 0:e.$set_once);if(u&&(l.$set_once=u),(l=rt(l,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,P(null==e?void 0:e.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=n),t===ko.DISMISSED||t===ko.SENT){var d=null==i?void 0:i[xo.SURVEY_ID],v=null==i?void 0:i[xo.SURVEY_ITERATION];h={id:d,current_iteration:v},localStorage.getItem(Po(h))||localStorage.setItem(Po(h),"true"),l.$set=f({},l.$set,{[Ro({id:d,current_iteration:v},t===ko.SENT?"responded":"dismissed")]:!0})}var c=f({},l.properties.$set,l.$set);if(R(c)||this.setPersonPropertiesForFlags(c),!O(this.config.before_send)){var p=this.Bs(l);if(!p)return;l=p}this.xs.emit("eventCaptured",l);var g={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Fs(g):this.Os.enqueue(g),l}H.critical("This capture call is ignored due to client rate limiting.")}}else H.error("No event name provided to posthog.capture")}else H.uninitializedWarning("posthog.capture")}Ye(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=f({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===t){var l=f({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!T(a.distinct_id)&&!F(a.distinct_id)||C(a.distinct_id))&&H.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var h,u=ao(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&X(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&X(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this.As)?void 0:p.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Qo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=X(a,h),"$pageview"===t&&o&&(a.title=o.title),!P(n)){var g=e.getTime()-n;a.$duration=parseFloat((g/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=X({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),x(this.config.property_denylist)?Y(this.config.property_denylist,(function(t){delete a[t]})):H.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(H.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.qs();return a.$process_person_profile=m,m&&!s&&this.Hs("_calculate_event_properties"),a}Us(t){var i;if(!this.persistence||!this.qs())return t;if(this.ks)return t;var e=this.persistence.get_initial_props(),r=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),s=X({},e,r||{},t||{}),n=this.config.sanitize_properties;return n&&(H.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.ks=!0,R(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Ws(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.xs.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return H.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),H.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))H.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==Jt){if(this.Hs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(ht)&&(this.unregister(ht),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(Nt)||"anonymous");t!==r&&n?(this.persistence.set_property(Nt,"identified"),this.setPersonPropertiesForFlags(f({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ps=Ws(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(Lt))}}else H.critical('The string "'+Jt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else H.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.Hs("posthog.setPersonProperties")){var e=Ws(this.get_distinct_id(),t,i);this.Ps!==e?(this.setPersonPropertiesForFlags(f({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ps=e):H.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){if(this.Hs("posthog.group")){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}}else H.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(H.info("reset"),!this.__loaded)return H.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(Nt,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Ps=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Jt,$device_id:null},"");else{var o=this.config.get_device_id(Wi());this.register_once({distinct_id:o,$device_id:t?o:n},"")}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 t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(lt)?(H.critical("Attempting to create alias for existing People user - aborting."),-2):this.Hs("posthog.alias")?(P(i)&&(i=this.get_distinct_id()),t!==i?(this.Ws(ht,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(H.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=f({},this.config);if(I(t)){var e,r,s,n,o;X(this.config,fa(t));var a=this.Ms();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yo(f({},this.config,{persistence:"sessionStorage"}),a),Qi.G()&&"true"===Qi.V("ph_debug")&&(this.config.debug=!0),this.config.debug&&(c.DEBUG=!0,H.info("set_config",{config:t,oldConfig:i,newConfig:f({},this.config)})),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Gs(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){var e=new Error("PostHog syntheticException");return this.exceptions.sendExceptionEvent(f({},Be((t=>t instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:e}),i))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:da;return i!==da&&(i=da+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(Nt))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(Nt))}qs(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&R(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ht])&&(null==(i=this.persistence)||null==(i=i.props)||!i[Wt]))}zs(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.qs()||this.Hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Hs(t){return"never"===this.config.person_profiles?(H.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ws(Wt,!0),!0)}Ms(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}Gs(){var t,i,e,r,s=this.Ms();(null==(t=this.persistence)?void 0:t.je)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.je)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){if("always"!==this.config.cookieless_mode){var i;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new Wo(this),this.persistence&&(this.sessionPropsManager=new qo(this,this.sessionManager,this.persistence)),this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Gs(),P(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(i=null==t?void 0:t.captureEventName)&&void 0!==i?i:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Ns()}else H.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Gs(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Jt,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Ns())):H.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 t=this.consent.consent;return t===ne.GRANTED?"granted":t===ne.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Gs()}_is_bot(){return n?Xo(n,this.config.custom_blocked_useragents):void 0}Ns(){o&&("visible"===o.visibilityState?this.Es||(this.Es=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.Is&&(o.removeEventListener("visibilitychange",this.Is),this.Is=null)):this.Is||(this.Is=this.Ns.bind(this),at(o,"visibilitychange",this.Is)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var t,i,e,r,s,n,o,a=this.Ts||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(H.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):(e="advanced_disable_decide",r=!1,s=H,n=(i="advanced_disable_flags")in(t=a)&&!P(t[i]),o=e in t&&!P(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Bs(t){if(O(this.config.before_send))return t;var i=x(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),O(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return j(t.event)?H.warn(s+". This can cause unexpected behavior."):H.info(s),null}e.properties&&!R(e.properties)||H.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.pe)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}}!function(t,i){for(var e=0;e