posthog-js 1.372.6 → 1.372.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t,e,i,r,s,n,a){try{var o=t[n](a),l=o.value}catch(t){return void i(t)}o.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var a=e.apply(i,r);function o(e){t(a,s,n,o,l,"next",e)}function l(e){t(a,s,n,o,l,"throw",e)}o(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}var r="1.372.6",s="web",n=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],a=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return n.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function o(t,e){return-1!==t.indexOf(e)}var l=function(t){return t.trim()},u=Object.prototype,h=u.hasOwnProperty,v=u.toString,d=Array.isArray||function(t){return"[object Array]"===v.call(t)},c=t=>"function"==typeof t,f=t=>t===Object(t)&&!d(t),p=t=>void 0===t,g=t=>"[object String]"==v.call(t),b=t=>null===t,_=t=>p(t)||b(t),m=t=>"[object Number]"==v.call(t)&&t==t,y=t=>"[object Boolean]"===v.call(t),w=t=>t instanceof FormData;function x(t){return null===t||"object"!=typeof t}function E(t,e){return{}.toString.call(t)==="[object "+e+"]"}function k(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}function S(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),m(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),S(i,e,i,r))}class F{constructor(t){this.$t={},this.zt=t.zt,this.Ut=S(t.bucketSize,0,100,t.Gt),this.Wt=S(t.refillRate,0,this.Ut,t.Gt),this.Xt=S(t.refillInterval,0,864e5,t.Gt)}Jt(t,e){var i=Math.floor((e-t.lastAccess)/this.Xt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Xt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Jt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var C,R,P,T=(t,e,i)=>{function r(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];e((()=>{(0,i[r])(t,...n)}))}return{debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("error",...e)},critical(){for(var e=arguments.length,r=new Array(e),s=0;e>s;s++)r[s]=arguments[s];i.error(t,...r)},createLogger:r=>T(t+" "+r,e,i)}},A={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},I=A.info;function O(t){if(y(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(d(t))return{arrayValue:{values:t.map((t=>O(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function j(t){var e=[];for(var i in t){var r=t[i];b(r)||p(r)||e.push({key:i,value:O(r)})}return e}function L(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return P&&i.length===R?P:(R=i.length,P=i.reduce(((i,r)=>{C||(C={});var s=C[r];if(s)i[s[0]]=s[1];else for(var n=t(r),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=e[r];if(l&&u){i[l]=u,C[r]=[l,u];break}}return i}),{}))}}class M{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&d(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,a={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(a.stacktrace={type:"raw",frames:t.stack});var o=[a];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:L(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var D="?";function N(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?D:i,in_app:!0};return p(r)||(n.lineno=r),p(s)||(n.colno=s),n}var U=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:D,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},z=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,H=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,V=/\((\S*)(?::(\d+))(?::(\d+))\)/,W=(t,e)=>{var i=z.exec(t);if(i){var[,r,s,n]=i;return N(e,r,D,+s,+n)}var a=H.exec(t);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=V.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=U(a[1]||D,a[2]);return N(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},B=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,q=(t,e)=>{var i=B.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=J.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||D;return[n,s]=U(n,s),N(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},G=/\(error: (.*)\)/;class K{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=g(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return E(t,"DOMException")}isDOMError(t){return E(t,"DOMError")}}class Y{match(t){return t instanceof Error}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class X{constructor(){}match(t){return E(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var Z=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Q{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Z);return r&&(e=r[1],i=r[2]),[e,i]}}var tt=["fatal","error","warning","log","info","debug"];function et(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class it{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return k(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+et(t)}isSeverityLevel(t){return g(t)&&!(t=>g(t)&&0===t.trim().length)(t)&&tt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(i instanceof Error)return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class rt{match(t){return k(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+et(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class st{match(t){return x(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class nt{match(t){return E(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!k(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return x(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var at="$message",ot="$timestamp",lt=new Set([at,ot]),ut={enabled:!0,max_bytes:32768};function ht(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ut.enabled,max_bytes:dt(t.max_bytes,ut.max_bytes)}:i({},ut)}class vt{constructor(t){this.Kt=[],this.Qt=0,this.Bt=ht(t)}setConfig(t){this.Bt=ht(t),this.er()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!f(i))return;var r=i,s=r[at],n=r[ot];if(!g(s)||0===s.trim().length)return;if(!g(n)&&!m(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Bt.max_bytes||(this.Kt.push({step:e.step,bytes:i}),this.Qt+=i,this.er())}}getAttachable(){return this.Kt.map((t=>t.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var t=this.Kt.shift();t&&(this.Qt-=t.bytes)}}}function dt(t,e){if(!m(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var ct="undefined"!=typeof window?window:void 0,ft="undefined"!=typeof globalThis?globalThis:ct;"undefined"==typeof self&&(ft.self=ft),"undefined"==typeof File&&(ft.File=function(){});var pt=null==ft?void 0:ft.navigator,gt=null==ft?void 0:ft.document,bt=null==ft?void 0:ft.location;null!=ft&&ft.XMLHttpRequest&&new ft.XMLHttpRequest;var _t=null!=ct?ct:{},mt=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(ct&&(_t.POSTHOG_DEBUG||i)&&!p(ct.console)&&ct.console){for(var r=("__rrweb_original__"in ct.console[e]?ct.console[e].__rrweb_original__:ct.console[e]),s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];r(t,...n)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>mt(t+" "+e,i)};return r},yt=mt("[PostHog.js]"),wt=yt.createLogger;function xt(t,e){if(!_(t))if(d(t))t.forEach(e);else if(w(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)h.call(t,i)&&e(t[i],i)}var Et=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function kt(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var St=function(t){try{return t()}catch(t){return}};function Ft(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ct(t){return"ph_toolbar_internal"===t.name}var Rt="$autocapture_disabled_server_side",$t="$heatmaps_enabled_server_side",Pt="$exception_capture_enabled_server_side",Tt="$error_tracking_suppression_rules",At="$error_tracking_capture_extension_exceptions",It="$web_vitals_enabled_server_side",Ot="$product_tours_enabled_server_side",jt="$web_vitals_allowed_metrics",Lt="$session_recording_remote_config",Mt="$enabled_feature_flags",Dt="$active_feature_flags",Nt="$early_access_features",Ut="$feature_flag_details",zt="$feature_flag_payloads",Ht="$feature_flag_request_id",Vt="$override_feature_flags",Wt="$override_feature_flag_payloads",Bt="$stored_person_properties",Jt="$stored_group_properties",qt="$surveys",Gt="$surveys_activated",Kt="ph_product_tours",Yt="$flag_call_reported",Xt="$flag_call_reported_session_id",Zt="$feature_flag_errors",Qt="$feature_flag_evaluated_at",te="__POSTHOG_TOOLBAR__",ee="PostHog loadExternalDependency extension not found.",ie="visibilitychange",re="beforeunload",se=1,ne=3,ae=11;function oe(t){return t instanceof Element&&(t.id===te||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function le(t){return!!t&&t.nodeType===se}function ue(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function he(t){return!!t&&t.nodeType===ne}function ve(t){return!!t&&t.nodeType===ae&&le(t.host)}function de(t){return t?l(t).split(/\s+/):[]}function ce(t){var e=null==ct?void 0:ct.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function fe(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return de(e)}function pe(t){return _(t)?null:l(t).split(/(\s+)/).filter((t=>Ie(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ge(t){var e="";return Se(t)&&!Fe(t)&&t.childNodes&&t.childNodes.length&&xt(t.childNodes,(function(t){var i;he(t)&&t.textContent&&(e+=null!==(i=pe(t.textContent))&&void 0!==i?i:"")})),l(e)}function be(t){return p(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var _e=["a","button","form","input","select","textarea","label"];function me(t,e){if(p(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ye(t){var e=t.parentNode;return!(!e||!le(e))&&e}var we=["next","previous","prev",">","<"],xe=[".ph-no-rageclick",".ph-no-capture"];var Ee=t=>!t||ue(t,"html")||!le(t),ke=(t,e)=>{if(!ct||Ee(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!ue(s,"body");)if(ve(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ye(s);if(!n)break;if(e||_e.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=ct.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Se(t){for(var e=t;e.parentNode&&!ue(e,"body");e=e.parentNode){var i=fe(e);if(o(i,"ph-sensitive")||o(i,"ph-no-capture"))return!1}if(o(fe(t),"ph-include"))return!0;var r=t.type||"";if(g(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!g(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Fe(t){return!!(ue(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ue(t,"select")||ue(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ce="(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})",Re=new RegExp("^(?:"+Ce+")$"),$e=new RegExp(Ce),Pe="\\d{3}-?\\d{2}-?\\d{4}",Te=new RegExp("^("+Pe+")$"),Ae=new RegExp("("+Pe+")");function Ie(t,e){if(void 0===e&&(e=!0),_(t))return!1;if(g(t)){if(t=l(t),(e?Re:$e).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Te:Ae).test(t))return!1}return!0}function Oe(t){var e=ge(t);return Ie(e=(e+" "+je(t)).trim())?e:""}function je(t){var e="";return t&&t.childNodes&&t.childNodes.length&&xt(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ge(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+je(t)).trim())}catch(t){yt.error("[AutoCapture]",t)}})),e}function Le(t){return t.replace(/"|\\"/g,'\\"')}function Me(t){var e=t.attr__class;return e?d(e)?e:de(e):void 0}class De{constructor(t){this.disabled=!1===t;var e=f(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var Ne=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!d(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(t){yt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ue=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var v=l[h].split("=");d(v)&&(e.includes(v[0])?u.push(v[0]+"="+i):u.push(l[h]))}var c=o;return null!=a&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},ze=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},He="$copy_autocapture",Ve=wt("[AutoCapture]");function We(t,e){return e.length>t?e.slice(0,t)+"...":e}function Be(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!le(e));return e}function Je(t,e){var r,s,{e:n,maskAllElementAttributes:a,maskAllText:l,elementAttributeIgnoreList:u,elementsChainAsString:h}=e;if(!le(t))return{props:{}};for(var v=[t],d=t;d.parentNode&&!ue(d,"body");)if(ve(d.parentNode))v.push(d.parentNode.host),d=d.parentNode.host;else{if(!le(d.parentNode))break;v.push(d.parentNode),d=d.parentNode}var c,f,b=[],_={},m=!1,y=!1;if(xt(v,(t=>{var e=Se(t);if(ue(t,"a")){var i=t.getAttribute("href");m=e&&!!i&&Ie(i)&&i}o(fe(t),"ph-no-capture")&&(y=!0),b.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};_e.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?We(1024,Oe(t)):We(1024,ge(t)));var a=fe(t);a.length>0&&(n.classes=a.filter((function(t){return""!==t}))),xt(t.attributes,(function(i){var s;if((!Fe(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Ie(i.value)&&(!g(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=i.value;"class"===i.name&&(a=de(a).join(" ")),n["attr__"+i.name]=We(1024,a)}}));for(var o=1,l=1,u=t;u=Be(u);)o++,u.tagName===t.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(t,a,l,u));var r=function(t){if(!Se(t))return{};var e={};return xt(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Ie(r)&&(e[i]=r)}})),e}(t);Et(_,r)})),y)return{props:{},explicitNoCapture:y};if(l||(b[0].$el_text=ue(t,"a")||ue(t,"button")?Oe(t):ge(t)),m){var w,x;b[0].attr__href=m;var E=null==(w=(t=>{var e=null==gt?void 0:gt.createElement("a");return p(e)?null:(e.href=t,e)})(m))?void 0:w.host,k=null==ct||null==(x=ct.location)?void 0:x.host;E&&k&&E!==k&&(c=m)}return{props:Et({$event_type:n.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(f=b,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var a=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return kt(a).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Le(e.toString())]=Le(i.toString())})),(s+=":")+kt(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Me(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return kt(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(f)))},null!=(r=b[0])&&r.$el_text?{$el_text:null==(s=b[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var qe=wt("[Dead Clicks]"),Ge=()=>!0;class Ke{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({$dead_clicks_enabled_server_side:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?qe.error("failed to load script",e):t()}))}hr(){var t;if(gt){if(!this.lr&&null!=(t=_t.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=f(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.lr=_t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.lr.start(gt),qe.info("starting...")}}else qe.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,qe.info("stopping..."))}}var Ye=wt("[ExceptionAutocapture]");function Xe(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return c(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var Ze=wt("[TracingHeaders]");Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return m(t)&&isFinite(t)&&Math.floor(t)===t});class Qe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Qe(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Qe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class ti{constructor(){this.I=0,this.S=0,this.k=new ri}generate(){var t=this.generateOrAbort();if(p(t)){this.I=0;var e=this.generateOrAbort();if(p(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Qe.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var ei,ii=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};ct&&!p(ct.crypto)&&crypto.getRandomValues&&(ii=t=>crypto.getRandomValues(t));class ri{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ii(this.T),this.N=0),this.T[this.N++]}}var si=()=>(ei||(ei=new ti)).generate(),ni="",ai=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function oi(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=gt),ni)return ni;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+si().toString();!ni&&r--;){var n=i.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(s)&&(e.cookie=a+";max-age=0",ni=n)}return ni}(t);if(!i){var r=(t=>{var e=t.match(ai);return e?e[0]:""})(t);r!==i&&yt.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var li={R:()=>!!gt,B(t){yt.error("cookieStore error: "+t)},O(t){if(gt){try{for(var e=t+"=",i=gt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(li.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(gt)try{var n="",a="",o=oi(gt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&yt.warn("cookieStore warning: large cookie, len="+u.length),gt.cookie=u,u}catch(t){return}},F(t,e){if(null!=gt&>.cookie)try{li.M(t,"",-1,e)}catch(t){return}}},ui=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],hi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ui],vi="<masked>",di=["li_fat_id"];function ci(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var fi=wt("[Web Vitals]"),pi=9e5,gi=wt("[RemoteConfig]");class bi{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=_t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Er(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Rr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return gi.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void gi.warn("Remote config is disabled. Falling back to local config.");this.Er((t=>{if(!t)return gi.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr((t=>{this.Nr(t),this.Mr()}));this.Nr(t),this.Mr()}))}catch(t){gi.error("Error loading remote config",t)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||"hidden"===(null==gt?void 0:gt.visibilityState)||this._instance.reloadFeatureFlags()}Mr(){var t;if(!this.Or){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Or=setInterval((()=>{this.refresh()}),e))}}Nr(t){var e;t||gi.error("Failed to fetch remote config from PostHog."),this._instance.Nr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var _i="disabled",mi="lazy_loading",yi="awaiting_config",wi="missing_config",xi="base64",Ei=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},ki={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Ei(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ei(e,t))))),icontains:(t,e)=>e.map(Si).some((e=>t.map(Si).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Si).every((e=>t.map(Si).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},Si=t=>t.toLowerCase();function Fi(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(p(s)||b(s))return!1;var n=[String(s)],a=ki[r.operator];return!!a&&a(r.values,n)}))}wt("[SessionRecording]"),wt("[SessionRecording]");var Ci="[SessionRecording]",Ri=wt(Ci),$i=wt("[Heatmaps]");function Pi(t){return f(t)&&"clientX"in t&&"clientY"in t&&m(t.clientX)&&m(t.clientY)}var Ti,Ai,Ii=wt("[Product Tours]"),Oi=["$set_once","$set"],ji=wt("[SiteApps]"),Li="Error while initializing PostHog app with config id ",Mi="events",Di="cancelEvents";void 0===Ti&&(Ti=t=>t()),T("[SurveyTranslations]",Ti,(void 0===Ai&&(Ai=console),{log:Ai.log.bind(Ai),warn:Ai.warn.bind(Ai),error:Ai.error.bind(Ai),debug:Ai.debug.bind(Ai)}));var Ni=wt("[Surveys]"),Ui=["popover","widget","api"];class zi{constructor(){this.oi={}}on(t,e){return this.oi[t]||(this.oi[t]=[]),this.oi[t].push(e),()=>{this.oi[t]=this.oi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.oi[t]||[])i(e);for(var r of this.oi["*"]||[])r(t,e)}}function Hi(t,e,i){if(_(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Vi{constructor(t){this.vn=new zi,this.fn=(t,e)=>this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e)&&this.yn(t,e),this.pn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.bn=new Set,this.wn=new Set}init(){var t,e;p(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!p(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.wn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.bn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.bn.has(t)||this.bn.has(null==e?void 0:e.event))&&this.wn&&(null==(i=this.wn)?void 0:i.size)>0&&this.wn.forEach((t=>{this._n(e,t)&&this.vn.emit("actionCaptured",t.name)}))}In(t){this.onAction("actionCaptured",(e=>t(e)))}_n(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.fn(t,i))return!0;return!1}onAction(t,e){return this.vn.on(t,e)}gn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Hi(r,e.url,e.url_matching||"contains"))return!1}return!0}mn(t,e){return!!this.Cn(t,e)&&!!this.Sn(t,e)&&!!this.xn(t,e)}Cn(t,e){var i;if(null==e||!e.href)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Hi(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Hi((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Sn(t,e){var i;if(null==e||!e.text)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Hi(t.text,e.text,e.text_matching||"exact")||Hi(t.$el_text,e.text,e.text_matching||"exact")));var s,n,a,o=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!o&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!_(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(o),n=e.text,a=e.text_matching||"exact",s.some((t=>Hi(t,n,a))))}xn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}kn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}yn(t,e){return null==e||!e.properties||0===e.properties.length||Fi(e.properties.reduce(((t,e)=>{var i=d(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Wi{constructor(t){this._instance=t,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(t,e){return!!t&&Fi(t.propertyFilters,null==e?void 0:e.properties)}Nn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Mn(t,e,i){var r=(i===Mi?this.Tn:this.An).get(t),s=[];return this.Fn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Rn(n,e)}))}register(t){var e;p(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.On(t),this.Pn(t))}Pn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Ln&&(this.Ln=new Vi(this._instance),this.Ln.init(),this.Ln.In((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Ln)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.En.get(e.name);i&&i.push(t.id),this.En.set(e.name,i||[t.id])}})))})))}On(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.Tn=this.Nn(t,Mi),this.An=this.Nn(t,Di))}onEvent(t,e){var i,r=this.le(),s=this.Dn(),n=this.Bn(),a=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&a.length>0){var o,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:a});var u=(null==e||null==(o=e.properties)?void 0:o.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=a.indexOf(u);0>h||(a.splice(h,1),this.jn(a))}}else{if(this.An.has(t)){var v=this.Mn(t,e,Di);v.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:v.map((t=>t.id))}),v.forEach((t=>{var e=a.indexOf(t.id);0>e||a.splice(e,1),this.$n(t.id)})),this.jn(a))}if(this.Tn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.Tn.get(t)});var d=this.Mn(t,e,Mi);this.jn(a.concat(d.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Dn(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.En.has(t)&&this.jn(r.concat(this.En.get(t)||[]))}jn(t){var e=this.le(),i=[...new Set(t)].filter((t=>!this.qn(t)));e.info("updating activated items",{activatedItems:i}),this.Zn(i)}getActivatedIds(){var t,e=this.Dn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.Tn}Hn(){return this.Ln}}class Bi extends Wi{constructor(t){super(t)}Dn(){return Gt}Bn(){return"survey shown"}Fn(t){var e;null==(e=this._instance)||e.getSurveys(t)}$n(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}le(){return Ni}Zn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[Gt]:t})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ji="SDK is not enabled or survey functionality is not yet loaded",qi="Disabled. Not loading surveys.",Gi=null!=ct&&ct.location?ze(ct.location.hash,"__posthog")||ze(location.hash,"state"):null,Ki="_postHogToolbarParams",Yi=wt("[Toolbar]"),Xi=wt("[FeatureFlags]"),Zi=wt("[FeatureFlags]",{debugEnabled:!0}),Qi="\" failed. Feature flags didn't load in time.",tr=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},er=t=>{var e={};for(var[i,r]of kt(t||{}))r&&(e[i]=r);return e},ir=wt("[Error tracking]"),rr="Refusing to render web experiment since the viewer is a likely bot",sr={icontains:(t,e)=>!!ct&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!ct&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!ct&&Ei(e.href,t),not_regex:(t,e)=>!!ct&&!Ei(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class nr{get Bt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{nr.Vn("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(nr.Vn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);g(r)&&t.variants[r]&&e.Un(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];nr.Yn(n)&&e.Un(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())nr.Vn(rr);else if(!this.Bt.disable_web_experiments){if(_(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nr.Vn("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Un(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=nr.getWindowLocation();if(null!=t&&t.search){var e=Ne(null==t?void 0:t.search,"__experiment_id"),i=Ne(null==t?void 0:t.search,"__experiment_variant");e&&i&&(nr.Vn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Bt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(nr.Vn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Un(r[0].name,e,r[0].variants[e].transforms))}static Yn(t){return!_(t.conditions)&&nr.Wn(t)&&nr.Xn(t)}static Wn(t){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=nr.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||sr[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==ct?void 0:ct.location}static Xn(t){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.utm))return!0;var i=function(t,e,i){if(!gt)return{};var r,s,n,a=(r=Ue(gt.URL,[],vi),s=hi.concat([]),n={},xt(s,(function(t){var e=Ne(r,t);n[t]=e||null})),n),o=function(){var t={};return xt(di,(function(e){var i=li.O(e);t[e]=i||null})),t}();return Et(o,a)}();if(i.utm_source){var r,s,n,a,o,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)==i.utm_campaign,d=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=t.conditions)||null==(a=a.utm)?void 0:a.utm_source)==i.utm_source,c=null==(o=t.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.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)==i.utm_term;return v&&c&&f&&d}return!1}static Vn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];yt.info("[WebExperiments] "+t,i)}Un(t,e,i){this._is_bot()?nr.Vn(rr):"control"!==e?i.forEach((i=>{if(i.selector){var r;nr.Vn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):nr.Vn("Control variants leave the page unmodified.")}_is_bot(){return pt&&this._instance?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&a(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>a(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(pt,this.Bt.custom_blocked_useragents):void 0}}var ar=wt("[Conversations]"),or="Conversations not available yet.",lr={featureFlags:class{constructor(t){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(t){return this._instance.get_property(t)}ls(){var t,e;return null!==(t=null==(e=this.ni)?void 0:e._r(this.Bt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,Xi.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var t,e=null!==(t=this.Bt.evaluation_contexts)&&void 0!==t?t:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(Xi.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Xi.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}cs(){return this.hs().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,a=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},o=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(a).filter((t=>o[t])).reduce(((t,e)=>(a[e]&&(t[e]=a[e]),t)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(t,e,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},a=i({},s,t),o=i({},n,e),l={};for(var[u,h]of Object.entries(a)){var v="string"==typeof h;l[u]={key:u,enabled:!!v||Boolean(h),variant:v?h:void 0,reason:void 0,metadata:p(null==o?void 0:o[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.os(Ut),e=this.os(Vt),r=this.os(Wt);if(!r&&!e)return t||{};var s=Et({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var a of n){var o,l,u=s[a],h=null==e?void 0:e[a],v=p(h)?null!==(o=null==u?void 0:u.enabled)&&void 0!==o&&o:!!h,d=p(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[a],f=i({},u,{enabled:v,variant:v?null!=d?d:null==u?void 0:u.variant:void 0});v!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),d!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[a]=f}return this.Jn||(Xi.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Jn=!0),s}getFlagVariants(){var t=this.os(Mt),e=this.os(Vt);if(!e)return t||{};for(var i=Et({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Xi.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.os(zt),e=this.os(Wt);if(!e)return t||{};for(var i=Et({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Xi.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.es=t}vs(t){var e;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var r=this.Bt.token,s=this.os("$device_id"),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.ni)?void 0:e.get_initial_props())||{},this.os(Bt)||{}),group_properties:this.os(Jt),timezone:ci()};b(s)||p(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Bt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.cs()&&(n.evaluation_contexts=this.hs());var a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Bt.disable_compression?void 0:xi,timeout:this.Bt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),s=!1),this.Qn=!1,!n.disable_flags||this.ts){this.rs=!s;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var o,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&a.push("quota_limited"),null==(r=this.ni)||r.register({[Zt]:a}),l)Xi.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(o=t.json)&&void 0!==o?o:{},s,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Xi.warn('getFeatureFlag for key "'+t+Qi)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],a=String(s),o=this.os(Ht)||void 0,l=this.os(Qt)||void 0,u=this.os(Yt)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var h,v=this._instance.get_session_id(),c=this.os(Xt);v&&v!==c&&(u={},null==(h=this.ni)||h.register({[Yt]:u,[Xt]:v}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(a))){var f,g,b,_,m,y,w,x,E,k;d(u[t])?u[t].push(a):u[t]=[a],null==(f=this.ni)||f.register({[Yt]:u});var S=this.getFeatureFlagDetails(t),F=[...null!==(g=this.os(Zt))&&void 0!==g?g:[]];p(s)&&F.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(b=this.Bt.bootstrap)||null==(b=b.featureFlags)?void 0:b[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Bt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.rs};p(null==S||null==(m=S.metadata)?void 0:m.version)||(C.$feature_flag_version=S.metadata.version);var R,P=null!==(y=null==S||null==(w=S.reason)?void 0:w.description)&&void 0!==y?y:null==S||null==(x=S.reason)?void 0:x.code;P&&(C.$feature_flag_reason=P),null!=S&&null!=(E=S.metadata)&&E.id&&(C.$feature_flag_id=S.metadata.id),p(null==S?void 0:S.original_variant)&&p(null==S?void 0:S.original_enabled)||(C.$feature_flag_original_response=p(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(k=S.metadata)&&k.original_payload&&(C.$feature_flag_original_payload=null==S||null==(R=S.metadata)?void 0:R.original_payload),F.length&&(C.$feature_flag_error=F.join(",")),this._instance.capture("$feature_flag_called",C)}if(r){var T=n;if(!p(n))try{T=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:T}}}}else Xi.warn('getFeatureFlagResult for key "'+t+Qi)}getRemoteConfigPayload(t,e){var i=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Bt.disable_compression?void 0:xi,timeout:this.Bt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return p(i)?void 0:!!i}Xi.warn('isFeatureEnabled for key "'+t+Qi)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.ni){this.Kn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),a=this.getFlagsWithDetails();!function(t,e,r,s,n,a){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):Xi.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=o.flags,u=o.featureFlags,h=o.featureFlagPayloads;if(u){var v=t.requestId,c=t.evaluatedAt;if(d(u)){Xi.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f={};if(u)for(var p=0;u.length>p;p++)f[u[p]]=!0;e&&e.register({[Dt]:u,[Mt]:f})}else{var g=u,b=h,_=l;if(null!=a&&a.partialResponse)g=i({},r,g),b=i({},s,b),_=i({},n,_);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));g=i({},r,Object.fromEntries(Object.entries(g).filter((t=>{var[e]=t;return m.has(e)})))),b=i({},s,Object.fromEntries(Object.entries(b||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},n,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else g=i({},r,g),b=i({},s,b),_=i({},n,_);e&&e.register(i({[Dt]:Object.keys(er(g)),[Mt]:g||{},[zt]:b||{},[Ut]:_||{}},v?{[Ht]:v}:{},c?{[Qt]:c}:{}))}}}(t,this.ni,s,n,a,r),e||(this.ss=!1),this.ps(e)}}override(t,e){void 0===e&&(e=!1),Xi.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ni)return Xi.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ni.unregister(Vt),this.ni.unregister(Wt),this.ps(),Zi.info("All overrides cleared");if(d(t)){var e=tr(t);return this.ni.register({[Vt]:e}),this.ps(),Zi.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(Vt),Zi.info("Flag overrides cleared");else if(r.flags){if(d(r.flags)){var s=tr(r.flags);this.ni.register({[Vt]:s})}else this.ni.register({[Vt]:r.flags});Zi.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(Wt),Zi.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[Wt]:r.payloads}),Zi.info("Payload overrides set",{payloads:r.payloads}))),void this.ps()}if(t&&"object"==typeof t)return this.ni.register({[Vt]:t}),this.ps(),Zi.info("Flag overrides set",{flags:t});Xi.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kn){var{flags:e,flagVariants:i}=this.gs();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.os(Nt)||[]).find((e=>e.flagKey===t)),a={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:a};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=i({},this.getFlagVariants(),{[t]:e});null==(s=this.ni)||s.register({[Dt]:Object.keys(er(l)),[Mt]:l}),this.ps()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.os(Nt),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(Nt),null==(r=this.ni)||r.register({[Nt]:s}),t(s)}}})}gs(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}ps(t){var{flags:e,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.os(Bt)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,a={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(a[o]=n[o]));this._instance.register({[Bt]:i({},r,a,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Bt)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.os(Jt)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[Jt]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.os(Jt)||{};this._instance.register({[Jt]:i({},e,{[t]:{}})})}else this._instance.unregister(Jt)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},ur={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ys)||!t.isStarted)}get status(){var t,e;return this.bs===yi||this.bs===wi?this.bs:null!==(t=null==(e=this.ys)?void 0:e.status)&&void 0!==t?t:this.bs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=_i,this.ws=void 0,this._instance=t,!this._instance.sessionManager)throw Ri.error("started without valid sessionManager"),new Error(Ci+" started without valid sessionManager. This is a bug.");if("always"===this.Bt.cookieless_mode)throw new Error(Ci+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(Lt))||!t.enabled),i=!this.Bt.disable_session_recording,r=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return ct&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.ys)||!e.isStarted){var i=!p(Object.assign)&&!p(Array.from);this._s&&i?(this.Is(t),Ri.info("starting")):(this.bs=_i,this.stopRecording())}}Is(t){var e,i,r;this._s&&(this.bs!==yi&&this.bs!==wi&&(this.bs=mi),null!=_t&&null!=(e=_t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=_t.__PosthogExtensions__)&&i.initSessionRecording?this.Cs(t):null==(r=_t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ss,(e=>{if(e)return Ri.error("could not load recorder",e);this.Cs(t)})))}stopRecording(){var t,e;null==(t=this.ws)||t.call(this),this.ws=void 0,null==(e=this.ys)||e.stop()}xs(){var t,e;null==(t=this.ws)||t.call(this),this.ws=void 0,null==(e=this.ys)||e.discard()}ks(){var t;null==(t=this.ni)||t.unregister("$session_is_sampled")}Ts(t,e){if(_(t))return null;var i,r=m(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ri.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}As(t){if(this.ni){var e,r,s=this.ni,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ts(null==(e=this.Bt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),a=this.Ts(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;_(o)&&this.ks();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[Lt]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:p(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.ws)||e.call(this),this.ws=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.As(t),void this.xs()):(this.As(t),void this.startIfEnabledOrStop()):(this.bs===yi&&(this.bs=wi,Ri.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.ys)&&i.log?this.ys.log(t,e):Ri.warn("log called before recorder was ready")}get Ss(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Lt);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e=this._instance.get_property(Lt);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Cs(t){var e,i;if(null==(e=_t.__PosthogExtensions__)||!e.initSessionRecording)return Ri.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ys||(this.ys=null==(i=_t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.bs===wi||this.bs===yi)return;return this.bs=yi,Ri.info("persisted remote config is stale, requesting fresh config before starting"),void new bi(this._instance).load()}this.bs=mi,this.ys.start(t)}onRRwebEmit(t){var e;null==(e=this.ys)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.ys||null==(e=this.ni)||e.register({$replay_override_linked_flag:!0}),null==(t=this.ys)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.ys||null==(e=this.ni)||e.register({$replay_override_sampling:!0}),null==(t=this.ys)||t.overrideSampling()}overrideTrigger(t){var e,i;this.ys||null==(i=this.ni)||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(e=this.ys)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ys)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.ys)||!i.tryAddCustomEvent(t,e))}}},hr={autocapture:class{constructor(t){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=t,this.rageclicks=new De(t.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var t,e,i=f(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Os(){if(this.isBrowserSupported()){if(ct&>){var t=t=>{t=t||(null==ct?void 0:ct.event);try{this.Ps(t)}catch(t){Ve.error("Failed to capture event",t)}};if(Ft(gt,"submit",t,{capture:!0}),Ft(gt,"change",t,{capture:!0}),Ft(gt,"click",t,{capture:!0}),this.Bt.capture_copied_text){var e=t=>{t=t||(null==ct?void 0:ct.event);try{this.Ps(t,He)}catch(t){Ve.error("Failed to capture copy/cut event",t)}};Ft(gt,"copy",e,{capture:!0}),Ft(gt,"cut",e,{capture:!0})}}}else Ve.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ms=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Rt]:!!t.autocapture_opt_out}),this.Ns=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Fs=t}getElementSelectors(t){var e,i=[];return null==(e=this.Fs)||e.forEach((e=>{var r=null==gt?void 0:gt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[Rt];if(b(this.Ns)&&!y(i)&&!this.instance.Fr())return!1;var r=null!==(e=this.Ns)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ps(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=be(t);he(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,e){if(!ct||Ee(t))return!1;var i,r,s;if(y(e)?(i=!!e&&xe,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:xe,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=ke(t,!1);return!function(t,e){if(!1===t||p(t))return!1;var i;if(!0===t)i=we;else{if(!d(t))return!1;if(t.length>10)return yt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var e;return{safeText:ge(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!me(n,i)}(r,this.instance.config.rageclick)&&this.Ps(t,"$rageclick");var s=e===He;if(r&&function(t,e,i,r,s){var n,a,o,l;if(void 0===i&&(i=void 0),!ct||Ee(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!ce(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&ce(i.url_ignorelist))return!1;if(null!=(o=i)&&o.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:h,targetElementList:v}=ke(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(p(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,i))return!1;if(!me(v,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=ct.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(_e.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Bt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=Je(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),e===He){var l,u=pe(null==ct||null==(l=ct.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return c(null==gt?void 0:gt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ls=(null==ct||null==(e=ct.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,yt.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(ct&&ct.history){var i=this;null!=(t=ct.history.pushState)&&t.__posthog_wrapped__||Xe(ct.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Bs("pushState")})),null!=(e=ct.history.replaceState)&&e.__posthog_wrapped__||Xe(ct.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Bs("replaceState")})),this.js()}}Bs(t){try{var e,i=null==ct||null==(e=ct.location)?void 0:e.pathname;if(!i)return;i!==this.Ls&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.Ls=i}catch(e){yt.error("Error capturing "+t+" pageview",e)}}js(){if(!this.Ds){var t=()=>{this.Bs("popstate")};Ft(ct,"popstate",t),this.Ds=()=>{ct&&ct.removeEventListener("popstate",t)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(t){var e;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=t,this.$s=!(null==(e=this.instance.persistence)||!e.props[$t]),this.rageclicks=new De(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return f(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Bt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return _(this.Bt.capture_heatmaps)?_(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:!1!==this.Bt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;$i.info("starting..."),this.Zs(),this.Lt()}else{var t;clearInterval(null!==(t=this.qs)&&void 0!==t?t:void 0),this.Hs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[$t]:e}),this.$s=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Vs(t){this.Tt(t.originalEvent,"deadclick")}Lt(){this.qs&&clearInterval(this.qs),this.qs="visible"===(null==gt?void 0:gt.visibilityState)?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){ct&>&&(this.zs=this.Yr.bind(this),Ft(ct,re,this.zs),this.Us=t=>this.Tt(t||(null==ct?void 0:ct.event)),Ft(gt,"click",this.Us,{capture:!0}),this.Ys=t=>this.Gs(t||(null==ct?void 0:ct.event)),Ft(gt,"mousemove",this.Ys,{capture:!0}),this.Ws=new Ke(this.instance,Ge,this.Vs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Lt.bind(this),Ft(gt,ie,this.Xs),this.Rs=!0)}Hs(){var t;ct&>&&(this.zs&&ct.removeEventListener(re,this.zs),this.Us&>.removeEventListener("click",this.Us,{capture:!0}),this.Ys&>.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&>.removeEventListener(ie,this.Xs),clearTimeout(this.Js),null==(t=this.Ws)||t.stop(),this.Rs=!1)}Ks(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&le(r)&&!ue(r,"body");){if(r===i)return!1;if(o(e,null==ct?void 0:ct.getComputedStyle(r).position))return!0;r=ye(r)}return!1}(be(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}Tt(t,e){var r;if(void 0===e&&(e="click"),!oe(t.target)&&Pi(t)){var s=this.Ks(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Qs(i({},s,{type:"rageclick"})),this.Qs(s)}}Gs(t){!oe(t.target)&&Pi(t)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(t,"mousemove"))}),500))}Qs(t){if(ct){var e=ct.location.href,i=this.Bt.custom_personal_data_properties,r=this.Bt.mask_personal_data_properties?[...ui,...i||[]]:[],s=Ue(e,r,vi);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Yr(){this.T&&!(t=>{if(f(t)){for(var e in t)if(h.call(t,e))return!1;return!0}return!1})(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ke,webVitalsAutocapture:class{constructor(t){var e;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(p(r))fi.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.io();p(s)||(_(null==t?void 0:t.name)||_(null==t?void 0:t.value)?fi.error("Invalid metric received",t):!this.no||this.no>t.value?(this.T.url!==s&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),p(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=p(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(i({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):fi.error("Ignoring metric with value >= "+this.no,t))}},this.so=()=>{if(!this.Rs){var t,e,i,r,s=_t.__PosthogExtensions__;p(s)||p(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):fi.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.$s=!(null==(e=this._instance.persistence)||!e.props[It]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=f(this.oo)?null==(t=this.oo)?void 0:t.web_vitals_allowed_metrics:void 0;return _(i)?(null==(e=this._instance.persistence)?void 0:e.props[jt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(f(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=f(this.oo)?this.oo.web_vitals_attribution:void 0;return null!=t&&t}get no(){var t=f(this.oo)&&m(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:pi;return t>0&&6e4>=t?pi:t}get isEnabled(){var t=null==bt?void 0:bt.protocol;if("http:"!==t&&"https:"!==t)return fi.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=f(this.oo)?this.oo.web_vitals:y(this.oo)?this.oo:void 0;return y(e)?e:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(fi.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(t){if("capturePerformance"in t){var e=f(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=f(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[It]:e}),this._instance.persistence.register({[jt]:i})),this.$s=e,this.startIfEnabled()}}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?fi.error("failed to load script",e):t()}))}io(){var t=ct?ct.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ui,...e||[]]:[];return Ue(t,i,vi)}fi.error("Could not determine current URL")}}},vr={exceptionObserver:class{constructor(t){var e,i,r;this.so=()=>{var t;if(ct&&this.isEnabled&&null!=(t=_t.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=_t.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=_t.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=_t.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=e(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=i(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=r(this.captureException.bind(this)))}catch(t){Ye.error("failed to start",t),this.ho()}}},this._instance=t,this.co=!(null==(e=this._instance.persistence)||!e.props[Pt]),this.do=new F({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Gt:Ye}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return f(t)?e=i({},e,t):(p(t)?this.co:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ye.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Ye.error("failed to load script",e);t()}))}ho(){var t,e,i;null==(t=this.ao)||t.call(this),this.ao=void 0,null==(e=this.lo)||e.call(this),this.lo=void 0,null==(i=this.uo)||i.call(this),this.uo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pt]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.do.consumeRateLimit(s)?Ye.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.fo=[],this.po=new M([new K,new nt,new X,new Y,new rt,new it,new Q,new st],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],a=e.split("\n"),o=s;a.length>o;o++){var l=a[o];if(1024>=l.length){var u=G.test(l)?l.replace(G,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var v=h(u,t);if(v){n.push(v);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||D});var r}))}(n)}}("web:javascript",W,q)),this._instance=t,this.fo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(Tt))&&void 0!==e?e:[],this.mo=ht(this.yo()),this.bo=new vt(this.mo)}onConfigChange(){this.mo=ht(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.fo=s,this._instance.persistence&&this._instance.persistence.register({[Tt]:this.fo,[At]:n})}}get wo(){var t,e=!!this._instance.get_property(At),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.po.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.mo.enabled)try{if(!g(t)||0===t.trim().length)return void ir.warn("Ignoring exception step because message must be a non-empty string");var r=this._o(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>lt.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&ir.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.bo.add(i({[at]:t,[ot]:(new Date).toISOString()},s))}catch(t){ir.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Io(e)){if(this.Co(e))return this.So("Exception dropped: matched a suppression rule"),void ir.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.xo(e))return this.So("Exception dropped: thrown by a browser extension"),void ir.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(e))return this.So("Exception dropped: thrown by the PostHog SDK"),void ir.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.mo.enabled&&_(t.$exception_steps)?this.To(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(t){return ir.error("Failed to capture exception event. Dropping this exception.",t),void this.bo.clear()}}catch(t){return void ir.error("Failed to process exception event. Ignoring this exception.",t)}}To(t){try{var e=this.bo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return ir.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}So(t){this.mo.enabled&&this.bo.add({[at]:t,[ot]:(new Date).toISOString()})}_o(t){return f(t)?i({},t):{}}yo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Co(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return g(i)&&i.length>0&&t.$exception_types.push(i),g(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.fo.some((t=>{var i=t.values.map((t=>{var i,r=ki[t.operator],s=d(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}xo(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ko(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],a=n[n.length-1];return null!==(r=null==a||null==(s=a.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Io(t){return!_(t)&&d(t)}}},dr=i({productTours:class{get ni(){return this._instance.persistence}constructor(t){this.Ao=null,this.Eo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ni&&this.ni.register({[Ot]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.Ao||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(Ot)||this.ur((()=>this.Ro()))}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ii.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Ao&&null!=(t=_t.__PosthogExtensions__)&&t.generateProductTours&&(this.Ao=_t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!d(this.Eo)||e){var i=this.ni;if(i){var r=i.props[Kt];if(d(r)&&!e)return this.Eo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ii.error(s),void t([],{isLoaded:!1,error:s})}var n=d(e.json.product_tours)?e.json.product_tours:[];this.Eo=n,i&&i.register({[Kt]:n}),t(n,{isLoaded:!0})}})}else t(this.Eo,{isLoaded:!0})}getActiveProductTours(t){_(this.Ao)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Ao)||e.showTourById(t)}previewTour(t){this.Ao?this.Ao.previewTour(t):this.ur((()=>{var e;this.Ro(),null==(e=this.Ao)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Ao)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ao)||t.nextStep()}previousStep(){var t;null==(t=this.Ao)||t.previousStep()}clearCache(){var t;this.Eo=null,null==(t=this.ni)||t.unregister(Kt)}resetTour(t){var e;null==(e=this.Ao)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Ao)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Ao)||e.cancelPendingTour(t)}}},lr),cr={siteApps:class{constructor(t){this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=_t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{t(),this.No=[],this.Fo=void 0}}}globalsForEvent(t){var e,r,s,n,a,o,l;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[d,c]of Object.entries(v))u[d]={id:h[d],type:d,properties:c};var{$set_once:f,$set:p}=t;return{event:i({},function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Oi),{properties:i({},t.properties,p?{$set:i({},null!==(e=null==(r=t.properties)?void 0:r.$set)&&void 0!==e?e:{},p)}:{},f?{$set_once:i({},null!==(s=null==(n=t.properties)?void 0:n.$set_once)&&void 0!==s?s:{},f)}:{}),elements_chain:null!==(a=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(l=t.properties)?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(ji.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ji.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){ji.error(Li+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ji.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Oo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Po(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){ji.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",(t=>this.Po(t)))):void ji.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;_t["__$$ph_site_app_"+t]=s._instance,null==(e=_t.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,o,(e=>{if(e)return ji.error(Li+t,e)}))};for(var{id:a,url:o}of t.siteApps)n(a)}else ji.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},fr={tracingHeaders:class{constructor(t){this.Lo=void 0,this.Do=void 0,this.so=()=>{var t,e,i=this.Bo()||[];p(this.Lo)&&(null==(t=_t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),p(this.Do)&&(null==(e=_t.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ze.error("failed to load script",e);t()}))}Bo(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Bo()?this.ur(this.so):(null==(t=this.Lo)||t.call(this),null==(e=this.Do)||e.call(this),this.Lo=void 0,this.Do=void 0)}}},pr=i({surveys:class{get Bt(){return this._instance.config}constructor(t){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Bt.disable_surveys){var e=t.surveys;if(_(e))return Ni.warn("Flags not loaded yet. Not loading surveys.");var i=d(e);this.jo=i?e.length>0:e,Ni.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith("seenSurvey_")||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)Ni.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)Ni.info(qi);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())Ni.info("Not loading surveys in cookieless mode without consent.");else{var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){if(!p(this.jo)||this.Bt.advanced_enable_surveys){var e=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var i=t.generateSurveys;if(i)return void this.Ho(i,e);var r=t.loadExternalDependency;if(!r)return void this.Vo(ee);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Vo("Could not load surveys script",i):this.Ho(t.generateSurveys,e)}))}catch(t){throw this.Vo("Error initializing surveys",t),t}finally{this.$o=!1}}}else Ni.error("PostHog Extensions not found.")}}Ho(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Bi(this._instance),Ni.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Vo(t,e){Ni.error(t,e),this.zo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.qo.push(t),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Bt.disable_surveys)return Ni.info(qi),t([]);var i,r=this._instance.get_property(qt);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Zo?this.Zo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Zo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:e=>{var r;this.Zo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Ni.error(n);var a={isLoaded:!1,error:n};return t([],a),void(null==i||i({surveys:[],context:a}))}var o,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(o=this._surveyEventReceiver)||o.register(u)),null==(r=this._instance.persistence)||r.register({[qt]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}zo(t){for(var e of this.qo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ni.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!_(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ni.warn("init was not called")}Uo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Yo(t){if(_(this._surveyManager))return{eligible:!1,reason:Ji};var e="string"==typeof t?this.Uo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(_(this._surveyManager))return Ni.warn("init was not called"),{visible:!1,disabledReason:Ji};var e=this.Yo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return _(this._surveyManager)?(Ni.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ji})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Yo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(_(this._surveyManager))Ni.warn("init was not called");else{var s="string"==typeof t?this.Uo(t):t;if(null!=s&&s.id)if(Ui.includes(s.type)){var n=null==gt?void 0:gt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Ni.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Ni.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),Ni.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Ni.warn("Survey element not found")}else Ni.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ni.warn("Survey not found")}}displaySurvey(t,e){var r;if(_(this._surveyManager))Ni.warn("init was not called");else{var s=this.Uo(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),"popover"!==e.displayType&&e.initialResponses&&Ni.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var a=this.canRenderSurvey(s);if(!a.visible)return void Ni.warn("Survey is not eligible to be displayed: ",a.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Ni.warn("Survey not found")}}cancelPendingSurvey(t){_(this._surveyManager)?Ni.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},lr),gr={toolbar:class{constructor(t){this.instance=t}Go(t){_t.ph_toolbar_state=t}Wo(){var t;return null!==(t=_t.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ct(this.instance.config))return!1;if(!ct||!gt)return!1;t=null!=t?t:ct.location,i=null!=i?i:ct.history;try{if(!e){try{ct.localStorage.setItem("test","test"),ct.localStorage.removeItem("test")}catch(t){return!1}e=null==ct?void 0:ct.localStorage}var r,s=Gi||ze(t.hash,"__posthog")||ze(t.hash,"state"),n=s?St((()=>JSON.parse(atob(decodeURIComponent(s)))))||St((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ki)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Xo(t){var e=_t.ph_load_toolbar||_t.ph_load_editor;!_(e)&&c(e)?e(t,this.instance):Yi.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==gt||!gt.getElementById(te));if(!ct||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(ct.localStorage.setItem(Ki,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Xo(s);else if(0===this.Wo()){var n;this.Go(1),null==(n=_t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Yi.error("[Toolbar] Failed to load",t),void this.Go(0);this.Go(2),this.Xo(s)})),Ft(ct,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(s)}))}return!0}Jo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},br=i({experiments:nr},lr),_r={conversations:class{constructor(t){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;_(e)||(y(e)?this.Ko=e:(this.Ko=e.enabled,this.ea=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||Ct(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t&&!p(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var e=t.initConversations;if(e)return this.ta(e),void(this.Qo=!1);var i=t.loadExternalDependency;if(!i)return void this.ra(ee);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ra("Could not load conversations script",e):this.ta(t.initConversations),this.Qo=!1}))}catch(t){this.ra("Error initializing conversations",t),this.Qo=!1}}else ar.error("Conversations enabled but missing token in remote config.")}}ta(t){if(this.ea)try{this._conversationsManager=t(this.ea,this._instance),ar.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else ar.error("Cannot complete initialization: remote config is null")}ra(t,e){ar.error(t,e),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ko&&!b(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(ar.warn(or),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(ar.warn(or),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(ar.warn(or),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(ar.warn(or),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(ar.warn(or),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(ar.warn(or),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ar.warn(or),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}un(){var t;null==(t=this._conversationsManager)||t.setIdentity()}hn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},mr={logs:class{constructor(t){var e;this.ia=!1,this.na=!1,this.Gt=wt("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!_(i)&&i&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(ee)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,r,s,n,a,o;if(this._instance.is_capturing())if(t&&t.body){var l=null!==(e=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s:1e3,h=Date.now();if(l>h-this.aa||(this.aa=h,this.oa=0,this.la=!1),u>this.oa){this.oa++;var v=function(t,e){var r=t.level||"info",{text:s,number:n}=A[r]||I,a=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var l=i({},o,t.attributes||{}),u={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:j(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),p(t.trace_flags)||(u.flags=t.trace_flags),u}(t,this.ua());this.sa.push({record:v}),(null!==(a=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==a?a:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ca}flushLogs(t){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),0!==this.sa.length){var e=this.sa;this.sa=[];var n=this._instance.config.logs,a=i({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),o=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:j(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),a,s,r),l=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Hi({method:"POST",url:l,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ha(){var t,e;this.jr||(this.jr=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}ua(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=_t&&null!=(t=_t.location)&&t.href&&(e.currentUrl=_t.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},yr=i({},lr,ur,hr,vr,dr,cr,pr,fr,gr,br,_r,mr),wr=lr,xr=ur,Er=hr,kr=vr,Sr=dr,Fr=cr,Cr=pr,Rr=fr,$r=gr,Pr=br,Tr=_r,Ar=mr;export{yr as AllExtensions,Er as AnalyticsExtensions,Tr as ConversationsExtensions,kr as ErrorTrackingExtensions,Pr as ExperimentsExtensions,wr as FeatureFlagsExtensions,Ar as LogsExtensions,Sr as ProductToursExtensions,xr as SessionReplayExtensions,Fr as SiteAppsExtensions,Cr as SurveysExtensions,$r as ToolbarExtensions,Rr as TracingExtensions};
|
|
1
|
+
function t(t,e,i,r,s,n,a){try{var o=t[n](a),l=o.value}catch(t){return void i(t)}o.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var a=e.apply(i,r);function o(e){t(a,s,n,o,l,"next",e)}function l(e){t(a,s,n,o,l,"throw",e)}o(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}var r="1.372.7",s="web",n=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],a=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return n.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function o(t,e){return-1!==t.indexOf(e)}var l=function(t){return t.trim()},u=Object.prototype,h=u.hasOwnProperty,v=u.toString,d=Array.isArray||function(t){return"[object Array]"===v.call(t)},c=t=>"function"==typeof t,f=t=>t===Object(t)&&!d(t),p=t=>void 0===t,g=t=>"[object String]"==v.call(t),b=t=>null===t,_=t=>p(t)||b(t),m=t=>"[object Number]"==v.call(t)&&t==t,y=t=>"[object Boolean]"===v.call(t),w=t=>t instanceof FormData;function x(t){return null===t||"object"!=typeof t}function E(t,e){return{}.toString.call(t)==="[object "+e+"]"}function k(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}function S(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),m(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),S(i,e,i,r))}class F{constructor(t){this.$t={},this.zt=t.zt,this.Ut=S(t.bucketSize,0,100,t.Gt),this.Wt=S(t.refillRate,0,this.Ut,t.Gt),this.Xt=S(t.refillInterval,0,864e5,t.Gt)}Jt(t,e){var i=Math.floor((e-t.lastAccess)/this.Xt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Xt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Jt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var C,R,P,T=(t,e,i)=>{function r(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];e((()=>{(0,i[r])(t,...n)}))}return{debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r("error",...e)},critical(){for(var e=arguments.length,r=new Array(e),s=0;e>s;s++)r[s]=arguments[s];i.error(t,...r)},createLogger:r=>T(t+" "+r,e,i)}},A={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},I=A.info;function O(t){if(y(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(d(t))return{arrayValue:{values:t.map((t=>O(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function j(t){var e=[];for(var i in t){var r=t[i];b(r)||p(r)||e.push({key:i,value:O(r)})}return e}function L(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return P&&i.length===R?P:(R=i.length,P=i.reduce(((i,r)=>{C||(C={});var s=C[r];if(s)i[s[0]]=s[1];else for(var n=t(r),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=e[r];if(l&&u){i[l]=u,C[r]=[l,u];break}}return i}),{}))}}class M{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&d(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,a={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(a.stacktrace={type:"raw",frames:t.stack});var o=[a];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:L(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var D="?";function N(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?D:i,in_app:!0};return p(r)||(n.lineno=r),p(s)||(n.colno=s),n}var U=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:D,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},z=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,H=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,V=/\((\S*)(?::(\d+))(?::(\d+))\)/,W=(t,e)=>{var i=z.exec(t);if(i){var[,r,s,n]=i;return N(e,r,D,+s,+n)}var a=H.exec(t);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=V.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=U(a[1]||D,a[2]);return N(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},B=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,q=(t,e)=>{var i=B.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=J.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||D;return[n,s]=U(n,s),N(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},G=/\(error: (.*)\)/;class K{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=g(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return E(t,"DOMException")}isDOMError(t){return E(t,"DOMError")}}class Y{match(t){return t instanceof Error}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class X{constructor(){}match(t){return E(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var Z=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Q{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Z);return r&&(e=r[1],i=r[2]),[e,i]}}var tt=["fatal","error","warning","log","info","debug"];function et(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class it{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return k(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+et(t)}isSeverityLevel(t){return g(t)&&!(t=>g(t)&&0===t.trim().length)(t)&&tt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(i instanceof Error)return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class rt{match(t){return k(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+et(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class st{match(t){return x(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class nt{match(t){return E(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!k(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return x(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var at="$message",ot="$timestamp",lt=new Set([at,ot]),ut={enabled:!0,max_bytes:32768};function ht(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ut.enabled,max_bytes:dt(t.max_bytes,ut.max_bytes)}:i({},ut)}class vt{constructor(t){this.Kt=[],this.Qt=0,this.Bt=ht(t)}setConfig(t){this.Bt=ht(t),this.er()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!f(i))return;var r=i,s=r[at],n=r[ot];if(!g(s)||0===s.trim().length)return;if(!g(n)&&!m(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Bt.max_bytes||(this.Kt.push({step:e.step,bytes:i}),this.Qt+=i,this.er())}}getAttachable(){return this.Kt.map((t=>t.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var t=this.Kt.shift();t&&(this.Qt-=t.bytes)}}}function dt(t,e){if(!m(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var ct="undefined"!=typeof window?window:void 0,ft="undefined"!=typeof globalThis?globalThis:ct;"undefined"==typeof self&&(ft.self=ft),"undefined"==typeof File&&(ft.File=function(){});var pt=null==ft?void 0:ft.navigator,gt=null==ft?void 0:ft.document,bt=null==ft?void 0:ft.location;null!=ft&&ft.XMLHttpRequest&&new ft.XMLHttpRequest;var _t=null!=ct?ct:{},mt=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(ct&&(_t.POSTHOG_DEBUG||i)&&!p(ct.console)&&ct.console){for(var r=("__rrweb_original__"in ct.console[e]?ct.console[e].__rrweb_original__:ct.console[e]),s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];r(t,...n)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>mt(t+" "+e,i)};return r},yt=mt("[PostHog.js]"),wt=yt.createLogger;function xt(t,e){if(!_(t))if(d(t))t.forEach(e);else if(w(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)h.call(t,i)&&e(t[i],i)}var Et=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function kt(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var St=function(t){try{return t()}catch(t){return}};function Ft(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ct(t){return"ph_toolbar_internal"===t.name}var Rt="$autocapture_disabled_server_side",$t="$heatmaps_enabled_server_side",Pt="$exception_capture_enabled_server_side",Tt="$error_tracking_suppression_rules",At="$error_tracking_capture_extension_exceptions",It="$web_vitals_enabled_server_side",Ot="$product_tours_enabled_server_side",jt="$web_vitals_allowed_metrics",Lt="$session_recording_remote_config",Mt="$enabled_feature_flags",Dt="$active_feature_flags",Nt="$early_access_features",Ut="$feature_flag_details",zt="$feature_flag_payloads",Ht="$feature_flag_request_id",Vt="$override_feature_flags",Wt="$override_feature_flag_payloads",Bt="$stored_person_properties",Jt="$stored_group_properties",qt="$surveys",Gt="$surveys_activated",Kt="ph_product_tours",Yt="$flag_call_reported",Xt="$flag_call_reported_session_id",Zt="$feature_flag_errors",Qt="$feature_flag_evaluated_at",te="__POSTHOG_TOOLBAR__",ee="PostHog loadExternalDependency extension not found.",ie="visibilitychange",re="beforeunload",se=1,ne=3,ae=11;function oe(t){return t instanceof Element&&(t.id===te||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function le(t){return!!t&&t.nodeType===se}function ue(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function he(t){return!!t&&t.nodeType===ne}function ve(t){return!!t&&t.nodeType===ae&&le(t.host)}function de(t){return t?l(t).split(/\s+/):[]}function ce(t){var e=null==ct?void 0:ct.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function fe(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return de(e)}function pe(t){return _(t)?null:l(t).split(/(\s+)/).filter((t=>Ie(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ge(t){var e="";return Se(t)&&!Fe(t)&&t.childNodes&&t.childNodes.length&&xt(t.childNodes,(function(t){var i;he(t)&&t.textContent&&(e+=null!==(i=pe(t.textContent))&&void 0!==i?i:"")})),l(e)}function be(t){return p(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var _e=["a","button","form","input","select","textarea","label"];function me(t,e){if(p(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ye(t){var e=t.parentNode;return!(!e||!le(e))&&e}var we=["next","previous","prev",">","<"],xe=[".ph-no-rageclick",".ph-no-capture"];var Ee=t=>!t||ue(t,"html")||!le(t),ke=(t,e)=>{if(!ct||Ee(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!ue(s,"body");)if(ve(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ye(s);if(!n)break;if(e||_e.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=ct.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Se(t){for(var e=t;e.parentNode&&!ue(e,"body");e=e.parentNode){var i=fe(e);if(o(i,"ph-sensitive")||o(i,"ph-no-capture"))return!1}if(o(fe(t),"ph-include"))return!0;var r=t.type||"";if(g(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!g(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Fe(t){return!!(ue(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ue(t,"select")||ue(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ce="(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})",Re=new RegExp("^(?:"+Ce+")$"),$e=new RegExp(Ce),Pe="\\d{3}-?\\d{2}-?\\d{4}",Te=new RegExp("^("+Pe+")$"),Ae=new RegExp("("+Pe+")");function Ie(t,e){if(void 0===e&&(e=!0),_(t))return!1;if(g(t)){if(t=l(t),(e?Re:$e).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Te:Ae).test(t))return!1}return!0}function Oe(t){var e=ge(t);return Ie(e=(e+" "+je(t)).trim())?e:""}function je(t){var e="";return t&&t.childNodes&&t.childNodes.length&&xt(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ge(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+je(t)).trim())}catch(t){yt.error("[AutoCapture]",t)}})),e}function Le(t){return t.replace(/"|\\"/g,'\\"')}function Me(t){var e=t.attr__class;return e?d(e)?e:de(e):void 0}class De{constructor(t){this.disabled=!1===t;var e=f(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var Ne=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!d(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(t){yt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ue=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var v=l[h].split("=");d(v)&&(e.includes(v[0])?u.push(v[0]+"="+i):u.push(l[h]))}var c=o;return null!=a&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},ze=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},He="$copy_autocapture",Ve=wt("[AutoCapture]");function We(t,e){return e.length>t?e.slice(0,t)+"...":e}function Be(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!le(e));return e}function Je(t,e){var r,s,{e:n,maskAllElementAttributes:a,maskAllText:l,elementAttributeIgnoreList:u,elementsChainAsString:h}=e;if(!le(t))return{props:{}};for(var v=[t],d=t;d.parentNode&&!ue(d,"body");)if(ve(d.parentNode))v.push(d.parentNode.host),d=d.parentNode.host;else{if(!le(d.parentNode))break;v.push(d.parentNode),d=d.parentNode}var c,f,b=[],_={},m=!1,y=!1;if(xt(v,(t=>{var e=Se(t);if(ue(t,"a")){var i=t.getAttribute("href");m=e&&!!i&&Ie(i)&&i}o(fe(t),"ph-no-capture")&&(y=!0),b.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};_e.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?We(1024,Oe(t)):We(1024,ge(t)));var a=fe(t);a.length>0&&(n.classes=a.filter((function(t){return""!==t}))),xt(t.attributes,(function(i){var s;if((!Fe(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Ie(i.value)&&(!g(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=i.value;"class"===i.name&&(a=de(a).join(" ")),n["attr__"+i.name]=We(1024,a)}}));for(var o=1,l=1,u=t;u=Be(u);)o++,u.tagName===t.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(t,a,l,u));var r=function(t){if(!Se(t))return{};var e={};return xt(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Ie(r)&&(e[i]=r)}})),e}(t);Et(_,r)})),y)return{props:{},explicitNoCapture:y};if(l||(b[0].$el_text=ue(t,"a")||ue(t,"button")?Oe(t):ge(t)),m){var w,x;b[0].attr__href=m;var E=null==(w=(t=>{var e=null==gt?void 0:gt.createElement("a");return p(e)?null:(e.href=t,e)})(m))?void 0:w.host,k=null==ct||null==(x=ct.location)?void 0:x.host;E&&k&&E!==k&&(c=m)}return{props:Et({$event_type:n.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(f=b,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var a=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return kt(a).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Le(e.toString())]=Le(i.toString())})),(s+=":")+kt(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Me(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return kt(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(f)))},null!=(r=b[0])&&r.$el_text?{$el_text:null==(s=b[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var qe=wt("[Dead Clicks]"),Ge=()=>!0;class Ke{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({$dead_clicks_enabled_server_side:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?qe.error("failed to load script",e):t()}))}hr(){var t;if(gt){if(!this.lr&&null!=(t=_t.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=f(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.lr=_t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.lr.start(gt),qe.info("starting...")}}else qe.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,qe.info("stopping..."))}}var Ye=wt("[ExceptionAutocapture]");function Xe(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return c(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var Ze=wt("[TracingHeaders]");Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return m(t)&&isFinite(t)&&Math.floor(t)===t});class Qe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Qe(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Qe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class ti{constructor(){this.I=0,this.S=0,this.k=new ri}generate(){var t=this.generateOrAbort();if(p(t)){this.I=0;var e=this.generateOrAbort();if(p(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Qe.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var ei,ii=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};ct&&!p(ct.crypto)&&crypto.getRandomValues&&(ii=t=>crypto.getRandomValues(t));class ri{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ii(this.T),this.N=0),this.T[this.N++]}}var si=()=>(ei||(ei=new ti)).generate(),ni="",ai=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function oi(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=gt),ni)return ni;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+si().toString();!ni&&r--;){var n=i.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(s)&&(e.cookie=a+";max-age=0",ni=n)}return ni}(t);if(!i){var r=(t=>{var e=t.match(ai);return e?e[0]:""})(t);r!==i&&yt.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var li={R:()=>!!gt,B(t){yt.error("cookieStore error: "+t)},O(t){if(gt){try{for(var e=t+"=",i=gt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(li.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(gt)try{var n="",a="",o=oi(gt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&yt.warn("cookieStore warning: large cookie, len="+u.length),gt.cookie=u,u}catch(t){return}},F(t,e){if(null!=gt&>.cookie)try{li.M(t,"",-1,e)}catch(t){return}}},ui=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],hi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ui],vi="<masked>",di=["li_fat_id"];function ci(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var fi=wt("[Web Vitals]"),pi=9e5,gi=wt("[RemoteConfig]");class bi{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=_t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Er(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Rr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return gi.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void gi.warn("Remote config is disabled. Falling back to local config.");this.Er((t=>{if(!t)return gi.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr((t=>{this.Nr(t),this.Mr()}));this.Nr(t),this.Mr()}))}catch(t){gi.error("Error loading remote config",t)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||"hidden"===(null==gt?void 0:gt.visibilityState)||this._instance.reloadFeatureFlags()}Mr(){var t;if(!this.Or){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Or=setInterval((()=>{this.refresh()}),e))}}Nr(t){var e;t||gi.error("Failed to fetch remote config from PostHog."),this._instance.Nr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var _i="disabled",mi="lazy_loading",yi="awaiting_config",wi="missing_config",xi="base64",Ei=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},ki={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Ei(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ei(e,t))))),icontains:(t,e)=>e.map(Si).some((e=>t.map(Si).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Si).every((e=>t.map(Si).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},Si=t=>t.toLowerCase();function Fi(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(p(s)||b(s))return!1;var n=[String(s)],a=ki[r.operator];return!!a&&a(r.values,n)}))}wt("[SessionRecording]"),wt("[SessionRecording]");var Ci="[SessionRecording]",Ri=wt(Ci),$i=wt("[Heatmaps]");function Pi(t){return f(t)&&"clientX"in t&&"clientY"in t&&m(t.clientX)&&m(t.clientY)}var Ti,Ai,Ii=wt("[Product Tours]"),Oi=["$set_once","$set"],ji=wt("[SiteApps]"),Li="Error while initializing PostHog app with config id ",Mi="events",Di="cancelEvents";void 0===Ti&&(Ti=t=>t()),T("[SurveyTranslations]",Ti,(void 0===Ai&&(Ai=console),{log:Ai.log.bind(Ai),warn:Ai.warn.bind(Ai),error:Ai.error.bind(Ai),debug:Ai.debug.bind(Ai)}));var Ni=wt("[Surveys]"),Ui=["popover","widget","api"];class zi{constructor(){this.oi={}}on(t,e){return this.oi[t]||(this.oi[t]=[]),this.oi[t].push(e),()=>{this.oi[t]=this.oi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.oi[t]||[])i(e);for(var r of this.oi["*"]||[])r(t,e)}}function Hi(t,e,i){if(_(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Vi{constructor(t){this.vn=new zi,this.fn=(t,e)=>this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e)&&this.yn(t,e),this.pn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.bn=new Set,this.wn=new Set}init(){var t,e;p(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!p(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.wn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.bn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.bn.has(t)||this.bn.has(null==e?void 0:e.event))&&this.wn&&(null==(i=this.wn)?void 0:i.size)>0&&this.wn.forEach((t=>{this._n(e,t)&&this.vn.emit("actionCaptured",t.name)}))}In(t){this.onAction("actionCaptured",(e=>t(e)))}_n(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.fn(t,i))return!0;return!1}onAction(t,e){return this.vn.on(t,e)}gn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Hi(r,e.url,e.url_matching||"contains"))return!1}return!0}mn(t,e){return!!this.Cn(t,e)&&!!this.Sn(t,e)&&!!this.xn(t,e)}Cn(t,e){var i;if(null==e||!e.href)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Hi(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Hi((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Sn(t,e){var i;if(null==e||!e.text)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Hi(t.text,e.text,e.text_matching||"exact")||Hi(t.$el_text,e.text,e.text_matching||"exact")));var s,n,a,o=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!o&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!_(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(o),n=e.text,a=e.text_matching||"exact",s.some((t=>Hi(t,n,a))))}xn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}kn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}yn(t,e){return null==e||!e.properties||0===e.properties.length||Fi(e.properties.reduce(((t,e)=>{var i=d(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Wi{constructor(t){this._instance=t,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(t,e){return!!t&&Fi(t.propertyFilters,null==e?void 0:e.properties)}Nn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Mn(t,e,i){var r=(i===Mi?this.Tn:this.An).get(t),s=[];return this.Fn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Rn(n,e)}))}register(t){var e;p(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.On(t),this.Pn(t))}Pn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Ln&&(this.Ln=new Vi(this._instance),this.Ln.init(),this.Ln.In((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Ln)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.En.get(e.name);i&&i.push(t.id),this.En.set(e.name,i||[t.id])}})))})))}On(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.Tn=this.Nn(t,Mi),this.An=this.Nn(t,Di))}onEvent(t,e){var i,r=this.le(),s=this.Dn(),n=this.Bn(),a=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&a.length>0){var o,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:a});var u=(null==e||null==(o=e.properties)?void 0:o.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=a.indexOf(u);0>h||(a.splice(h,1),this.jn(a))}}else{if(this.An.has(t)){var v=this.Mn(t,e,Di);v.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:v.map((t=>t.id))}),v.forEach((t=>{var e=a.indexOf(t.id);0>e||a.splice(e,1),this.$n(t.id)})),this.jn(a))}if(this.Tn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.Tn.get(t)});var d=this.Mn(t,e,Mi);this.jn(a.concat(d.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Dn(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.En.has(t)&&this.jn(r.concat(this.En.get(t)||[]))}jn(t){var e=this.le(),i=[...new Set(t)].filter((t=>!this.qn(t)));e.info("updating activated items",{activatedItems:i}),this.Zn(i)}getActivatedIds(){var t,e=this.Dn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.Tn}Hn(){return this.Ln}}class Bi extends Wi{constructor(t){super(t)}Dn(){return Gt}Bn(){return"survey shown"}Fn(t){var e;null==(e=this._instance)||e.getSurveys(t)}$n(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}le(){return Ni}Zn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[Gt]:t})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ji="SDK is not enabled or survey functionality is not yet loaded",qi="Disabled. Not loading surveys.",Gi=null!=ct&&ct.location?ze(ct.location.hash,"__posthog")||ze(location.hash,"state"):null,Ki="_postHogToolbarParams",Yi=wt("[Toolbar]"),Xi=wt("[FeatureFlags]"),Zi=wt("[FeatureFlags]",{debugEnabled:!0}),Qi="\" failed. Feature flags didn't load in time.",tr=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},er=t=>{var e={};for(var[i,r]of kt(t||{}))r&&(e[i]=r);return e},ir=wt("[Error tracking]"),rr="Refusing to render web experiment since the viewer is a likely bot",sr={icontains:(t,e)=>!!ct&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!ct&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!ct&&Ei(e.href,t),not_regex:(t,e)=>!!ct&&!Ei(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class nr{get Bt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{nr.Vn("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(nr.Vn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);g(r)&&t.variants[r]&&e.Un(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];nr.Yn(n)&&e.Un(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())nr.Vn(rr);else if(!this.Bt.disable_web_experiments){if(_(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nr.Vn("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Un(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=nr.getWindowLocation();if(null!=t&&t.search){var e=Ne(null==t?void 0:t.search,"__experiment_id"),i=Ne(null==t?void 0:t.search,"__experiment_variant");e&&i&&(nr.Vn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Bt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(nr.Vn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Un(r[0].name,e,r[0].variants[e].transforms))}static Yn(t){return!_(t.conditions)&&nr.Wn(t)&&nr.Xn(t)}static Wn(t){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=nr.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||sr[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==ct?void 0:ct.location}static Xn(t){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.utm))return!0;var i=function(t,e,i){if(!gt)return{};var r,s,n,a=(r=Ue(gt.URL,[],vi),s=hi.concat([]),n={},xt(s,(function(t){var e=Ne(r,t);n[t]=e||null})),n),o=function(){var t={};return xt(di,(function(e){var i=li.O(e);t[e]=i||null})),t}();return Et(o,a)}();if(i.utm_source){var r,s,n,a,o,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)==i.utm_campaign,d=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=t.conditions)||null==(a=a.utm)?void 0:a.utm_source)==i.utm_source,c=null==(o=t.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.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)==i.utm_term;return v&&c&&f&&d}return!1}static Vn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];yt.info("[WebExperiments] "+t,i)}Un(t,e,i){this._is_bot()?nr.Vn(rr):"control"!==e?i.forEach((i=>{if(i.selector){var r;nr.Vn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):nr.Vn("Control variants leave the page unmodified.")}_is_bot(){return pt&&this._instance?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&a(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>a(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(pt,this.Bt.custom_blocked_useragents):void 0}}var ar=wt("[Conversations]"),or="Conversations not available yet.",lr={featureFlags:class{constructor(t){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(t){return this._instance.get_property(t)}ls(){var t,e;return null!==(t=null==(e=this.ni)?void 0:e._r(this.Bt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,Xi.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var t,e=null!==(t=this.Bt.evaluation_contexts)&&void 0!==t?t:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(Xi.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Xi.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}cs(){return this.hs().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,a=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},o=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(a).filter((t=>o[t])).reduce(((t,e)=>(a[e]&&(t[e]=a[e]),t)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(t,e,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},a=i({},s,t),o=i({},n,e),l={};for(var[u,h]of Object.entries(a)){var v="string"==typeof h;l[u]={key:u,enabled:!!v||Boolean(h),variant:v?h:void 0,reason:void 0,metadata:p(null==o?void 0:o[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.os(Ut),e=this.os(Vt),r=this.os(Wt);if(!r&&!e)return t||{};var s=Et({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var a of n){var o,l,u=s[a],h=null==e?void 0:e[a],v=p(h)?null!==(o=null==u?void 0:u.enabled)&&void 0!==o&&o:!!h,d=p(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[a],f=i({},u,{enabled:v,variant:v?null!=d?d:null==u?void 0:u.variant:void 0});v!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),d!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[a]=f}return this.Jn||(Xi.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Jn=!0),s}getFlagVariants(){var t=this.os(Mt),e=this.os(Vt);if(!e)return t||{};for(var i=Et({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Xi.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.os(zt),e=this.os(Wt);if(!e)return t||{};for(var i=Et({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(Xi.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.es=t}vs(t){var e;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var r=this.Bt.token,s=this.os("$device_id"),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.ni)?void 0:e.get_initial_props())||{},this.os(Bt)||{}),group_properties:this.os(Jt),timezone:ci()};b(s)||p(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Bt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.cs()&&(n.evaluation_contexts=this.hs());var a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Bt.disable_compression?void 0:xi,timeout:this.Bt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),s=!1),this.Qn=!1,!n.disable_flags||this.ts){this.rs=!s;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var o,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&a.push("quota_limited"),null==(r=this.ni)||r.register({[Zt]:a}),l)Xi.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(o=t.json)&&void 0!==o?o:{},s,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Xi.warn('getFeatureFlag for key "'+t+Qi)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],a=String(s),o=this.os(Ht)||void 0,l=this.os(Qt)||void 0,u=this.os(Yt)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var h,v=this._instance.get_session_id(),c=this.os(Xt);v&&v!==c&&(u={},null==(h=this.ni)||h.register({[Yt]:u,[Xt]:v}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(a))){var f,g,b,_,m,y,w,x,E,k;d(u[t])?u[t].push(a):u[t]=[a],null==(f=this.ni)||f.register({[Yt]:u});var S=this.getFeatureFlagDetails(t),F=[...null!==(g=this.os(Zt))&&void 0!==g?g:[]];p(s)&&F.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(b=this.Bt.bootstrap)||null==(b=b.featureFlags)?void 0:b[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Bt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.rs};p(null==S||null==(m=S.metadata)?void 0:m.version)||(C.$feature_flag_version=S.metadata.version);var R,P=null!==(y=null==S||null==(w=S.reason)?void 0:w.description)&&void 0!==y?y:null==S||null==(x=S.reason)?void 0:x.code;P&&(C.$feature_flag_reason=P),null!=S&&null!=(E=S.metadata)&&E.id&&(C.$feature_flag_id=S.metadata.id),p(null==S?void 0:S.original_variant)&&p(null==S?void 0:S.original_enabled)||(C.$feature_flag_original_response=p(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(k=S.metadata)&&k.original_payload&&(C.$feature_flag_original_payload=null==S||null==(R=S.metadata)?void 0:R.original_payload),F.length&&(C.$feature_flag_error=F.join(",")),this._instance.capture("$feature_flag_called",C)}if(r){var T=n;if(!p(n))try{T=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:T}}}}else Xi.warn('getFeatureFlagResult for key "'+t+Qi)}getRemoteConfigPayload(t,e){var i=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Bt.disable_compression?void 0:xi,timeout:this.Bt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return p(i)?void 0:!!i}Xi.warn('isFeatureEnabled for key "'+t+Qi)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.ni){this.Kn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),a=this.getFlagsWithDetails();!function(t,e,r,s,n,a){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):Xi.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=o.flags,u=o.featureFlags,h=o.featureFlagPayloads;if(u){var v=t.requestId,c=t.evaluatedAt;if(d(u)){Xi.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f={};if(u)for(var p=0;u.length>p;p++)f[u[p]]=!0;e&&e.register({[Dt]:u,[Mt]:f})}else{var g=u,b=h,_=l;if(null!=a&&a.partialResponse)g=i({},r,g),b=i({},s,b),_=i({},n,_);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));g=i({},r,Object.fromEntries(Object.entries(g).filter((t=>{var[e]=t;return m.has(e)})))),b=i({},s,Object.fromEntries(Object.entries(b||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},n,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else g=i({},r,g),b=i({},s,b),_=i({},n,_);e&&e.register(i({[Dt]:Object.keys(er(g)),[Mt]:g||{},[zt]:b||{},[Ut]:_||{}},v?{[Ht]:v}:{},c?{[Qt]:c}:{}))}}}(t,this.ni,s,n,a,r),e||(this.ss=!1),this.ps(e)}}override(t,e){void 0===e&&(e=!1),Xi.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ni)return Xi.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ni.unregister(Vt),this.ni.unregister(Wt),this.ps(),Zi.info("All overrides cleared");if(d(t)){var e=tr(t);return this.ni.register({[Vt]:e}),this.ps(),Zi.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(Vt),Zi.info("Flag overrides cleared");else if(r.flags){if(d(r.flags)){var s=tr(r.flags);this.ni.register({[Vt]:s})}else this.ni.register({[Vt]:r.flags});Zi.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(Wt),Zi.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[Wt]:r.payloads}),Zi.info("Payload overrides set",{payloads:r.payloads}))),void this.ps()}if(t&&"object"==typeof t)return this.ni.register({[Vt]:t}),this.ps(),Zi.info("Flag overrides set",{flags:t});Xi.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kn){var{flags:e,flagVariants:i}=this.gs();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.os(Nt)||[]).find((e=>e.flagKey===t)),a={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:a};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=i({},this.getFlagVariants(),{[t]:e});null==(s=this.ni)||s.register({[Dt]:Object.keys(er(l)),[Mt]:l}),this.ps()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.os(Nt),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(Nt),null==(r=this.ni)||r.register({[Nt]:s}),t(s)}}})}gs(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}ps(t){var{flags:e,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.os(Bt)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,a={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(a[o]=n[o]));this._instance.register({[Bt]:i({},r,a,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Bt)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.os(Jt)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[Jt]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.os(Jt)||{};this._instance.register({[Jt]:i({},e,{[t]:{}})})}else this._instance.unregister(Jt)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},ur={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ys)||!t.isStarted)}get status(){var t,e;return this.bs===yi||this.bs===wi?this.bs:null!==(t=null==(e=this.ys)?void 0:e.status)&&void 0!==t?t:this.bs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=_i,this.ws=void 0,this._instance=t,!this._instance.sessionManager)throw Ri.error("started without valid sessionManager"),new Error(Ci+" started without valid sessionManager. This is a bug.");if("always"===this.Bt.cookieless_mode)throw new Error(Ci+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(Lt))||!t.enabled),i=!this.Bt.disable_session_recording,r=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return ct&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.ys)||!e.isStarted){var i=!p(Object.assign)&&!p(Array.from);this._s&&i?(this.Is(t),Ri.info("starting")):(this.bs=_i,this.stopRecording())}}Is(t){var e,i,r;this._s&&(this.bs!==yi&&this.bs!==wi&&(this.bs=mi),null!=_t&&null!=(e=_t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=_t.__PosthogExtensions__)&&i.initSessionRecording?this.Cs(t):null==(r=_t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ss,(e=>{if(e)return Ri.error("could not load recorder",e);this.Cs(t)})))}stopRecording(){var t,e;null==(t=this.ws)||t.call(this),this.ws=void 0,null==(e=this.ys)||e.stop()}xs(){var t,e;null==(t=this.ws)||t.call(this),this.ws=void 0,null==(e=this.ys)||e.discard()}ks(){var t;null==(t=this.ni)||t.unregister("$session_is_sampled")}Ts(t,e){if(_(t))return null;var i,r=m(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ri.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}As(t){if(this.ni){var e,r,s=this.ni,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ts(null==(e=this.Bt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),a=this.Ts(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;_(o)&&this.ks();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[Lt]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:p(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.ws)||e.call(this),this.ws=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.As(t),void this.xs()):(this.As(t),void this.startIfEnabledOrStop()):(this.bs===yi&&(this.bs=wi,Ri.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.ys)&&i.log?this.ys.log(t,e):Ri.warn("log called before recorder was ready")}get Ss(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Lt);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e=this._instance.get_property(Lt);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Cs(t){var e,i;if(null==(e=_t.__PosthogExtensions__)||!e.initSessionRecording)return Ri.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ys||(this.ys=null==(i=_t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.bs===wi||this.bs===yi)return;return this.bs=yi,Ri.info("persisted remote config is stale, requesting fresh config before starting"),void new bi(this._instance).load()}this.bs=mi,this.ys.start(t)}onRRwebEmit(t){var e;null==(e=this.ys)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.ys||null==(e=this.ni)||e.register({$replay_override_linked_flag:!0}),null==(t=this.ys)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.ys||null==(e=this.ni)||e.register({$replay_override_sampling:!0}),null==(t=this.ys)||t.overrideSampling()}overrideTrigger(t){var e,i;this.ys||null==(i=this.ni)||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(e=this.ys)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ys)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.ys)||!i.tryAddCustomEvent(t,e))}}},hr={autocapture:class{constructor(t){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=t,this.rageclicks=new De(t.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var t,e,i=f(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Os(){if(this.isBrowserSupported()){if(ct&>){var t=t=>{t=t||(null==ct?void 0:ct.event);try{this.Ps(t)}catch(t){Ve.error("Failed to capture event",t)}};if(Ft(gt,"submit",t,{capture:!0}),Ft(gt,"change",t,{capture:!0}),Ft(gt,"click",t,{capture:!0}),this.Bt.capture_copied_text){var e=t=>{t=t||(null==ct?void 0:ct.event);try{this.Ps(t,He)}catch(t){Ve.error("Failed to capture copy/cut event",t)}};Ft(gt,"copy",e,{capture:!0}),Ft(gt,"cut",e,{capture:!0})}}}else Ve.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ms=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Rt]:!!t.autocapture_opt_out}),this.Ns=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Fs=t}getElementSelectors(t){var e,i=[];return null==(e=this.Fs)||e.forEach((e=>{var r=null==gt?void 0:gt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[Rt];if(b(this.Ns)&&!y(i)&&!this.instance.Fr())return!1;var r=null!==(e=this.Ns)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ps(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=be(t);he(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,e){if(!ct||Ee(t))return!1;var i,r,s;if(y(e)?(i=!!e&&xe,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:xe,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=ke(t,!1);return!function(t,e){if(!1===t||p(t))return!1;var i;if(!0===t)i=we;else{if(!d(t))return!1;if(t.length>10)return yt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var e;return{safeText:ge(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!me(n,i)}(r,this.instance.config.rageclick)&&this.Ps(t,"$rageclick");var s=e===He;if(r&&function(t,e,i,r,s){var n,a,o,l;if(void 0===i&&(i=void 0),!ct||Ee(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!ce(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&ce(i.url_ignorelist))return!1;if(null!=(o=i)&&o.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:h,targetElementList:v}=ke(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(p(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,i))return!1;if(!me(v,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=ct.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(_e.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Bt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=Je(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),e===He){var l,u=pe(null==ct||null==(l=ct.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return c(null==gt?void 0:gt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ls=(null==ct||null==(e=ct.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,yt.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(ct&&ct.history){var i=this;null!=(t=ct.history.pushState)&&t.__posthog_wrapped__||Xe(ct.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Bs("pushState")})),null!=(e=ct.history.replaceState)&&e.__posthog_wrapped__||Xe(ct.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Bs("replaceState")})),this.js()}}Bs(t){try{var e,i=null==ct||null==(e=ct.location)?void 0:e.pathname;if(!i)return;i!==this.Ls&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.Ls=i}catch(e){yt.error("Error capturing "+t+" pageview",e)}}js(){if(!this.Ds){var t=()=>{this.Bs("popstate")};Ft(ct,"popstate",t),this.Ds=()=>{ct&&ct.removeEventListener("popstate",t)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(t){var e;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=t,this.$s=!(null==(e=this.instance.persistence)||!e.props[$t]),this.rageclicks=new De(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return f(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Bt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return _(this.Bt.capture_heatmaps)?_(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:!1!==this.Bt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;$i.info("starting..."),this.Zs(),this.Lt()}else{var t;clearInterval(null!==(t=this.qs)&&void 0!==t?t:void 0),this.Hs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[$t]:e}),this.$s=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Vs(t){this.Tt(t.originalEvent,"deadclick")}Lt(){this.qs&&clearInterval(this.qs),this.qs="visible"===(null==gt?void 0:gt.visibilityState)?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){ct&>&&(this.zs=this.Yr.bind(this),Ft(ct,re,this.zs),this.Us=t=>this.Tt(t||(null==ct?void 0:ct.event)),Ft(gt,"click",this.Us,{capture:!0}),this.Ys=t=>this.Gs(t||(null==ct?void 0:ct.event)),Ft(gt,"mousemove",this.Ys,{capture:!0}),this.Ws=new Ke(this.instance,Ge,this.Vs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Lt.bind(this),Ft(gt,ie,this.Xs),this.Rs=!0)}Hs(){var t;ct&>&&(this.zs&&ct.removeEventListener(re,this.zs),this.Us&>.removeEventListener("click",this.Us,{capture:!0}),this.Ys&>.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&>.removeEventListener(ie,this.Xs),clearTimeout(this.Js),null==(t=this.Ws)||t.stop(),this.Rs=!1)}Ks(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&le(r)&&!ue(r,"body");){if(r===i)return!1;if(o(e,null==ct?void 0:ct.getComputedStyle(r).position))return!0;r=ye(r)}return!1}(be(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}Tt(t,e){var r;if(void 0===e&&(e="click"),!oe(t.target)&&Pi(t)){var s=this.Ks(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Qs(i({},s,{type:"rageclick"})),this.Qs(s)}}Gs(t){!oe(t.target)&&Pi(t)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(t,"mousemove"))}),500))}Qs(t){if(ct){var e=ct.location.href,i=this.Bt.custom_personal_data_properties,r=this.Bt.mask_personal_data_properties?[...ui,...i||[]]:[],s=Ue(e,r,vi);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Yr(){this.T&&!(t=>{if(f(t)){for(var e in t)if(h.call(t,e))return!1;return!0}return!1})(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ke,webVitalsAutocapture:class{constructor(t){var e;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(p(r))fi.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.io();p(s)||(_(null==t?void 0:t.name)||_(null==t?void 0:t.value)?fi.error("Invalid metric received",t):!this.no||this.no>t.value?(this.T.url!==s&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),p(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=p(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(i({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):fi.error("Ignoring metric with value >= "+this.no,t))}},this.so=()=>{if(!this.Rs){var t,e,i,r,s=_t.__PosthogExtensions__;p(s)||p(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):fi.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.$s=!(null==(e=this._instance.persistence)||!e.props[It]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=f(this.oo)?null==(t=this.oo)?void 0:t.web_vitals_allowed_metrics:void 0;return _(i)?(null==(e=this._instance.persistence)?void 0:e.props[jt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(f(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=f(this.oo)?this.oo.web_vitals_attribution:void 0;return null!=t&&t}get no(){var t=f(this.oo)&&m(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:pi;return t>0&&6e4>=t?pi:t}get isEnabled(){var t=null==bt?void 0:bt.protocol;if("http:"!==t&&"https:"!==t)return fi.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=f(this.oo)?this.oo.web_vitals:y(this.oo)?this.oo:void 0;return y(e)?e:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(fi.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(t){if("capturePerformance"in t){var e=f(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=f(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[It]:e}),this._instance.persistence.register({[jt]:i})),this.$s=e,this.startIfEnabled()}}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?fi.error("failed to load script",e):t()}))}io(){var t=ct?ct.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ui,...e||[]]:[];return Ue(t,i,vi)}fi.error("Could not determine current URL")}}},vr={exceptionObserver:class{constructor(t){var e,i,r;this.so=()=>{var t;if(ct&&this.isEnabled&&null!=(t=_t.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=_t.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=_t.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=_t.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=e(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=i(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=r(this.captureException.bind(this)))}catch(t){Ye.error("failed to start",t),this.ho()}}},this._instance=t,this.co=!(null==(e=this._instance.persistence)||!e.props[Pt]),this.do=new F({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Gt:Ye}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return f(t)?e=i({},e,t):(p(t)?this.co:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ye.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Ye.error("failed to load script",e);t()}))}ho(){var t,e,i;null==(t=this.ao)||t.call(this),this.ao=void 0,null==(e=this.lo)||e.call(this),this.lo=void 0,null==(i=this.uo)||i.call(this),this.uo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pt]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.do.consumeRateLimit(s)?Ye.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.fo=[],this.po=new M([new K,new nt,new X,new Y,new rt,new it,new Q,new st],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],a=e.split("\n"),o=s;a.length>o;o++){var l=a[o];if(1024>=l.length){var u=G.test(l)?l.replace(G,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var v=h(u,t);if(v){n.push(v);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||D});var r}))}(n)}}("web:javascript",W,q)),this._instance=t,this.fo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(Tt))&&void 0!==e?e:[],this.mo=ht(this.yo()),this.bo=new vt(this.mo)}onConfigChange(){this.mo=ht(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.fo=s,this._instance.persistence&&this._instance.persistence.register({[Tt]:this.fo,[At]:n})}}get wo(){var t,e=!!this._instance.get_property(At),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.po.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.mo.enabled)try{if(!g(t)||0===t.trim().length)return void ir.warn("Ignoring exception step because message must be a non-empty string");var r=this._o(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>lt.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&ir.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.bo.add(i({[at]:t,[ot]:(new Date).toISOString()},s))}catch(t){ir.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Io(e)){if(this.Co(e))return this.So("Exception dropped: matched a suppression rule"),void ir.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.xo(e))return this.So("Exception dropped: thrown by a browser extension"),void ir.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(e))return this.So("Exception dropped: thrown by the PostHog SDK"),void ir.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.mo.enabled&&_(t.$exception_steps)?this.To(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(t){return ir.error("Failed to capture exception event. Dropping this exception.",t),void this.bo.clear()}}catch(t){return void ir.error("Failed to process exception event. Ignoring this exception.",t)}}To(t){try{var e=this.bo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return ir.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}So(t){this.mo.enabled&&this.bo.add({[at]:t,[ot]:(new Date).toISOString()})}_o(t){return f(t)?i({},t):{}}yo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Co(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return g(i)&&i.length>0&&t.$exception_types.push(i),g(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.fo.some((t=>{var i=t.values.map((t=>{var i,r=ki[t.operator],s=d(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}xo(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ko(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],a=n[n.length-1];return null!==(r=null==a||null==(s=a.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Io(t){return!_(t)&&d(t)}}},dr=i({productTours:class{get ni(){return this._instance.persistence}constructor(t){this.Ao=null,this.Eo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ni&&this.ni.register({[Ot]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.Ao||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(Ot)||this.ur((()=>this.Ro()))}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ii.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Ao&&null!=(t=_t.__PosthogExtensions__)&&t.generateProductTours&&(this.Ao=_t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!d(this.Eo)||e){var i=this.ni;if(i){var r=i.props[Kt];if(d(r)&&!e)return this.Eo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Ii.error(s),void t([],{isLoaded:!1,error:s})}var n=d(e.json.product_tours)?e.json.product_tours:[];this.Eo=n,i&&i.register({[Kt]:n}),t(n,{isLoaded:!0})}})}else t(this.Eo,{isLoaded:!0})}getActiveProductTours(t){_(this.Ao)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Ao)||e.showTourById(t)}previewTour(t){this.Ao?this.Ao.previewTour(t):this.ur((()=>{var e;this.Ro(),null==(e=this.Ao)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Ao)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ao)||t.nextStep()}previousStep(){var t;null==(t=this.Ao)||t.previousStep()}clearCache(){var t;this.Eo=null,null==(t=this.ni)||t.unregister(Kt)}resetTour(t){var e;null==(e=this.Ao)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Ao)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Ao)||e.cancelPendingTour(t)}}},lr),cr={siteApps:class{constructor(t){this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=_t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{t(),this.No=[],this.Fo=void 0}}}globalsForEvent(t){var e,r,s,n,a,o,l;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[d,c]of Object.entries(v))u[d]={id:h[d],type:d,properties:c};var{$set_once:f,$set:p}=t;return{event:i({},function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Oi),{properties:i({},t.properties,p?{$set:i({},null!==(e=null==(r=t.properties)?void 0:r.$set)&&void 0!==e?e:{},p)}:{},f?{$set_once:i({},null!==(s=null==(n=t.properties)?void 0:n.$set_once)&&void 0!==s?s:{},f)}:{}),elements_chain:null!==(a=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(l=t.properties)?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(ji.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ji.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){ji.error(Li+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ji.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Oo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Po(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){ji.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",(t=>this.Po(t)))):void ji.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;_t["__$$ph_site_app_"+t]=s._instance,null==(e=_t.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,o,(e=>{if(e)return ji.error(Li+t,e)}))};for(var{id:a,url:o}of t.siteApps)n(a)}else ji.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},fr={tracingHeaders:class{constructor(t){this.Lo=void 0,this.Do=void 0,this.so=()=>{var t,e,i=this.Bo()||[];p(this.Lo)&&(null==(t=_t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),p(this.Do)&&(null==(e=_t.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ur(t){var e,i;null!=(e=_t.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=_t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ze.error("failed to load script",e);t()}))}Bo(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Bo()?this.ur(this.so):(null==(t=this.Lo)||t.call(this),null==(e=this.Do)||e.call(this),this.Lo=void 0,this.Do=void 0)}}},pr=i({surveys:class{get Bt(){return this._instance.config}constructor(t){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Bt.disable_surveys){var e=t.surveys;if(_(e))return Ni.warn("Flags not loaded yet. Not loading surveys.");var i=d(e);this.jo=i?e.length>0:e,Ni.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith("seenSurvey_")||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)Ni.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)Ni.info(qi);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())Ni.info("Not loading surveys in cookieless mode without consent.");else{var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){if(!p(this.jo)||this.Bt.advanced_enable_surveys){var e=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var i=t.generateSurveys;if(i)return void this.Ho(i,e);var r=t.loadExternalDependency;if(!r)return void this.Vo(ee);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Vo("Could not load surveys script",i):this.Ho(t.generateSurveys,e)}))}catch(t){throw this.Vo("Error initializing surveys",t),t}finally{this.$o=!1}}}else Ni.error("PostHog Extensions not found.")}}Ho(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Bi(this._instance),Ni.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Vo(t,e){Ni.error(t,e),this.zo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.qo.push(t),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Bt.disable_surveys)return Ni.info(qi),t([]);var i,r=this._instance.get_property(qt);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Zo?this.Zo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Zo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:e=>{var r;this.Zo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Ni.error(n);var a={isLoaded:!1,error:n};return t([],a),void(null==i||i({surveys:[],context:a}))}var o,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(o=this._surveyEventReceiver)||o.register(u)),null==(r=this._instance.persistence)||r.register({[qt]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}zo(t){for(var e of this.qo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ni.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!_(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ni.warn("init was not called")}Uo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Yo(t){if(_(this._surveyManager))return{eligible:!1,reason:Ji};var e="string"==typeof t?this.Uo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(_(this._surveyManager))return Ni.warn("init was not called"),{visible:!1,disabledReason:Ji};var e=this.Yo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return _(this._surveyManager)?(Ni.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ji})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Yo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(_(this._surveyManager))Ni.warn("init was not called");else{var s="string"==typeof t?this.Uo(t):t;if(null!=s&&s.id)if(Ui.includes(s.type)){var n=null==gt?void 0:gt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Ni.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Ni.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),Ni.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Ni.warn("Survey element not found")}else Ni.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ni.warn("Survey not found")}}displaySurvey(t,e){var r;if(_(this._surveyManager))Ni.warn("init was not called");else{var s=this.Uo(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),"popover"!==e.displayType&&e.initialResponses&&Ni.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var a=this.canRenderSurvey(s);if(!a.visible)return void Ni.warn("Survey is not eligible to be displayed: ",a.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Ni.warn("Survey not found")}}cancelPendingSurvey(t){_(this._surveyManager)?Ni.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},lr),gr={toolbar:class{constructor(t){this.instance=t}Go(t){_t.ph_toolbar_state=t}Wo(){var t;return null!==(t=_t.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ct(this.instance.config))return!1;if(!ct||!gt)return!1;t=null!=t?t:ct.location,i=null!=i?i:ct.history;try{if(!e){try{ct.localStorage.setItem("test","test"),ct.localStorage.removeItem("test")}catch(t){return!1}e=null==ct?void 0:ct.localStorage}var r,s=Gi||ze(t.hash,"__posthog")||ze(t.hash,"state"),n=s?St((()=>JSON.parse(atob(decodeURIComponent(s)))))||St((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ki)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Xo(t){var e=_t.ph_load_toolbar||_t.ph_load_editor;!_(e)&&c(e)?e(t,this.instance):Yi.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==gt||!gt.getElementById(te));if(!ct||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(ct.localStorage.setItem(Ki,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Xo(s);else if(0===this.Wo()){var n;this.Go(1),null==(n=_t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Yi.error("[Toolbar] Failed to load",t),void this.Go(0);this.Go(2),this.Xo(s)})),Ft(ct,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(s)}))}return!0}Jo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},br=i({experiments:nr},lr),_r={conversations:class{constructor(t){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;_(e)||(y(e)?this.Ko=e:(this.Ko=e.enabled,this.ea=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||Ct(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t&&!p(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var e=t.initConversations;if(e)return this.ta(e),void(this.Qo=!1);var i=t.loadExternalDependency;if(!i)return void this.ra(ee);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ra("Could not load conversations script",e):this.ta(t.initConversations),this.Qo=!1}))}catch(t){this.ra("Error initializing conversations",t),this.Qo=!1}}else ar.error("Conversations enabled but missing token in remote config.")}}ta(t){if(this.ea)try{this._conversationsManager=t(this.ea,this._instance),ar.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else ar.error("Cannot complete initialization: remote config is null")}ra(t,e){ar.error(t,e),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ko&&!b(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(ar.warn(or),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(ar.warn(or),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(ar.warn(or),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(ar.warn(or),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(ar.warn(or),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(ar.warn(or),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ar.warn(or),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}un(){var t;null==(t=this._conversationsManager)||t.setIdentity()}hn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},mr={logs:class{constructor(t){var e;this.ia=!1,this.na=!1,this.Gt=wt("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!_(i)&&i&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(ee)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,r,s,n,a,o;if(this._instance.is_capturing())if(t&&t.body){var l=null!==(e=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s:1e3,h=Date.now();if(l>h-this.aa||(this.aa=h,this.oa=0,this.la=!1),u>this.oa){this.oa++;var v=function(t,e){var r=t.level||"info",{text:s,number:n}=A[r]||I,a=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var l=i({},o,t.attributes||{}),u={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:j(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),p(t.trace_flags)||(u.flags=t.trace_flags),u}(t,this.ua());this.sa.push({record:v}),(null!==(a=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==a?a:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ca}flushLogs(t){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),0!==this.sa.length){var e=this.sa;this.sa=[];var n=this._instance.config.logs,a=i({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),o=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:j(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),a,s,r),l=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Hi({method:"POST",url:l,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ha(){var t,e;this.jr||(this.jr=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}ua(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=_t&&null!=(t=_t.location)&&t.href&&(e.currentUrl=_t.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},yr=i({},lr,ur,hr,vr,dr,cr,pr,fr,gr,br,_r,mr),wr=lr,xr=ur,Er=hr,kr=vr,Sr=dr,Fr=cr,Cr=pr,Rr=fr,$r=gr,Pr=br,Tr=_r,Ar=mr;export{yr as AllExtensions,Er as AnalyticsExtensions,Tr as ConversationsExtensions,kr as ErrorTrackingExtensions,Pr as ExperimentsExtensions,wr as FeatureFlagsExtensions,Ar as LogsExtensions,Sr as ProductToursExtensions,xr as SessionReplayExtensions,Fr as SiteAppsExtensions,Cr as SurveysExtensions,$r as ToolbarExtensions,Rr as TracingExtensions};
|
|
2
2
|
//# sourceMappingURL=extension-bundles.js.map
|