!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var 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,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,v=null==n?void 0:n.userAgent,d=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.301.2"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},b=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},S=function(t){return t.replace(/^\$/,"")};var E=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,R=E||function(t){return"[object Array]"===T.call(t)},I=t=>"function"==typeof t,F=t=>t===Object(t)&&!R(t),C=t=>{if(F(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,O=t=>"[object String]"==T.call(t),A=t=>O(t)&&0===t.trim().length,D=t=>null===t,j=t=>M(t)||D(t),L=t=>"[object Number]"==T.call(t),N=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,z=t=>w(b,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function q(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],G=t=>w(W,t),V=[!1,"false",0,"0","no"];function J(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.S}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.$(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Y,X,Q,Z=t=>t instanceof Error;function tt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Q&&e.length===X||(X=e.length,Q=e.reduce(((e,r)=>{Y||(Y={});var s=Y[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,u=i[r];if(l&&u){e[l]=u,Y[r]=[l,u];break}}return e}),{})),Q}}class it{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&R(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:tt(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var et="?";function rt(t,i,e,r,s){var n={platform:t,filename:i,function:""===e?et:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var st=(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]:et,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},nt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ot=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,at=/\((\S*)(?::(\d+))(?::(\d+))\)/,lt=(t,i)=>{var e=nt.exec(t);if(e){var[,r,s,n]=e;return rt(i,r,et,+s,+n)}var o=ot.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=at.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=st(o[1]||et,o[2]);return rt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ut=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ht=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vt=(t,i)=>{var e=ut.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ht.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||et;return[n,s]=st(n,s),rt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},dt=/\(error: (.*)\)/,ct=50;function ft(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r1024)){var l=dt.test(a)?a.replace(dt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=ct)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ct).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||et});var e}))}(s)}}class pt{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=O(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}}class gt{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class _t{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var mt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class yt{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(mt);return r&&(i=r[1],e=r[2]),[i,e]}}var bt=["fatal","error","warning","log","info","debug"];function wt(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""}class xt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+wt(t)}isSeverityLevel(t){return O(t)&&!A(t)&&bt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Z(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class St{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+wt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Et{match(t){return H(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class $t{match(t){return B(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(H(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var kt=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||d.POSTHOG_DEBUG||r)&&!M(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>kt(i+" "+t,e)};return s},Pt=kt("[PostHog.js]"),Tt=Pt.createLogger,Rt=Tt("[ExternalScriptsLoader]"),It=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Rt.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)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__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);It(t,n,e)},d.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);It(t,r,e)};var Ft={};function Ct(t,i,e){if(R(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||L(t))&&(i[e]=t)})),i};function Ut(t,i){return e=t,r=t=>O(t)&&!D(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),R(i)?(n=[],Ct(i,(i=>{n.push(t(i))}))):(n={},Mt(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var zt=["herokuapp.com","vercel.app","netlify.app"];function Ht(t){var i=null==t?void 0:t.hostname;if(!O(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of zt)if(e===r)return!1;return!0}function Bt(t,i){for(var e=0;ee.match(t))))}function Ii(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 Fi(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Qi(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ci(t){var i="";return qi(t)&&!Wi(t)&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;ki(t)&&t.textContent&&(i+=null!==(e=Fi(t.textContent))&&void 0!==e?e:"")})),x(i)}function Mi(t){return M(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,i){if(M(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Di(t){var i=t.parentNode;return!(!i||!Ei(i))&&i}var ji=["next","previous","prev",">","<"],Li=10;var Ni=[".ph-no-rageclick",".ph-no-capture"];function Ui(i,e){if(!t||zi(i))return!1;var r,s,n;N(e)?(r=!!e&&Ni,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ni,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Hi(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=ji;else{if(!R(t))return!1;if(t.length>Li)return Pt.error("[PostHog] content_ignorelist array cannot exceed "+Li+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:Ci(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Ai(o,r)}var zi=t=>!t||$i(t,"html")||!Ei(t),Hi=(i,e)=>{if(!t||zi(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!$i(n,"body");)if(Pi(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Di(n);if(!o)break;if(e||Oi.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Bi(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||zi(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!Ri(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&Ri(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}var{parentIsUsefulElement:v,targetElementList:d}=Hi(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(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(!Ai(d,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){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 v?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Oi.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function qi(t){for(var i=t;i.parentNode&&!$i(i,"body");i=i.parentNode){var e=Ii(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(Ii(t),"ph-include"))return!0;var r=t.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(O(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 Wi(t){return!!($i(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$i(t,"select")||$i(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Gi="(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("^(?:"+Gi+")$"),Ji=new RegExp(Gi),Ki="\\d{3}-?\\d{2}-?\\d{4}",Yi=new RegExp("^("+Ki+")$"),Xi=new RegExp("("+Ki+")");function Qi(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(O(t)){if(t=x(t),(i?Vi:Ji).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Yi:Xi).test(t))return!1}return!0}function Zi(t){var i=Ci(t);return Qi(i=(i+" "+te(t)).trim())?i:""}function te(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ci(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+te(t)).trim())}catch(t){Pt.error("[AutoCapture]",t)}})),i}function ie(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=g({},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 Dt(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[ee(i.toString())]=ee(e.toString())})),r+=":",r+=Dt(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:re(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dt(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 ee(t){return t.replace(/"|\\"/g,'\\"')}function re(t){var i=t.attr__class;return i?R(i)?i:Ti(i):void 0}class se{constructor(t){this.disabled=!1===t;var i=F(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y){var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},le=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Mt(t,(function(t,i){M(t)||M(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)},ue=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;st?i.slice(0,t)+"...":i}function fe(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ei(i));return i}function pe(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=ce(1024,Zi(t)):n.$el_text=ce(1024,Ci(t)));var o=Ii(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Mt(t.attributes,(function(e){var s;if((!Wi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Qi(e.value)&&(s=e.name,!O(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]=ce(1024,o)}}));for(var a=1,l=1,u=t;u=fe(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ge(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],v=i;v.parentNode&&!$i(v,"body");)Pi(v.parentNode)?(h.push(v.parentNode.host),v=v.parentNode.host):(h.push(v.parentNode),v=v.parentNode);var d,c=[],f={},p=!1,g=!1;if(Mt(h,(t=>{var i=qi(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Qi(p)&&p),w(Ii(t),"ph-no-capture")&&(g=!0),c.push(pe(t,o,a,l));var e=function(t){if(!qi(t))return{};var i={};return Mt(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&&Qi(r)&&(i[e]=r)}})),i}(t);Ot(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Zi(i):c[0].$el_text=Ci(i)),p){var _,m;c[0].attr__href=p;var y=null==(_=ae(p))?void 0:_.host,b=null==t||null==(m=t.location)?void 0:m.host;y&&b&&y!==b&&(d=p)}return{props:Ot({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:ie(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},f)}}class _e{constructor(t){this.P=!1,this.T=null,this.R=!1,this.instance=t,this.rageclicks=new se(t.config.rageclick),this.I=null}get F(){var t,i,e=F(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}C(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.M(i)}catch(t){de.error("Failed to capture event",t)}};if(qt(o,"submit",i,{capture:!0}),qt(o,"change",i,{capture:!0}),qt(o,"click",i,{capture:!0}),this.F.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.M(i,ne)};qt(o,"copy",e,{capture:!0}),qt(o,"cut",e,{capture:!0})}}}else de.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.C(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.R=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Jt]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.I=t}getElementSelectors(t){var i,e=[];return null==(i=this.I)||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[Jt],r=this.T;if(D(r)&&!N(e)&&!this.instance.O())return!1;var s=null!==(i=this.T)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}M(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=Mi(i);if(ki(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,i.timeStamp||(new Date).getTime())&&Ui(s,this.instance.config.rageclick)&&this.M(i,"$rageclick");var n=e===ne;if(s&&Bi(s,i,this.F,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ge(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.F.element_attribute_ignorelist,elementsChainAsString:this.R});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ne){var u,h=Fi(null==t||null==(u=t.getSelection())?void 0:u.toString()),v=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=v}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return I(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 L(t)&&isFinite(t)&&Math.floor(t)===t});var me="0123456789abcdef";class ye{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 ye(s)}toString(){for(var t="",i=0;i>>4)+me.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 ye(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 be{constructor(){this.A=0,this.D=0,this.j=new Se}generate(){var t=this.generateOrAbort();if(M(t)){this.A=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return ye.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var we,xe=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 Se{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(xe(this.N),this.U=0),this.N[this.U++]}}var Ee=()=>$e().toString(),$e=()=>(we||(we=new be)).generate(),ke="";var Pe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Te(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),ke)return ke;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_"+Ee();!ke&&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",ke=n)}return ke}(t);if(!e){var r=(t=>{var i=t.match(Pe);return i?i[0]:""})(t);r!==e&&Pt.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Re={H:()=>!!o,B:function(t){Pt.error("cookieStore error: "+t)},q:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r3686.4&&Pt.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},V:function(t,i){if(null!=o&&o.cookie)try{Re.G(t,"",-1,i)}catch(t){return}}},Ie=null,Fe={H:function(){if(!D(Ie))return Ie;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Fe.G(e,"xyz"),'"xyz"'!==Fe.q(e)&&(i=!1),Fe.V(e)}catch(t){i=!1}return i||Pt.error("localStorage unsupported; falling back to cookie store"),Ie=i,i},B:function(t){Pt.error("localStorage error: "+t)},q:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Fe.B(t)}return null},W:function(t){try{return JSON.parse(Fe.q(t))||{}}catch(t){}return null},G:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Fe.B(t)}},V:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Fe.B(t)}}},Ce=["distinct_id",ri,si,yi,mi],Me=g({},Fe,{W:function(t){try{var i={};try{i=Re.W(t)||{}}catch(t){}var e=Ot(i,JSON.parse(Fe.q(t)||"{}"));return Fe.G(t,e),e}catch(t){}return null},G:function(t,i,e,r,s,n){try{Fe.G(t,i,void 0,void 0,n);var o={};Ce.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Re.G(t,o,e,r,s,n)}catch(t){Fe.B(t)}},V:function(i,e){try{null==t||t.localStorage.removeItem(i),Re.V(i,e)}catch(t){Fe.B(t)}}}),Oe={},Ae={H:function(){return!0},B:function(t){Pt.error("memoryStorage error: "+t)},q:function(t){return Oe[t]||null},W:function(t){return Oe[t]||null},G:function(t,i){Oe[t]=i},V:function(t){delete Oe[t]}},De=null,je={H:function(){if(!D(De))return De;if(De=!0,M(t))De=!1;else try{var i="__support__";je.G(i,"xyz"),'"xyz"'!==je.q(i)&&(De=!1),je.V(i)}catch(t){De=!1}return De},B:function(t){Pt.error("sessionStorage error: ",t)},q:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){je.B(t)}return null},W:function(t){try{return JSON.parse(je.q(t))||null}catch(t){}return null},G:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){je.B(t)}},V:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){je.B(t)}}},Le=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Ne{constructor(t){this._instance=t}get F(){return this._instance.config}get consent(){return this.J()?Le.DENIED:this.K}isOptedOut(){return"always"===this.F.cookieless_mode||(this.consent===Le.DENIED||this.consent===Le.PENDING&&(this.F.opt_out_capturing_by_default||"on_reject"===this.F.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Le.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.F.cookie_expiration,this.F.cross_subdomain_cookie,this.F.secure_cookie)}reset(){this.Y.V(this.X,this.F.cross_subdomain_cookie)}get X(){var{token: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 K(){var t=this.Y.q(this.X);return G(t)?Le.GRANTED:w(V,t)?Le.DENIED:Le.PENDING}get Y(){if(!this.Z){var t=this.F.opt_out_capturing_persistence_type;this.Z="localStorage"===t?Fe:Re;var i="localStorage"===t?Re:Fe;i.q(this.X)&&(this.Z.q(this.X)||this.optInOut(G(i.q(this.X))),i.V(this.X,this.F.cross_subdomain_cookie))}return this.Z}J(){return!!this.F.respect_dnt&&!!Bt([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,d.doNotTrack],(t=>G(t)))}}var Ue=Tt("[Dead Clicks]"),ze=()=>!0,He=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(ti)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!F(r)||e};class Be{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[ti]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var i,e;null!=(i=d.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=d.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ue.error("failed to load script",i):t()}))}et(){var t;if(o){if(!this.tt&&null!=(t=d.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=F(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.tt=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.tt.start(o),Ue.info("starting...")}}else Ue.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ue.info("stopping..."))}}var qe=Tt("[ExceptionAutocapture]");class We{constructor(i){var e,r,s;this.rt=()=>{var i;if(t&&this.isEnabled&&null!=(i=d.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.F.capture_unhandled_errors&&(this.st=e(this.captureException.bind(this))),!this.nt&&this.F.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.F.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(t){qe.error("failed to start",t),this.lt()}}},this._instance=i,this.ut=!(null==(e=this._instance.persistence)||!e.props[Yt]),this.F=this.ht(),this.vt=new K({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,h:qe}),this.startIfEnabled()}ht(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return F(t)?i=g({},i,t):(M(t)?this.ut:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.F.capture_console_errors||this.F.capture_unhandled_errors||this.F.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(qe.info("enabled"),this.it(this.rt))}it(t){var i,e;null!=(i=d.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=d.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return qe.error("failed to load script",i);t()}))}lt(){var t,i,e;null==(t=this.st)||t.call(this),this.st=void 0,null==(i=this.nt)||i.call(this),this.nt=void 0,null==(e=this.ot)||e.call(this),this.ot=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ut=!!i||!1,this.F=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Yt]:this.ut}),this.startIfEnabled()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.vt.consumeRateLimit(r)?qe.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Ge(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return I(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class Ve{constructor(i){var e;this._instance=i,this.dt=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Pt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Pt.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Ge(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Ge(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("replaceState")})),this.gt()}}ft(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.dt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.dt=r}catch(t){Pt.error("Error capturing "+i+" pageview",t)}}gt(){if(!this.ct){var i=()=>{this.ft("popstate")};qt(t,"popstate",i),this.ct=()=>{t&&t.removeEventListener("popstate",i)}}}}var Je=Tt("[SegmentIntegration]");function Ke(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()||Ee();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ci,"identified")),i()},s=e.user();"then"in s&&I(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Je.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()||(Je.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Je.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 Ye="posthog-js";function Xe(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,v;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 c=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(u=c[0])?void 0:u.type,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=c[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(v=c[0])?void 0:v.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Ze=null!=t&&t.location?ve(t.location.hash,"__posthog")||ve(location.hash,"state"):null,tr="_postHogToolbarParams",ir=Tt("[Toolbar]"),er=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(er||{});class rr{constructor(t){this.instance=t}_t(t){d.ph_toolbar_state=t}yt(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:er.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=Ze||ve(i.hash,"__posthog")||ve(i.hash,"state"),a=n?jt((()=>JSON.parse(atob(decodeURIComponent(n)))))||jt((()=>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(tr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}bt(t){var i=d.ph_load_toolbar||d.ph_load_editor;!j(i)&&I(i)?i(t,this.instance):ir.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(bi));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(tr,JSON.stringify(g({},s,{source:void 0}))),this.yt()===er.LOADED)this.bt(s);else if(this.yt()===er.UNINITIALIZED){var n;this._t(er.LOADING),null==(n=d.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ir.error("[Toolbar] Failed to load",t),void this._t(er.UNINITIALIZED);this._t(er.LOADED),this.bt(s)})),qt(t,"turbolinks:load",(()=>{this._t(er.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(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 sr=Tt("[TracingHeaders]");class nr{constructor(t){this.xt=void 0,this.St=void 0,this.rt=()=>{var t,i;M(this.xt)&&(null==(t=d.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.St)&&(null==(i=d.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var i,e;null!=(i=d.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=d.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return sr.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(t=this.xt)||t.call(this),null==(i=this.St)||i.call(this),this.xt=void 0,this.St=void 0)}}var or="Mobile",ar="iOS",lr="Android",ur="Tablet",hr=lr+" "+ur,vr="iPad",dr="Apple",cr=dr+" Watch",fr="Safari",pr="BlackBerry",gr="Samsung",_r=gr+"Browser",mr=gr+" Internet",yr="Chrome",br=yr+" OS",wr=yr+" "+ar,xr="Internet Explorer",Sr=xr+" "+or,Er="Opera",$r=Er+" Mini",kr="Edge",Pr="Microsoft "+kr,Tr="Firefox",Rr=Tr+" "+ar,Ir="Nintendo",Fr="PlayStation",Cr="Xbox",Mr=lr+" "+or,Or=or+" "+fr,Ar="Windows",Dr=Ar+" Phone",jr="Nokia",Lr="Ouya",Nr="Generic",Ur=Nr+" "+or.toLowerCase(),zr=Nr+" "+ur.toLowerCase(),Hr="Konqueror",Br="(\\d+(\\.\\d+)?)",qr=new RegExp("Version/"+Br),Wr=new RegExp(Cr,"i"),Gr=new RegExp(Fr+" \\w+","i"),Vr=new RegExp(Ir+" \\w+","i"),Jr=new RegExp(pr+"|PlayBook|BB10","i"),Kr={"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 Yr=(t,i)=>i&&w(i,dr)||function(t){return w(t,fr)&&!w(t,yr)&&!w(t,lr)}(t),Xr=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?$r:w(t," OPR/")?Er:Jr.test(t)?pr:w(t,"IE"+or)||w(t,"WPDesktop")?Sr:w(t,_r)?mr:w(t,kr)||w(t,"Edg/")?Pr:w(t,"FBIOS")?"Facebook "+or:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?wr:w(t,"CrMo")||w(t,yr)?yr:w(t,lr)&&w(t,fr)?Mr:w(t,"FxiOS")?Rr:w(t.toLowerCase(),Hr.toLowerCase())?Hr:Yr(t,i)?w(t,or)?Or:fr:w(t,Tr)?Tr:w(t,"MSIE")||w(t,"Trident/")?xr:w(t,"Gecko")?Tr:""},Qr={[Sr]:[new RegExp("rv:"+Br)],[Pr]:[new RegExp(kr+"?\\/"+Br)],[yr]:[new RegExp("("+yr+"|CrMo)\\/"+Br)],[wr]:[new RegExp("CriOS\\/"+Br)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Br)],[fr]:[qr],[Or]:[qr],[Er]:[new RegExp("(Opera|OPR)\\/"+Br)],[Tr]:[new RegExp(Tr+"\\/"+Br)],[Rr]:[new RegExp("FxiOS\\/"+Br)],[Hr]:[new RegExp("Konqueror[:/]?"+Br,"i")],[pr]:[new RegExp(pr+" "+Br),qr],[Mr]:[new RegExp("android\\s"+Br,"i")],[mr]:[new RegExp(_r+"\\/"+Br)],[xr]:[new RegExp("(rv:|MSIE )"+Br)],Mozilla:[new RegExp("rv:"+Br)]},Zr=function(t,i){var e=Xr(t,i),r=Qr[e];if(M(r))return null;for(var s=0;s[Cr,t&&t[1]||""]],[new RegExp(Ir,"i"),[Ir,""]],[new RegExp(Fr,"i"),[Fr,""]],[Jr,[pr,""]],[new RegExp(Ar,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Dr,""];if(new RegExp(or).test(i)&&!/IEMobile\b/.test(i))return[Ar+" "+or,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Kr[r]||"";return/arm/i.test(i)&&(s="RT"),[Ar,s]}return[Ar,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[ar,i.join(".")]}return[ar,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+lr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lr+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[lr,i.join(".")]}return[lr,""]}],[/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/,[br,""]],[/Linux|debian/i,["Linux",""]]],is=function(t){return Vr.test(t)?Ir:Gr.test(t)?Fr:Wr.test(t)?Cr:new RegExp(Lr,"i").test(t)?Lr:new RegExp("("+Dr+"|WPDesktop)","i").test(t)?Dr:/iPad/.test(t)?vr:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?cr:Jr.test(t)?pr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jr,"i").test(t)?jr:/(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(or).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)?lr:hr:lr:new RegExp("(pda|"+or+")","i").test(t)?Ur:new RegExp(ur,"i").test(t)&&!new RegExp(ur+" pc","i").test(t)?zr:""},es="https?://(.*)",rs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ss=At(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],rs),ns="",os=["li_fat_id"];function as(t,i,e){if(!o)return{};var r,s=i?At([],rs,e||[]):[],n=ls(he(o.URL,s,ns),t),a=(r={},Mt(os,(function(t){var i=Re.q(t);r[t]=i||null})),r);return Ot(a,n)}function ls(t,i){var e=ss.concat(i||[]),r={};return Mt(e,(function(i){var e=ue(t,i);r[i]=e||null})),r}function us(t){var i=function(t){return t?0===t.search(es+"google.([^/?]*)")?"google":0===t.search(es+"bing.com")?"bing":0===t.search(es+"yahoo.com")?"yahoo":0===t.search(es+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?ue(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function hs(){return navigator.language||navigator.userLanguage}function vs(){return(null==o?void 0:o.referrer)||"$direct"}function ds(t,i){var e=t?At([],rs,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:vs().substring(0,1e3),u:r?he(r,e,ns):void 0}}function cs(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=ae(e))?void 0:i.host};if(r){s.$current_url=r;var n=ae(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ls(r);Ot(s,o)}if(e){var a=us(e);Ot(s,a)}return s}function fs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ps(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function gs(i,e){if(!v)return{};var r,s,n,o=i?At([],rs,e||[]):[],[l,u]=function(t){for(var i=0;i1e3?v.substring(0,997)+"...":v,$browser_version:Zr(v,navigator.vendor),$browser_language:hs(),$browser_language_prefix:(r=hs(),"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 _s=Tt("[Web Vitals]"),ms=9e5;class ys{constructor(t){var i;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))_s.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Tt();if(!M(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))_s.error("Invalid metric received",t);else if(this.Rt&&t.value>=this.Rt)_s.error("Ignoring metric with value >= "+this.Rt,t);else this.N.url!==r&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()}},this.rt=()=>{var t,i,e,r,s=d.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Pt.bind(this)),this.P=!0):_s.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Et=!(null==(i=this._instance.persistence)||!i.props[Zt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=F(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return M(e)?(null==(i=this._instance.persistence)?void 0:i.props[ii])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(F(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var t=F(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ms;return 0{i?_s.error("failed to load script",i):t()}))}Tt(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?At([],rs,r||[]):[];return he(i,s,ns)}_s.error("Could not determine current URL")}}var bs=Tt("[Heatmaps]");function ws(t){return F(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}class xs{constructor(t){var i;this.Et=!1,this.P=!1,this.It=null,this.instance=t,this.Et=!(null==(i=this.instance.persistence)||!i.props[Kt]),this.rageclicks=new se(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return F(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 M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;bs.info("starting..."),this.Ft(),this.Ct()}else{var t;clearInterval(null!==(t=this.It)&&void 0!==t?t:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Kt]:i}),this.Et=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Ot(t){this.At(t.originalEvent,"deadclick")}Ct(){this.It&&clearInterval(this.It),this.It=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ft(){t&&o&&(this.jt=this.Dt.bind(this),qt(t,"beforeunload",this.jt),this.Lt=i=>this.At(i||(null==t?void 0:t.event)),qt(o,"click",this.Lt,{capture:!0}),this.Nt=i=>this.Ut(i||(null==t?void 0:t.event)),qt(o,"mousemove",this.Nt,{capture:!0}),this.zt=new Be(this.instance,ze,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ct.bind(this),qt(o,"visibilitychange",this.Ht),this.P=!0)}Mt(){var i;t&&o&&(this.jt&&t.removeEventListener("beforeunload",this.jt),this.Lt&&o.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&o.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&o.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),null==(i=this.zt)||i.stop(),this.P=!1)}qt(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&&Ei(s)&&!$i(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Di(s)}return!1}(Mi(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}At(t,i){var e;if(void 0===i&&(i="click"),!Si(t.target)&&ws(t)){var r=this.qt(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Wt(g({},r,{type:"rageclick"})),this.Wt(r)}}Ut(t){!Si(t.target)&&ws(t)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(t,"mousemove"))}),500))}Wt(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?At([],rs,s||[]):[],o=he(e,n,ns);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(i)}}Dt(){this.N&&!C(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ss{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.Gt(i,e);return this.Vt={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.Gt(t,null==(i=this.Vt)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Vt)?void 0:t.pageViewId}}Gt(t,i){var e=this.Vt;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:u,maxContentY:h}=s;if(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var v=n<=1?1:J(o/n,0,1,Pt),d=n<=1?1:J(a/n,0,1,Pt),c=l<=1?1:J(u/l,0,1,Pt),f=l<=1?1:J(h/l,0,1,Pt);r=Ot(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$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 Es=Uint8Array,$s=Uint16Array,ks=Uint32Array,Ps=new Es([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]),Ts=new Es([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]),Rs=new Es([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Is=function(t,i){for(var e=new $s(31),r=0;r<31;++r)e[r]=i+=1<>>1|(21845&Ds)<<1;js=(61680&(js=(52428&js)>>>2|(13107&js)<<2))>>>4|(3855&js)<<4,As[Ds]=((65280&js)>>>8|(255&js)<<8)>>>1}var Ls=function(t,i,e){for(var r=t.length,s=0,n=new $s(i);s>>l]=u}else for(o=new $s(r),s=0;s>>15-t[s];return o},Ns=new Es(288);for(Ds=0;Ds<144;++Ds)Ns[Ds]=8;for(Ds=144;Ds<256;++Ds)Ns[Ds]=9;for(Ds=256;Ds<280;++Ds)Ns[Ds]=7;for(Ds=280;Ds<288;++Ds)Ns[Ds]=8;var Us=new Es(32);for(Ds=0;Ds<32;++Ds)Us[Ds]=5;var zs=Ls(Ns,9,0),Hs=Ls(Us,5,0),Bs=function(t){return(t/8>>0)+(7&t&&1)},qs=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof $s?$s:t instanceof ks?ks:Es)(e-i);return r.set(t.subarray(i,e)),r},Ws=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Gs=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},Vs=function(t,i){for(var e=[],r=0;rd&&(d=n[r].s);var c=new $s(d+1),f=Js(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<i))break;p+=_-(1<>>=g;p>0;){var y=n[r].s;c[y]=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Es(c),f]},Js=function(t,i,e){return-1==t.s?Math.max(Js(t.l,i,e+1),Js(t.r,i,e+1)):i[t.s]=e},Ks=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new $s(++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]},Ys=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&&!P[Rs[R-1]];--R);var I,F,C,M,O=u+5<<3,A=Ys(s,Ns)+Ys(n,Us)+o,D=Ys(s,d)+Ys(n,p)+o+14+3*R+Ys(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O<=A&&O<=D)return Xs(i,h,t.subarray(l,l+u));if(Ws(i,h,1+(D15&&(Ws(i,h,U[E]>>>5&127),h+=U[E]>>>12)}}}else I=zs,F=Ns,C=Hs,M=Us;for(E=0;E255){z=r[E]>>>18&31;Gs(i,h,I[z+257]),h+=F[z+257],z>7&&(Ws(i,h,r[E]>>>23&31),h+=Ps[z]);var H=31&r[E];Gs(i,h,C[H]),h+=M[H],H>3&&(Gs(i,h,r[E]>>>5&8191),h+=Ts[H])}else Gs(i,h,I[r[E]]),h+=F[r[E]];return Gs(i,h,I[256]),h+F[256]},Zs=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tn=function(){for(var t=new ks(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),en=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Es(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var v=h+65535;v>>13,f=8191&d,p=(1<7e3||P>24576)&&M>423){u=Qs(t,l,0,w,x,S,k,P,R,h-R,u),P=E=k=0,R=h;for(var O=0;O<286;++O)x[O]=0;for(O=0;O<30;++O)S[O]=0}var A=2,D=0,j=f,L=F-C&32767;if(M>2&&I==b(h-L))for(var N=Math.min(c,M)-1,U=Math.min(32767,h),z=Math.min(258,M);L<=U&&--j&&F!=C;){if(t[h+A]==t[h+A-L]){for(var H=0;HA){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(O=0;Oq&&(q=G,C=W)}}}L+=(F=C)-(C=g[F])+32768&32767}if(D){w[P++]=268435456|Ms[A]<<18|Os[D];var V=31&Ms[A],J=31&Os[D];k+=Ps[V]+Ts[J],++x[257+V],++S[J],T=h+A,++E}else w[P++]=t[h],++x[t[h]]}}u=Qs(t,l,n,w,x,S,k,P,R,h-R,u)}return qs(a,0,r+Bs(u)+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)},rn=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function sn(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=en(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return 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&&rn(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)}}(n,i),rn(n,o-8,e.d()),rn(n,o-4,r),n}var nn=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),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},on=!!u||!!l,an="text/plain",ln=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=le(o);return l&&a.push(l),s+"?"+a.join("&")},un=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),hn=t=>{var{data:i,compression:e}=t;if(i){if(e===oe.GZipJS){var r=sn(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Es(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;or.length){var a=new Es(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 qs(r,0,s)}(un(i)),{mtime:0}),s=new Blob([r],{type:an});return{contentType:an,body:s,estimatedSize:s.size}}if(e===oe.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=nn(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,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a"data="+encodeURIComponent("string"==typeof t?t:un(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=un(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vn=[];l&&vn.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=hn(t))&&void 0!==i?i:{},o=new Headers;Mt(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var v=new h;u={signal:v.signal,timeout:setTimeout((()=>v.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?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){Pt.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Pt.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&vn.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=hn(t))&&void 0!==i?i:{};Mt(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(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&&vn.push({transport:"sendBeacon",method:t=>{var i=ln(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=hn(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var dn=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 cn(t,i,e){return un({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var fn={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=>dn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!dn(i,t))))),icontains:(t,i)=>i.map(pn).some((i=>t.map(pn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(pn).every((i=>t.map(pn).every((t=>!i.includes(t)))))},pn=t=>t.toLowerCase();function gn(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||D(s))return!1;var n=[String(s)],o=fn[r.operator];return!!o&&o(r.values,n)}))}var _n=Tt("[Error tracking]");class mn{constructor(t){var i,e;this.Jt=[],this.Kt=new it([new pt,new $t,new _t,new gt,new St,new xt,new yt,new Et],ft("web:javascript",lt,vt)),this._instance=t,this.Jt=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Xt))&&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.Jt=s,this._instance.persistence&&this._instance.persistence.register({[Xt]:this.Jt,[Qt]:n})}get Yt(){var t,i=!!this._instance.get_property(Qt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Kt.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.Xt(i)){if(this.Qt(i))return void _n.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(i))return void _n.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(i))return void _n.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return O(e)&&e.length>0&&t.$exception_types.push(e),O(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Jt.some((t=>{var e=t.values.map((t=>{var e,r=fn[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}Zt(t){return t.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://")))}ti(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Xt(t){return!j(t)&&R(t)}}var yn=Tt("[FeatureFlags]"),bn=Tt("[FeatureFlags]",{debugEnabled:!0}),wn="$active_feature_flags",xn="$override_feature_flags",Sn="$feature_flag_payloads",En="$override_feature_flag_payloads",$n="$feature_flag_request_id",kn="$feature_flag_evaluated_at",Pn=t=>{var i={};for(var[e,r]of Dt(t||{}))r&&(i[e]=r);return i},Tn=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]})))):yn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Rn=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class In{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||yn.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.vi({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(ai),i=this._instance.get_property(xn),e=this._instance.get_property(En);if(!e&&!i)return t||{};var r=Ot({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,v=M(u)?l.variant:"string"==typeof u?u:void 0,d=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=v?v:null==l?void 0:l.variant:void 0});if(h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),v!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),d)c.metadata=g({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.ii||(yn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ii=!0),r}getFlagVariants(){var t=this._instance.get_property(ni),i=this._instance.get_property(xn);if(!i)return t||{};for(var e=Ot({},t),r=Object.keys(i),s=0;s{this.vi()}),5))}di(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}vi(t){var i;if(this.di(),!this._instance.O())if(this.ri)this.ni=!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:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(li)||{}),group_properties:this._instance.get_property(ui)};(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(e.disable_flags=!0),this.ui()&&(e.evaluation_environments=this.li());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("flags",s+n);r&&(e.timezone=fs()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:e,compression:this._instance.config.disable_compression?void 0:oe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,r,s=!0;(200===t.statusCode&&(this.ni||(this.$anon_distinct_id=void 0),s=!1),this.ri=!1,this.oi)||(this.oi=!0,this._instance.fi(null!==(r=t.json)&&void 0!==r?r:{}));if(!e.disable_flags||this.ni)if(this.ai=!s,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Rn.FeatureFlags))yn.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.ni&&(this.ni=!1,this.vi())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property($n)||void 0,n=this._instance.get_property(kn)||void 0,o=this._instance.get_property(di)||{};if((i.send_event||!("send_event"in i))&&(!(t in o)||!o[t].includes(r))){var a,l,u,h,v,d,c,f,p;R(o[t])?o[t].push(r):o[t]=[r],null==(a=this._instance.persistence)||a.register({[di]:o});var g=this.getFeatureFlagDetails(t),_={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[t])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[t])||null,$used_bootstrap_value:!this.ai};M(null==g||null==(h=g.metadata)?void 0:h.version)||(_.$feature_flag_version=g.metadata.version);var m,y=null!==(v=null==g||null==(d=g.reason)?void 0:d.description)&&void 0!==v?v:null==g||null==(c=g.reason)?void 0:c.code;if(y&&(_.$feature_flag_reason=y),null!=g&&null!=(f=g.metadata)&&f.id&&(_.$feature_flag_id=g.metadata.id),M(null==g?void 0:g.original_variant)&&M(null==g?void 0:g.original_enabled)||(_.$feature_flag_original_response=M(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(p=g.metadata)&&p.original_payload)_.$feature_flag_original_payload=null==g||null==(m=g.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",_)}return e}yn.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,r={distinct_id:this._instance.get_distinct_id(),token:e};this.ui()&&(r.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:oe.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.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}yn.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.ei=!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=Tn(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(R(a)){yn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(a)for(var d=0;dthis.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(oi)||[]).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=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[wn]:Object.keys(Pn(a)),[ni]:a}),this.pi()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(oi),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance.ci({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(oi),null==(r=this._instance.persistence)||r.register({[oi]:s}),t(s)}}})}gi(){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)),{})}}pi(t){var{flags:i,flagVariants:e}=this.gi();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(li)||{};this._instance.register({[li]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(li)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ui)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[ui]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(ui)||{};this._instance.register({[ui]:g({},i,{[t]:{}})})}else this._instance.unregister(ui)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.di(),this.ii=!1}}var Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Cn{constructor(t,i){this.F=t,this.props={},this.mi=!1,this.yi=(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.Y=this.bi(t),this.load(),t.debug&&Pt.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.wi}bi(t){-1===Fn.indexOf(t.persistence.toLowerCase())&&(Pt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Fe.H()?Fe:"localstorage+cookie"===i&&Me.H()?Me:"sessionstorage"===i&&je.H()?je:"memory"===i?Ae:"cookie"===i?Re:Me.H()?Me:Re}properties(){var t={};return Mt(this.props,(function(i,e){if(e===ni&&F(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(F(t)){this.xi=M(i)?this.$i:i;var e=!1;if(Mt(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.mi){var t=as(this.F.custom_campaign_params,this.F.mask_personal_data_properties,this.F.custom_personal_data_properties);C(Nt(t))||this.register(t),this.mi=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?us(t):{})}update_referrer_info(){var t;this.register_once({$referrer:vs(),$referring_domain:null!=o&&o.referrer&&(null==(t=ae(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[gi]||this.props[_i]||this.register_once({[mi]:ds(this.F.mask_personal_data_properties,this.F.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Mt([_i,gi],(i=>{var e=this.props[i];e&&Mt(e,(function(i,e){t["$initial_"+S(e)]=i}))}));var i,e,r=this.props[mi];if(r){var s=(i=cs(r),e={},Mt(i,(function(t,i){e["$initial_"+S(i)]=t})),e);Ot(t,s)}return t}safe_merge(t){return Mt(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.$i=this.xi=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.bi(t),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(t){this.wi=t,this.wi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Si&&(this.Si=t,this.remove(),this.save())}set_secure(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Vt]||{};e[t]=i,this.props[Vt]=e,this.save()}remove_event_timer(t){var i=(this.props[Vt]||{})[t];return M(i)||(delete this.props[Vt][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Mn=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({}),On=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),An=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),Dn=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}({}),jn=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Ln{constructor(){this.ki={},this.ki={}}on(t,i){return this.ki[t]||(this.ki[t]=[]),this.ki[t].push(i),()=>{this.ki[t]=this.ki[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.ki[t]||[])e(i);for(var r of this.ki["*"]||[])r(t,i)}}function Nn(t,i,e){if(j(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class Un{constructor(t){this.Pi=new Ln,this.Ti=(t,i)=>this.Ri(t,i)&&this.Ii(t,i)&&this.Fi(t,i)&&this.Ci(t,i),this.Ri=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Mi=new Set,this.Oi=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t.Ai)){var i;null==(i=this._instance)||i.Ai(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i.Ai)&&(t.forEach((t=>{var i,e;null==(i=this.Oi)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Mi)||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.Mi.has(t)||this.Mi.has(null==i?void 0:i.event))&&this.Oi&&(null==(e=this.Oi)?void 0:e.size)>0&&this.Oi.forEach((t=>{this.Di(i,t)&&this.Pi.emit("actionCaptured",t.name)}))}ji(t){this.onAction("actionCaptured",(i=>t(i)))}Di(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ti(t,e))return!0;return!1}onAction(t,i){return this.Pi.on(t,i)}Ii(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(!Nn(r,i.url,i.url_matching||"contains"))return!1}return!0}Fi(t,i){return!!this.Li(t,i)&&(!!this.Ni(t,i)&&!!this.Ui(t,i))}Li(t,i){var e;if(null==i||!i.href)return!0;var r=this.zi(t);if(r.length>0)return r.some((t=>Nn(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Nn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Ni(t,i){var e;if(null==i||!i.text)return!0;var r=this.zi(t);if(r.length>0)return r.some((t=>Nn(t.text,i.text,i.text_matching||"exact")||Nn(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!j(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>Nn(t,n,o))))}Ui(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}zi(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ci(t,i){return null==i||!i.properties||0===i.properties.length||gn(i.properties.reduce(((t,i)=>{var e=R(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}var zn=Tt("[Surveys]");var Hn="seenSurvey_",Bn=(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},qn=t=>{var i=""+Hn+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Hn+t.id+"_"+t.current_iteration),i},Wn=[On.Popover,On.Widget,On.API],Gn={ignoreConditions:!1,ignoreDelay:!1,displayType:jn.Popover};class Vn{constructor(t){this._instance=t,this.Hi=new Map,this.Bi=new Map,this.qi=new Map}Wi(t,i){return!!t&&gn(t.propertyFilters,null==i?void 0:i.properties)}Gi(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}Vi(t,i,e){var r,s=(e===Mn.Activation?this.Hi:this.Bi).get(t),n=[];return null==(r=this._instance)||r.getSurveys((t=>{n=t.filter((t=>null==s?void 0:s.includes(t.id)))})),n.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.Wi(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i.Ai)||(this.Ji(t),this.Ki(t))}Ki(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.Yi){this.Yi=new Un(this._instance),this.Yi.init();this.Yi.ji((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.Yi)||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.qi.get(i.name);e&&e.push(t.id),this.qi.set(i.name,e||[t.id])}})))}))}}Ji(t){var i,e=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})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i.Ai(((t,i)=>{this.onEvent(t,i)})),this.Hi=this.Gi(t,Mn.Activation),this.Bi=this.Gi(t,Mn.Cancellation)}}onEvent(t,i){var e,r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[vi])||[];if(An.SHOWN===t&&i&&r.length>0){var s;zn.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.Xi(r))}}else{if(this.Bi.has(t)){var a=this.Vi(t,i,Mn.Cancellation);a.length>0&&(zn.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:a.map((t=>t.id))}),a.forEach((t=>{var i,e=r.indexOf(t.id);e>=0&&r.splice(e,1),null==(i=this._instance)||i.cancelPendingSurvey(t.id)})),this.Xi(r))}if(this.Hi.has(t)){zn.info("survey event name matched",{event:t,eventPayload:i,surveys:this.Hi.get(t)});var l=this.Vi(t,i,Mn.Activation);this.Xi(r.concat(l.map((t=>t.id))||[]))}}}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[vi])||[];this.qi.has(t)&&this.Xi(e.concat(this.qi.get(t)||[]))}Xi(t){var i;zn.info("updating activated surveys",{activatedSurveys:t}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[vi]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[vi];return i||[]}getEventToSurveys(){return this.Hi}Qi(){return this.Yi}}class Jn{constructor(t){this.Zi=void 0,this._surveyManager=null,this.te=!1,this.ie=!1,this.ee=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return zn.warn("Flags not loaded yet. Not loading surveys.");var e=R(i);this.Zi=e?i.length>0:i,zn.info("flags response received, isSurveysEnabled: "+this.Zi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;ilocalStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.ie)zn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)zn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())zn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==d?void 0:d.__PosthogExtensions__;if(t){if(!M(this.Zi)||this._instance.config.advanced_enable_surveys){var i=this.Zi||this._instance.config.advanced_enable_surveys;this.ie=!0;try{var e=t.generateSurveys;if(e)return void this.re(e,i);var r=t.loadExternalDependency;if(!r)return void this.se("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.se("Could not load surveys script",e):this.re(t.generateSurveys,i)}))}catch(t){throw this.se("Error initializing surveys",t),t}finally{this.ie=!1}}}else zn.error("PostHog Extensions not found.")}}re(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new Vn(this._instance),zn.info("Surveys loaded successfully"),this.ne({isLoaded:!0})}se(t,i){zn.error(t,i),this.ne({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ee.push(t),this._surveyManager&&this.ne({isLoaded:!0}),()=>{this.ee=this.ee.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return zn.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(hi);if(e&&!i)return t(e,{isLoaded:!0});if(this.te)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.te=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var e;this.te=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return zn.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({[hi]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.te=!1,t}}ne(t){for(var i of this.ee)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){zn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);zn.warn("init was not called")}oe(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}ae(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.oe(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return zn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.ae(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(this._surveyManager)?(zn.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.ae(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(j(this._surveyManager))zn.warn("init was not called");else{var r="string"==typeof t?this.oe(t):t;if(null!=r&&r.id)if(Wn.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(zn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;zn.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(r,s),zn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);zn.warn("Survey element not found")}else zn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else zn.warn("Survey not found")}}displaySurvey(t,i){var e;if(j(this._surveyManager))zn.warn("init was not called");else{var r=this.oe(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void zn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==jn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else zn.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?zn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var Kn=Tt("[RateLimiter]");class Yn{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=>{Kn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Kn.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(pi))&&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(pi,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()t(this.remoteConfig))):(Xn.error("PostHog Extensions not found. Cannot load remote config."),t())}ue(t){this._instance.ci({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 Xn.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Xn.warn("Remote config is disabled. Falling back to local config.");this.le((t=>{if(!t)return Xn.info("No config found after loading remote JS config. Falling back to JSON."),void this.ue((t=>{this.fi(t)}));this.fi(t)}))}catch(t){Xn.error("Error loading remote config",t)}}fi(t){t?this._instance.config.__preview_remote_config?(this._instance.fi(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Xn.info("__preview_remote_config is disabled. Logging config instead",t):Xn.error("Failed to fetch remote config from PostHog.")}}var Zn=3e3;class to{constructor(t,i){this.he=!0,this.ve=[],this.de=J((null==i?void 0:i.flush_interval_ms)||Zn,250,5e3,Pt.createLogger("flush interval"),Zn),this.ce=t}enqueue(t){this.ve.push(t),this.fe||this.pe()}unload(){this.ge();var t=this.ve.length>0?this._e():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ce(g({},t,{transport:"sendBeacon"}))}))}enable(){this.he=!1,this.pe()}pe(){var t=this;this.he||(this.fe=setTimeout((()=>{if(this.ge(),this.ve.length>0){var i=this._e(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&R(e.data)&&Mt(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ce(e)};for(var r in i)e()}}),this.de))}ge(){clearTimeout(this.fe),this.fe=void 0}_e(){var t={};return Mt(this.ve,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.ve=[],t}}var io=["retriesPerformedSoFar"];class eo{constructor(i){this.me=!1,this.ye=3e3,this.ve=[],this._instance=i,this.ve=[],this.be=!0,!M(t)&&"onLine"in t.navigator&&(this.be=t.navigator.onLine,this.we=()=>{this.be=!0,this.Dt()},this.xe=()=>{this.be=!1},qt(t,"online",this.we),qt(t,"offline",this.xe))}get length(){return this.ve.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,io);L(i)&&i>0&&(e.url=ln(e.url,{retry_count:i})),this._instance.ci(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.Se(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}Se(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.ve.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pt.warn(s),this.me||(this.me=!0,this.Ee())}Ee(){if(this.$e&&clearTimeout(this.$e),0===this.ve.length)return this.me=!1,void(this.$e=void 0);this.$e=setTimeout((()=>{this.be&&this.ve.length>0&&this.Dt(),this.Ee()}),this.ye)}Dt(){var t=Date.now(),i=[],e=this.ve.filter((e=>e.retryAt0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.$e&&(clearTimeout(this.$e),this.$e=void 0),this.me=!1,M(t)||(this.we&&(t.removeEventListener("online",this.we),this.we=void 0),this.xe&&(t.removeEventListener("offline",this.xe),this.xe=void 0)),this.ve))try{this._instance.ci(g({},i,{transport:"sendBeacon"}))}catch(t){Pt.error(t)}this.ve=[]}}class ro{constructor(t){this.ke=()=>{var t,i,e,r;this.Pe||(this.Pe={});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.Pe.lastScrollY=Math.ceil(n),this.Pe.maxScrollY=Math.max(n,null!==(t=this.Pe.maxScrollY)&&void 0!==t?t:0),this.Pe.maxScrollHeight=Math.max(o,null!==(i=this.Pe.maxScrollHeight)&&void 0!==i?i:0),this.Pe.lastContentY=a,this.Pe.maxContentY=Math.max(a,null!==(e=this.Pe.maxContentY)&&void 0!==e?e:0),this.Pe.maxContentHeight=Math.max(l,null!==(r=this.Pe.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Pe}resetContext(){var t=this.Pe;return setTimeout(this.ke,0),t}startMeasuringScrollPosition(){qt(t,"scroll",this.ke,{capture:!0}),qt(t,"scrollend",this.ke,{capture:!0}),qt(t,"resize",this.ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=R(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 so=t=>ds(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class no{constructor(t,i,e,r){this.Te=t=>{var i=this.Re();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ie(this._instance)};this.Fe.register({[fi]:e})}},this._instance=t,this.Ce=i,this.Fe=e,this.Ie=r||so,this.Ce.onSessionId(this.Te)}Re(){return this.Fe.props[fi]}getSetOnceProps(){var t,i=null==(t=this.Re())?void 0:t.props;return i?"r"in i?cs(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 Mt(Nt(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+S(e)]=i})),t}}var oo=Tt("[SessionId]");class ao{on(t,i){return this.Me.on(t,i)}constructor(t,i,e){var r;if(this.Oe=[],this.Ae=void 0,this.Me=new Ln,this.De=(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.F=t.config,this.Fe=t.persistence,this.je=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ne=i||Ee,this.Ue=e||Ee;var s=this.F.persistence_name||this.F.token,n=this.F.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(n,60,36e3,oo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ze(),this.He="ph_"+s+"_window_id",this.Be="ph_"+s+"_primary_window_exists",this.qe()){var o=je.W(this.He),a=je.W(this.Be);o&&!a?this.je=o:je.V(this.He),je.G(this.Be,!0)}if(null!=(r=this.F.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.F.bootstrap.sessionID);this.We(this.F.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){oo.error("Invalid sessionID in bootstrap",t)}this.Ge()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.Oe)&&(this.Oe=[]),this.Oe.push(t),this.Le&&t(this.Le,this.je),()=>{this.Oe=this.Oe.filter((i=>i!==t))}}qe(){return"memory"!==this.F.persistence&&!this.Fe.wi&&je.H()}Ve(t){t!==this.je&&(this.je=t,this.qe()&&je.G(this.He,t))}Je(){return this.je?this.je:this.qe()?je.W(this.He):null}We(t,i,e){t===this.Le&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Le=t,this.Fe.register({[ri]:[i,t,e]}))}Ke(){var t=this.Fe.props[ri];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.We(null,null,null)}destroy(){clearTimeout(this.Ye),this.Ye=void 0,this.Ae&&t&&(t.removeEventListener("beforeunload",this.Ae,{capture:!1}),this.Ae=void 0),this.Oe=[]}Ge(){this.Ae=()=>{this.qe()&&je.V(this.Be)},qt(t,"beforeunload",this.Ae,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.F.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.Ke(),o=this.Je(),a=L(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.De(e,r);u||h||a?(s=this.Ne(),o=this.Ue(),oo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Ue(),l=!0);var v=0===r||!t||a?e:r,d=0===n?(new Date).getTime():n;return this.Ve(o),this.We(s,v,d),t||this.ze(),l&&this.Oe.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}ze(){clearTimeout(this.Ye),this.Ye=setTimeout((()=>{var[t]=this.Ke();if(this.De((new Date).getTime(),t)){var i=this.Le;this.resetSessionId(),this.Me.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var lo=["$set_once","$set"],uo=Tt("[SiteApps]");class ho{constructor(t){this._instance=t,this.Xe=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qe(t,i){if(i){var e=this.globalsForEvent(i);this.Xe.push(e),this.Xe.length>1e3&&(this.Xe=this.Xe.slice(10))}}get siteAppLoaders(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ai(this.Qe.bind(this));this.Ze=()=>{t(),this.Xe=[],this.Ze=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[v,d]of Object.entries(h))l[v]={id:u[v],type:v,properties:d};var{$set_once:c,$set:f}=t;return{event:g({},_(t,lo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},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.Xe.length&&(uo.info("Processing "+this.Xe.length+" events for site app with id "+t.id),this.Xe.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.Ze)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,uo.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){uo.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){uo.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}tr(){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)}ir(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){uo.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.tr(),void this._instance.on("eventCaptured",(t=>this.ir(t)))):void uo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Ze)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;d["__$$ph_site_app_"+t]=s._instance,null==(i=d.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return uo.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else uo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var vo=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},co=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),fo="i.posthog.com";class po{constructor(t){this.er={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+fo,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=co.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=co.EU:this.er[this.apiHost]=co.CUSTOM),this.er[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===co.CUSTOM)return this.apiHost+i;var e=fo+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var go={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&&dn(e.href,i),not_regex:(i,e)=>!!t&&!dn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class _o{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{_o.rr("retrieved web experiments from the server"),i.sr=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.sr)_o.rr("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.sr)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.nr(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];_o.ar(n)&&i.nr(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())_o.rr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.sr))return this.sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_o.rr("applying feature flags",t),t.forEach((t=>{var i;if(this.sr&&null!=(i=this.sr)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.sr)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.nr(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=_o.getWindowLocation();if(null!=t&&t.search){var i=ue(null==t?void 0:t.search,"__experiment_id"),e=ue(null==t?void 0:t.search,"__experiment_variant");i&&e&&(_o.rr("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.lr(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.ci({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)}})}lr(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(_o.rr("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.nr(r[0].name,i,r[0].variants[i].transforms))}static ar(t){return!j(t.conditions)&&(_o.ur(t)&&_o.hr(t))}static ur(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=_o.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||go[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 hr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=as();if(e.utm_source){var r,s,n,o,a,l,u,h,v=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,d=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==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return v&&c&&f&&d}return!1}static rr(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r{if(e.selector){var r;_o.rr("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)}))}})):_o.rr("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?vo(n,this._instance.config.custom_blocked_useragents):void 0}}var mo=Tt("[PostHog ExternalIntegrations]"),yo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class bo{constructor(t){this._instance=t}it(t,i){var e;null==(e=d.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return mo.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.it(yo[i],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=d.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=d.__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 wo="[SessionRecording]",xo=Tt(wo);class So{get started(){var t;return!(null==(t=this.vr)||!t.isStarted)}get status(){return this.vr?this.vr.status:this.dr&&!this.cr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.dr=!1,this.pr=void 0,this._instance=t,!this._instance.sessionManager)throw xo.error("started without valid sessionManager"),new Error(wo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(wo+' cannot be used with cookieless_mode="always"')}get cr(){var i,e=!(null==(i=this._instance.get_property(ei))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.cr||null==(i=this.vr)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.cr&&e?(this.gr(t),xo.info("starting")):this.stopRecording()}}gr(t){var i,e,r;this.cr&&(null!=d&&null!=(i=d.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=d.__PosthogExtensions__)&&e.initSessionRecording?this._r(t):null==(r=d.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.mr,(i=>{if(i)return xo.error("could not load recorder",i);this._r(t)})))}stopRecording(){var t,i;null==(t=this.pr)||t.call(this),this.pr=void 0,null==(i=this.vr)||i.stop()}yr(){var t;null==(t=this._instance.persistence)||t.unregister(si)}br(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=j(e)?null:parseFloat(e);j(s)&&this.yr();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ei]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:M(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.pr)||i.call(this),this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.br(t),this.dr=!0,this.startIfEnabledOrStop()):this.dr=!0:xo.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.vr)&&e.log?this.vr.log(t,i):xo.warn("log called before recorder was ready")}get mr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ei);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}_r(t){var i,e;if(null==(i=d.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.vr||(this.vr=null==(e=d.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.vr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.vr.start(t)}onRRwebEmit(t){var i;null==(i=this.vr)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.vr||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.vr)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.vr||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.vr)||t.overrideSampling()}overrideTrigger(t){var i,e;this.vr||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.vr)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.vr)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.vr)||!e.tryAddCustomEvent(t,i))}}var Eo={},$o=()=>{},ko="posthog",Po=!on&&-1===(null==v?void 0:v.indexOf("MSIE"))&&-1===(null==v?void 0:v.indexOf("Mozilla")),To=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ht(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:$o,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:a&&O(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,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;Pt.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:Zn},error_tracking:{},_onCapture:$o,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(i))},Ro=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Ot({},i,t);return R(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:R(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pt.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Io{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(t){Pt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Fo{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 Io,this.Sr=!1,this.version=c.LIB_VERSION,this.Er=new Ln,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=To(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.$r=!1,this.kr=null,this.Pr=null,this.Tr=null,this.featureFlags=new In(this),this.toolbar=new rr(this),this.scrollManager=new ro(this),this.pageViewManager=new Ss(this),this.surveys=new Jn(this),this.experiments=new _o(this),this.exceptions=new mn(this),this.rateLimiter=new Yn(this),this.requestRouter=new po(this),this.consent=new Ne(this),this.externalIntegrations=new bo(this),this.people={set:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Pt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==ko){var r,s=null!==(r=Eo[e])&&void 0!==r?r:new Fo;return s._init(t,i,e),Eo[e]=s,Eo[ko][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||A(i))return Pt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},e.debug=this.Rr(e.debug),this.Ir=e,this.Fr=[],e.person_profiles&&(this.Pr=e.person_profiles),this.set_config(Ot({},To(e.defaults),Ro(e),{name:r,token:i})),this.config.on_xhr_error&&Pt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:oe.GZipJS;var n=this.Cr();this.persistence=new Cn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Mr=new to((t=>this.Or(t)),this.config.request_queue_config),this.Ar=new eo(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new ao(this),this.sessionPropsManager=new no(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Pt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(l)}),0)):(Pt.info("Initializing extensions synchronously"),this.Dr(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Pt.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,v=this.config.get_device_id(Ee()),d=null!=(u=e.bootstrap)&&u.isIdentifiedID?v:e.bootstrap.distinctID;this.persistence.set_property(ci,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:d})}if(this.jr()){var f,p,_=Object.keys((null==(f=e.bootstrap)?void 0:f.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}),{}),m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter((t=>_[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:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:wi,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Ee());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(ci,"anonymous")}return qt(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Ke(this,(()=>this.Lr())):this.Lr(),I(this.config._onCapture)&&this.config._onCapture!==$o&&(Pt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Pt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Dr(t){var i=performance.now();this.historyAutocapture=new Ve(this),this.historyAutocapture.startIfEnabled();var e=[];e.push((()=>{new nr(this).startIfEnabledOrStop()})),e.push((()=>{var t;this.siteApps=new ho(this),null==(t=this.siteApps)||t.init()})),t||e.push((()=>{this.sessionRecording=new So(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||e.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),e.push((()=>{this.autocapture=new _e(this),this.autocapture.startIfEnabled()})),e.push((()=>{this.surveys.loadIfEnabled()})),e.push((()=>{this.heatmaps=new xs(this),this.heatmaps.startIfEnabled()})),e.push((()=>{this.webVitalsAutocapture=new ys(this)})),e.push((()=>{this.exceptionObserver=new We(this),this.exceptionObserver.startIfEnabled()})),e.push((()=>{this.deadClicksAutocapture=new Be(this,He),this.deadClicksAutocapture.startIfEnabled()})),e.push((()=>{if(this.Nr){var t=this.Nr;this.Nr=void 0,this.fi(t)}})),this.Ur(e,i)}Ur(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Ur(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Pt.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Pt.info("PostHog extensions initialized ("+r+"ms)")}fi(t){var i,e,r,s,n,a,l,u;if(!o||!o.body)return Pt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Nr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,oe.GZipJS)?oe.GZipJS:w(t.supportedCompression,oe.Base64)?oe.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pr?this.Pr:"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==(u=this.deadClicksAutocapture)||u.onRemoteConfig(t)}Lr(){try{this.config.loaded(this)}catch(t){Pt.critical("`loaded` function failed",t)}this.zr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Hr()}),1),new Qn(this).load(),this.featureFlags.flags()}zr(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Mr)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ct(this.__request_queue,(t=>this.Or(t))),this.__request_queue=[],this.zr()}_handle_unload(){var t,i;this.config.request_batching?(this.Br()&&this.capture("$pageleave"),null==(t=this.Mr)||t.unload(),null==(i=this.Ar)||i.unload()):this.Br()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(t){this.__loaded&&(Po?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=ln(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=ln(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=vn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Bt(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},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)}}))))}Or(t){this.Ar?this.Ar.retriableRequest(t):this.ci(t)}_execute_array(t){var i,e=[],r=[],s=[];Ct(t,(t=>{t&&(i=t[0],R(i)?s.push(t):I(t)?t.call(this):R(t)&&"alias"===i?e.push(t):R(t)&&-1!==i.indexOf("capture")&&I(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ct(t,(function(t){if(R(t[0])){var e=i;Mt(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)}jr(){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.Mr){if(this.is_capturing())if(!M(t)&&O(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(Pt.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 o=new Date,a=(null==e?void 0:e.timestamp)||o,l=Ee(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,v=this.qr(null==e?void 0:e.$set_once);if(v&&(u.$set_once=v),(u=Ut(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===An.DISMISSED||t===An.SENT){var d=null==i?void 0:i[Dn.SURVEY_ID],c=null==i?void 0:i[Dn.SURVEY_ITERATION];h={id:d,current_iteration:c},localStorage.getItem(qn(h))||localStorage.setItem(qn(h),"true"),u.$set=g({},u.$set,{[Bn({id:d,current_iteration:c},t===An.SENT?"responded":"dismissed")]:!0})}var f=g({},u.properties.$set,u.$set);if(C(f)||this.setPersonPropertiesForFlags(f),!j(this.config.before_send)){var p=this.Wr(u);if(!p)return;u=p}this.Er.emit("eventCaptured",u);var _={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,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.Or(_):this.Mr.enqueue(_),u}Pt.critical("This capture call is ignored due to client rate limiting.")}}else Pt.error("No event name provided to posthog.capture")}else Pt.uninitializedWarning("posthog.capture")}Ai(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=g({},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=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Pt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=gs(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=d,a.$window_id=c}this.sessionPropsManager&&Ot(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ot(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Ar)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===co.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ot(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}v&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ot({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Mt(this.config.property_denylist,(function(t){delete a[t]})):Pt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Gr();return a.$process_person_profile=m,m&&!s&&this.Vr("_calculate_event_properties"),a}qr(t){var i;if(!this.persistence||!this.Gr())return t;if(this.Sr)return t;var e=this.persistence.get_initial_props(),r=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),s=Ot({},e,r||{},t||{}),n=this.config.sanitize_properties;return n&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.Sr=!0,C(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)}Jr(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.Er.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)}displaySurvey(t,i){void 0===i&&(i=Gn),this.surveys.displaySurvey(t,i)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}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 Pt.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Pt.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()))Pt.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!==wi){if(this.Vr("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(Gt)&&(this.unregister(Gt),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(ci)||"anonymous");t!==r&&n?(this.persistence.set_property(ci,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Tr=cn(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(di))}}else Pt.critical('The string "'+wi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Pt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.Vr("posthog.setPersonProperties")){var e=cn(this.get_distinct_id(),t,i);this.Tr!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Tr=e):Pt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){if(this.Vr("posthog.group")){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},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 Pt.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.Vr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(Pt.info("reset"),!this.__loaded)return Pt.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(ci,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Tr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:wi,$device_id:null},"");else{var o=this.config.get_device_id(Ee());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(Wt)?(Pt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vr("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.Jr(Gt,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(F(t)){var e,r,s,n,o;Ot(this.config,Ro(t));var a=this.Cr();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cn(g({},this.config,{persistence:"sessionStorage"}),a);var l=this.Rr(this.config.debug);N(l)&&(this.config.debug=l),N(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Fe.H()&&Fe.G("ph_debug","true"),Pt.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,Fe.H()&&Fe.V("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Kr(),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"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,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:ko;return i!==ko&&(i=ko+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ci))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ci))}Gr(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Gt])&&(null==(i=this.persistence)||null==(i=i.props)||!i[yi]))}Br(){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.Gr()||this.Vr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vr(t){return"never"===this.config.person_profiles?(Pt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Jr(yi,!0),!0)}Cr(){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}Kr(){var t,i,e,r,s=this.Cr();(null==(t=this.persistence)?void 0:t.wi)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.wi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){if("always"!==this.config.cookieless_mode){var i,e;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(i=this.sessionManager)||i.destroy(),this.sessionManager=new ao(this),this.persistence&&(this.sessionPropsManager=new no(this,this.sessionManager,this.persistence)),this.sessionRecording=new So(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this.Kr(),this.zr(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(e=null==t?void 0:t.captureEventName)&&void 0!==e?e:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Hr()}else Pt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Kr(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:wi,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Hr())):Pt.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===Le.GRANTED?"granted":t===Le.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.Kr()}_is_bot(){return n?vo(n,this.config.custom_blocked_useragents):void 0}Hr(){o&&("visible"===o.visibilityState?this.$r||(this.$r=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.kr&&(o.removeEventListener("visibilitychange",this.kr),this.kr=null)):this.kr||(this.kr=this.Hr.bind(this),qt(o,"visibilitychange",this.kr)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}O(){var t,i,e,r,s,n,o,a=this.Ir||{};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?(Pt.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=Pt,n=(i="advanced_disable_flags")in(t=a)&&!M(t[i]),o=e in t&&!M(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)}Wr(t){if(j(this.config.before_send))return t;var i=R(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Pt.warn(s+". This can cause unexpected behavior."):Pt.info(s),null}e.properties&&!C(e.properties)||Pt.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.Vt)?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)})}Rr(t){var i=N(t)&&!t,e=Fe.H()&&"true"===Fe.q("ph_debug");return!i&&(!!e||t)}}!function(t,i){for(var e=0;e