posthog-js 1.372.1 → 1.372.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/conversations.js +1 -1
- package/dist/conversations.js.map +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/dist/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/dist/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/dist/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js +3 -12
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js +2 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js +0 -2
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/src/extensions/conversations/external/components/styles.js +2 -2
- package/lib/src/extensions/conversations/external/components/styles.js.map +1 -1
- package/lib/src/extensions/conversations/external/index.js +3 -1
- package/lib/src/extensions/conversations/external/index.js.map +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.1",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),_=t=>null===t,b=t=>p(t)||_(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.Yt),this.Wt=S(t.refillRate,0,this.Ut,t.Yt),this.Gt=S(t.refillInterval,0,864e5,t.Yt)}Xt(t,e){var i=Math.floor((e-t.lastAccess)/this.Gt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Gt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Xt(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={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=T.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 A(t){var e=[];for(var i in t){var r=t[i];_(r)||p(r)||e.push({key:i,value:O(r)})}return e}function j(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 L{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:j(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 M="?";function D(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?M:i,in_app:!0};return p(r)||(n.lineno=r),p(s)||(n.colno=s),n}var N=(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]:M,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},U=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,z=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,H=/\((\S*)(?::(\d+))(?::(\d+))\)/,V=(t,e)=>{var i=U.exec(t);if(i){var[,r,s,n]=i;return D(e,r,M,+s,+n)}var a=z.exec(t);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=H.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=N(a[1]||M,a[2]);return D(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},W=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,B=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,J=(t,e)=>{var i=W.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=B.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]||M;return[n,s]=N(n,s),D(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},q=/\(error: (.*)\)/;class G{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 K{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 Y{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 X=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Z{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(X);return r&&(e=r[1],i=r[2]),[e,i]}}var Q=["fatal","error","warning","log","info","debug"];function tt(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 et{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: "+tt(t)}isSeverityLevel(t){return g(t)&&!(t=>g(t)&&0===t.trim().length)(t)&&Q.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 it{match(t){return k(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+tt(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class rt{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 st{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 nt="$message",at="$timestamp",ot=new Set([nt,at]),lt={enabled:!0,max_bytes:32768};function ut(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:lt.enabled,max_bytes:vt(t.max_bytes,lt.max_bytes)}:i({},lt)}class ht{constructor(t){this.Jt=[],this.Kt=0,this.Lt=ut(t)}setConfig(t){this.Lt=ut(t),this.Qt()}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[nt],n=r[at];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.Lt.max_bytes||(this.Jt.push({step:e.step,bytes:i}),this.Kt+=i,this.Qt())}}getAttachable(){return this.Jt.map((t=>t.step))}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var t=this.Jt.shift();t&&(this.Kt-=t.bytes)}}}function vt(t,e){if(!m(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var dt="undefined"!=typeof window?window:void 0,ct="undefined"!=typeof globalThis?globalThis:dt;"undefined"==typeof self&&(ct.self=ct),"undefined"==typeof File&&(ct.File=function(){});var ft=null==ct?void 0:ct.navigator,pt=null==ct?void 0:ct.document,gt=null==ct?void 0:ct.location;null!=ct&&ct.XMLHttpRequest&&new ct.XMLHttpRequest;var _t=null!=dt?dt:{},bt=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(dt&&(_t.POSTHOG_DEBUG||i)&&!p(dt.console)&&dt.console){for(var r=("__rrweb_original__"in dt.console[e]?dt.console[e].__rrweb_original__:dt.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)}},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)=>bt(t+" "+e,i)};return r},mt=bt("[PostHog.js]"),yt=mt.createLogger;function wt(t,e){if(!b(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 xt=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 Et(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 kt=function(t){try{return t()}catch(t){return}};function St(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 Ft(t){return"ph_toolbar_internal"===t.name}var Ct="$autocapture_disabled_server_side",Rt="$heatmaps_enabled_server_side",$t="$exception_capture_enabled_server_side",Pt="$error_tracking_suppression_rules",Tt="$error_tracking_capture_extension_exceptions",It="$web_vitals_enabled_server_side",Ot="$product_tours_enabled_server_side",At="$web_vitals_allowed_metrics",jt="$session_recording_remote_config",Lt="$enabled_feature_flags",Mt="$active_feature_flags",Dt="$early_access_features",Nt="$feature_flag_details",Ut="$feature_flag_payloads",zt="$feature_flag_request_id",Ht="$override_feature_flags",Vt="$override_feature_flag_payloads",Wt="$stored_person_properties",Bt="$stored_group_properties",Jt="$surveys",qt="$surveys_activated",Gt="ph_product_tours",Kt="$flag_call_reported",Yt="$flag_call_reported_session_id",Xt="$feature_flag_errors",Zt="$feature_flag_evaluated_at",Qt="__POSTHOG_TOOLBAR__",te="PostHog loadExternalDependency extension not found.",ee="visibilitychange",ie="beforeunload";function re(t){return t instanceof Element&&(t.id===Qt||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function se(t){return!!t&&1===t.nodeType}function ne(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function ae(t){return!!t&&3===t.nodeType}function oe(t){return!!t&&11===t.nodeType}function le(t){return t?l(t).split(/\s+/):[]}function ue(t){var e=null==dt?void 0:dt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function he(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 le(e)}function ve(t){return b(t)?null:l(t).split(/(\s+)/).filter((t=>$e(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function de(t){var e="";return we(t)&&!xe(t)&&t.childNodes&&t.childNodes.length&&wt(t.childNodes,(function(t){var i;ae(t)&&t.textContent&&(e+=null!==(i=ve(t.textContent))&&void 0!==i?i:"")})),l(e)}function ce(t){return p(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var fe=["a","button","form","input","select","textarea","label"];function pe(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 ge(t){var e=t.parentNode;return!(!e||!se(e))&&e}var _e=["next","previous","prev",">","<"],be=[".ph-no-rageclick",".ph-no-capture"];var me=t=>!t||ne(t,"html")||!se(t),ye=(t,e)=>{if(!dt||me(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!ne(s,"body");)if(oe(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ge(s);if(!n)break;if(e||fe.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=dt.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function we(t){for(var e=t;e.parentNode&&!ne(e,"body");e=e.parentNode){var i=he(e);if(o(i,"ph-sensitive")||o(i,"ph-no-capture"))return!1}if(o(he(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 xe(t){return!!(ne(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ne(t,"select")||ne(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ee="(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})",ke=new RegExp("^(?:"+Ee+")$"),Se=new RegExp(Ee),Fe="\\d{3}-?\\d{2}-?\\d{4}",Ce=new RegExp("^("+Fe+")$"),Re=new RegExp("("+Fe+")");function $e(t,e){if(void 0===e&&(e=!0),b(t))return!1;if(g(t)){if(t=l(t),(e?ke:Se).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ce:Re).test(t))return!1}return!0}function Pe(t){var e=de(t);return $e(e=(e+" "+Te(t)).trim())?e:""}function Te(t){var e="";return t&&t.childNodes&&t.childNodes.length&&wt(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=de(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Te(t)).trim())}catch(t){mt.error("[AutoCapture]",t)}})),e}function Ie(t){return t.replace(/"|\\"/g,'\\"')}function Oe(t){var e=t.attr__class;return e?d(e)?e:le(e):void 0}class Ae{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 je=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){mt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Le=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},Me=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},De="$copy_autocapture",Ne=yt("[AutoCapture]");function Ue(t,e){return e.length>t?e.slice(0,t)+"...":e}function ze(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!se(e));return e}function He(t,e){for(var r,s,{e:n,maskAllElementAttributes:a,maskAllText:l,elementAttributeIgnoreList:u,elementsChainAsString:h}=e,v=[t],d=t;d.parentNode&&!ne(d,"body");)oe(d.parentNode)?(v.push(d.parentNode.host),d=d.parentNode.host):(v.push(d.parentNode),d=d.parentNode);var c,f,_=[],b={},m=!1,y=!1;if(wt(v,(t=>{var e=we(t);"a"===t.tagName.toLowerCase()&&(m=t.getAttribute("href"),m=e&&m&&$e(m)&&m),o(he(t),"ph-no-capture")&&(y=!0),_.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};fe.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Ue(1024,Pe(t)):Ue(1024,de(t)));var a=he(t);a.length>0&&(n.classes=a.filter((function(t){return""!==t}))),wt(t.attributes,(function(i){var s;if((!xe(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&$e(i.value)&&(!g(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=i.value;"class"===i.name&&(a=le(a).join(" ")),n["attr__"+i.name]=Ue(1024,a)}}));for(var o=1,l=1,u=t;u=ze(u);)o++,u.tagName===t.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(t,a,l,u));var i=function(t){if(!we(t))return{};var e={};return wt(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&&$e(r)&&(e[i]=r)}})),e}(t);xt(b,i)})),y)return{props:{},explicitNoCapture:y};if(l||(_[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?Pe(t):de(t)),m){var w,x;_[0].attr__href=m;var E=null==(w=(t=>{var e=null==pt?void 0:pt.createElement("a");return p(e)?null:(e.href=t,e)})(m))?void 0:w.host,k=null==dt||null==(x=dt.location)?void 0:x.host;E&&k&&E!==k&&(c=m)}return{props:xt({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(f=_,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 Et(a).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Ie(e.toString())]=Ie(i.toString())})),(s+=":")+Et(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:Oe(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Et(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=_[0])&&r.$el_text?{$el_text:null==(s=_[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},b)}}var Ve=yt("[Dead Clicks]"),We=()=>!0;class Be{get lazyLoadedDeadClicksAutocapture(){return this.ar}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.lr((()=>{this.ur()})):this.stop()}lr(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?Ve.error("failed to load script",e):t()}))}ur(){var t;if(pt){if(!this.ar&&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.ar=_t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.ar.start(pt),Ve.info("starting...")}}else Ve.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,Ve.info("stopping..."))}}var Je=yt("[ExceptionAutocapture]");function qe(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 Ge=yt("[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 Ke{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 Ke(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 Ke(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 Ye{constructor(){this.I=0,this.S=0,this.k=new Qe}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 Ke.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 Xe,Ze=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};dt&&!p(dt.crypto)&&crypto.getRandomValues&&(Ze=t=>crypto.getRandomValues(t));class Qe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Ze(this.T),this.N=0),this.T[this.N++]}}var ti=()=>(Xe||(Xe=new Ye)).generate(),ei="",ii=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function ri(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=pt),ei)return ei;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_"+ti().toString();!ei&&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",ei=n)}return ei}(t);if(!i){var r=(t=>{var e=t.match(ii);return e?e[0]:""})(t);r!==i&&mt.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var si={R:()=>!!pt,B(t){mt.error("cookieStore error: "+t)},O(t){if(pt){try{for(var e=t+"=",i=pt.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(si.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(pt)try{var n="",a="",o=ri(pt.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&&mt.warn("cookieStore warning: large cookie, len="+u.length),pt.cookie=u,u}catch(t){return}},F(t,e){if(null!=pt&&pt.cookie)try{si.M(t,"",-1,e)}catch(t){return}}},ni=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ai=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ni],oi="<masked>",li=["li_fat_id"];function ui(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var hi=yt("[Web Vitals]"),vi=9e5,di=yt("[RemoteConfig]");class ci{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}Ar(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()}Er(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 di.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void di.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return di.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){di.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==pt?void 0:pt.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||di.error("Failed to fetch remote config from PostHog."),this._instance.Rr(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 fi="disabled",pi="lazy_loading",gi="awaiting_config",_i="missing_config",bi="base64",mi=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}},yi={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=>mi(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!mi(e,t))))),icontains:(t,e)=>e.map(wi).some((e=>t.map(wi).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(wi).every((e=>t.map(wi).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)))}))},wi=t=>t.toLowerCase();function xi(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(p(s)||_(s))return!1;var n=[String(s)],a=yi[r.operator];return!!a&&a(r.values,n)}))}yt("[SessionRecording]"),yt("[SessionRecording]");var Ei="[SessionRecording]",ki=yt(Ei),Si=yt("[Heatmaps]");function Fi(t){return f(t)&&"clientX"in t&&"clientY"in t&&m(t.clientX)&&m(t.clientY)}var Ci=yt("[Product Tours]"),Ri=["$set_once","$set"],$i=yt("[SiteApps]"),Pi="Error while initializing PostHog app with config id ",Ti="events",Ii="cancelEvents",Oi=yt("[Surveys]"),Ai=["popover","widget","api"];class ji{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}function Li(t,e,i){if(b(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 Mi{constructor(t){this.dn=new ji,this.vn=(t,e)=>this.fn(t,e)&&this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e),this.fn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.yn=new Set,this.bn=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.bn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.yn)||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.yn.has(t)||this.yn.has(null==e?void 0:e.event))&&this.bn&&(null==(i=this.bn)?void 0:i.size)>0&&this.bn.forEach((t=>{this._n(e,t)&&this.dn.emit("actionCaptured",t.name)}))}wn(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.vn(t,i))return!0;return!1}onAction(t,e){return this.dn.on(t,e)}pn(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(!Li(r,e.url,e.url_matching||"contains"))return!1}return!0}gn(t,e){return!!this.In(t,e)&&!!this.Cn(t,e)&&!!this.Sn(t,e)}In(t,e){var i;if(null==e||!e.href)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Li(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Li((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Cn(t,e){var i;if(null==e||!e.text)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Li(t.text,e.text,e.text_matching||"exact")||Li(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;!b(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=>Li(t,n,a))))}Sn(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}xn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}mn(t,e){return null==e||!e.properties||0===e.properties.length||xi(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 Di{constructor(t){this._instance=t,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(t,e){return!!t&&xi(t.propertyFilters,null==e?void 0:e.properties)}Rn(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}Nn(t,e,i){var r=(i===Ti?this.kn:this.Tn).get(t),s=[];return this.Mn((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.En(n,e)}))}register(t){var e;p(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fn(t),this.On(t))}On(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.Pn&&(this.Pn=new Mi(this._instance),this.Pn.init(),this.Pn.wn((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.Pn)||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.An.get(e.name);i&&i.push(t.id),this.An.set(e.name,i||[t.id])}})))})))}Fn(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.kn=this.Rn(t,Ti),this.Tn=this.Rn(t,Ii))}onEvent(t,e){var i,r=this.ue(),s=this.Ln(),n=this.Dn(),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.Bn(a))}}else{if(this.Tn.has(t)){var v=this.Nn(t,e,Ii);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.jn(t.id)})),this.Bn(a))}if(this.kn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.kn.get(t)});var d=this.Nn(t,e,Ti);this.Bn(a.concat(d.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Ln(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.An.has(t)&&this.Bn(r.concat(this.An.get(t)||[]))}Bn(t){var e=this.ue(),i=[...new Set(t)].filter((t=>!this.$n(t)));e.info("updating activated items",{activatedItems:i}),this.qn(i)}getActivatedIds(){var t,e=this.Ln();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class Ni extends Di{constructor(t){super(t)}Ln(){return qt}Dn(){return"survey shown"}Mn(t){var e;null==(e=this._instance)||e.getSurveys(t)}jn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ue(){return Oi}qn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[qt]:t})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ui="SDK is not enabled or survey functionality is not yet loaded",zi="Disabled. Not loading surveys.",Hi=null!=dt&&dt.location?Me(dt.location.hash,"__posthog")||Me(location.hash,"state"):null,Vi="_postHogToolbarParams",Wi=yt("[Toolbar]"),Bi=yt("[FeatureFlags]"),Ji=yt("[FeatureFlags]",{debugEnabled:!0}),qi="\" failed. Feature flags didn't load in time.",Gi=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ki=t=>{var e={};for(var[i,r]of Et(t||{}))r&&(e[i]=r);return e},Yi=yt("[Error tracking]"),Xi="Refusing to render web experiment since the viewer is a likely bot",Zi={icontains:(t,e)=>!!dt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!dt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!dt&&mi(e.href,t),not_regex:(t,e)=>!!dt&&!mi(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Qi{get Lt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Qi.Hn("retrieved web experiments from the server"),e.Vn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Vn&&(Qi.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Vn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);g(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Qi.Un(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Qi.Hn(Xi);else if(!this.Lt.disable_web_experiments){if(b(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Qi.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Vn&&null!=(e=this.Vn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Vn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Qi.getWindowLocation();if(null!=t&&t.search){var e=je(null==t?void 0:t.search,"__experiment_id"),i=je(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Qi.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Yn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Lt.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.Lt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Yn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Qi.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Un(t){return!b(t.conditions)&&Qi.Wn(t)&&Qi.Gn(t)}static Wn(t){var e;if(b(t.conditions)||b(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Qi.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Zi[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==dt?void 0:dt.location}static Gn(t){var e;if(b(t.conditions)||b(null==(e=t.conditions)?void 0:e.utm))return!0;var i=function(t,e,i){if(!pt)return{};var r,s,n,a=(r=Le(pt.URL,[],oi),s=ai.concat([]),n={},wt(s,(function(t){var e=je(r,t);n[t]=e||null})),n),o=function(){var t={};return wt(li,(function(e){var i=si.O(e);t[e]=i||null})),t}();return xt(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 Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];mt.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Qi.Hn(Xi):"control"!==e?i.forEach((i=>{if(i.selector){var r;Qi.Hn("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)}))}})):Qi.Hn("Control variants leave the page unmodified.")}_is_bot(){return ft&&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}(ft,this.Lt.custom_blocked_useragents):void 0}}var tr=yt("[Conversations]"),er="Conversations not available yet.",ir={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return null!==(t=null==(e=this.ii)?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Bi.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=null!==(t=this.Lt.evaluation_contexts)&&void 0!==t?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Bi.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Bi.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}hs(){return this.us().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.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(Nt),e=this.ss(Ht),r=this.ss(Vt);if(!r&&!e)return t||{};var s=xt({},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.Xn||(Bi.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Xn=!0),s}getFlagVariants(){var t=this.ss(Lt),e=this.ss(Ht);if(!e)return t||{};for(var i=xt({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Bi.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xn=!0),i}getFlagPayloads(){var t=this.ss(Ut),e=this.ss(Vt);if(!e)return t||{};for(var i=xt({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Bi.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xn=!0),i}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.ds()}),5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var r=this.Lt.token,s=this.ss("$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.ii)?void 0:e.get_initial_props())||{},this.ss(Wt)||{}),group_properties:this.ss(Bt),timezone:ui()};_(s)||p(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.hs()&&(n.evaluation_contexts=this.us());var a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Lt.disable_compression?void 0:bi,timeout:this.Lt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!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.ii)||r.register({[Xt]:a}),l)Bi.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.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){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 Bi.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.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],a=String(s),o=this.ss(zt)||void 0,l=this.ss(Zt)||void 0,u=this.ss(Kt)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var h,v=this._instance.get_session_id(),c=this.ss(Yt);v&&v!==c&&(u={},null==(h=this.ii)||h.register({[Kt]:u,[Yt]: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.ii)||f.register({[Kt]:u});var S=this.getFeatureFlagDetails(t),F=[...null!==(g=this.ss(Xt))&&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==(_=this.Lt.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])||null,$feature_flag_bootstrapped_payload:(null==(b=this.Lt.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])||null,$used_bootstrap_value:!this.ts};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 Bi.warn('getFeatureFlagResult for key "'+t+qi)}getRemoteConfigPayload(t,e){var i=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:bi,timeout:this.Lt.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.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return p(i)?void 0:!!i}Bi.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.ii){this.Jn=!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]})))):Bi.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)){Bi.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({[Mt]:u,[Lt]:f})}else{var g=u,_=h,b=l;if(null!=a&&a.partialResponse)g=i({},r,g),_=i({},s,_),b=i({},n,b);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)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),b=i({},n,Object.fromEntries(Object.entries(b||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else g=i({},r,g),_=i({},s,_),b=i({},n,b);e&&e.register(i({[Mt]:Object.keys(Ki(g)),[Lt]:g||{},[Ut]:_||{},[Nt]:b||{}},v?{[zt]:v}:{},c?{[Zt]:c}:{}))}}}(t,this.ii,s,n,a,r),e||(this.ns=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),Bi.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Bi.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ii.unregister(Ht),this.ii.unregister(Vt),this.fs(),Ji.info("All overrides cleared");if(d(t)){var e=Gi(t);return this.ii.register({[Ht]:e}),this.fs(),Ji.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Xn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ii.unregister(Ht),Ji.info("Flag overrides cleared");else if(r.flags){if(d(r.flags)){var s=Gi(r.flags);this.ii.register({[Ht]:s})}else this.ii.register({[Ht]:r.flags});Ji.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ii.unregister(Vt),Ji.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[Vt]:r.payloads}),Ji.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.ii.register({[Ht]:t}),this.fs(),Ji.info("Flag overrides set",{flags:t});Bi.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.ss(Dt)||[]).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.ii)||s.register({[Mt]:Object.keys(Ki(l)),[Lt]:l}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ss(Dt),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.Lt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ii)||i.unregister(Dt),null==(r=this.ii)||r.register({[Dt]:s}),t(s)}}})}ps(){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)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(Wt)||{},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({[Wt]:i({},r,a,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Wt)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(Bt)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[Bt]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(Bt)||{};this._instance.register({[Bt]:i({},e,{[t]:{}})})}else this._instance.unregister(Bt)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},rr={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===gi||this.ys===_i?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=fi,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw ki.error("started without valid sessionManager"),new Error(Ei+" started without valid sessionManager. This is a bug.");if("always"===this.Lt.cookieless_mode)throw new Error(Ei+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(jt))||!t.enabled),i=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return dt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!p(Object.assign)&&!p(Array.from);this._s&&i?(this.ws(t),ki.info("starting")):(this.ys=fi,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==gi&&this.ys!==_i&&(this.ys=pi),null!=_t&&null!=(e=_t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=_t.__PosthogExtensions__)&&i.initSessionRecording?this.Is(t):null==(r=_t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,(e=>{if(e)return ki.error("could not load recorder",e);this.Is(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}xs(){var t;null==(t=this.ii)||t.unregister("$session_is_sampled")}ks(t,e){if(b(t))return null;var i,r=m(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(ki.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,r,s=this.ii,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ks(null==(e=this.Lt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),a=this.ks(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;b(o)&&this.xs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[jt]: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.bs)||e.call(this),this.bs=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===gi&&(this.ys=_i,ki.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.gs)&&i.log?this.gs.log(t,e):ki.warn("log called before recorder was ready")}get Cs(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(jt);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(jt);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}Is(t){var e,i;if(null==(e=_t.__PosthogExtensions__)||!e.initSessionRecording)return ki.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.gs||(this.gs=null==(i=_t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As()){if(this.ys===_i||this.ys===gi)return;return this.ys=gi,ki.info("persisted remote config is stale, requesting fresh config before starting"),void new ci(this._instance).load()}this.ys=pi,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.ii)||e.register({$replay_override_linked_flag:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.ii)||e.register({$replay_override_sampling:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.ii)||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},sr={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new Ae(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){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}Fs(){if(this.isBrowserSupported()){if(dt&&pt){var t=t=>{t=t||(null==dt?void 0:dt.event);try{this.Os(t)}catch(t){Ne.error("Failed to capture event",t)}};if(St(pt,"submit",t,{capture:!0}),St(pt,"change",t,{capture:!0}),St(pt,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=t=>{this.Os(t=t||(null==dt?void 0:dt.event),De)};St(pt,"copy",e,{capture:!0}),St(pt,"cut",e,{capture:!0})}}}else Ne.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ct]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ms)||e.forEach((e=>{var r=null==pt?void 0:pt.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[Ct];if(_(this.Rs)&&!y(i)&&!this.instance.Mr())return!1;var r=null!==(e=this.Rs)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Os(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ce(t);ae(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(!dt||me(t))return!1;var i,r,s;if(y(e)?(i=!!e&&be,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:be,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=ye(t,!1);return!function(t,e){if(!1===t||p(t))return!1;var i;if(!0===t)i=_e;else{if(!d(t))return!1;if(t.length>10)return mt.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:de(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!pe(n,i)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var s=e===De;if(r&&function(t,e,i,r,s){var n,a,o,l;if(void 0===i&&(i=void 0),!dt||me(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!ue(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&ue(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}=ye(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(!pe(v,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=dt.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&&(fe.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Lt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=He(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),e===De){var l,u=ve(null==dt||null==(l=dt.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==pt?void 0:pt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(null==dt||null==(e=dt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(mt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,mt.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(dt&&dt.history){var i=this;null!=(t=dt.history.pushState)&&t.__posthog_wrapped__||qe(dt.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("pushState")})),null!=(e=dt.history.replaceState)&&e.__posthog_wrapped__||qe(dt.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("replaceState")})),this.Bs()}}Ds(t){try{var e,i=null==dt||null==(e=dt.location)?void 0:e.pathname;if(!i)return;i!==this.Ps&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.Ps=i}catch(e){mt.error("Error capturing "+t+" pageview",e)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};St(dt,"popstate",t),this.Ls=()=>{dt&&dt.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!(null==(e=this.instance.persistence)||!e.props[Rt]),this.rageclicks=new Ae(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return f(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return b(this.Lt.capture_heatmaps)?b(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:!1!==this.Lt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Es)return;Si.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval(null!==(t=this.$s)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Rt]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s="visible"===(null==pt?void 0:pt.visibilityState)?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){dt&&pt&&(this.Vs=this.Ur.bind(this),St(dt,ie,this.Vs),this.zs=t=>this.At(t||(null==dt?void 0:dt.event)),St(pt,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||(null==dt?void 0:dt.event)),St(pt,"mousemove",this.Us,{capture:!0}),this.Ws=new Be(this.instance,We,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),St(pt,ee,this.Gs),this.Es=!0)}Zs(){var t;dt&&pt&&(this.Vs&&dt.removeEventListener(ie,this.Vs),this.zs&&pt.removeEventListener("click",this.zs,{capture:!0}),this.Us&&pt.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&&pt.removeEventListener(ee,this.Gs),clearTimeout(this.Xs),null==(t=this.Ws)||t.stop(),this.Es=!1)}Js(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&&se(r)&&!ne(r,"body");){if(r===i)return!1;if(o(e,null==dt?void 0:dt.getComputedStyle(r).position))return!0;r=ge(r)}return!1}(ce(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}At(t,e){var r;if(void 0===e&&(e="click"),!re(t.target)&&Fi(t)){var s=this.Js(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Ks(i({},s,{type:"rageclick"})),this.Ks(s)}}Ys(t){!re(t.target)&&Fi(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout((()=>{this.Ks(this.Js(t,"mousemove"))}),500))}Ks(t){if(dt){var e=dt.location.href,i=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...ni,...i||[]]:[],s=Le(e,r,oi);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Ur(){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:Be,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),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.dt=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(p(r))hi.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();p(s)||(b(null==t?void 0:t.name)||b(null==t?void 0:t.value)?hi.error("Invalid metric received",t):!this.io||this.io>t.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,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.Qs()):hi.error("Ignoring metric with value >= "+this.io,t))}},this.no=()=>{if(!this.Es){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.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.dt.bind(this)),this.Es=!0):hi.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!(null==(e=this._instance.persistence)||!e.props[It]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=f(this.so)?null==(t=this.so)?void 0:t.web_vitals_allowed_metrics:void 0;return b(i)?(null==(e=this._instance.persistence)?void 0:e.props[At])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(f(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=f(this.so)?this.so.web_vitals_attribution:void 0;return null!=t&&t}get io(){var t=f(this.so)&&m(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:vi;return t>0&&6e4>=t?vi:t}get isEnabled(){var t=null==gt?void 0:gt.protocol;if("http:"!==t&&"https:"!==t)return hi.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=f(this.so)?this.so.web_vitals:y(this.so)?this.so:void 0;return y(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(hi.info("enabled, starting..."),this.lr(this.no))}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({[At]:i})),this.js=e,this.startIfEnabled()}}lr(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?hi.error("failed to load script",e):t()}))}ro(){var t=dt?dt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ni,...e||[]]:[];return Le(t,i,oi)}hi.error("Could not determine current URL")}}},nr={exceptionObserver:class{constructor(t){var e,i,r;this.no=()=>{var t;if(dt&&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.oo&&this.Lt.capture_unhandled_errors&&(this.oo=e(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=r(this.captureException.bind(this)))}catch(t){Je.error("failed to start",t),this.uo()}}},this._instance=t,this.ho=!(null==(e=this._instance.persistence)||!e.props[$t]),this.co=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,Yt:Je}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){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.ho:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Je.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(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 Je.error("failed to load script",e);t()}))}uo(){var t,e,i;null==(t=this.oo)||t.call(this),this.oo=void 0,null==(e=this.ao)||e.call(this),this.ao=void 0,null==(i=this.lo)||i.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[$t]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}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.co.consumeRateLimit(s)?Je.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.vo=[],this.fo=new L([new G,new st,new Y,new K,new it,new et,new Z,new rt],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=q.test(l)?l.replace(q,"$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||M});var r}))}(n)}}("web:javascript",V,J)),this._instance=t,this.vo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(Pt))&&void 0!==e?e:[],this.po=ut(this.mo()),this.yo=new ht(this.po)}onConfigChange(){this.po=ut(this.mo()),this.yo.setConfig(this.po)}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.vo=s,this._instance.persistence&&this._instance.persistence.register({[Pt]:this.vo,[Tt]:n})}}get bo(){var t,e=!!this._instance.get_property(Tt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!g(t)||0===t.trim().length)return void Yi.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)=>ot.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Yi.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.yo.add(i({[nt]:t,[at]:(new Date).toISOString()},s))}catch(t){Yi.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void Yi.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void Yi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Yi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.po.enabled&&b(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(t){return Yi.error("Failed to capture exception event. Dropping this exception.",t),void this.yo.clear()}}catch(t){return void Yi.error("Failed to process exception event. Ignoring this exception.",t)}}ko(t){try{var e=this.yo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Yi.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.po.enabled&&this.yo.add({[nt]:t,[at]:(new Date).toISOString()})}_o(t){return f(t)?i({},t):{}}mo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Io(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.vo.some((t=>{var i=t.values.map((t=>{var i,r=yi[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)}))}So(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://")))}xo(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}wo(t){return!b(t)&&d(t)}}},ar=i({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[Ot]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(Ot)||this.lr((()=>this.Eo()))}lr(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?Ci.error("Could not load product tours script",e):t()}))}Eo(){var t;!this.To&&null!=(t=_t.__PosthogExtensions__)&&t.generateProductTours&&(this.To=_t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!d(this.Ao)||e){var i=this.ii;if(i){var r=i.props[Gt];if(d(r)&&!e)return this.Ao=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 Ci.error(s),void t([],{isLoaded:!1,error:s})}var n=d(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[Gt]:n}),t(n,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){b(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.To)||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr((()=>{var e;this.Eo(),null==(e=this.To)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.To)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.To)||t.nextStep()}previousStep(){var t;null==(t=this.To)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.ii)||t.unregister(Gt)}resetTour(t){var e;null==(e=this.To)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.To)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.To)||e.cancelPendingTour(t)}}},ir),or={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var i=this.globalsForEvent(e);this.Ro.push(i),this.Ro.length>1e3&&(this.Ro=this.Ro.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.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=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,Ri),{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.Ro.length&&($i.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.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.Mo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,$i.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){$i.error(Pi+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){$i.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Fo(){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)}Oo(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){$i.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.Fo(),void this._instance.on("eventCaptured",(t=>this.Oo(t)))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Mo)||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 $i.error(Pi+t,e)}))};for(var{id:a,url:o}of t.siteApps)n(a)}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},lr={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var t,e,i=this.Do()||[];p(this.Po)&&(null==(t=_t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),p(this.Lo)&&(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()}lr(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 Ge.error("failed to load script",e);t()}))}Do(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):(null==(t=this.Po)||t.call(this),null==(e=this.Lo)||e.call(this),this.Po=void 0,this.Lo=void 0)}}},ur=i({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(b(e))return Oi.warn("Flags not loaded yet. Not loading surveys.");var i=d(e);this.Bo=i?e.length>0:e,Oi.info("flags response received, isSurveysEnabled: "+this.Bo),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.jo)Oi.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)Oi.info(zi);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())Oi.info("Not loading surveys in cookieless mode without consent.");else{var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){if(!p(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var i=t.generateSurveys;if(i)return void this.Zo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(te);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.jo=!1}}}else Oi.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ni(this._instance),Oi.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){Oi.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Lt.disable_surveys)return Oi.info(zi),t([]);var i,r=this._instance.get_property(Jt);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.qo?this.qo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.qo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:e=>{var r;this.qo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Oi.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({[Jt]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Oi.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!b(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Oi.warn("init was not called")}zo(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}Uo(t){if(b(this._surveyManager))return{eligible:!1,reason:Ui};var e="string"==typeof t?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(b(this._surveyManager))return Oi.warn("init was not called"),{visible:!1,disabledReason:Ui};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return b(this._surveyManager)?(Oi.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ui})):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.Uo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(b(this._surveyManager))Oi.warn("init was not called");else{var s="string"==typeof t?this.zo(t):t;if(null!=s&&s.id)if(Ai.includes(s.type)){var n=null==pt?void 0:pt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Oi.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Oi.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),Oi.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Oi.warn("Survey element not found")}else Oi.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Oi.warn("Survey not found")}}displaySurvey(t,e){var r;if(b(this._surveyManager))Oi.warn("init was not called");else{var s=this.zo(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&&Oi.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 Oi.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 Oi.warn("Survey not found")}}cancelPendingSurvey(t){b(this._surveyManager)?Oi.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},ir),hr={toolbar:class{constructor(t){this.instance=t}Yo(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),Ft(this.instance.config))return!1;if(!dt||!pt)return!1;t=null!=t?t:dt.location,i=null!=i?i:dt.history;try{if(!e){try{dt.localStorage.setItem("test","test"),dt.localStorage.removeItem("test")}catch(t){return!1}e=null==dt?void 0:dt.localStorage}var r,s=Hi||Me(t.hash,"__posthog")||Me(t.hash,"state"),n=s?kt((()=>JSON.parse(atob(decodeURIComponent(s)))))||kt((()=>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(Vi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Go(t){var e=_t.ph_load_toolbar||_t.ph_load_editor;!b(e)&&c(e)?e(t,this.instance):Wi.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==pt||!pt.getElementById(Qt));if(!dt||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(dt.localStorage.setItem(Vi,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Go(s);else if(0===this.Wo()){var n;this.Yo(1),null==(n=_t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Wi.error("[Toolbar] Failed to load",t),void this.Yo(0);this.Yo(2),this.Go(s)})),St(dt,"turbolinks:load",(()=>{this.Yo(0),this.loadToolbar(s)}))}return!0}Xo(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)}}},vr=i({experiments:Qi},ir),dr={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;b(e)||(y(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||Ft(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t&&!p(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var i=t.loadExternalDependency;if(!i)return void this.ta(te);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ta("Could not load conversations script",e):this.ea(t.initConversations),this.Ko=!1}))}catch(t){this.ta("Error initializing conversations",t),this.Ko=!1}}else tr.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),tr.info("Conversations loaded successfully")}catch(t){this.ta("Error completing conversations initialization",t)}else tr.error("Cannot complete initialization: remote config is null")}ta(t,e){tr.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():tr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Jo&&!_(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):(tr.warn(er),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(tr.warn(er),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(tr.warn(er),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(tr.warn(er),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(tr.warn(er),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(tr.warn(er),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(tr.warn(er),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}ln(){var t;null==(t=this._conversationsManager)||t.setIdentity()}un(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},cr={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=yt("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!b(i)&&i&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){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.Yt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ia=!0)})):this.Yt.error(te)}else this.Yt.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.oa||(this.oa=h,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var v=function(t,e){var r=t.level||"info",{text:s,number:n}=T[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:A(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.la());this.na.push({record:v}),(null!==(a=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==a?a:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={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.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),0!==this.na.length){var e=this.na;this.na=[];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:A(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.Zi({method:"POST",url:l,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout((()=>{this.Br=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}la(){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}}},fr=i({},ir,rr,sr,nr,ar,or,ur,lr,hr,vr,dr,cr),pr=ir,gr=rr,_r=sr,br=nr,mr=ar,yr=or,wr=ur,xr=lr,Er=hr,kr=vr,Sr=dr,Fr=cr;export{fr as AllExtensions,_r as AnalyticsExtensions,Sr as ConversationsExtensions,br as ErrorTrackingExtensions,kr as ExperimentsExtensions,pr as FeatureFlagsExtensions,Fr as LogsExtensions,mr as ProductToursExtensions,gr as SessionReplayExtensions,yr as SiteAppsExtensions,wr as SurveysExtensions,Er as ToolbarExtensions,xr 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.2",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),_=t=>null===t,b=t=>p(t)||_(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.Yt),this.Wt=S(t.refillRate,0,this.Ut,t.Yt),this.Gt=S(t.refillInterval,0,864e5,t.Yt)}Xt(t,e){var i=Math.floor((e-t.lastAccess)/this.Gt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Gt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Xt(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={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=T.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 A(t){var e=[];for(var i in t){var r=t[i];_(r)||p(r)||e.push({key:i,value:O(r)})}return e}function j(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 L{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:j(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 M="?";function D(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?M:i,in_app:!0};return p(r)||(n.lineno=r),p(s)||(n.colno=s),n}var N=(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]:M,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},U=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,z=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,H=/\((\S*)(?::(\d+))(?::(\d+))\)/,V=(t,e)=>{var i=U.exec(t);if(i){var[,r,s,n]=i;return D(e,r,M,+s,+n)}var a=z.exec(t);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=H.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=N(a[1]||M,a[2]);return D(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},W=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,B=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,J=(t,e)=>{var i=W.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=B.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]||M;return[n,s]=N(n,s),D(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},q=/\(error: (.*)\)/;class G{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 K{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 Y{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 X=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Z{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(X);return r&&(e=r[1],i=r[2]),[e,i]}}var Q=["fatal","error","warning","log","info","debug"];function tt(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 et{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: "+tt(t)}isSeverityLevel(t){return g(t)&&!(t=>g(t)&&0===t.trim().length)(t)&&Q.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 it{match(t){return k(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+tt(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class rt{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 st{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 nt="$message",at="$timestamp",ot=new Set([nt,at]),lt={enabled:!0,max_bytes:32768};function ut(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:lt.enabled,max_bytes:vt(t.max_bytes,lt.max_bytes)}:i({},lt)}class ht{constructor(t){this.Jt=[],this.Kt=0,this.Lt=ut(t)}setConfig(t){this.Lt=ut(t),this.Qt()}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[nt],n=r[at];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.Lt.max_bytes||(this.Jt.push({step:e.step,bytes:i}),this.Kt+=i,this.Qt())}}getAttachable(){return this.Jt.map((t=>t.step))}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var t=this.Jt.shift();t&&(this.Kt-=t.bytes)}}}function vt(t,e){if(!m(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var dt="undefined"!=typeof window?window:void 0,ct="undefined"!=typeof globalThis?globalThis:dt;"undefined"==typeof self&&(ct.self=ct),"undefined"==typeof File&&(ct.File=function(){});var ft=null==ct?void 0:ct.navigator,pt=null==ct?void 0:ct.document,gt=null==ct?void 0:ct.location;null!=ct&&ct.XMLHttpRequest&&new ct.XMLHttpRequest;var _t=null!=dt?dt:{},bt=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(dt&&(_t.POSTHOG_DEBUG||i)&&!p(dt.console)&&dt.console){for(var r=("__rrweb_original__"in dt.console[e]?dt.console[e].__rrweb_original__:dt.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)}},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)=>bt(t+" "+e,i)};return r},mt=bt("[PostHog.js]"),yt=mt.createLogger;function wt(t,e){if(!b(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 xt=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 Et(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 kt=function(t){try{return t()}catch(t){return}};function St(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 Ft(t){return"ph_toolbar_internal"===t.name}var Ct="$autocapture_disabled_server_side",Rt="$heatmaps_enabled_server_side",$t="$exception_capture_enabled_server_side",Pt="$error_tracking_suppression_rules",Tt="$error_tracking_capture_extension_exceptions",It="$web_vitals_enabled_server_side",Ot="$product_tours_enabled_server_side",At="$web_vitals_allowed_metrics",jt="$session_recording_remote_config",Lt="$enabled_feature_flags",Mt="$active_feature_flags",Dt="$early_access_features",Nt="$feature_flag_details",Ut="$feature_flag_payloads",zt="$feature_flag_request_id",Ht="$override_feature_flags",Vt="$override_feature_flag_payloads",Wt="$stored_person_properties",Bt="$stored_group_properties",Jt="$surveys",qt="$surveys_activated",Gt="ph_product_tours",Kt="$flag_call_reported",Yt="$flag_call_reported_session_id",Xt="$feature_flag_errors",Zt="$feature_flag_evaluated_at",Qt="__POSTHOG_TOOLBAR__",te="PostHog loadExternalDependency extension not found.",ee="visibilitychange",ie="beforeunload";function re(t){return t instanceof Element&&(t.id===Qt||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function se(t){return!!t&&1===t.nodeType}function ne(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function ae(t){return!!t&&3===t.nodeType}function oe(t){return!!t&&11===t.nodeType}function le(t){return t?l(t).split(/\s+/):[]}function ue(t){var e=null==dt?void 0:dt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function he(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 le(e)}function ve(t){return b(t)?null:l(t).split(/(\s+)/).filter((t=>$e(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function de(t){var e="";return we(t)&&!xe(t)&&t.childNodes&&t.childNodes.length&&wt(t.childNodes,(function(t){var i;ae(t)&&t.textContent&&(e+=null!==(i=ve(t.textContent))&&void 0!==i?i:"")})),l(e)}function ce(t){return p(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var fe=["a","button","form","input","select","textarea","label"];function pe(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 ge(t){var e=t.parentNode;return!(!e||!se(e))&&e}var _e=["next","previous","prev",">","<"],be=[".ph-no-rageclick",".ph-no-capture"];var me=t=>!t||ne(t,"html")||!se(t),ye=(t,e)=>{if(!dt||me(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!ne(s,"body");)if(oe(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ge(s);if(!n)break;if(e||fe.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=dt.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function we(t){for(var e=t;e.parentNode&&!ne(e,"body");e=e.parentNode){var i=he(e);if(o(i,"ph-sensitive")||o(i,"ph-no-capture"))return!1}if(o(he(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 xe(t){return!!(ne(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ne(t,"select")||ne(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ee="(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})",ke=new RegExp("^(?:"+Ee+")$"),Se=new RegExp(Ee),Fe="\\d{3}-?\\d{2}-?\\d{4}",Ce=new RegExp("^("+Fe+")$"),Re=new RegExp("("+Fe+")");function $e(t,e){if(void 0===e&&(e=!0),b(t))return!1;if(g(t)){if(t=l(t),(e?ke:Se).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ce:Re).test(t))return!1}return!0}function Pe(t){var e=de(t);return $e(e=(e+" "+Te(t)).trim())?e:""}function Te(t){var e="";return t&&t.childNodes&&t.childNodes.length&&wt(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=de(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Te(t)).trim())}catch(t){mt.error("[AutoCapture]",t)}})),e}function Ie(t){return t.replace(/"|\\"/g,'\\"')}function Oe(t){var e=t.attr__class;return e?d(e)?e:le(e):void 0}class Ae{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 je=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){mt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Le=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},Me=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},De="$copy_autocapture",Ne=yt("[AutoCapture]");function Ue(t,e){return e.length>t?e.slice(0,t)+"...":e}function ze(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!se(e));return e}function He(t,e){for(var r,s,{e:n,maskAllElementAttributes:a,maskAllText:l,elementAttributeIgnoreList:u,elementsChainAsString:h}=e,v=[t],d=t;d.parentNode&&!ne(d,"body");)oe(d.parentNode)?(v.push(d.parentNode.host),d=d.parentNode.host):(v.push(d.parentNode),d=d.parentNode);var c,f,_=[],b={},m=!1,y=!1;if(wt(v,(t=>{var e=we(t);"a"===t.tagName.toLowerCase()&&(m=t.getAttribute("href"),m=e&&m&&$e(m)&&m),o(he(t),"ph-no-capture")&&(y=!0),_.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};fe.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Ue(1024,Pe(t)):Ue(1024,de(t)));var a=he(t);a.length>0&&(n.classes=a.filter((function(t){return""!==t}))),wt(t.attributes,(function(i){var s;if((!xe(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&$e(i.value)&&(!g(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=i.value;"class"===i.name&&(a=le(a).join(" ")),n["attr__"+i.name]=Ue(1024,a)}}));for(var o=1,l=1,u=t;u=ze(u);)o++,u.tagName===t.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(t,a,l,u));var i=function(t){if(!we(t))return{};var e={};return wt(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&&$e(r)&&(e[i]=r)}})),e}(t);xt(b,i)})),y)return{props:{},explicitNoCapture:y};if(l||(_[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?Pe(t):de(t)),m){var w,x;_[0].attr__href=m;var E=null==(w=(t=>{var e=null==pt?void 0:pt.createElement("a");return p(e)?null:(e.href=t,e)})(m))?void 0:w.host,k=null==dt||null==(x=dt.location)?void 0:x.host;E&&k&&E!==k&&(c=m)}return{props:xt({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(f=_,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 Et(a).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Ie(e.toString())]=Ie(i.toString())})),(s+=":")+Et(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:Oe(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Et(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=_[0])&&r.$el_text?{$el_text:null==(s=_[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},b)}}var Ve=yt("[Dead Clicks]"),We=()=>!0;class Be{get lazyLoadedDeadClicksAutocapture(){return this.ar}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.lr((()=>{this.ur()})):this.stop()}lr(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?Ve.error("failed to load script",e):t()}))}ur(){var t;if(pt){if(!this.ar&&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.ar=_t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.ar.start(pt),Ve.info("starting...")}}else Ve.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,Ve.info("stopping..."))}}var Je=yt("[ExceptionAutocapture]");function qe(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 Ge=yt("[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 Ke{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 Ke(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 Ke(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 Ye{constructor(){this.I=0,this.S=0,this.k=new Qe}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 Ke.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 Xe,Ze=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};dt&&!p(dt.crypto)&&crypto.getRandomValues&&(Ze=t=>crypto.getRandomValues(t));class Qe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Ze(this.T),this.N=0),this.T[this.N++]}}var ti=()=>(Xe||(Xe=new Ye)).generate(),ei="",ii=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function ri(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=pt),ei)return ei;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_"+ti().toString();!ei&&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",ei=n)}return ei}(t);if(!i){var r=(t=>{var e=t.match(ii);return e?e[0]:""})(t);r!==i&&mt.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var si={R:()=>!!pt,B(t){mt.error("cookieStore error: "+t)},O(t){if(pt){try{for(var e=t+"=",i=pt.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(si.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(pt)try{var n="",a="",o=ri(pt.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&&mt.warn("cookieStore warning: large cookie, len="+u.length),pt.cookie=u,u}catch(t){return}},F(t,e){if(null!=pt&&pt.cookie)try{si.M(t,"",-1,e)}catch(t){return}}},ni=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ai=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ni],oi="<masked>",li=["li_fat_id"];function ui(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var hi=yt("[Web Vitals]"),vi=9e5,di=yt("[RemoteConfig]");class ci{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}Ar(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()}Er(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 di.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void di.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return di.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){di.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==pt?void 0:pt.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||di.error("Failed to fetch remote config from PostHog."),this._instance.Rr(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 fi="disabled",pi="lazy_loading",gi="awaiting_config",_i="missing_config",bi="base64",mi=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}},yi={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=>mi(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!mi(e,t))))),icontains:(t,e)=>e.map(wi).some((e=>t.map(wi).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(wi).every((e=>t.map(wi).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)))}))},wi=t=>t.toLowerCase();function xi(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(p(s)||_(s))return!1;var n=[String(s)],a=yi[r.operator];return!!a&&a(r.values,n)}))}yt("[SessionRecording]"),yt("[SessionRecording]");var Ei="[SessionRecording]",ki=yt(Ei),Si=yt("[Heatmaps]");function Fi(t){return f(t)&&"clientX"in t&&"clientY"in t&&m(t.clientX)&&m(t.clientY)}var Ci=yt("[Product Tours]"),Ri=["$set_once","$set"],$i=yt("[SiteApps]"),Pi="Error while initializing PostHog app with config id ",Ti="events",Ii="cancelEvents",Oi=yt("[Surveys]"),Ai=["popover","widget","api"];class ji{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}function Li(t,e,i){if(b(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 Mi{constructor(t){this.dn=new ji,this.vn=(t,e)=>this.fn(t,e)&&this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e),this.fn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.yn=new Set,this.bn=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.bn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.yn)||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.yn.has(t)||this.yn.has(null==e?void 0:e.event))&&this.bn&&(null==(i=this.bn)?void 0:i.size)>0&&this.bn.forEach((t=>{this._n(e,t)&&this.dn.emit("actionCaptured",t.name)}))}wn(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.vn(t,i))return!0;return!1}onAction(t,e){return this.dn.on(t,e)}pn(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(!Li(r,e.url,e.url_matching||"contains"))return!1}return!0}gn(t,e){return!!this.In(t,e)&&!!this.Cn(t,e)&&!!this.Sn(t,e)}In(t,e){var i;if(null==e||!e.href)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Li(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Li((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Cn(t,e){var i;if(null==e||!e.text)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Li(t.text,e.text,e.text_matching||"exact")||Li(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;!b(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=>Li(t,n,a))))}Sn(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}xn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}mn(t,e){return null==e||!e.properties||0===e.properties.length||xi(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 Di{constructor(t){this._instance=t,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(t,e){return!!t&&xi(t.propertyFilters,null==e?void 0:e.properties)}Rn(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}Nn(t,e,i){var r=(i===Ti?this.kn:this.Tn).get(t),s=[];return this.Mn((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.En(n,e)}))}register(t){var e;p(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fn(t),this.On(t))}On(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.Pn&&(this.Pn=new Mi(this._instance),this.Pn.init(),this.Pn.wn((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.Pn)||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.An.get(e.name);i&&i.push(t.id),this.An.set(e.name,i||[t.id])}})))})))}Fn(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.kn=this.Rn(t,Ti),this.Tn=this.Rn(t,Ii))}onEvent(t,e){var i,r=this.ue(),s=this.Ln(),n=this.Dn(),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.Bn(a))}}else{if(this.Tn.has(t)){var v=this.Nn(t,e,Ii);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.jn(t.id)})),this.Bn(a))}if(this.kn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.kn.get(t)});var d=this.Nn(t,e,Ti);this.Bn(a.concat(d.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Ln(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.An.has(t)&&this.Bn(r.concat(this.An.get(t)||[]))}Bn(t){var e=this.ue(),i=[...new Set(t)].filter((t=>!this.$n(t)));e.info("updating activated items",{activatedItems:i}),this.qn(i)}getActivatedIds(){var t,e=this.Ln();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class Ni extends Di{constructor(t){super(t)}Ln(){return qt}Dn(){return"survey shown"}Mn(t){var e;null==(e=this._instance)||e.getSurveys(t)}jn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ue(){return Oi}qn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[qt]:t})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ui="SDK is not enabled or survey functionality is not yet loaded",zi="Disabled. Not loading surveys.",Hi=null!=dt&&dt.location?Me(dt.location.hash,"__posthog")||Me(location.hash,"state"):null,Vi="_postHogToolbarParams",Wi=yt("[Toolbar]"),Bi=yt("[FeatureFlags]"),Ji=yt("[FeatureFlags]",{debugEnabled:!0}),qi="\" failed. Feature flags didn't load in time.",Gi=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ki=t=>{var e={};for(var[i,r]of Et(t||{}))r&&(e[i]=r);return e},Yi=yt("[Error tracking]"),Xi="Refusing to render web experiment since the viewer is a likely bot",Zi={icontains:(t,e)=>!!dt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!dt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!dt&&mi(e.href,t),not_regex:(t,e)=>!!dt&&!mi(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Qi{get Lt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Qi.Hn("retrieved web experiments from the server"),e.Vn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Vn&&(Qi.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Vn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);g(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Qi.Un(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Qi.Hn(Xi);else if(!this.Lt.disable_web_experiments){if(b(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Qi.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Vn&&null!=(e=this.Vn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Vn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Qi.getWindowLocation();if(null!=t&&t.search){var e=je(null==t?void 0:t.search,"__experiment_id"),i=je(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Qi.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Yn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Lt.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.Lt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Yn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Qi.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Un(t){return!b(t.conditions)&&Qi.Wn(t)&&Qi.Gn(t)}static Wn(t){var e;if(b(t.conditions)||b(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Qi.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Zi[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==dt?void 0:dt.location}static Gn(t){var e;if(b(t.conditions)||b(null==(e=t.conditions)?void 0:e.utm))return!0;var i=function(t,e,i){if(!pt)return{};var r,s,n,a=(r=Le(pt.URL,[],oi),s=ai.concat([]),n={},wt(s,(function(t){var e=je(r,t);n[t]=e||null})),n),o=function(){var t={};return wt(li,(function(e){var i=si.O(e);t[e]=i||null})),t}();return xt(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 Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];mt.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Qi.Hn(Xi):"control"!==e?i.forEach((i=>{if(i.selector){var r;Qi.Hn("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)}))}})):Qi.Hn("Control variants leave the page unmodified.")}_is_bot(){return ft&&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}(ft,this.Lt.custom_blocked_useragents):void 0}}var tr=yt("[Conversations]"),er="Conversations not available yet.",ir={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return null!==(t=null==(e=this.ii)?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Bi.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=null!==(t=this.Lt.evaluation_contexts)&&void 0!==t?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Bi.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Bi.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}hs(){return this.us().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.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(Nt),e=this.ss(Ht),r=this.ss(Vt);if(!r&&!e)return t||{};var s=xt({},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.Xn||(Bi.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Xn=!0),s}getFlagVariants(){var t=this.ss(Lt),e=this.ss(Ht);if(!e)return t||{};for(var i=xt({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Bi.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xn=!0),i}getFlagPayloads(){var t=this.ss(Ut),e=this.ss(Vt);if(!e)return t||{};for(var i=xt({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Bi.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xn=!0),i}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.ds()}),5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var r=this.Lt.token,s=this.ss("$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.ii)?void 0:e.get_initial_props())||{},this.ss(Wt)||{}),group_properties:this.ss(Bt),timezone:ui()};_(s)||p(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.hs()&&(n.evaluation_contexts=this.us());var a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Lt.disable_compression?void 0:bi,timeout:this.Lt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!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.ii)||r.register({[Xt]:a}),l)Bi.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.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){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 Bi.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.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],a=String(s),o=this.ss(zt)||void 0,l=this.ss(Zt)||void 0,u=this.ss(Kt)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var h,v=this._instance.get_session_id(),c=this.ss(Yt);v&&v!==c&&(u={},null==(h=this.ii)||h.register({[Kt]:u,[Yt]: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.ii)||f.register({[Kt]:u});var S=this.getFeatureFlagDetails(t),F=[...null!==(g=this.ss(Xt))&&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==(_=this.Lt.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])||null,$feature_flag_bootstrapped_payload:(null==(b=this.Lt.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])||null,$used_bootstrap_value:!this.ts};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 Bi.warn('getFeatureFlagResult for key "'+t+qi)}getRemoteConfigPayload(t,e){var i=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:bi,timeout:this.Lt.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.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return p(i)?void 0:!!i}Bi.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.ii){this.Jn=!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]})))):Bi.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)){Bi.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({[Mt]:u,[Lt]:f})}else{var g=u,_=h,b=l;if(null!=a&&a.partialResponse)g=i({},r,g),_=i({},s,_),b=i({},n,b);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)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),b=i({},n,Object.fromEntries(Object.entries(b||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else g=i({},r,g),_=i({},s,_),b=i({},n,b);e&&e.register(i({[Mt]:Object.keys(Ki(g)),[Lt]:g||{},[Ut]:_||{},[Nt]:b||{}},v?{[zt]:v}:{},c?{[Zt]:c}:{}))}}}(t,this.ii,s,n,a,r),e||(this.ns=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),Bi.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Bi.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ii.unregister(Ht),this.ii.unregister(Vt),this.fs(),Ji.info("All overrides cleared");if(d(t)){var e=Gi(t);return this.ii.register({[Ht]:e}),this.fs(),Ji.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Xn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ii.unregister(Ht),Ji.info("Flag overrides cleared");else if(r.flags){if(d(r.flags)){var s=Gi(r.flags);this.ii.register({[Ht]:s})}else this.ii.register({[Ht]:r.flags});Ji.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ii.unregister(Vt),Ji.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[Vt]:r.payloads}),Ji.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.ii.register({[Ht]:t}),this.fs(),Ji.info("Flag overrides set",{flags:t});Bi.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.ss(Dt)||[]).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.ii)||s.register({[Mt]:Object.keys(Ki(l)),[Lt]:l}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ss(Dt),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.Lt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ii)||i.unregister(Dt),null==(r=this.ii)||r.register({[Dt]:s}),t(s)}}})}ps(){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)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(Wt)||{},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({[Wt]:i({},r,a,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Wt)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(Bt)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[Bt]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(Bt)||{};this._instance.register({[Bt]:i({},e,{[t]:{}})})}else this._instance.unregister(Bt)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},rr={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===gi||this.ys===_i?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=fi,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw ki.error("started without valid sessionManager"),new Error(Ei+" started without valid sessionManager. This is a bug.");if("always"===this.Lt.cookieless_mode)throw new Error(Ei+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(jt))||!t.enabled),i=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return dt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!p(Object.assign)&&!p(Array.from);this._s&&i?(this.ws(t),ki.info("starting")):(this.ys=fi,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==gi&&this.ys!==_i&&(this.ys=pi),null!=_t&&null!=(e=_t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=_t.__PosthogExtensions__)&&i.initSessionRecording?this.Is(t):null==(r=_t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,(e=>{if(e)return ki.error("could not load recorder",e);this.Is(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}xs(){var t;null==(t=this.ii)||t.unregister("$session_is_sampled")}ks(t,e){if(b(t))return null;var i,r=m(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(ki.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,r,s=this.ii,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ks(null==(e=this.Lt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),a=this.ks(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;b(o)&&this.xs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[jt]: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.bs)||e.call(this),this.bs=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===gi&&(this.ys=_i,ki.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.gs)&&i.log?this.gs.log(t,e):ki.warn("log called before recorder was ready")}get Cs(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(jt);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(jt);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}Is(t){var e,i;if(null==(e=_t.__PosthogExtensions__)||!e.initSessionRecording)return ki.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.gs||(this.gs=null==(i=_t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As()){if(this.ys===_i||this.ys===gi)return;return this.ys=gi,ki.info("persisted remote config is stale, requesting fresh config before starting"),void new ci(this._instance).load()}this.ys=pi,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.ii)||e.register({$replay_override_linked_flag:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.ii)||e.register({$replay_override_sampling:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.ii)||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},sr={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new Ae(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){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}Fs(){if(this.isBrowserSupported()){if(dt&&pt){var t=t=>{t=t||(null==dt?void 0:dt.event);try{this.Os(t)}catch(t){Ne.error("Failed to capture event",t)}};if(St(pt,"submit",t,{capture:!0}),St(pt,"change",t,{capture:!0}),St(pt,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=t=>{this.Os(t=t||(null==dt?void 0:dt.event),De)};St(pt,"copy",e,{capture:!0}),St(pt,"cut",e,{capture:!0})}}}else Ne.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ct]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ms)||e.forEach((e=>{var r=null==pt?void 0:pt.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[Ct];if(_(this.Rs)&&!y(i)&&!this.instance.Mr())return!1;var r=null!==(e=this.Rs)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Os(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ce(t);ae(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(!dt||me(t))return!1;var i,r,s;if(y(e)?(i=!!e&&be,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:be,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=ye(t,!1);return!function(t,e){if(!1===t||p(t))return!1;var i;if(!0===t)i=_e;else{if(!d(t))return!1;if(t.length>10)return mt.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:de(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!pe(n,i)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var s=e===De;if(r&&function(t,e,i,r,s){var n,a,o,l;if(void 0===i&&(i=void 0),!dt||me(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!ue(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&ue(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}=ye(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(!pe(v,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=dt.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&&(fe.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Lt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=He(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),e===De){var l,u=ve(null==dt||null==(l=dt.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==pt?void 0:pt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(null==dt||null==(e=dt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(mt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,mt.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(dt&&dt.history){var i=this;null!=(t=dt.history.pushState)&&t.__posthog_wrapped__||qe(dt.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("pushState")})),null!=(e=dt.history.replaceState)&&e.__posthog_wrapped__||qe(dt.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("replaceState")})),this.Bs()}}Ds(t){try{var e,i=null==dt||null==(e=dt.location)?void 0:e.pathname;if(!i)return;i!==this.Ps&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.Ps=i}catch(e){mt.error("Error capturing "+t+" pageview",e)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};St(dt,"popstate",t),this.Ls=()=>{dt&&dt.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!(null==(e=this.instance.persistence)||!e.props[Rt]),this.rageclicks=new Ae(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return f(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return b(this.Lt.capture_heatmaps)?b(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:!1!==this.Lt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Es)return;Si.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval(null!==(t=this.$s)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Rt]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s="visible"===(null==pt?void 0:pt.visibilityState)?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){dt&&pt&&(this.Vs=this.Ur.bind(this),St(dt,ie,this.Vs),this.zs=t=>this.At(t||(null==dt?void 0:dt.event)),St(pt,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||(null==dt?void 0:dt.event)),St(pt,"mousemove",this.Us,{capture:!0}),this.Ws=new Be(this.instance,We,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),St(pt,ee,this.Gs),this.Es=!0)}Zs(){var t;dt&&pt&&(this.Vs&&dt.removeEventListener(ie,this.Vs),this.zs&&pt.removeEventListener("click",this.zs,{capture:!0}),this.Us&&pt.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&&pt.removeEventListener(ee,this.Gs),clearTimeout(this.Xs),null==(t=this.Ws)||t.stop(),this.Es=!1)}Js(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&&se(r)&&!ne(r,"body");){if(r===i)return!1;if(o(e,null==dt?void 0:dt.getComputedStyle(r).position))return!0;r=ge(r)}return!1}(ce(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}At(t,e){var r;if(void 0===e&&(e="click"),!re(t.target)&&Fi(t)){var s=this.Js(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Ks(i({},s,{type:"rageclick"})),this.Ks(s)}}Ys(t){!re(t.target)&&Fi(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout((()=>{this.Ks(this.Js(t,"mousemove"))}),500))}Ks(t){if(dt){var e=dt.location.href,i=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...ni,...i||[]]:[],s=Le(e,r,oi);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Ur(){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:Be,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),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.dt=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(p(r))hi.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();p(s)||(b(null==t?void 0:t.name)||b(null==t?void 0:t.value)?hi.error("Invalid metric received",t):!this.io||this.io>t.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,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.Qs()):hi.error("Ignoring metric with value >= "+this.io,t))}},this.no=()=>{if(!this.Es){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.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.dt.bind(this)),this.Es=!0):hi.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!(null==(e=this._instance.persistence)||!e.props[It]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=f(this.so)?null==(t=this.so)?void 0:t.web_vitals_allowed_metrics:void 0;return b(i)?(null==(e=this._instance.persistence)?void 0:e.props[At])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(f(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=f(this.so)?this.so.web_vitals_attribution:void 0;return null!=t&&t}get io(){var t=f(this.so)&&m(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:vi;return t>0&&6e4>=t?vi:t}get isEnabled(){var t=null==gt?void 0:gt.protocol;if("http:"!==t&&"https:"!==t)return hi.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=f(this.so)?this.so.web_vitals:y(this.so)?this.so:void 0;return y(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(hi.info("enabled, starting..."),this.lr(this.no))}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({[At]:i})),this.js=e,this.startIfEnabled()}}lr(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?hi.error("failed to load script",e):t()}))}ro(){var t=dt?dt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ni,...e||[]]:[];return Le(t,i,oi)}hi.error("Could not determine current URL")}}},nr={exceptionObserver:class{constructor(t){var e,i,r;this.no=()=>{var t;if(dt&&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.oo&&this.Lt.capture_unhandled_errors&&(this.oo=e(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=r(this.captureException.bind(this)))}catch(t){Je.error("failed to start",t),this.uo()}}},this._instance=t,this.ho=!(null==(e=this._instance.persistence)||!e.props[$t]),this.co=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,Yt:Je}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){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.ho:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Je.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(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 Je.error("failed to load script",e);t()}))}uo(){var t,e,i;null==(t=this.oo)||t.call(this),this.oo=void 0,null==(e=this.ao)||e.call(this),this.ao=void 0,null==(i=this.lo)||i.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[$t]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}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.co.consumeRateLimit(s)?Je.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.vo=[],this.fo=new L([new G,new st,new Y,new K,new it,new et,new Z,new rt],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=q.test(l)?l.replace(q,"$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||M});var r}))}(n)}}("web:javascript",V,J)),this._instance=t,this.vo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(Pt))&&void 0!==e?e:[],this.po=ut(this.mo()),this.yo=new ht(this.po)}onConfigChange(){this.po=ut(this.mo()),this.yo.setConfig(this.po)}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.vo=s,this._instance.persistence&&this._instance.persistence.register({[Pt]:this.vo,[Tt]:n})}}get bo(){var t,e=!!this._instance.get_property(Tt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!g(t)||0===t.trim().length)return void Yi.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)=>ot.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Yi.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.yo.add(i({[nt]:t,[at]:(new Date).toISOString()},s))}catch(t){Yi.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void Yi.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void Yi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Yi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.po.enabled&&b(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(t){return Yi.error("Failed to capture exception event. Dropping this exception.",t),void this.yo.clear()}}catch(t){return void Yi.error("Failed to process exception event. Ignoring this exception.",t)}}ko(t){try{var e=this.yo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Yi.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.po.enabled&&this.yo.add({[nt]:t,[at]:(new Date).toISOString()})}_o(t){return f(t)?i({},t):{}}mo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Io(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.vo.some((t=>{var i=t.values.map((t=>{var i,r=yi[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)}))}So(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://")))}xo(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}wo(t){return!b(t)&&d(t)}}},ar=i({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[Ot]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(Ot)||this.lr((()=>this.Eo()))}lr(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?Ci.error("Could not load product tours script",e):t()}))}Eo(){var t;!this.To&&null!=(t=_t.__PosthogExtensions__)&&t.generateProductTours&&(this.To=_t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!d(this.Ao)||e){var i=this.ii;if(i){var r=i.props[Gt];if(d(r)&&!e)return this.Ao=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 Ci.error(s),void t([],{isLoaded:!1,error:s})}var n=d(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[Gt]:n}),t(n,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){b(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.To)||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr((()=>{var e;this.Eo(),null==(e=this.To)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.To)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.To)||t.nextStep()}previousStep(){var t;null==(t=this.To)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.ii)||t.unregister(Gt)}resetTour(t){var e;null==(e=this.To)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.To)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.To)||e.cancelPendingTour(t)}}},ir),or={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var i=this.globalsForEvent(e);this.Ro.push(i),this.Ro.length>1e3&&(this.Ro=this.Ro.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.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=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,Ri),{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.Ro.length&&($i.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.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.Mo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,$i.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){$i.error(Pi+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){$i.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Fo(){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)}Oo(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){$i.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.Fo(),void this._instance.on("eventCaptured",(t=>this.Oo(t)))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Mo)||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 $i.error(Pi+t,e)}))};for(var{id:a,url:o}of t.siteApps)n(a)}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},lr={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var t,e,i=this.Do()||[];p(this.Po)&&(null==(t=_t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),p(this.Lo)&&(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()}lr(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 Ge.error("failed to load script",e);t()}))}Do(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):(null==(t=this.Po)||t.call(this),null==(e=this.Lo)||e.call(this),this.Po=void 0,this.Lo=void 0)}}},ur=i({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(b(e))return Oi.warn("Flags not loaded yet. Not loading surveys.");var i=d(e);this.Bo=i?e.length>0:e,Oi.info("flags response received, isSurveysEnabled: "+this.Bo),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.jo)Oi.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)Oi.info(zi);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())Oi.info("Not loading surveys in cookieless mode without consent.");else{var t=null==_t?void 0:_t.__PosthogExtensions__;if(t){if(!p(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var i=t.generateSurveys;if(i)return void this.Zo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(te);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.jo=!1}}}else Oi.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ni(this._instance),Oi.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){Oi.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Lt.disable_surveys)return Oi.info(zi),t([]);var i,r=this._instance.get_property(Jt);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.qo?this.qo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.qo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:e=>{var r;this.qo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Oi.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({[Jt]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Oi.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!b(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Oi.warn("init was not called")}zo(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}Uo(t){if(b(this._surveyManager))return{eligible:!1,reason:Ui};var e="string"==typeof t?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(b(this._surveyManager))return Oi.warn("init was not called"),{visible:!1,disabledReason:Ui};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return b(this._surveyManager)?(Oi.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ui})):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.Uo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(b(this._surveyManager))Oi.warn("init was not called");else{var s="string"==typeof t?this.zo(t):t;if(null!=s&&s.id)if(Ai.includes(s.type)){var n=null==pt?void 0:pt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Oi.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Oi.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),Oi.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Oi.warn("Survey element not found")}else Oi.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Oi.warn("Survey not found")}}displaySurvey(t,e){var r;if(b(this._surveyManager))Oi.warn("init was not called");else{var s=this.zo(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&&Oi.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 Oi.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 Oi.warn("Survey not found")}}cancelPendingSurvey(t){b(this._surveyManager)?Oi.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},ir),hr={toolbar:class{constructor(t){this.instance=t}Yo(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),Ft(this.instance.config))return!1;if(!dt||!pt)return!1;t=null!=t?t:dt.location,i=null!=i?i:dt.history;try{if(!e){try{dt.localStorage.setItem("test","test"),dt.localStorage.removeItem("test")}catch(t){return!1}e=null==dt?void 0:dt.localStorage}var r,s=Hi||Me(t.hash,"__posthog")||Me(t.hash,"state"),n=s?kt((()=>JSON.parse(atob(decodeURIComponent(s)))))||kt((()=>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(Vi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Go(t){var e=_t.ph_load_toolbar||_t.ph_load_editor;!b(e)&&c(e)?e(t,this.instance):Wi.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==pt||!pt.getElementById(Qt));if(!dt||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(dt.localStorage.setItem(Vi,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Go(s);else if(0===this.Wo()){var n;this.Yo(1),null==(n=_t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Wi.error("[Toolbar] Failed to load",t),void this.Yo(0);this.Yo(2),this.Go(s)})),St(dt,"turbolinks:load",(()=>{this.Yo(0),this.loadToolbar(s)}))}return!0}Xo(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)}}},vr=i({experiments:Qi},ir),dr={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;b(e)||(y(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||Ft(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==_t?void 0:_t.__PosthogExtensions__;if(t&&!p(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var i=t.loadExternalDependency;if(!i)return void this.ta(te);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ta("Could not load conversations script",e):this.ea(t.initConversations),this.Ko=!1}))}catch(t){this.ta("Error initializing conversations",t),this.Ko=!1}}else tr.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),tr.info("Conversations loaded successfully")}catch(t){this.ta("Error completing conversations initialization",t)}else tr.error("Cannot complete initialization: remote config is null")}ta(t,e){tr.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():tr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Jo&&!_(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):(tr.warn(er),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(tr.warn(er),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(tr.warn(er),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(tr.warn(er),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(tr.warn(er),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(tr.warn(er),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(tr.warn(er),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}ln(){var t;null==(t=this._conversationsManager)||t.setIdentity()}un(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},cr={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=yt("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!b(i)&&i&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){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.Yt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ia=!0)})):this.Yt.error(te)}else this.Yt.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.oa||(this.oa=h,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var v=function(t,e){var r=t.level||"info",{text:s,number:n}=T[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:A(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.la());this.na.push({record:v}),(null!==(a=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==a?a:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={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.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),0!==this.na.length){var e=this.na;this.na=[];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:A(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.Zi({method:"POST",url:l,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout((()=>{this.Br=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}la(){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}}},fr=i({},ir,rr,sr,nr,ar,or,ur,lr,hr,vr,dr,cr),pr=ir,gr=rr,_r=sr,br=nr,mr=ar,yr=or,wr=ur,xr=lr,Er=hr,kr=vr,Sr=dr,Fr=cr;export{fr as AllExtensions,_r as AnalyticsExtensions,Sr as ConversationsExtensions,br as ErrorTrackingExtensions,kr as ExperimentsExtensions,pr as FeatureFlagsExtensions,Fr as LogsExtensions,mr as ProductToursExtensions,gr as SessionReplayExtensions,yr as SiteAppsExtensions,wr as SurveysExtensions,Er as ToolbarExtensions,xr as TracingExtensions};
|
|
2
2
|
//# sourceMappingURL=extension-bundles.js.map
|