posthog-js 1.63.0 → 1.63.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/CHANGELOG.md +9 -0
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +1 -3
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/dist/module.d.ts
CHANGED
|
@@ -112,7 +112,6 @@ interface PostHogConfig {
|
|
|
112
112
|
ui_host: string | null;
|
|
113
113
|
token: string;
|
|
114
114
|
autocapture: boolean | AutocaptureConfig;
|
|
115
|
-
autocapture_exceptions: boolean;
|
|
116
115
|
rageclick: boolean;
|
|
117
116
|
cross_subdomain_cookie: boolean;
|
|
118
117
|
persistence: 'localStorage' | 'cookie' | 'memory' | 'localStorage+cookie' | 'sessionStorage';
|
|
@@ -644,19 +643,18 @@ declare class ExceptionObserver {
|
|
|
644
643
|
private originalOnErrorHandler;
|
|
645
644
|
private originalOnUnhandledRejectionHandler;
|
|
646
645
|
constructor(instance: PostHog);
|
|
647
|
-
startObservingIfEnabled(): void;
|
|
648
646
|
startCapturing(): void;
|
|
649
647
|
stopCapturing(): void;
|
|
650
648
|
isCapturing(): boolean;
|
|
651
649
|
isEnabled(): boolean;
|
|
652
650
|
afterDecideResponse(response: DecideResponse): void;
|
|
651
|
+
captureException(args: ErrorEventArgs, properties?: Properties): void;
|
|
653
652
|
/**
|
|
654
653
|
* :TRICKY: Make sure we batch these requests
|
|
655
654
|
*/
|
|
656
655
|
sendExceptionEvent(properties: {
|
|
657
656
|
[key: string]: any;
|
|
658
657
|
}): void;
|
|
659
|
-
captureException(args: ErrorEventArgs, properties?: Properties): void;
|
|
660
658
|
}
|
|
661
659
|
|
|
662
660
|
/**
|
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=c(e);if(t){var i=c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return d(this,n)}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}Object.defineProperty(exports,"__esModule",{value:!0});var y={DEBUG:!1,LIB_VERSION:"1.63.0"},m=Array.prototype,b=Object.prototype,w=b.toString,k=b.hasOwnProperty,S="undefined"!=typeof window?window:{},F=S.navigator||{userAgent:""},E=S.document||{},x=F.userAgent,O=["localhost","127.0.0.1"],P=m.forEach,I=m.indexOf,$=Array.isArray,T={},R={log:function(){if(y.DEBUG&&!L(window.console)&&window.console){for(var e=("__rrweb_original__"in window.console.log?window.console.log.__rrweb_original__:window.console.log),t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];try{e.apply(window.console,n)}catch(t){C(n,(function(t){e(t)}))}}},error:function(){if(y.DEBUG&&!L(window.console)&&window.console){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){C(r,(function(e){i(e)}))}}},critical:function(){if(!L(window.console)&&window.console){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){C(r,(function(e){i(e)}))}}}},A=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function C(e,t,n){if(Array.isArray(e))if(P&&e.forEach===P)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===T)return}function M(e,t,n){if(null!=e){if(Array.isArray(e))return C(e,t,n);for(var r in e)if(k.call(e,r)&&t.call(n,e[r],r)===T)return}}var j=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return C(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},D=$||function(e){return"[object Array]"===w.call(e)},N=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(e){return!1}};function q(e,t){return-1!==e.indexOf(t)}var H=function(e){return e===Object(e)&&!D(e)},L=function(e){return void 0===e},B=function(e){return"[object String]"==w.call(e)},U=function(e){return"[object Number]"==w.call(e)},V=function e(t){return M(t,(function(n,r){!function(e){return"[object Date]"==w.call(e)}(n)?H(n)&&(t[r]=e(n)):t[r]=G(n)})),t},G=function(e){function t(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},W=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){R.critical("Implementation error. Please turn on debug and contact support@posthog.com."),R.critical(e)}}},z=function(e){var t={};return M(e,(function(e,n){B(e)&&e.length>0&&(t[n]=e)})),t};var Q=["$performance_raw"];function J(e,t){return n=e,r=function(e,n){return n&&Q.indexOf(n)>-1?e:"string"==typeof e&&null!==t?e.slice(0,t):e},i=new Set,function e(t,n){return t!==Object(t)?r?r(t,n):t:i.has(t)?void 0:(i.add(t),D(t)?(o=[],C(t,(function(t){o.push(e(t))}))):(o={},M(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}function X(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,c=0,u="",l=[];if(!e)return e;e=Y(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,l[c++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(a<e.length);switch(u=l.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}var Z,Y=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<r;i++){var s=e.charCodeAt(i),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(n>t&&(o+=e.substring(t,n)),o+=a,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},K=(Z=function(){for(var e=(new Date).valueOf(),t=0;e==(new Date).valueOf();)t++;return e.toString(16)+t.toString(16)},function(){var e="undefined"!=typeof window?(window.screen.height*window.screen.width).toString(16):"0";return Z()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=x,r=0,i=[];function o(e,t){var n,r=0;for(n=0;n<t.length;n++)r|=i[n]<<8*n;return e^r}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(r=o(r,i),i=[]);return i.length>0&&(r=o(r,i)),r.toString(16)}()+"-"+e+"-"+Z()}),ee=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp|ahrefsbot|facebookexternalhit|facebookcatalog|applebot|semrushbot|duckduckbot|twitterbot|rogerbot|linkedinbot|mj12bot|sitebulb|bot.htm|bot.php|hubspot|crawler)/i.test(e)},te=function(e,t){var n=t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]"),r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var i=r[1];try{i=decodeURIComponent(i)}catch(e){R.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},ne=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},re=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,o){if(t)if(t.addEventListener&&!i)t.addEventListener(n,r,!!o);else{var s="on"+n,a=t[s];t[s]=function(t,n,r){return function(i){if(i=i||e(window.event)){var o,s=!0;N(r)&&(o=r(i));var a=n.call(t,i);return!1!==o&&!1!==a||(s=!1),s}}}(t,r,a)}else R.error("No valid element provided to register_event")}}();function ie(e,t){var n=function(){var n=E.createElement("script");n.type="text/javascript",n.src=e,n.onload=function(e){return t(void 0,e)},n.onerror=function(e){return t(e)};var r,i=E.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):E.body.appendChild(n)};E.body?n():E.addEventListener("DOMContentLoaded",n)}var oe={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","msclkid"].concat(e||[]),n={};return M(t,(function(e){var t=te(E.URL,e);t.length&&(n[e]=t)})),n},searchEngine:function(){var e=E.referrer;return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=oe.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(null!==e){n.$search_engine=e;var r=te(E.referrer,t);r.length&&(n.ph_keyword=r)}return n},browser:function(e,t,n){return t=t||"",n||q(e," OPR/")?q(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":q(e,"IEMobile")||q(e,"WPDesktop")?"Internet Explorer Mobile":q(e,"SamsungBrowser/")?"Samsung Internet":q(e,"Edge")||q(e,"Edg/")?"Microsoft Edge":q(e,"FBIOS")?"Facebook Mobile":q(e,"Chrome")?"Chrome":q(e,"CriOS")?"Chrome iOS":q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"FxiOS")?"Firefox iOS":q(t,"Apple")?q(e,"Mobile")?"Mobile Safari":"Safari":q(e,"Android")?"Android Mobile":q(e,"Konqueror")?"Konqueror":q(e,"Firefox")?"Firefox":q(e,"MSIE")||q(e,"Trident/")?"Internet Explorer":q(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[oe.browser(e,t,n)];if(void 0===r)return null;var i=e.match(r);return i?parseFloat(i[i.length-2]):null},browserLanguage:function(){return F.language||F.userLanguage},os:function(e){if(/Windows/i.test(e)){if(/Phone/.test(e)||/WPDesktop/.test(e))return{os_name:"Windows Phone",os_version:""};var t=/Windows NT ([0-9.]+)/i.exec(e);return t&&t[1]?{os_name:"Windows",os_version:t[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(e)){var n=/OS (\d+)_(\d+)_?(\d+)?/i.exec(e);return n&&n[1]?{os_name:"iOS",os_version:[n[1],n[2],n[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(e)){var r=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(e);return r&&r[1]?{os_name:"Android",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(e))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(e)){var i=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(e);return i&&i[1]?{os_name:"Mac OS X",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(e)?{os_name:"Linux",os_version:""}:/CrOS/.test(e)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)&&!/Mobile/.test(e)?"Android Tablet":/Android/.test(e)?"Android":""},deviceType:function(e){var t=this.device(e);return"iPad"===t||"Android Tablet"===t?"Tablet":t?"Mobile":"Desktop"},referrer:function(){return E.referrer||"$direct"},referringDomain:function(){if(!E.referrer)return"$direct";var e=E.createElement("a");return e.href=E.referrer,e.host},properties:function(){var e=oe.os(x),t=e.os_name,n=e.os_version;return j(z({$os:t,$os_version:n,$browser:oe.browser(x,F.vendor,S.opera),$device:oe.device(x),$device_type:oe.deviceType(x)}),{$current_url:null==S?void 0:S.location.href,$host:null==S?void 0:S.location.host,$pathname:null==S?void 0:S.location.pathname,$browser_version:oe.browserVersion(x,F.vendor,S.opera),$browser_language:oe.browserLanguage(),$screen_height:null==S?void 0:S.screen.height,$screen_width:null==S?void 0:S.screen.width,$viewport_height:null==S?void 0:S.innerHeight,$viewport_width:null==S?void 0:S.innerWidth,$lib:"web",$lib_version:y.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:(Date.now=Date.now||function(){return+new Date},Date.now()/1e3)})},people_properties:function(){var e=oe.os(x),t=e.os_name,n=e.os_version;return j(z({$os:t,$os_version:n,$browser:oe.browser(x,F.vendor,S.opera)}),{$browser_version:oe.browserVersion(x,F.vendor,S.opera)})}};function se(e){switch(n(e.className)){case"string":return e.className;case"object":return("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";default:return""}}function ae(e){var t="";return fe(e)&&!he(e)&&e.childNodes&&e.childNodes.length&&M(e.childNodes,(function(e){le(e)&&e.textContent&&(t+=A(e.textContent).split(/(\s+)/).filter(_e).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))})),A(t)}function ce(e){return!!e&&1===e.nodeType}function ue(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function le(e){return!!e&&3===e.nodeType}function de(e){return!!e&&11===e.nodeType}var pe=["a","button","form","input","select","textarea","label"];function fe(e){for(var t=e;t.parentNode&&!ue(t,"body");t=t.parentNode){var n=se(t).split(" ");if(q(n,"ph-sensitive")||q(n,"ph-no-capture"))return!1}if(q(se(e).split(" "),"ph-include"))return!0;var r=e.type||"";if("string"==typeof r)switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if("string"==typeof i){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function he(e){return!!(ue(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ue(e,"select")||ue(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function _e(e){if(null===e||L(e))return!1;if("string"==typeof e){e=A(e);if(/^(?:(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}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0}function ge(e){var t=ae(e);return _e(t="".concat(t," ").concat(ve(e)).trim())?t:""}function ve(e){var t="";return e&&e.childNodes&&e.childNodes.length&&M(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=ae(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(ve(e)).trim())}catch(e){console.error(e)}})),t}var ye=function(){function e(t){r(this,e),this.clicks=[],this.enabled=t}return o(e,[{key:"isRageClick",value:function(e,t,n){if(!this.enabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),me=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,be={is_supported:function(){return!0},error:function(e){R.error("cookieStore error: "+e)},get:function(e){try{for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch(e){}return null},parse:function(e){var t;try{t=JSON.parse(be.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){try{var o="",s="",a="";if(r){var c=document.location.hostname.match(me),u=c?c[0]:"";o=u?"; domain=."+u:""}if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),s="; expires="+l.toUTCString()}i&&(a="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+o+a;return document.cookie=d,d}catch(e){return}},remove:function(e,t){try{be.set(e,"",-1,t)}catch(e){return}}},we=null,ke={is_supported:function(){if(null!==we)return we;var e=!0;if("undefined"!=typeof window)try{var t="__mplssupport__";ke.set(t,"xyz"),'"xyz"'!==ke.get(t)&&(e=!1),ke.remove(t)}catch(t){e=!1}else e=!1;return e||R.error("localStorage unsupported; falling back to cookie store"),we=e,e},error:function(e){R.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(e){ke.error(e)}return null},parse:function(e){try{return JSON.parse(ke.get(e))||{}}catch(e){}return null},set:function(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){ke.error(e)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(e){ke.error(e)}}},Se=t(t({},ke),{},{parse:function(e){try{var t={};try{(t=be.parse(e)||{}).distinct_id&&be.set(e,{distinct_id:t.distinct_id})}catch(e){}var n=j(t,JSON.parse(ke.get(e)||"{}"));return ke.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{ke.set(e,t),t.distinct_id&&be.set(e,{distinct_id:t.distinct_id},n,r,i)}catch(e){ke.error(e)}},remove:function(e,t){try{window.localStorage.removeItem(e),be.remove(e,t)}catch(e){ke.error(e)}}}),Fe={},Ee={is_supported:function(){return!0},error:function(e){R.error("memoryStorage error: "+e)},get:function(e){return Fe[e]||null},parse:function(e){return Fe[e]||null},set:function(e,t){Fe[e]=t},remove:function(e){delete Fe[e]}},xe=null,Oe={is_supported:function(){if(null!==xe)return xe;if(xe=!0,"undefined"!=typeof window)try{var e="__support__";Oe.set(e,"xyz"),'"xyz"'!==Oe.get(e)&&(xe=!1),Oe.remove(e)}catch(e){xe=!1}else xe=!1;return xe},error:function(e){y.DEBUG&&R.error("sessionStorage error: ",e)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(e){Oe.error(e)}return null},parse:function(e){try{return JSON.parse(Oe.get(e))||null}catch(e){}return null},set:function(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Oe.error(e)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(e){Oe.error(e)}}},Pe="$people_distinct_id",Ie="__alias",$e="__timers",Te="$autocapture_disabled_server_side",Re="$session_recording_enabled_server_side",Ae="$console_log_recording_enabled_server_side",Ce="$session_recording_recorder_version_server_side",Me="$sesid",je="$enabled_feature_flags",De="$early_access_features",Ne="$stored_person_properties",qe="$stored_group_properties",He="$user_state",Le=[Pe,Ie,"__cmpns",$e,Re,Me,je,He,De,qe,Ne],Be=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ue=function(){function e(t){r(this,e);var n="";t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=t.custom_campaign_params||[],t.persistence_name?this.name="ph_"+t.persistence_name:this.name="ph_"+n+"_posthog",-1===Be.indexOf(t.persistence.toLowerCase())&&(R.critical("Unknown persistence type "+t.persistence+"; falling back to cookie"),t.persistence="cookie");var i=t.persistence.toLowerCase();"localstorage"===i&&ke.is_supported()?this.storage=ke:"localstorage+cookie"===i&&Se.is_supported()?this.storage=Se:"sessionstorage"===i&&Oe.is_supported()?this.storage=Oe:this.storage="memory"===i?Ee:be,this.user_state="anonymous",this.load(),this.update_config(t),this.save()}return o(e,[{key:"properties",value:function(){var e={};return M(this.props,(function(t,r){if(r===je&&"object"===n(t))for(var i=Object.keys(t),o=0;o<i.length;o++)e["$feature/".concat(i[o])]=t[i[o]];else a=r,c=!1,(null===(s=Le)?c:I&&s.indexOf===I?-1!=s.indexOf(a):(M(s,(function(e){if(c||(c=e===a))return T})),c))||(e[r]=t);var s,a,c})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=j({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var r=this;if(H(e)){void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n;var i=!1;if(M(e,(function(e,n){r.props.hasOwnProperty(n)&&r.props[n]!==t||(r.props[n]=e,i=!0)})),i)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(H(e)){this.expire_days=void 0===t?this.default_expiry:t;var r=!1;if(M(e,(function(t,i){e.hasOwnProperty(i)&&n.props[i]!==t&&(n.props[i]=t,r=!0)})),r)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(oe.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(oe.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||oe.referrer(),$referring_domain:this.props.$referring_domain||oe.referringDomain()})}},{key:"get_referrer_info",value:function(){return z({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return M(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[$e]||{};n[e]=t,this.props[$e]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[$e]||{})[e];return L(t)||(delete this.props[$e][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[He]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[He]=e,this.save()}}]),e}(),Ve={_initializedTokens:[],_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t=!!e.get_property(Te),n=!!e.get_config("autocapture");this._isAutocaptureEnabled=n&&!t},_previousElementSibling:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ce(t));return t},_getAugmentPropertiesFromElement:function(e){if(!fe(e))return{};var t={};return M(e.attributes,(function(e){if(0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&_e(r)&&(t[n]=r)}})),t},_getPropertiesFromElement:function(e,t,n){var r=e.tagName.toLowerCase(),i={tag_name:r};pe.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?i.$el_text=ge(e):i.$el_text=ae(e));var o=se(e);o.length>0&&(i.classes=o.split(" ").filter((function(e){return""!==e}))),M(e.attributes,(function(n){var r;he(e)&&-1===["name","id","class"].indexOf(n.name)||!t&&_e(n.value)&&("string"!=typeof(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))&&(i["attr__"+n.name]=n.value)}));for(var s=1,a=1,c=e;c=this._previousElementSibling(c);)s++,c.tagName===e.tagName&&a++;return i.nth_child=s,i.nth_of_type=a,i},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return M(document.querySelectorAll(e.css_selector),(function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),_e(n)&&t.push(n)})),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return M(this._customProperties,(function(r){M(r.event_selectors,(function(i){M(document.querySelectorAll(i),(function(i){q(e,i)&&fe(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return void 0===e.target?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},_captureEvent:function(e,t){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$autocapture",o=this._getEventTarget(e);(le(o)&&(o=o.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent)&&(null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,t,"$rageclick"));if(o&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||ue(e,"html")||!ce(e))return!1;if(null!=n&&n.url_allowlist){var r=window.location.href,i=n.url_allowlist;if(i&&!i.some((function(e){return r.match(e)})))return!1}if(null!=n&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some((function(e){return t.type===e})))return!1}if(null!=n&&n.element_allowlist){var s=n.element_allowlist;if(s&&!s.some((function(t){return e.tagName.toLowerCase()===t})))return!1}if(null!=n&&n.css_selector_allowlist){var a=n.css_selector_allowlist;if(a&&!a.some((function(t){return e.matches(t)})))return!1}for(var c=!1,u=[e],l=!0,d=e;d.parentNode&&!ue(d,"body");)if(de(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=d.parentNode||!1))break;if(pe.indexOf(l.tagName.toLowerCase())>-1)c=!0;else{var p=window.getComputedStyle(l);p&&"pointer"===p.getPropertyValue("cursor")&&(c=!0)}u.push(l),d=l}var f=window.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return"submit"===t.type;case"input":case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return c?"click"===t.type:"click"===t.type&&(pe.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var s=[o],a=o;a.parentNode&&!ue(a,"body");)de(a.parentNode)?(s.push(a.parentNode.host),a=a.parentNode.host):(s.push(a.parentNode),a=a.parentNode);var c,u=[],l={},d=!1;if(M(s,(function(e){var n=fe(e);"a"===e.tagName.toLowerCase()&&(c=e.getAttribute("href"),c=n&&_e(c)&&c),q(se(e).split(" "),"ph-no-capture")&&(d=!0),u.push(r._getPropertiesFromElement(e,t.get_config("mask_all_element_attributes"),t.get_config("mask_all_text")));var i=r._getAugmentPropertiesFromElement(e);j(l,i)})),t.get_config("mask_all_text")||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?u[0].$el_text=ge(o):u[0].$el_text=ae(o)),c&&(u[0].attr__href=c),d)return!1;var p=j(this._getDefaultProperties(e.type),{$elements:u},this._getCustomProperties(s),l);return t.capture(i,p),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(e){var t=this,n=function(n){n=n||window.event,t._captureEvent(n,e)};re(document,"submit",n,!1,!0),re(document,"change",n,!1,!0),re(document,"click",n,!1,!0)},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;"boolean"!=typeof e.__autocapture&&(this.config=e.__autocapture),null!==(t=this.config)&&void 0!==t&&t.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map((function(e){return new RegExp(e)}))),this.rageclicks=new ye(e.get_config("rageclick"))},afterDecideResponse:function(e,t){this._setIsAutocaptureEnabled(t);var n=t.get_config("token");this._initializedTokens.indexOf(n)>-1?R.log('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(s({},Te,!!e.autocapture_opt_out)),this._initializedTokens.push(n),e&&e.config&&e.config.enable_collect_everything&&this._isAutocaptureEnabled?(e.custom_properties&&(this._customProperties=e.custom_properties),this._addDomEventHandlers(t)):t.__autocapture=!1)},enabledForProject:function(e,t,n){if(!e)return!0;t=L(t)?10:t,n=L(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return N(document.querySelectorAll)}};!function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=e[t].bind(e))}(Ve),function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=W(e[t]))}(Ve);var Ge="__ph_opt_in_out_";function We(e,t){et(!0,e,t)}function ze(e,t){et(!1,e,t)}function Qe(e,t){return"1"===Ke(e,t)}function Je(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||S,n=t.navigator||{},r=!1;return M([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){q([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===Ke(e,t)}function Xe(e,t){Ze(t=t||{}).remove(Ye(e,t),!!t.crossSubdomainCookie)}function Ze(e){return"localStorage"===(e=e||{}).persistenceType?ke:"localStorage+cookie"===e.persistenceType?Se:be}function Ye(e,t){return((t=t||{}).persistencePrefix||Ge)+e}function Ke(e,t){return Ze(t).get(Ye(e,t))}function et(e,t,n){B(t)&&t.length?(Ze(n=n||{}).set(Ye(t,n),e?1:0,U(n.cookieExpiration)?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function tt(e,t){var n=!1;try{var r=e.get_config("token"),i=e.get_config("respect_dnt"),o=e.get_config("opt_out_capturing_persistence_type"),s=e.get_config("opt_out_capturing_cookie_prefix")||void 0,a=e.get_config("window");r&&(n=Je(r,{respectDnt:i,persistenceType:o,persistencePrefix:s,window:a}))}catch(e){t||console.error("Unexpected error when checking capturing opt-out status: "+e)}return n}function nt(e,t,n){return function(){for(var r=tt(e,n),i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];if(!r)return t.apply(this,o);var a=o[o.length-1];"function"==typeof a&&a(0)}}var rt="$set",it=function(){function e(t){var n=this;r(this,e),this._posthog=t,this.set=nt(t,(function(e,t,r){var i=n.set_action(e,t);return n._posthog.setPersonPropertiesForFlags(i.$set||{}),H(e)&&(r=t),n._get_config("save_referrer")&&n._posthog.sessionPersistence.update_referrer_info(),i[rt]=j({},oe.people_properties(),n._posthog.sessionPersistence.get_referrer_info(),i[rt]),n._send_request(i,r)})),this.set_once=nt(t,(function(e,t,r){var i=n.set_once_action(e,t);return H(e)&&(r=t),n._send_request(i,r)}))}return o(e,[{key:"toString",value:function(){return this._posthog.toString()+".people"}},{key:"_send_request",value:function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._posthog.get_distinct_id();var n=this._posthog.get_property("$device_id"),r=this._posthog.get_property("$user_id"),i=this._posthog.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=V(e),s=J(o,this._get_config("properties_string_max_length")),a=X(JSON.stringify(o));return this._posthog._send_request(this._get_config("api_host")+"/engage/",{data:a},{},this._posthog._prepare_callback(t,s)),s}},{key:"_get_config",value:function(e){return this._posthog.get_config(e)}},{key:"_is_reserved_property",value:function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e}},{key:"set_action",value:function(e,t){return this.apiActionParser(rt,e,t)}},{key:"set_once_action",value:function(e,t){return this.apiActionParser("$set_once",e,t)}},{key:"apiActionParser",value:function(e,t,n){var r=this,i={},o={};return H(t)?M(t,(function(e,t){r._is_reserved_property(t)||(o[t]=e)})):o[t]=n,i[e]=o,i}}]),e}(),ot="$active_feature_flags",st="$override_feature_flags",at="$feature_flag_payloads",ct=function(e){var t,n={},r=v(function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}(e||{}));try{for(r.s();!(t=r.n()).done;){var i=f(t.value,2),o=i[0],s=i[1];s&&(n[o]=s)}}catch(e){r.e(e)}finally{r.f()}return n},ut=function(){function e(t){r(this,e),this.instance=t,this._override_warning=!1,this.flagCallReported={},this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return o(e,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(je),t=this.instance.get_property(st);if(!t)return e||{};for(var n=j({},e),r=Object.keys(t),i=0;i<r.length;i++)!1===t[r[i]]?delete n[r[i]]:n[r[i]]=t[r[i]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(at)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())}),5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;this.setReloadingPaused(!0);var t=this.instance.get_config("token"),n=this.instance.get_property(Ne),r=this.instance.get_property(qe),i=X(JSON.stringify({token:t,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:n,group_properties:r}));this.instance._send_request(this.instance.get_config("api_host")+"/decide/?v=3",{data:i},{method:"POST"},this.instance._prepare_callback((function(t){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(t),e.setReloadingPaused(!1),e._startReloadTimer()})))}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.getFlags())return console.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time."),!1;var n=this.getFlagVariants()[e];return!t.send_event&&"send_event"in t||this.flagCallReported[e]||(this.flagCallReported[e]=!0,this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})),n}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getFlags()?!!this.getFeatureFlag(e,t):(console.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time."),!1)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((function(t){return t!==e}))}},{key:"receivedFeatureFlags",value:function(e){this.instance.decideEndpointWasHit=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.featureFlags,a=e.featureFlagPayloads;if(o)if(Array.isArray(o)){var c,u={};if(o)for(var l=0;l<o.length;l++)u[o[l]]=!0;n&&n.register((s(c={},ot,o),s(c,je,u),c))}else{var d,p=o,f=a;e.errorsWhileComputingFlags&&(p=t(t({},r),p),f=t(t({},i),f)),n&&n.register((s(d={},ot,Object.keys(ct(p))),s(d,je,p||{}),s(d,at,f||{}),d))}}(e,this.instance.persistence,n,r),this._fireFeatureFlagsCallbacks()}},{key:"override",value:function(e){if(this._override_warning=!1,!1===e)this.instance.persistence.unregister(st);else if(Array.isArray(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(s({},st,t))}else this.instance.persistence.register(s({},st,e))}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks(),r=n.flags,i=n.flagVariants;e(r,i)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,n){var r,i=s({},"$feature_enrollment/".concat(e),n);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:n,$set:i}),this.setPersonPropertiesForFlags(i,!1);var o=t(t({},this.getFlagVariants()),{},s({},e,n));this.instance.persistence.register((s(r={},ot,Object.keys(ct(o))),s(r,je,o),r)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(De);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/api/early_access_features/?token=").concat(this.instance.get_config("token")),{},{method:"GET"},(function(n){var r=n.earlyAccessFeatures;return t.instance.persistence.register(s({},De,r)),e(r)}))}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((function(e){return t[e]})),flagVariants:Object.keys(t).filter((function(e){return t[e]})).reduce((function(e,n){return e[n]=t[n],e}),{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),t=e.flags,n=e.flagVariants;this.featureFlagEventHandlers.forEach((function(e){return e(t,n)}))}},{key:"setPersonPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(Ne)||{};this.instance.register(s({},Ne,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Ne)}},{key:"setGroupPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(qe)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((function(n){r[n]=t(t({},r[n]),e[n]),delete e[n]})),this.instance.register(s({},qe,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var n=this.instance.get_property(qe)||{};this.instance.register(s({},qe,t(t({},n),{},s({},e,{}))))}else this.instance.unregister(qe)}}]),e}(),lt="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==",dt=2,pt=4,ft=6;var ht="rrweb/console@1";var _t,gt="/e/";!function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet"}(_t||(_t={}));var vt=[_t.MouseMove,_t.MouseInteraction,_t.Scroll,_t.ViewportResize,_t.Input,_t.TouchMove,_t.MediaInteraction,_t.Drag],yt=function(){function e(t){r(this,e),s(this,"lastActivityTimestamp",Date.now()),s(this,"isIdle",!1),this.instance=t,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=gt,this.stopRrweb=void 0,this.windowId=null,this.sessionId=null,this.receivedDecide=!1}return o(e,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(Re),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"isConsoleLogCaptureEnabled",value:function(){var e=!!this.instance.get_property(Ae),t=this.instance.get_config("enable_recording_console_log");return null!=t?t:e}},{key:"getRecordingVersion",value:function(){var e,t=this.instance.get_property(Ce);return(null===(e=this.instance.get_config("session_recording"))||void 0===e?void 0:e.recorderVersion)||t||"v1"}},{key:"afterDecideResponse",value:function(e){var t,n,r,i,o,a;(this.receivedDecide=!0,this.instance.persistence)&&this.instance.persistence.register((s(o={},Re,!!e.sessionRecording),s(o,Ae,null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled),s(o,Ce,null===(i=e.sessionRecording)||void 0===i?void 0:i.recorderVersion),o));null!==(t=e.sessionRecording)&&void 0!==t&&t.endpoint&&(this.endpoint=null===(a=e.sessionRecording)||void 0===a?void 0:a.endpoint);null!==(n=e.sessionRecording)&&void 0!==n&&n.recorderVersion&&(this.recorderVersion=e.sessionRecording.recorderVersion),this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach((function(t){return e._captureSnapshot(t)}))),this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(void 0!==Object.assign&&!this.captureStarted&&!this.instance.get_config("disable_session_recording")){this.captureStarted=!0,this.instance.sessionManager.checkAndGetSessionAndWindowId();var t="v2"===this.getRecordingVersion()?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.getRecordingVersion()?ie(this.instance.get_config("api_host")+"/static/".concat(t,"?v=").concat(y.LIB_VERSION),(function(n){if(n)return R.error("Could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==vt.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this._isInteractiveEvent(e);if(t||this.isIdle||e.timestamp-this.lastActivityTimestamp>3e5&&(this.isIdle=!0),t&&(this.lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryTakeFullSnapshot())),!this.isIdle){var n=this.instance.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=n.windowId,i=n.sessionId;-1!==[dt,pt].indexOf(e.type)||this.windowId===r&&this.sessionId===i||this._tryTakeFullSnapshot(),this.windowId=r,this.sessionId=i}}},{key:"_tryTakeFullSnapshot",value:function(){if(!this.captureStarted)return!1;try{var e;return null===(e=this.rrwebRecord)||void 0===e||e.takeFullSnapshot(),!0}catch(e){return R.error("Error taking full snapshot.",e),!1}}},{key:"_onScriptLoaded",value:function(){var e=this,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var r=this.instance.get_config("session_recording"),i=0,o=Object.entries(r||{});i<o.length;i++){var s=f(o[i],2),a=s[0],c=s[1];a in n&&(n[a]=c)}this.rrwebRecord?(this.stopRrweb=this.rrwebRecord(t({emit:function(t){e.onRRwebEmit(t)},plugins:window.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled()?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},n)),this.instance._addCaptureHook((function(t){try{var n;if("$pageview"===t)null===(n=e.rrwebRecord)||void 0===n||n.addCustomEvent("$pageview",{href:window.location.href})}catch(e){R.error("Could not add $pageview to rrweb session",e)}})),this.lastActivityTimestamp=Date.now(),this.isIdle=!1):R.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"onRRwebEmit",value:function(e){if(e=function(e){if(e&&"object"===n(e)&&e.type===ft&&"object"===n(e.data)&&e.data.plugin===ht){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var t=[],r=0;r<e.data.payload.payload.length;r++)e.data.payload.payload[r]&&e.data.payload.payload[r].length>2e3?t.push(e.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):t.push(e.data.payload.payload[r]);return e.data.payload.payload=t,e}return e}(function(e){if(e&&"object"===n(e)){var t=JSON.stringify(e);if(t.length>5e6){var r,i=v(t.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(i.s();!(r=i.n()).done;){var o=r.value;t="image/"===o[1].toLocaleLowerCase().slice(0,6)?t.replace(o[0],lt):t.replace(o[0],"")}}catch(e){i.e(e)}finally{i.f()}}return JSON.parse(t)}return e}(e)),this._updateWindowAndSessionIds(e),!this.isIdle){var t={$snapshot_data:e,$session_id:this.sessionId,$window_id:this.windowId};this.instance._captureMetrics.incr("rrweb-record"),this.instance._captureMetrics.incr("rrweb-record-".concat(e.type)),this.emit?this._captureSnapshot(t):this.snapshots.push(t)}}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===dt}})}}]),e}(),mt={entryType:0,timeOrigin:1,name:2,startTime:3,redirectStart:4,redirectEnd:5,workerStart:6,fetchStart:7,domainLookupStart:8,domainLookupEnd:9,connectStart:10,secureConnectionStart:11,connectEnd:12,requestStart:13,responseStart:14,responseEnd:15,decodedBodySize:16,encodedBodySize:17,initiatorType:18,nextHopProtocol:19,renderBlockingStatus:20,responseStatus:21,transferSize:22,element:23,renderTime:24,loadTime:25,size:26,id:27,url:28,domComplete:29,domContentLoadedEvent:30,domInteractive:31,loadEventEnd:32,loadEventStart:33,redirectCount:34,navigationType:35,unloadEventEnd:36,unloadEventStart:37,duration:39,timestamp:40},bt=["first-input","navigation","paint","resource"],wt=["/s/","/e/"],kt=function(){function e(t){r(this,e),s(this,"_forceAllowLocalhost",!1),this.instance=t}return o(e,[{key:"startObservingIfEnabled",value:function(){this.isEnabled()?this.startObserving():this.stopObserving()}},{key:"startObserving",value:function(){var e=this;if(!this.observer)if(!O.includes(location.hostname)||this._forceAllowLocalhost)try{this.observer=new PerformanceObserver((function(t){t.getEntries().forEach((function(t){e._capturePerformanceEvent(t)}))}));var t=PerformanceObserver.supportedEntryTypes.filter((function(e){return bt.includes(e)}));t.forEach((function(t){var n;null===(n=e.observer)||void 0===n||n.observe({type:t,buffered:!0})}))}catch(e){console.error("PostHog failed to start performance observer",e),this.stopObserving()}else R.log("PostHog Peformance observer not started because we are on localhost.")}},{key:"stopObserving",value:function(){this.observer&&(this.observer.disconnect(),this.observer=void 0)}},{key:"isObserving",value:function(){return!!this.observer}},{key:"isEnabled",value:function(){var e,t;return null!==(e=null!==(t=this.instance.get_config("capture_performance"))&&void 0!==t?t:this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.capturePerformance||!1,this.isEnabled()&&this.startObserving()}},{key:"_capturePerformanceEvent",value:function(e){if(0===e.name.indexOf(this.instance.get_config("api_host"))){var t=e.name.replace(this.instance.get_config("api_host"),"");if(wt.find((function(e){return 0===t.indexOf(e)})))return}var n={url:e.name},r=this.instance.get_config("session_recording");if(r.maskNetworkRequestFn&&(n=r.maskNetworkRequestFn(n)),n){var i=e.toJSON();i.name=n.url;var o={},a=Math.floor(Date.now()-performance.now());for(var c in o[mt.timeOrigin]=a,o[mt.timestamp]=Math.floor(a+e.startTime),mt)void 0!==i[c]&&(o[mt[c]]=i[c]);if(this.capturePerformanceEvent(o),St(e)){var u,l=v(e.serverTiming||[]);try{for(l.s();!(u=l.n()).done;){var d,p=u.value;this.capturePerformanceEvent((s(d={},mt.timeOrigin,a),s(d,mt.timestamp,Math.floor(a+e.startTime)),s(d,mt.name,p.name),s(d,mt.duration,p.duration),s(d,mt.entryType,"serverTiming"),d))}}catch(e){l.e(e)}finally{l.f()}}}}},{key:"capturePerformanceEvent",value:function(e){var t,n=e[mt.timestamp];null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"posthog/network@1",payload:e},timestamp:n})}}]),e}(),St=function(e){return"navigation"===e.entryType||"resource"===e.entryType},Ft=function(){function e(t){r(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return o(e,[{key:"call",value:function(){var e=this,t=X(JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Ne),group_properties:this.instance.get_property(qe)}));this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=3"),{data:t,verbose:!0},{method:"POST"},(function(t){return e.parseDecideResponse(t)}))}},{key:"parseDecideResponse",value:function(e){var t,n,r,i=this;if(0!==(null==e?void 0:e.status)){if(this.instance.decideEndpointWasHit=!0,!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){i.parseDecideResponse(e)}),500);if(this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),Ve.afterDecideResponse(e,this.instance),null===(n=this.instance.webPerformance)||void 0===n||n.afterDecideResponse(e),null===(r=this.instance.exceptionAutocapture)||void 0===r||r.afterDecideResponse(e),this.instance.featureFlags.receivedFeatureFlags(e),this.instance.compression={},e.supportedCompression&&!this.instance.get_config("disable_compression")){var o,s={},a=v(e.supportedCompression);try{for(a.s();!(o=a.n()).done;){s[o.value]=!0}}catch(e){a.e(e)}finally{a.f()}this.instance.compression=s}if(e.siteApps)if(this.instance.get_config("opt_in_site_apps")){var c,u=this.instance.get_config("api_host"),l=v(e.siteApps);try{var d=function(){var e=c.value,t=e.id,n=e.url,r=[u,"/"===u[u.length-1]&&"/"===n[0]?n.substring(1):n].join("");window["__$$ph_site_app_".concat(t)]=i.instance,ie(r,(function(e){e&&console.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(l.s();!(c=l.n()).done;)d()}catch(e){l.e(e)}finally{l.f()}}else e.siteApps.length>0&&console.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else console.error("Failed to fetch feature flags from PostHog.")}}]),e}(),Et=["https://app.posthog.com","https://eu.posthog.com"],xt=["source"],Ot=function(){function e(t){r(this,e),this.instance=t}return o(e,[{key:"afterDecideResponse",value:function(e){var n=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&n.toolbarVersion&&0===n.toolbarVersion.indexOf("toolbar")&&this.loadToolbar(t({},n))}},{key:"maybeLoadToolbar",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!t){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(e){return!1}t=window.localStorage}var r,i=ne(e.hash,"__posthog")||ne(e.hash,"state"),o=i?JSON.parse(decodeURIComponent(i)):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState("",document.title,e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.get_config("token")!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}},{key:"loadToolbar",value:function(e){var n=this;if(window._postHogToolbarLoaded)return!1;window._postHogToolbarLoaded=!0;var r=this.instance.get_config("api_host"),i=3e4*Math.floor(Date.now()/3e4),o="".concat(r).concat(r.endsWith("/")?"":"/","static/toolbar.js?_ts=").concat(i),s=!Et.includes(this.instance.get_config("api_host"))&&this.instance.get_config("advanced_disable_toolbar_metrics"),a=t(t({token:this.instance.get_config("token")},e),{},{apiURL:r},s?{instrument:!1}:{});a.source;var c=l(a,xt);return window.localStorage.setItem("_postHogToolbarParams",JSON.stringify(c)),ie(o,(function(e){e?R.error("Failed to load toolbar",e):(window.ph_load_toolbar||window.ph_load_editor)(a,n.instance)})),re(window,"turbolinks:load",(function(){window._postHogToolbarLoaded=!1,n.loadToolbar(a)})),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;return this.maybeLoadToolbar(e,t,n)}}]),e}(),Pt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;r(this,e),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=t}return o(e,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),e}(),It=function(e){a(i,Pt);var n=p(i);function i(e,t){var o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;return r(this,i),(o=n.call(this,s)).handlePollRequest=t,o.captureMetrics=e,o}return o(i,[{key:"enqueue",value:function(e,t,n){this.captureMetrics.incr("batch-enqueue"),this._event_queue.push({url:e,data:t,options:n}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;clearTimeout(this._poller),this._poller=setTimeout((function(){if(e._event_queue.length>0){var t=e.formatQueue(),n=function(n){var r=t[n],i=r.url,o=r.data,s=r.options;M(o,(function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp})),e.handlePollRequest(i,o,s),e.captureMetrics.incr("batch-requests"),e.captureMetrics.incr("batch-requests-".concat(i.slice(i.length-2))),e.captureMetrics.incr("batch-handle",o.length),e.captureMetrics.incr("batch-handle-".concat(i.slice(i.length-2)),o.length)};for(var r in t)n(r);e._event_queue.length=0,e._empty_queue_count=0}else e._empty_queue_count++;e._empty_queue_count>4&&(e.isPolling=!1,e._empty_queue_count=0),e.isPolling&&e.poll()}),this._pollInterval)}},{key:"updateUnloadMetrics",value:function(){var e=this.formatQueue();for(var t in e){var n=e[t],r=n.url,i=n.data;this.captureMetrics.incr("batch-unload-requests"),this.captureMetrics.incr("batch-unload-requests-".concat(r.slice(r.length-2))),this.captureMetrics.incr("batch-unload",i.length),this.captureMetrics.incr("batch-unload-".concat(r.slice(r.length-2)),i.length)}}},{key:"unload",value:function(){var e=this;clearTimeout(this._poller);var n=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var r=Object.values(n);[].concat(h(r.filter((function(e){return 0===e.url.indexOf("/e")}))),h(r.filter((function(e){return 0!==e.url.indexOf("/e")})))).map((function(n){var r=n.url,i=n.data,o=n.options;e.handlePollRequest(r,i,t(t({},o),{},{transport:"sendBeacon"}))}))}},{key:"formatQueue",value:function(){var e={};return M(this._event_queue,(function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;void 0===e[o]&&(e[o]={data:[],url:n,options:i}),i&&e[o].options&&e[o].options._metrics&&!e[o].options._metrics.rrweb_full_snapshot&&(e[o].options._metrics.rrweb_full_snapshot=i._metrics.rrweb_full_snapshot),e[o].data.push(r)})),e}}]),i}(),$t=function(){function e(t){r(this,e),this.enabled=t,this.metrics={}}return o(e,[{key:"incr",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)+t)}},{key:"decr",value:function(e){this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)-1)}}]),e}(),Tt=Uint8Array,Rt=Uint16Array,At=Uint32Array,Ct=new Tt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mt=new Tt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jt=new Tt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dt=function(e,t){for(var n=new Rt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new At(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Nt=Dt(Ct,2),qt=Nt[0],Ht=Nt[1];qt[28]=258,Ht[258]=28;for(var Lt=Dt(Mt,0)[1],Bt=new Rt(32768),Ut=0;Ut<32768;++Ut){var Vt=(43690&Ut)>>>1|(21845&Ut)<<1;Vt=(61680&(Vt=(52428&Vt)>>>2|(13107&Vt)<<2))>>>4|(3855&Vt)<<4,Bt[Ut]=((65280&Vt)>>>8|(255&Vt)<<8)>>>1}var Gt=function(e,t,n){for(var r=e.length,i=0,o=new Rt(t);i<r;++i)++o[e[i]-1];var s,a=new Rt(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new Rt(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,p=d|(1<<l)-1;d<=p;++d)s[Bt[d]>>>c]=u}else for(s=new Rt(r),i=0;i<r;++i)s[i]=Bt[a[e[i]-1]++]>>>15-e[i];return s},Wt=new Tt(288);for(Ut=0;Ut<144;++Ut)Wt[Ut]=8;for(Ut=144;Ut<256;++Ut)Wt[Ut]=9;for(Ut=256;Ut<280;++Ut)Wt[Ut]=7;for(Ut=280;Ut<288;++Ut)Wt[Ut]=8;var zt=new Tt(32);for(Ut=0;Ut<32;++Ut)zt[Ut]=5;var Qt,Jt=Gt(Wt,9,0),Xt=Gt(zt,5,0),Zt=function(e){return(e/8>>0)+(7&e&&1)},Yt=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Rt?Rt:e instanceof At?At:Tt)(n-t);return r.set(e.subarray(t,n)),r},Kt=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},en=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},tn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new Tt(0),0];if(1==i){var s=new Tt(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:a.f+c.f,l:a,r:c};var p=o[0].s;for(r=1;r<i;++r)o[r].s>p&&(p=o[r].s);var f=new Rt(p+1),h=nn(n[l-1],f,0);if(h>t){r=0;var _=0,g=h-t,v=1<<g;for(o.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<i;++r){var y=o[r].s;if(!(f[y]>t))break;_+=v-(1<<h-f[y]),f[y]=t}for(_>>>=g;_>0;){var m=o[r].s;f[m]<t?_-=1<<t-f[m]++-1:++r}for(;r>=0&&_;--r){var b=o[r].s;f[b]==t&&(--f[b],++_)}h=t}return[new Tt(f),h]},nn=function e(t,n,r){return-1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},rn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Rt(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},on=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},sn=function(e,t,n){var r=n.length,i=Zt(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},an=function(e,t,n,r,i,o,s,a,c,u,l){Kt(t,l++,n),++i[256];for(var d=tn(i,15),p=d[0],f=d[1],h=tn(o,15),_=h[0],g=h[1],v=rn(p),y=v[0],m=v[1],b=rn(_),w=b[0],k=b[1],S=new Rt(19),F=0;F<y.length;++F)S[31&y[F]]++;for(F=0;F<w.length;++F)S[31&w[F]]++;for(var E=tn(S,7),x=E[0],O=E[1],P=19;P>4&&!x[jt[P-1]];--P);var I,$,T,R,A=u+5<<3,C=on(i,Wt)+on(o,zt)+s,M=on(i,p)+on(o,_)+s+14+3*P+on(S,x)+(2*S[16]+3*S[17]+7*S[18]);if(A<=C&&A<=M)return sn(t,l,e.subarray(c,c+u));if(Kt(t,l,1+(M<C)),l+=2,M<C){I=Gt(p,f,0),$=p,T=Gt(_,g,0),R=_;var j=Gt(x,O,0);Kt(t,l,m-257),Kt(t,l+5,k-1),Kt(t,l+10,P-4),l+=14;for(F=0;F<P;++F)Kt(t,l+3*F,x[jt[F]]);l+=3*P;for(var D=[y,w],N=0;N<2;++N){var q=D[N];for(F=0;F<q.length;++F){var H=31&q[F];Kt(t,l,j[H]),l+=x[H],H>15&&(Kt(t,l,q[F]>>>5&127),l+=q[F]>>>12)}}}else I=Jt,$=Wt,T=Xt,R=zt;for(F=0;F<a;++F)if(r[F]>255){H=r[F]>>>18&31;en(t,l,I[H+257]),l+=$[H+257],H>7&&(Kt(t,l,r[F]>>>23&31),l+=Ct[H]);var L=31&r[F];en(t,l,T[L]),l+=R[L],L>3&&(en(t,l,r[F]>>>5&8191),l+=Mt[L])}else en(t,l,I[r[F]]),l+=$[r[F]];return en(t,l,I[256]),l+$[256]},cn=new At([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),un=new Tt(0),ln=function(){for(var e=new At(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),dn=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ln[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},pn=function(e,t,n,r,i){return function(e,t,n,r,i,o){var s=e.length,a=new Tt(r+s+5*(1+Math.floor(s/7e3))+i),c=a.subarray(r,a.length-i),u=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d<s?u=sn(c,u,e.subarray(l,d)):(c[l]=o,u=sn(c,u,e.subarray(l,s)))}else{for(var p=cn[t-1],f=p>>>13,h=8191&p,_=(1<<n)-1,g=new Rt(32768),v=new Rt(_+1),y=Math.ceil(n/3),m=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<m)&_},w=new At(25e3),k=new Rt(288),S=new Rt(32),F=0,E=0,x=(l=0,0),O=0,P=0;l<s;++l){var I=b(l),$=32767&l,T=v[I];if(g[$]=T,v[I]=$,O<=l){var R=s-l;if((F>7e3||x>24576)&&R>423){u=an(e,c,0,w,k,S,E,x,P,l-P,u),x=F=E=0,P=l;for(var A=0;A<286;++A)k[A]=0;for(A=0;A<30;++A)S[A]=0}var C=2,M=0,j=h,D=$-T&32767;if(R>2&&I==b(l-D))for(var N=Math.min(f,R)-1,q=Math.min(32767,l),H=Math.min(258,R);D<=q&&--j&&$!=T;){if(e[l+C]==e[l+C-D]){for(var L=0;L<H&&e[l+L]==e[l+L-D];++L);if(L>C){if(C=L,M=D,L>N)break;var B=Math.min(D,L-2),U=0;for(A=0;A<B;++A){var V=l-D+A+32768&32767,G=V-g[V]+32768&32767;G>U&&(U=G,T=V)}}}D+=($=T)-(T=g[$])+32768&32767}if(M){w[x++]=268435456|Ht[C]<<18|Lt[M];var W=31&Ht[C],z=31&Lt[M];E+=Ct[W]+Mt[z],++k[257+W],++S[z],O=l+C,++F}else w[x++]=e[l],++k[e[l]]}}u=an(e,c,o,w,k,S,E,x,P,l-P,u),o||(u=sn(c,u,un))}return Yt(a,0,r+Zt(u)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},fn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},hn=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&fn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},_n=function(e){return 10+(e.filename&&e.filename.length+1||0)};function gn(e,t){void 0===t&&(t={});var n=dn(),r=e.length;n.p(e);var i=pn(e,t,_n(t),8),o=i.length;return hn(i,t),fn(i,o-8,n.d()),fn(i,o-4,r),i}function vn(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Tt(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;s<n;++s){if(i+5>r.length){var a=new Tt(i+8+(n-s<<1));a.set(r),r=a}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return Yt(r,0,i)}exports.Compression=void 0,(Qt=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",Qt.Base64="base64";var yn=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=y.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,s=v(i[1].split("&"));try{for(s.s();!(o=s.n()).done;){var a=o.value.split("=")[0];r[a]&&delete r[a]}}catch(e){s.e(e)}finally{s.f()}}var c=e.indexOf("?")>-1?"&":"?";return e+c+function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return M(e,(function(e,r){t=encodeURIComponent(e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t})),i.join(r)}(r)},mn=function e(t,n){if(n.blob&&t.buffer)return new Blob([t.buffer],{type:"text/plain"});if(n.sendBeacon||n.blob){var r=e(t,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}if("POST"!==n.method)return null;var i,o;return i=Array.isArray(t)||(o=t,"[object Uint8Array]"===Object.prototype.toString.call(o))?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(i+="&compression="+t.compression),i},bn=function(e){var t=e.url,n=e.data,r=e.headers,i=e.options,o=e.captureMetrics,s=e.callback,a=e.retriesPerformedSoFar,c=e.retryQueue,u=e.onXHRError,l=e.timeout,d=void 0===l?1e4:l,p=new XMLHttpRequest;p.open(i.method||"GET",t,!0);var f=mn(n,i);o.incr("_send_request"),o.incr("_send_request_inflight"),M(r,(function(e,t){p.setRequestHeader(t,e)})),"POST"!==i.method||i.blob||p.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p.timeout=d,p.withCredentials=!0,p.onreadystatechange=function(){if(4===p.readyState)if(o.incr("xhr-response"),o.incr("xhr-response-".concat(p.status)),o.decr("_send_request_inflight"),200===p.status){if(s){var e;try{e=JSON.parse(p.responseText)}catch(e){return void R.error(e)}s(e)}}else"function"==typeof u&&u(p),[401,403,404,500].indexOf(p.status)<0&&c.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(a||0)+1,callback:s}),s&&s({status:0})},p.send(f)},wn=function(e){a(i,Pt);var n=p(i);function i(e,t){var o;return r(this,i),(o=n.call(this)).captureMetrics=e,o.isPolling=!1,o.queue=[],o.areWeOnline=!0,o.onXHRError=t,"undefined"!=typeof window&&"onLine"in window.navigator&&(o.areWeOnline=window.navigator.onLine,window.addEventListener("online",(function(){o._handleWeAreNowOnline()})),window.addEventListener("offline",(function(){o.areWeOnline=!1}))),o}return o(i,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var n=3e3*Math.pow(2,t),r=new Date(Date.now()+n);console.warn("Enqueued failed request for retry in ".concat(n)),this.queue.push({retryAt:r,requestData:e}),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout((function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()}),this._pollInterval)}},{key:"flush",value:function(){var e=new Date(Date.now()),t=this.queue.filter((function(t){return t.retryAt<e}));if(t.length>0){this.queue=this.queue.filter((function(t){return t.retryAt>=e}));var n,r=v(t);try{for(r.s();!(n=r.n()).done;){var i=n.value.requestData;this._executeXhrRequest(i)}}catch(e){r.e(e)}finally{r.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var e,n=v(this.queue);try{for(n.s();!(e=n.n()).done;){var r=e.value.requestData,i=r.url,o=r.data,s=r.options;try{window.navigator.sendBeacon(i,mn(o,t(t({},s),{},{sendBeacon:!0})))}catch(e){y.DEBUG&&console.error(e)}}}catch(e){n.e(e)}finally{n.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var t=e.url,n=e.data,r=e.options,i=e.headers,o=e.callback,s=e.retriesPerformedSoFar;bn({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:s||0,callback:o,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}(),kn=18e5,Sn=864e5,Fn=function(){function e(t,n){r(this,e),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null;var i=t.persistence_name||t.token;if(this.window_id_storage_key="ph_"+i+"_window_id",this.primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var o=Oe.parse(this.window_id_storage_key),s=Oe.parse(this.primary_window_exists_storage_key);o&&!s?this._windowId=o:Oe.remove(this.window_id_storage_key),Oe.set(this.primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return o(e,[{key:"_canUseSessionStorage",value:function(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&Oe.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Oe.set(this.window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?Oe.parse(this.window_id_storage_key):null}},{key:"_setSessionId",value:function(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register(s({},Me,[t,e,n])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[Me];return Array.isArray(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;window.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&Oe.remove(e.primary_window_exists_storage_key)}))}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),n=f(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],s=this._getWindowId(),a=o&&o>0&&Math.abs(t-o)>Sn;!i||!e&&Math.abs(t-r)>kn||a?(i=K(),s=K(),o=t):s||(s=K());var c=0===r||!e||a?t:r,u=0===o?(new Date).getTime():o;return this._setWindowId(s),this._setSessionId(i,c,u),{sessionId:i,windowId:s}}}]),e}(),En=o((function e(t,n,i,o){r(this,e),this.name="posthog-js",this.setupOnce=function(e){e((function(e){var r,s,a,c,u;if("error"!==e.level||!t.__loaded)return e;e.tags||(e.tags={});var l=t.config.ui_host||t.config.api_host;e.tags["PostHog Person URL"]=l+"/person/"+t.get_distinct_id(),t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var d=(null===(r=e.exception)||void 0===r?void 0:r.values)||[],p={$exception_message:null===(s=d[0])||void 0===s?void 0:s.value,$exception_type:null===(a=d[0])||void 0===a?void 0:a.type,$exception_personURL:l+"/person/"+t.get_distinct_id(),$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:null===(c=d[0])||void 0===c?void 0:c.value,$sentry_exception_type:null===(u=d[0])||void 0===u?void 0:u.type,$sentry_tags:e.tags};return n&&i&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+e.event_id),t.capture("$exception",p),e}))}})),xn=function(e){var t=function(t,n){t.event.userId||t.event.anonymousId===e.get_distinct_id()||e.reset(),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(e.register({distinct_id:t.event.userId}),e.reloadFeatureFlags());var r=e._calculate_event_properties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,"$pageview")},identify:function(e){return t(e,"$identify")},screen:function(e){return t(e,"$screen")}}},On=function(){function e(){r(this,e),s(this,"_seenFirstPageView",!1)}return o(e,[{key:"onPageview",value:function(){this._seenFirstPageView&&(this._pageViewId=K()),this._seenFirstPageView=!0}},{key:"getPageViewId",value:function(){return this._pageViewId||(this._pageViewId=K()),this._pageViewId}}]),e}();function Pn(e){return"undefined"!=typeof Event&&In(e,Event)}function In(e,t){try{return e instanceof t}catch(e){return!1}}function $n(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Tn(e){return $n(e,"DOMError")}var Rn=/\(error: (.*)\)/,An=50,Cn="?";function Mn(e,t,n,r){var i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}var jn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Dn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Nn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Hn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Ln=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.sort((function(e,t){return e[0]-t[0]})).map((function(e){return e[1]}));return function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],o=e.split("\n"),s=n;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var c=Rn.test(a)?a.replace(Rn,"$1"):a;if(!c.match(/\S*Error: /)){var u,l=v(i);try{for(l.s();!(u=l.n()).done;){var d=(0,u.value)(c);if(d){r.push(d);break}}}catch(e){l.e(e)}finally{l.f()}if(r.length>=An)break}}}return function(e){if(!e.length)return[];var n=e.slice(0,An);return n.reverse(),n.map((function(e){return t(t({},e),{},{filename:e.filename||n[n.length-1].filename,function:e.function||"?"})}))}(r)}}.apply(void 0,[[30,function(e){var t=jn.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){var n=Dn.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}var r=f(Bn(t[1]||Cn,t[2]),2),i=r[0];return Mn(r[1],i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,function(e){var t=Nn.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=qn.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||Cn,o=f(Bn(i,r),2);return i=o[0],Mn(r=o[1],i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,function(e){var t=Hn.exec(e);return t?Mn(t[2],t[1]||Cn,+t[3],t[4]?+t[4]:void 0):void 0}]]),Bn=function(e,t){var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Cn,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Un=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Vn=/Minified React error #\d+;/i;function Gn(e){var t=e.stacktrace||e.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Vn.test(e.message))return 1}return 0}(e);try{return Ln(t,n)}catch(e){}return[]}function Wn(e){var t=Gn(e);return{$exception_type:e.name,$exception_message:e.message,$exception_stack_trace_raw:JSON.stringify(t)}}function zn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:"".concat(i.slice(0,t),"...")}return""}function Qn(e){var n=f(e,5),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],c={};if(void 0===a&&"string"==typeof r){var u="Error",l=r,d=r.match(Un);d&&(u=d[1],l=d[2]),c={$exception_type:u,$exception_message:l}}var p=a||r;if(function(e){return $n(e,"ErrorEvent")}(p)&&p.error)c=Wn(p.error);else if(Tn(p)||function(e){return $n(e,"DOMException")}(p)){var h=p;if(function(e){return"stack"in e}(p))c=Wn(p);else{var _=h.name||(Tn(h)?"DOMError":"DOMException"),g=h.message?"".concat(_,": ").concat(h.message):_;c=function(e){return{$exception_type:"Error",$exception_message:e}}(g),c.$exception_type=c.$exception_type||"Error",c.$exception_message=c.$exception_message||g}"code"in h&&(c.$exception_DOMException_code="".concat(h.code))}else if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return In(e,Error)}}(p))c=Wn(p);else if(function(e){return $n(e,"Object")}(p)||Pn(p)){c=function(e){return{$exception_type:Pn(e)?e.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",zn(e))}}(p),c.$exception_is_synthetic=!0}else c.$exception_type=c.$exception_type||"Error",c.$exception_message=c.$exception_message||p,c.$exception_is_synthetic=!0;return t(t(t(t({},c),{},{$exception_type:c.$exception_type||"UnknownErrorType",$exception_message:c.$exception_message||""},i?{$exception_source:i}:{}),o?{$exception_lineno:o}:{}),s?{$exception_colno:s}:{})}function Jn(e){var r=f(e,1)[0],i=r;try{"reason"in r?i=r.reason:"detail"in r&&"reason"in r.detail&&(i=r.detail.reason)}catch(e){}var o,s={};return(s=null===(o=i)||"object"!==n(o)&&"function"!=typeof o?{$exception_message:"Non-Error promise rejection captured with value: ".concat(String(i))}:Qn([i])).$exception_handled=!1,t(t({},s),{},{$exception_type:s.$exception_type="UnhandledRejection",$exception_message:s.$exception_message=s.$exception_message||r.reason||String(i)})}var Xn,Zn,Yn,Kn=function(){function e(t){r(this,e),s(this,"originalOnErrorHandler",void 0),s(this,"originalOnUnhandledRejectionHandler",void 0),this.instance=t}return o(e,[{key:"startObservingIfEnabled",value:function(){this.isEnabled()?this.startCapturing():this.stopCapturing()}},{key:"startCapturing",value:function(){var e;if(null===(e=S.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)try{this.originalOnErrorHandler=S.onerror,S.onerror=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.captureException(t),!!this.originalOnErrorHandler&&this.originalOnErrorHandler.apply(this,t)}.bind(this),S.onerror.__POSTHOG_INSTRUMENTED__=!0,this.originalOnUnhandledRejectionHandler=S.onunhandledrejection,S.onunhandledrejection=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Jn(t);return this.sendExceptionEvent(r),!this.originalOnUnhandledRejectionHandler||this.originalOnUnhandledRejectionHandler.apply(S,t)}.bind(this),S.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0}catch(e){console.error("PostHog failed to start exception autocapture",e),this.stopCapturing()}}},{key:"stopCapturing",value:function(){var e,t;void 0!==this.originalOnErrorHandler&&(S.onerror=this.originalOnErrorHandler,this.originalOnErrorHandler=null),null===(e=S.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,void 0!==this.originalOnUnhandledRejectionHandler&&(S.onunhandledrejection=this.originalOnUnhandledRejectionHandler,this.originalOnUnhandledRejectionHandler=null),null===(t=S.onunhandledrejection)||void 0===t||delete t.__POSTHOG_INSTRUMENTED__}},{key:"isCapturing",value:function(){var e;return!(null===(e=S.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}},{key:"isEnabled",value:function(){var e,t;return null!==(e=null!==(t=this.instance.get_config("autocapture_exceptions"))&&void 0!==t?t:this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.autocaptureExceptions||!1,this.isEnabled()&&this.startCapturing()}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{transport:"XHR",method:"POST",endpoint:"/e/",_noTruncate:!0,_batchKey:"exceptionEvent"})}},{key:"captureException",value:function(e,n){var r=Qn(e),i=t(t({},n),r),o=this.instance.config.ui_host||this.instance.config.api_host;r.$exception_personURL=o+"/person/"+this.instance.get_distinct_id(),this.sendExceptionEvent(i)}}]),e}();!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(Xn||(Xn={}));var er=function(){},tr={},nr="posthog",rr=S.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,ir=!rr&&-1===x.indexOf("MSIE")&&-1===x.indexOf("Mozilla"),or=function(){var e,t,n;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,autocapture_exceptions:!1,rageclick:!0,cross_subdomain_cookie:-1===(null==E||null===(e=E.location)||void 0===e||null===(t=e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:er,store_google:!0,custom_campaign_params:[],save_referrer:!0,test:!1,verbose:!1,capture_pageview:!0,capture_pageleave:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==S||null===(n=S.location)||void 0===n?void 0:n.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!0,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;console.error(t)},get_device_id:function(e){return e},_onCapture:er,_capture_metrics:!1,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1}},sr=function(e,t,n,r){var i,o=n!==nr&&Yn?n?Yn[n]:void 0:Yn,s={initComplete:!1,syncCode:!1},a=function(e){return function(t){s[e]||(s[e]=!0,s.initComplete&&s.syncCode&&(null==r||r(t)))}};if(o&&Zn===Xn.INIT_MODULE)i=o;else{if(o&&!D(o))return void console.error("You have already initialized "+n);i=new ar}if(i._init(e,t,n,a("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new yt(i),i.sessionRecording.startRecordingIfEnabled(),i.webPerformance=new kt(i),i.webPerformance.startObservingIfEnabled(),i.exceptionAutocapture=new Kn(i),i.exceptionAutocapture.startObservingIfEnabled(),i.__autocapture=i.get_config("autocapture"),Ve._setIsAutocaptureEnabled(i),Ve._isAutocaptureEnabled){i.__autocapture=i.get_config("autocapture");Ve.enabledForProject(i.get_config("token"),100,100)?Ve.isBrowserSupported()?Ve.init(i):(i.__autocapture=!1,R.log("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,R.log("Not in active bucket: disabling Automatic Event Collection."))}return y.DEBUG=y.DEBUG||i.get_config("debug"),void 0!==o&&D(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),a("syncCode")(i),i},ar=function(){function e(){var t=this;r(this,e),this.config=or(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=En,this.segmentIntegration=function(){return xn(t)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.people=new it(this),this.featureFlags=new ut(this),this.feature_flags=this.featureFlags,this.toolbar=new Ot(this),this.pageViewIdManager=new On,this._captureMetrics=void 0,this._requestQueue=void 0,this._retryQueue=void 0,this.persistence=void 0,this.sessionPersistence=void 0,this.sessionManager=void 0}return o(e,[{key:"init",value:function(e,t,n){if(L(n))console.error("You must name your new library: init(token, config, name)");else{if(n!==nr){var r=sr(e,t,n,(function(e){Yn[n]=e,e._loaded()}));return Yn[n]=r,r}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var c,u={segmentRegister:!1,syncCode:!1},l=function(e){return function(){u[e]||(u[e]=!0,u.segmentRegister&&u.syncCode&&(null==a||a(i)))}};(this.set_config(j({},or(),o,{name:s,token:e,callback_fn:(s===nr?s:nr+"."+s)+"._jsc"})),this._jsc=function(){},null!=S&&null!==(n=S.rrweb)&&void 0!==n&&n.record||null!=S&&S.rrwebRecord)&&(this.__loaded_recorder_version=null==S||null===(c=S.rrweb)||void 0===c?void 0:c.version);if(this._captureMetrics=new $t(this.get_config("_capture_metrics")),this._requestQueue=new It(this._captureMetrics,this._handle_queued_event.bind(this)),this._retryQueue=new wn(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new Ue(this.config),this.sessionManager=new Fn(this.config,this.persistence),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new Ue(t(t({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),o.segment?(this.config.get_device_id=function(){return o.segment.user().anonymousId()},o.segment.user().id()&&(this.register({distinct_id:o.segment.user().id()}),this.persistence.set_user_state("identified")),o.segment.register(this.segmentIntegration()).then(l("segmentRegister"))):l("segmentRegister")(),void 0!==(null===(r=o.bootstrap)||void 0===r?void 0:r.distinctID)){var d,p,f=this.get_config("get_device_id")(K()),h=null!==(d=o.bootstrap)&&void 0!==d&&d.isIdentifiedID?f:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(p=o.bootstrap)&&void 0!==p&&p.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var _,g,v=Object.keys((null===(_=o.bootstrap)||void 0===_?void 0:_.featureFlags)||{}).filter((function(e){var t,n;return!(null===(t=o.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])})).reduce((function(e,t){var n,r;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),y=Object.keys((null===(g=o.bootstrap)||void 0===g?void 0:g.featureFlagPayloads)||{}).filter((function(e){return v[e]})).reduce((function(e,t){var n,r,i,s;null!==(n=o.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(i=o.bootstrap)||void 0===i||null===(s=i.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:y})}if(!this.get_distinct_id()){var m=this.get_config("get_device_id")(K());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_user_state("anonymous")}S.addEventListener&&S.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_loaded",value:function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0}),this.get_config("advanced_disable_decide")||new Ft(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)}},{key:"_start_queue_if_opted_in",value:function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||C(this.__request_queue,(function(t){e._send_request.apply(e,h(t))})),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(L(e))return null;if(rr)return function(n){e(n,t)};var n=this._jsc,r=""+Math.floor(1e8*Math.random()),i=this.get_config("callback_fn")+"["+r+"]";return n[r]=function(i){delete n[r],e(i,t)},i}},{key:"_handle_unload",value:function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics)),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,t,n){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,n||tr,er)}},{key:"__compress_and_send_json_request",value:function(e,n,r,i){var o=function(e,n,r){return e===exports.Compression.GZipJS?[gn(vn(n),{mtime:0}),t(t({},r),{},{blob:!0,urlQueryArgs:{compression:exports.Compression.GZipJS}})]:[{data:X(n)},r]}(this.compression[exports.Compression.GZipJS]?exports.Compression.GZipJS:exports.Compression.Base64,n,r),s=f(o,2),a=s[0],c=s[1];this._send_request(e,a,c,i)}},{key:"_send_request",value:function(e,n,r,i){if(ir)this.__request_queue.push([e,n,r,i]);else{var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};r=j(o,r||{}),rr||(r.method="GET");var s="sendBeacon"in S.navigator&&"sendBeacon"===r.transport;if(e=yn(e,r.urlQueryArgs||{},{ip:this.get_config("ip")}),s)try{S.navigator.sendBeacon(e,mn(n,t(t({},r),{},{sendBeacon:!0})))}catch(e){this.get_config("debug")&&console.error(e)}else if(rr)try{bn({url:e,data:n,headers:this.get_config("xhr_headers"),options:r,captureMetrics:this._captureMetrics,callback:i,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(e){console.error(e)}else{var a,c=E.createElement("script");c.type="text/javascript",c.async=!0,c.defer=!0,c.src=e;var u=E.getElementsByTagName("script")[0];null===(a=u.parentNode)||void 0===a||a.insertBefore(c,u)}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];C(e,(function(e){e&&(t=e[0],D(t)?o.push(e):"function"==typeof e?e.call(n):D(e)&&"alias"===t?r.push(e):D(e)&&-1!==t.indexOf("capture")&&"function"==typeof n[t]?o.push(e):i.push(e))}));var s=function(e,t){C(e,(function(e){if(D(e[0])){var n=t;M(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};s(r,this),s(i,this),s(o,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"captureException",value:function(e,t){var n;null===(n=this.exceptionAutocapture)||void 0===n||n.captureException([e.name,void 0,void 0,void 0,e],t)}},{key:"capture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tr;if(this.__loaded&&!tt(this,!1)){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(n=n||tr).transport;if(r&&(n.transport=r),L(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!ee(x)){this.sessionPersistence.update_search_keyword(),this.get_config("store_google")&&this.sessionPersistence.update_campaign_params(),this.get_config("save_referrer")&&this.sessionPersistence.update_referrer_info();var i={event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(i.$set=n.$set,i.$set_once=n.$set_once),(i=J(i,n._noTruncate?null:this.get_config("properties_string_max_length"))).timestamp=n.timestamp||new Date,this.get_config("debug")&&R.log("PostHog.js send",i);var o=JSON.stringify(i),s=this.get_config("api_host")+(n.endpoint||"/e/"),a=n!==tr;return!this.get_config("request_batching")||a&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(s,o,n):this._requestQueue.enqueue(s,i,n),this._invokeCaptureHooks(e,i),i}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),M(this.__captureHooks,(function(t){return t(e)}))}},{key:"_calculate_event_properties",value:function(e,n){var r,i=this.persistence.remove_event_timer(e),o=t({},n);if(o.token=this.get_config("token"),"$snapshot"===e){var s=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,o}var a=oe.properties();if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(),u=c.sessionId,l=c.windowId;o.$session_id=u,o.$window_id=l}if(null!==(r=this.webPerformance)&&void 0!==r&&r.isEnabled&&("$pageview"===e&&this.pageViewIdManager.onPageview(),o=j(o,{$pageview_id:this.pageViewIdManager.getPageViewId()})),"$performance_event"===e){var d=this.persistence.properties();return o.distinct_id=d.distinct_id,o.$current_url=a.$current_url,o}if(void 0!==i){var p=(new Date).getTime()-i;o.$duration=parseFloat((p/1e3).toFixed(3))}o=j({},oe.properties(),this.persistence.properties(),this.sessionPersistence.properties(),o);var f=this.get_config("property_blacklist");D(f)?M(f,(function(e){delete o[e]})):console.error("Invalid value for property_blacklist config: "+f);var h=this.get_config("sanitize_properties");return h&&(o=h(o,e)),o}},{key:"register",value:function(e,t){this.persistence.register(e,t)}},{key:"register_once",value:function(e,t,n){this.persistence.register_once(e,t,n)}},{key:"register_for_session",value:function(e){this.sessionPersistence.register(e)}},{key:"unregister",value:function(e){this.persistence.unregister(e)}},{key:"unregister_for_session",value:function(e){this.sessionPersistence.unregister(e)}},{key:"_register_single",value:function(e,t){this.register(s({},e,t))}},{key:"getFeatureFlag",value:function(e,t){return this.featureFlags.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}},{key:"isFeatureEnabled",value:function(e,t){return this.featureFlags.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}},{key:"getEarlyAccessFeatures",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"identify",value:function(e,t,n){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(Ie)&&(this.unregister(Ie),this.register({distinct_id:e}));var o="anonymous"===this.persistence.get_user_state();e!==r&&o?(this.persistence.set_user_state("identified"),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t&&this.people.set(t),n&&this.people.set_once(n)),e!==r&&this.reloadFeatureFlags()}else console.error("Unique user id has not been set in posthog.identify")}},{key:"group",value:function(e,n,r){if(e&&n){this._captureMetrics.incr("group");var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},i),{},s({},e,n))}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags(s({},e,r))),i[e]===n||r||this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t=this.get_property("$device_id");this.persistence.clear(),this.sessionPersistence.clear(),this.persistence.set_user_state("anonymous"),this.sessionManager.resetSessionId();var n=this.get_config("get_device_id")(K());this.register_once({distinct_id:n,$device_id:e?n:t},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){return this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId}},{key:"get_session_replay_url",value:function(e){var t=(this.config.ui_host||this.config.api_host)+"/replay/"+this.get_session_id();if(null!=e&&e.withTimestamp&&this.sessionManager._sessionStartTimestamp){var n,r=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!this.sessionManager._sessionStartTimestamp)return t;var i=Math.max(Math.floor(((new Date).getTime()-(this.sessionManager._sessionStartTimestamp||0))/1e3)-r,0);t+="?t=".concat(i)}return t}},{key:"alias",value:function(e,t){return e===this.get_property(Pe)?(R.critical("Attempting to create alias for existing People user - aborting."),-2):(L(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Ie,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var n=t({},this.config);H(e)&&(j(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),this.sessionPersistence&&this.sessionPersistence.update_config(this.config),ke.is_supported()&&"true"===ke.get("ph_debug")&&(this.config.debug=!0),this.get_config("debug")&&(y.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&n.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started())}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_config",value:function(e){var t;return null===(t=this.config)||void 0===t?void 0:t[e]}},{key:"get_property",value:function(e){return this.persistence.props[e]}},{key:"getSessionProperty",value:function(e){return this.sessionPersistence.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.get_config("name"))&&void 0!==e?e:nr;return t!==nr&&(t=nr+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&ke.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!be.get("ph_optout")||(be.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))}},{key:"_gdpr_update_persistence",value:function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),this.get_config("disable_persistence")||this.sessionPersistence.disabled===t||this.sessionPersistence.set_disabled(t)}},{key:"_gdpr_call_func",value:function(e,t){return t=j({capture:this.capture.bind(this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t||{}),ke.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=j({enable_persistence:!0},e||{}),this._gdpr_call_func(We,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=j({clear_persistence:!0},e||{});this._gdpr_call_func(ze,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Qe,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Je,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=j({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(Xe,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(S.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(S.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),e}();!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=W(e.prototype[t[n]])}(ar,["identify"]);var cr={},ur=function(){Yn.init=function(e,t,n){if(n)return Yn[n]||(Yn[n]=cr[n]=sr(e||"",t||{},n,(function(e){Yn[n]=cr[n]=e,e._loaded()}))),Yn[n];var r=Yn;return cr[nr]?r=cr[nr]:e&&(r=sr(e,t||{},nr,(function(e){cr[nr]=e,e._loaded()})),cr[nr]=r),Yn=r,Zn===Xn.INIT_SNIPPET&&(S[nr]=Yn),M(cr,(function(e,t){t!==nr&&(Yn[t]=e)})),r}},lr=function(){function e(){e.done||(e.done=!0,ir=!1,M(cr,(function(e){e._dom_loaded()})))}E.addEventListener&&("complete"===E.readyState?e():E.addEventListener("DOMContentLoaded",e,!1)),re(S,"load",e,!0)};var dr=(Zn=Xn.INIT_MODULE,Yn=new ar,ur(),Yn.init(),lr(),Yn);exports.PostHog=ar,exports.default=dr,exports.posthog=dr;
|
|
1
|
+
"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=c(e);if(t){var i=c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return d(this,n)}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}Object.defineProperty(exports,"__esModule",{value:!0});var y={DEBUG:!1,LIB_VERSION:"1.63.2"},m=Array.prototype,b=Object.prototype,w=b.toString,k=b.hasOwnProperty,S="undefined"!=typeof window?window:{},F=S.navigator||{userAgent:""},E=S.document||{},x=F.userAgent,O=["localhost","127.0.0.1"],P=m.forEach,I=m.indexOf,$=Array.isArray,T={},R={log:function(){if(y.DEBUG&&!L(window.console)&&window.console){for(var e=("__rrweb_original__"in window.console.log?window.console.log.__rrweb_original__:window.console.log),t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];try{e.apply(window.console,n)}catch(t){C(n,(function(t){e(t)}))}}},error:function(){if(y.DEBUG&&!L(window.console)&&window.console){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){C(r,(function(e){i(e)}))}}},critical:function(){if(!L(window.console)&&window.console){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=["PostHog error:"].concat(t),i="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{i.apply(window.console,r)}catch(e){C(r,(function(e){i(e)}))}}}},A=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function C(e,t,n){if(Array.isArray(e))if(P&&e.forEach===P)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===T)return}function M(e,t,n){if(null!=e){if(Array.isArray(e))return C(e,t,n);for(var r in e)if(k.call(e,r)&&t.call(n,e[r],r)===T)return}}var j=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return C(n,(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},D=$||function(e){return"[object Array]"===w.call(e)},N=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(e){return!1}};function q(e,t){return-1!==e.indexOf(t)}var H=function(e){return e===Object(e)&&!D(e)},L=function(e){return void 0===e},B=function(e){return"[object String]"==w.call(e)},U=function(e){return"[object Number]"==w.call(e)},V=function e(t){return M(t,(function(n,r){!function(e){return"[object Date]"==w.call(e)}(n)?H(n)&&(t[r]=e(n)):t[r]=G(n)})),t},G=function(e){function t(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},W=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){R.critical("Implementation error. Please turn on debug and contact support@posthog.com."),R.critical(e)}}},z=function(e){var t={};return M(e,(function(e,n){B(e)&&e.length>0&&(t[n]=e)})),t};var Q=["$performance_raw"];function J(e,t){return n=e,r=function(e,n){return n&&Q.indexOf(n)>-1?e:"string"==typeof e&&null!==t?e.slice(0,t):e},i=new Set,function e(t,n){return t!==Object(t)?r?r(t,n):t:i.has(t)?void 0:(i.add(t),D(t)?(o=[],C(t,(function(t){o.push(e(t))}))):(o={},M(t,(function(t,n){i.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,r,i}function X(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,c=0,u="",l=[];if(!e)return e;e=Y(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,l[c++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(a<e.length);switch(u=l.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}var Z,Y=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<r;i++){var s=e.charCodeAt(i),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(n>t&&(o+=e.substring(t,n)),o+=a,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},K=(Z=function(){for(var e=(new Date).valueOf(),t=0;e==(new Date).valueOf();)t++;return e.toString(16)+t.toString(16)},function(){var e="undefined"!=typeof window?(window.screen.height*window.screen.width).toString(16):"0";return Z()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=x,r=0,i=[];function o(e,t){var n,r=0;for(n=0;n<t.length;n++)r|=i[n]<<8*n;return e^r}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(r=o(r,i),i=[]);return i.length>0&&(r=o(r,i)),r.toString(16)}()+"-"+e+"-"+Z()}),ee=function(e){return!!/(google web preview|baiduspider|yandexbot|bingbot|googlebot|yahoo! slurp|ahrefsbot|facebookexternalhit|facebookcatalog|applebot|semrushbot|duckduckbot|twitterbot|rogerbot|linkedinbot|mj12bot|sitebulb|bot.htm|bot.php|hubspot|crawler)/i.test(e)},te=function(e,t){var n=t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]"),r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var i=r[1];try{i=decodeURIComponent(i)}catch(e){R.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},ne=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},re=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,r,i,o){if(t)if(t.addEventListener&&!i)t.addEventListener(n,r,!!o);else{var s="on"+n,a=t[s];t[s]=function(t,n,r){return function(i){if(i=i||e(window.event)){var o,s=!0;N(r)&&(o=r(i));var a=n.call(t,i);return!1!==o&&!1!==a||(s=!1),s}}}(t,r,a)}else R.error("No valid element provided to register_event")}}();function ie(e,t){var n=function(){var n=E.createElement("script");n.type="text/javascript",n.src=e,n.onload=function(e){return t(void 0,e)},n.onerror=function(e){return t(e)};var r,i=E.querySelectorAll("body > script");i.length>0?null===(r=i[0].parentNode)||void 0===r||r.insertBefore(n,i[0]):E.body.appendChild(n)};E.body?n():E.addEventListener("DOMContentLoaded",n)}var oe={campaignParams:function(e){var t=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","fbclid","msclkid"].concat(e||[]),n={};return M(t,(function(e){var t=te(E.URL,e);t.length&&(n[e]=t)})),n},searchEngine:function(){var e=E.referrer;return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=oe.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(null!==e){n.$search_engine=e;var r=te(E.referrer,t);r.length&&(n.ph_keyword=r)}return n},browser:function(e,t,n){return t=t||"",n||q(e," OPR/")?q(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":q(e,"IEMobile")||q(e,"WPDesktop")?"Internet Explorer Mobile":q(e,"SamsungBrowser/")?"Samsung Internet":q(e,"Edge")||q(e,"Edg/")?"Microsoft Edge":q(e,"FBIOS")?"Facebook Mobile":q(e,"Chrome")?"Chrome":q(e,"CriOS")?"Chrome iOS":q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"FxiOS")?"Firefox iOS":q(t,"Apple")?q(e,"Mobile")?"Mobile Safari":"Safari":q(e,"Android")?"Android Mobile":q(e,"Konqueror")?"Konqueror":q(e,"Firefox")?"Firefox":q(e,"MSIE")||q(e,"Trident/")?"Internet Explorer":q(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[oe.browser(e,t,n)];if(void 0===r)return null;var i=e.match(r);return i?parseFloat(i[i.length-2]):null},browserLanguage:function(){return F.language||F.userLanguage},os:function(e){if(/Windows/i.test(e)){if(/Phone/.test(e)||/WPDesktop/.test(e))return{os_name:"Windows Phone",os_version:""};var t=/Windows NT ([0-9.]+)/i.exec(e);return t&&t[1]?{os_name:"Windows",os_version:t[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(e)){var n=/OS (\d+)_(\d+)_?(\d+)?/i.exec(e);return n&&n[1]?{os_name:"iOS",os_version:[n[1],n[2],n[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(e)){var r=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(e);return r&&r[1]?{os_name:"Android",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(e))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(e)){var i=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(e);return i&&i[1]?{os_name:"Mac OS X",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(e)?{os_name:"Linux",os_version:""}:/CrOS/.test(e)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)&&!/Mobile/.test(e)?"Android Tablet":/Android/.test(e)?"Android":""},deviceType:function(e){var t=this.device(e);return"iPad"===t||"Android Tablet"===t?"Tablet":t?"Mobile":"Desktop"},referrer:function(){return E.referrer||"$direct"},referringDomain:function(){if(!E.referrer)return"$direct";var e=E.createElement("a");return e.href=E.referrer,e.host},properties:function(){var e=oe.os(x),t=e.os_name,n=e.os_version;return j(z({$os:t,$os_version:n,$browser:oe.browser(x,F.vendor,S.opera),$device:oe.device(x),$device_type:oe.deviceType(x)}),{$current_url:null==S?void 0:S.location.href,$host:null==S?void 0:S.location.host,$pathname:null==S?void 0:S.location.pathname,$browser_version:oe.browserVersion(x,F.vendor,S.opera),$browser_language:oe.browserLanguage(),$screen_height:null==S?void 0:S.screen.height,$screen_width:null==S?void 0:S.screen.width,$viewport_height:null==S?void 0:S.innerHeight,$viewport_width:null==S?void 0:S.innerWidth,$lib:"web",$lib_version:y.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:(Date.now=Date.now||function(){return+new Date},Date.now()/1e3)})},people_properties:function(){var e=oe.os(x),t=e.os_name,n=e.os_version;return j(z({$os:t,$os_version:n,$browser:oe.browser(x,F.vendor,S.opera)}),{$browser_version:oe.browserVersion(x,F.vendor,S.opera)})}};function se(e){switch(n(e.className)){case"string":return e.className;case"object":return("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";default:return""}}function ae(e){var t="";return fe(e)&&!he(e)&&e.childNodes&&e.childNodes.length&&M(e.childNodes,(function(e){le(e)&&e.textContent&&(t+=A(e.textContent).split(/(\s+)/).filter(_e).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))})),A(t)}function ce(e){return!!e&&1===e.nodeType}function ue(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function le(e){return!!e&&3===e.nodeType}function de(e){return!!e&&11===e.nodeType}var pe=["a","button","form","input","select","textarea","label"];function fe(e){for(var t=e;t.parentNode&&!ue(t,"body");t=t.parentNode){var n=se(t).split(" ");if(q(n,"ph-sensitive")||q(n,"ph-no-capture"))return!1}if(q(se(e).split(" "),"ph-include"))return!0;var r=e.type||"";if("string"==typeof r)switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";if("string"==typeof i){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function he(e){return!!(ue(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ue(e,"select")||ue(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function _e(e){if(null===e||L(e))return!1;if("string"==typeof e){e=A(e);if(/^(?:(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}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0}function ge(e){var t=ae(e);return _e(t="".concat(t," ").concat(ve(e)).trim())?t:""}function ve(e){var t="";return e&&e.childNodes&&e.childNodes.length&&M(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var r=ae(e);t="".concat(t," ").concat(r).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(ve(e)).trim())}catch(e){console.error(e)}})),t}var ye=function(){function e(t){r(this,e),this.clicks=[],this.enabled=t}return o(e,[{key:"isRageClick",value:function(e,t,n){if(!this.enabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),me=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,be={is_supported:function(){return!0},error:function(e){R.error("cookieStore error: "+e)},get:function(e){try{for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch(e){}return null},parse:function(e){var t;try{t=JSON.parse(be.get(e))||{}}catch(e){}return t},set:function(e,t,n,r,i){try{var o="",s="",a="";if(r){var c=document.location.hostname.match(me),u=c?c[0]:"";o=u?"; domain=."+u:""}if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),s="; expires="+l.toUTCString()}i&&(a="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+o+a;return document.cookie=d,d}catch(e){return}},remove:function(e,t){try{be.set(e,"",-1,t)}catch(e){return}}},we=null,ke={is_supported:function(){if(null!==we)return we;var e=!0;if("undefined"!=typeof window)try{var t="__mplssupport__";ke.set(t,"xyz"),'"xyz"'!==ke.get(t)&&(e=!1),ke.remove(t)}catch(t){e=!1}else e=!1;return e||R.error("localStorage unsupported; falling back to cookie store"),we=e,e},error:function(e){R.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(e){ke.error(e)}return null},parse:function(e){try{return JSON.parse(ke.get(e))||{}}catch(e){}return null},set:function(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){ke.error(e)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(e){ke.error(e)}}},Se=t(t({},ke),{},{parse:function(e){try{var t={};try{(t=be.parse(e)||{}).distinct_id&&be.set(e,{distinct_id:t.distinct_id})}catch(e){}var n=j(t,JSON.parse(ke.get(e)||"{}"));return ke.set(e,n),n}catch(e){}return null},set:function(e,t,n,r,i){try{ke.set(e,t),t.distinct_id&&be.set(e,{distinct_id:t.distinct_id},n,r,i)}catch(e){ke.error(e)}},remove:function(e,t){try{window.localStorage.removeItem(e),be.remove(e,t)}catch(e){ke.error(e)}}}),Fe={},Ee={is_supported:function(){return!0},error:function(e){R.error("memoryStorage error: "+e)},get:function(e){return Fe[e]||null},parse:function(e){return Fe[e]||null},set:function(e,t){Fe[e]=t},remove:function(e){delete Fe[e]}},xe=null,Oe={is_supported:function(){if(null!==xe)return xe;if(xe=!0,"undefined"!=typeof window)try{var e="__support__";Oe.set(e,"xyz"),'"xyz"'!==Oe.get(e)&&(xe=!1),Oe.remove(e)}catch(e){xe=!1}else xe=!1;return xe},error:function(e){y.DEBUG&&R.error("sessionStorage error: ",e)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(e){Oe.error(e)}return null},parse:function(e){try{return JSON.parse(Oe.get(e))||null}catch(e){}return null},set:function(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Oe.error(e)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(e){Oe.error(e)}}},Pe="$people_distinct_id",Ie="__alias",$e="__timers",Te="$autocapture_disabled_server_side",Re="$session_recording_enabled_server_side",Ae="$console_log_recording_enabled_server_side",Ce="$session_recording_recorder_version_server_side",Me="$sesid",je="$enabled_feature_flags",De="$early_access_features",Ne="$stored_person_properties",qe="$stored_group_properties",He="$user_state",Le=[Pe,Ie,"__cmpns",$e,Re,Me,je,He,De,qe,Ne],Be=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ue=function(){function e(t){r(this,e);var n="";t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=t.custom_campaign_params||[],t.persistence_name?this.name="ph_"+t.persistence_name:this.name="ph_"+n+"_posthog",-1===Be.indexOf(t.persistence.toLowerCase())&&(R.critical("Unknown persistence type "+t.persistence+"; falling back to cookie"),t.persistence="cookie");var i=t.persistence.toLowerCase();"localstorage"===i&&ke.is_supported()?this.storage=ke:"localstorage+cookie"===i&&Se.is_supported()?this.storage=Se:"sessionstorage"===i&&Oe.is_supported()?this.storage=Oe:this.storage="memory"===i?Ee:be,this.user_state="anonymous",this.load(),this.update_config(t),this.save()}return o(e,[{key:"properties",value:function(){var e={};return M(this.props,(function(t,r){if(r===je&&"object"===n(t))for(var i=Object.keys(t),o=0;o<i.length;o++)e["$feature/".concat(i[o])]=t[i[o]];else a=r,c=!1,(null===(s=Le)?c:I&&s.indexOf===I?-1!=s.indexOf(a):(M(s,(function(e){if(c||(c=e===a))return T})),c))||(e[r]=t);var s,a,c})),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=j({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var r=this;if(H(e)){void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n;var i=!1;if(M(e,(function(e,n){r.props.hasOwnProperty(n)&&r.props[n]!==t||(r.props[n]=e,i=!0)})),i)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(H(e)){this.expire_days=void 0===t?this.default_expiry:t;var r=!1;if(M(e,(function(t,i){e.hasOwnProperty(i)&&n.props[i]!==t&&(n.props[i]=t,r=!0)})),r)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(oe.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(oe.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||oe.referrer(),$referring_domain:this.props.$referring_domain||oe.referringDomain()})}},{key:"get_referrer_info",value:function(){return z({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return M(this.props,(function(t,n){n in e||(e[n]=t)})),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[$e]||{};n[e]=t,this.props[$e]=n,this.save()}},{key:"remove_event_timer",value:function(e){var t=(this.props[$e]||{})[e];return L(t)||(delete this.props[$e][e],this.save()),t}},{key:"get_user_state",value:function(){return this.props[He]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[He]=e,this.save()}}]),e}(),Ve={_initializedTokens:[],_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(e){var t=!!e.get_property(Te),n=!!e.get_config("autocapture");this._isAutocaptureEnabled=n&&!t},_previousElementSibling:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ce(t));return t},_getAugmentPropertiesFromElement:function(e){if(!fe(e))return{};var t={};return M(e.attributes,(function(e){if(0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&_e(r)&&(t[n]=r)}})),t},_getPropertiesFromElement:function(e,t,n){var r=e.tagName.toLowerCase(),i={tag_name:r};pe.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?i.$el_text=ge(e):i.$el_text=ae(e));var o=se(e);o.length>0&&(i.classes=o.split(" ").filter((function(e){return""!==e}))),M(e.attributes,(function(n){var r;he(e)&&-1===["name","id","class"].indexOf(n.name)||!t&&_e(n.value)&&("string"!=typeof(r=n.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))&&(i["attr__"+n.name]=n.value)}));for(var s=1,a=1,c=e;c=this._previousElementSibling(c);)s++,c.tagName===e.tagName&&a++;return i.nth_child=s,i.nth_of_type=a,i},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(e){var t=[];return M(document.querySelectorAll(e.css_selector),(function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),_e(n)&&t.push(n)})),t.join(", ")},_getCustomProperties:function(e){var t=this,n={};return M(this._customProperties,(function(r){M(r.event_selectors,(function(i){M(document.querySelectorAll(i),(function(i){q(e,i)&&fe(i)&&(n[r.name]=t._extractCustomPropertyValue(r))}))}))})),n},_getEventTarget:function(e){return void 0===e.target?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t},_captureEvent:function(e,t){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$autocapture",o=this._getEventTarget(e);(le(o)&&(o=o.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent)&&(null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,t,"$rageclick"));if(o&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||ue(e,"html")||!ce(e))return!1;if(null!=n&&n.url_allowlist){var r=window.location.href,i=n.url_allowlist;if(i&&!i.some((function(e){return r.match(e)})))return!1}if(null!=n&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some((function(e){return t.type===e})))return!1}if(null!=n&&n.element_allowlist){var s=n.element_allowlist;if(s&&!s.some((function(t){return e.tagName.toLowerCase()===t})))return!1}if(null!=n&&n.css_selector_allowlist){var a=n.css_selector_allowlist;if(a&&!a.some((function(t){return e.matches(t)})))return!1}for(var c=!1,u=[e],l=!0,d=e;d.parentNode&&!ue(d,"body");)if(de(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=d.parentNode||!1))break;if(pe.indexOf(l.tagName.toLowerCase())>-1)c=!0;else{var p=window.getComputedStyle(l);p&&"pointer"===p.getPropertyValue("cursor")&&(c=!0)}u.push(l),d=l}var f=window.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return"submit"===t.type;case"input":case"select":case"textarea":return"change"===t.type||"click"===t.type;default:return c?"click"===t.type:"click"===t.type&&(pe.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(o,e,this.config)){for(var s=[o],a=o;a.parentNode&&!ue(a,"body");)de(a.parentNode)?(s.push(a.parentNode.host),a=a.parentNode.host):(s.push(a.parentNode),a=a.parentNode);var c,u=[],l={},d=!1;if(M(s,(function(e){var n=fe(e);"a"===e.tagName.toLowerCase()&&(c=e.getAttribute("href"),c=n&&_e(c)&&c),q(se(e).split(" "),"ph-no-capture")&&(d=!0),u.push(r._getPropertiesFromElement(e,t.get_config("mask_all_element_attributes"),t.get_config("mask_all_text")));var i=r._getAugmentPropertiesFromElement(e);j(l,i)})),t.get_config("mask_all_text")||("a"===o.tagName.toLowerCase()||"button"===o.tagName.toLowerCase()?u[0].$el_text=ge(o):u[0].$el_text=ae(o)),c&&(u[0].attr__href=c),d)return!1;var p=j(this._getDefaultProperties(e.type),{$elements:u},this._getCustomProperties(s),l);return t.capture(i,p),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(e){var t=this,n=function(n){n=n||window.event,t._captureEvent(n,e)};re(document,"submit",n,!1,!0),re(document,"change",n,!1,!0),re(document,"click",n,!1,!0)},_customProperties:[],rageclicks:null,config:void 0,init:function(e){var t;"boolean"!=typeof e.__autocapture&&(this.config=e.__autocapture),null!==(t=this.config)&&void 0!==t&&t.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map((function(e){return new RegExp(e)}))),this.rageclicks=new ye(e.get_config("rageclick"))},afterDecideResponse:function(e,t){this._setIsAutocaptureEnabled(t);var n=t.get_config("token");this._initializedTokens.indexOf(n)>-1?R.log('autocapture already initialized for token "'+n+'"'):(t.persistence&&t.persistence.register(s({},Te,!!e.autocapture_opt_out)),this._initializedTokens.push(n),e&&e.config&&e.config.enable_collect_everything&&this._isAutocaptureEnabled?(e.custom_properties&&(this._customProperties=e.custom_properties),this._addDomEventHandlers(t)):t.__autocapture=!1)},enabledForProject:function(e,t,n){if(!e)return!0;t=L(t)?10:t,n=L(n)?10:n;for(var r=0,i=0;i<e.length;i++)r+=e.charCodeAt(i);return r%t<n},isBrowserSupported:function(){return N(document.querySelectorAll)}};!function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=e[t].bind(e))}(Ve),function(e){for(var t in e)"function"==typeof e[t]&&(e[t]=W(e[t]))}(Ve);var Ge="__ph_opt_in_out_";function We(e,t){et(!0,e,t)}function ze(e,t){et(!1,e,t)}function Qe(e,t){return"1"===Ke(e,t)}function Je(e,t){return!!function(e){if(e&&e.respectDnt){var t=e&&e.window||S,n=t.navigator||{},r=!1;return M([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){q([!0,1,"1","yes"],e)&&(r=!0)})),r}return!1}(t)||"0"===Ke(e,t)}function Xe(e,t){Ze(t=t||{}).remove(Ye(e,t),!!t.crossSubdomainCookie)}function Ze(e){return"localStorage"===(e=e||{}).persistenceType?ke:"localStorage+cookie"===e.persistenceType?Se:be}function Ye(e,t){return((t=t||{}).persistencePrefix||Ge)+e}function Ke(e,t){return Ze(t).get(Ye(e,t))}function et(e,t,n){B(t)&&t.length?(Ze(n=n||{}).set(Ye(t,n),e?1:0,U(n.cookieExpiration)?n.cookieExpiration:null,n.crossSubdomainCookie,n.secureCookie),n.capture&&e&&n.capture(n.captureEventName||"$opt_in",n.captureProperties||{},{send_instantly:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function tt(e,t){var n=!1;try{var r=e.get_config("token"),i=e.get_config("respect_dnt"),o=e.get_config("opt_out_capturing_persistence_type"),s=e.get_config("opt_out_capturing_cookie_prefix")||void 0,a=e.get_config("window");r&&(n=Je(r,{respectDnt:i,persistenceType:o,persistencePrefix:s,window:a}))}catch(e){t||console.error("Unexpected error when checking capturing opt-out status: "+e)}return n}function nt(e,t,n){return function(){for(var r=tt(e,n),i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];if(!r)return t.apply(this,o);var a=o[o.length-1];"function"==typeof a&&a(0)}}var rt="$set",it=function(){function e(t){var n=this;r(this,e),this._posthog=t,this.set=nt(t,(function(e,t,r){var i=n.set_action(e,t);return n._posthog.setPersonPropertiesForFlags(i.$set||{}),H(e)&&(r=t),n._get_config("save_referrer")&&n._posthog.sessionPersistence.update_referrer_info(),i[rt]=j({},oe.people_properties(),n._posthog.sessionPersistence.get_referrer_info(),i[rt]),n._send_request(i,r)})),this.set_once=nt(t,(function(e,t,r){var i=n.set_once_action(e,t);return H(e)&&(r=t),n._send_request(i,r)}))}return o(e,[{key:"toString",value:function(){return this._posthog.toString()+".people"}},{key:"_send_request",value:function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._posthog.get_distinct_id();var n=this._posthog.get_property("$device_id"),r=this._posthog.get_property("$user_id"),i=this._posthog.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=V(e),s=J(o,this._get_config("properties_string_max_length")),a=X(JSON.stringify(o));return this._posthog._send_request(this._get_config("api_host")+"/engage/",{data:a},{},this._posthog._prepare_callback(t,s)),s}},{key:"_get_config",value:function(e){return this._posthog.get_config(e)}},{key:"_is_reserved_property",value:function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e}},{key:"set_action",value:function(e,t){return this.apiActionParser(rt,e,t)}},{key:"set_once_action",value:function(e,t){return this.apiActionParser("$set_once",e,t)}},{key:"apiActionParser",value:function(e,t,n){var r=this,i={},o={};return H(t)?M(t,(function(e,t){r._is_reserved_property(t)||(o[t]=e)})):o[t]=n,i[e]=o,i}}]),e}(),ot="$active_feature_flags",st="$override_feature_flags",at="$feature_flag_payloads",ct=function(e){var t,n={},r=v(function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}(e||{}));try{for(r.s();!(t=r.n()).done;){var i=f(t.value,2),o=i[0],s=i[1];s&&(n[o]=s)}}catch(e){r.e(e)}finally{r.f()}return n},ut=function(){function e(t){r(this,e),this.instance=t,this._override_warning=!1,this.flagCallReported={},this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return o(e,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(je),t=this.instance.get_property(st);if(!t)return e||{};for(var n=j({},e),r=Object.keys(t),i=0;i<r.length;i++)!1===t[r[i]]?delete n[r[i]]:n[r[i]]=t[r[i]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this._override_warning=!0),n}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(at)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())}),5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;this.setReloadingPaused(!0);var t=this.instance.get_config("token"),n=this.instance.get_property(Ne),r=this.instance.get_property(qe),i=X(JSON.stringify({token:t,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:n,group_properties:r}));this.instance._send_request(this.instance.get_config("api_host")+"/decide/?v=3",{data:i},{method:"POST"},this.instance._prepare_callback((function(t){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(t),e.setReloadingPaused(!1),e._startReloadTimer()})))}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.getFlags())return console.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time."),!1;var n=this.getFlagVariants()[e];return!t.send_event&&"send_event"in t||this.flagCallReported[e]||(this.flagCallReported[e]=!0,this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})),n}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getFlags()?!!this.getFeatureFlag(e,t):(console.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time."),!1)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((function(t){return t!==e}))}},{key:"receivedFeatureFlags",value:function(e){this.instance.decideEndpointWasHit=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads();!function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.featureFlags,a=e.featureFlagPayloads;if(o)if(Array.isArray(o)){var c,u={};if(o)for(var l=0;l<o.length;l++)u[o[l]]=!0;n&&n.register((s(c={},ot,o),s(c,je,u),c))}else{var d,p=o,f=a;e.errorsWhileComputingFlags&&(p=t(t({},r),p),f=t(t({},i),f)),n&&n.register((s(d={},ot,Object.keys(ct(p))),s(d,je,p||{}),s(d,at,f||{}),d))}}(e,this.instance.persistence,n,r),this._fireFeatureFlagsCallbacks()}},{key:"override",value:function(e){if(this._override_warning=!1,!1===e)this.instance.persistence.unregister(st);else if(Array.isArray(e)){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;this.instance.persistence.register(s({},st,t))}else this.instance.persistence.register(s({},st,e))}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var n=this._prepareFeatureFlagsForCallbacks(),r=n.flags,i=n.flagVariants;e(r,i)}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,n){var r,i=s({},"$feature_enrollment/".concat(e),n);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:n,$set:i}),this.setPersonPropertiesForFlags(i,!1);var o=t(t({},this.getFlagVariants()),{},s({},e,n));this.instance.persistence.register((s(r={},ot,Object.keys(ct(o))),s(r,je,o),r)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.instance.get_property(De);if(r&&!n)return e(r);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/api/early_access_features/?token=").concat(this.instance.get_config("token")),{},{method:"GET"},(function(n){var r=n.earlyAccessFeatures;return t.instance.persistence.register(s({},De,r)),e(r)}))}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((function(e){return t[e]})),flagVariants:Object.keys(t).filter((function(e){return t[e]})).reduce((function(e,n){return e[n]=t[n],e}),{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),t=e.flags,n=e.flagVariants;this.featureFlagEventHandlers.forEach((function(e){return e(t,n)}))}},{key:"setPersonPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(Ne)||{};this.instance.register(s({},Ne,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Ne)}},{key:"setGroupPropertiesForFlags",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.instance.get_property(qe)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((function(n){r[n]=t(t({},r[n]),e[n]),delete e[n]})),this.instance.register(s({},qe,t(t({},r),e))),n&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var n=this.instance.get_property(qe)||{};this.instance.register(s({},qe,t(t({},n),{},s({},e,{}))))}else this.instance.unregister(qe)}}]),e}(),lt="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==",dt=2,pt=4,ft=6;var ht="rrweb/console@1";var _t,gt="/e/";!function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet"}(_t||(_t={}));var vt=[_t.MouseMove,_t.MouseInteraction,_t.Scroll,_t.ViewportResize,_t.Input,_t.TouchMove,_t.MediaInteraction,_t.Drag],yt=function(){function e(t){r(this,e),s(this,"lastActivityTimestamp",Date.now()),s(this,"isIdle",!1),this.instance=t,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=gt,this.stopRrweb=void 0,this.windowId=null,this.sessionId=null,this.receivedDecide=!1}return o(e,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(Re),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"isConsoleLogCaptureEnabled",value:function(){var e=!!this.instance.get_property(Ae),t=this.instance.get_config("enable_recording_console_log");return null!=t?t:e}},{key:"getRecordingVersion",value:function(){var e,t=this.instance.get_property(Ce);return(null===(e=this.instance.get_config("session_recording"))||void 0===e?void 0:e.recorderVersion)||t||"v1"}},{key:"afterDecideResponse",value:function(e){var t,n,r,i,o,a;(this.receivedDecide=!0,this.instance.persistence)&&this.instance.persistence.register((s(o={},Re,!!e.sessionRecording),s(o,Ae,null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled),s(o,Ce,null===(i=e.sessionRecording)||void 0===i?void 0:i.recorderVersion),o));null!==(t=e.sessionRecording)&&void 0!==t&&t.endpoint&&(this.endpoint=null===(a=e.sessionRecording)||void 0===a?void 0:a.endpoint);null!==(n=e.sessionRecording)&&void 0!==n&&n.recorderVersion&&(this.recorderVersion=e.sessionRecording.recorderVersion),this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach((function(t){return e._captureSnapshot(t)}))),this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(void 0!==Object.assign&&!this.captureStarted&&!this.instance.get_config("disable_session_recording")){this.captureStarted=!0,this.instance.sessionManager.checkAndGetSessionAndWindowId();var t="v2"===this.getRecordingVersion()?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.getRecordingVersion()?ie(this.instance.get_config("api_host")+"/static/".concat(t,"?v=").concat(y.LIB_VERSION),(function(n){if(n)return R.error("Could not load ".concat(t),n);e._onScriptLoaded()})):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var t;return 3===e.type&&-1!==vt.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this._isInteractiveEvent(e);if(t||this.isIdle||e.timestamp-this.lastActivityTimestamp>3e5&&(this.isIdle=!0),t&&(this.lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryTakeFullSnapshot())),!this.isIdle){var n=this.instance.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=n.windowId,i=n.sessionId;-1!==[dt,pt].indexOf(e.type)||this.windowId===r&&this.sessionId===i||this._tryTakeFullSnapshot(),this.windowId=r,this.sessionId=i}}},{key:"_tryTakeFullSnapshot",value:function(){if(!this.captureStarted)return!1;try{var e;return null===(e=this.rrwebRecord)||void 0===e||e.takeFullSnapshot(),!0}catch(e){return R.error("Error taking full snapshot.",e),!1}}},{key:"_onScriptLoaded",value:function(){var e=this,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var r=this.instance.get_config("session_recording"),i=0,o=Object.entries(r||{});i<o.length;i++){var s=f(o[i],2),a=s[0],c=s[1];a in n&&(n[a]=c)}this.rrwebRecord?(this.stopRrweb=this.rrwebRecord(t({emit:function(t){e.onRRwebEmit(t)},plugins:window.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled()?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},n)),this.instance._addCaptureHook((function(t){try{var n;if("$pageview"===t)null===(n=e.rrwebRecord)||void 0===n||n.addCustomEvent("$pageview",{href:window.location.href})}catch(e){R.error("Could not add $pageview to rrweb session",e)}})),this.lastActivityTimestamp=Date.now(),this.isIdle=!1):R.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"onRRwebEmit",value:function(e){if(e=function(e){if(e&&"object"===n(e)&&e.type===ft&&"object"===n(e.data)&&e.data.plugin===ht){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var t=[],r=0;r<e.data.payload.payload.length;r++)e.data.payload.payload[r]&&e.data.payload.payload[r].length>2e3?t.push(e.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):t.push(e.data.payload.payload[r]);return e.data.payload.payload=t,e}return e}(function(e){if(e&&"object"===n(e)){var t=JSON.stringify(e);if(t.length>5e6){var r,i=v(t.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(i.s();!(r=i.n()).done;){var o=r.value;t="image/"===o[1].toLocaleLowerCase().slice(0,6)?t.replace(o[0],lt):t.replace(o[0],"")}}catch(e){i.e(e)}finally{i.f()}}return JSON.parse(t)}return e}(e)),this._updateWindowAndSessionIds(e),!this.isIdle){var t={$snapshot_data:e,$session_id:this.sessionId,$window_id:this.windowId};this.instance._captureMetrics.incr("rrweb-record"),this.instance._captureMetrics.incr("rrweb-record-".concat(e.type)),this.emit?this._captureSnapshot(t):this.snapshots.push(t)}}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===dt}})}}]),e}(),mt={entryType:0,timeOrigin:1,name:2,startTime:3,redirectStart:4,redirectEnd:5,workerStart:6,fetchStart:7,domainLookupStart:8,domainLookupEnd:9,connectStart:10,secureConnectionStart:11,connectEnd:12,requestStart:13,responseStart:14,responseEnd:15,decodedBodySize:16,encodedBodySize:17,initiatorType:18,nextHopProtocol:19,renderBlockingStatus:20,responseStatus:21,transferSize:22,element:23,renderTime:24,loadTime:25,size:26,id:27,url:28,domComplete:29,domContentLoadedEvent:30,domInteractive:31,loadEventEnd:32,loadEventStart:33,redirectCount:34,navigationType:35,unloadEventEnd:36,unloadEventStart:37,duration:39,timestamp:40},bt=["first-input","navigation","paint","resource"],wt=["/s/","/e/"],kt=function(){function e(t){r(this,e),s(this,"_forceAllowLocalhost",!1),this.instance=t}return o(e,[{key:"startObservingIfEnabled",value:function(){this.isEnabled()?this.startObserving():this.stopObserving()}},{key:"startObserving",value:function(){var e,t,n=this;if(!this.observer)if(void 0!==(null===(e=window)||void 0===e||null===(t=e.PerformanceObserver)||void 0===t?void 0:t.supportedEntryTypes))if(!O.includes(location.hostname)||this._forceAllowLocalhost)try{this.observer=new PerformanceObserver((function(e){e.getEntries().forEach((function(e){n._capturePerformanceEvent(e)}))}));var r=PerformanceObserver.supportedEntryTypes.filter((function(e){return bt.includes(e)}));r.forEach((function(e){var t;null===(t=n.observer)||void 0===t||t.observe({type:e,buffered:!0})}))}catch(e){console.error("PostHog failed to start performance observer",e),this.stopObserving()}else R.log("PostHog Peformance observer not started because we are on localhost.");else R.log("PostHog Peformance observer not started because PerformanceObserver is not supported by this browser.")}},{key:"stopObserving",value:function(){this.observer&&(this.observer.disconnect(),this.observer=void 0)}},{key:"isObserving",value:function(){return!!this.observer}},{key:"isEnabled",value:function(){var e,t;return null!==(e=null!==(t=this.instance.get_config("capture_performance"))&&void 0!==t?t:this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.capturePerformance||!1,this.isEnabled()&&this.startObserving()}},{key:"_capturePerformanceEvent",value:function(e){if(0===e.name.indexOf(this.instance.get_config("api_host"))){var t=e.name.replace(this.instance.get_config("api_host"),"");if(wt.find((function(e){return 0===t.indexOf(e)})))return}var n={url:e.name},r=this.instance.get_config("session_recording");if(r.maskNetworkRequestFn&&(n=r.maskNetworkRequestFn(n)),n){var i=e.toJSON();i.name=n.url;var o={},a=Math.floor(Date.now()-performance.now());for(var c in o[mt.timeOrigin]=a,o[mt.timestamp]=Math.floor(a+e.startTime),mt)void 0!==i[c]&&(o[mt[c]]=i[c]);if(this.capturePerformanceEvent(o),St(e)){var u,l=v(e.serverTiming||[]);try{for(l.s();!(u=l.n()).done;){var d,p=u.value;this.capturePerformanceEvent((s(d={},mt.timeOrigin,a),s(d,mt.timestamp,Math.floor(a+e.startTime)),s(d,mt.name,p.name),s(d,mt.duration,p.duration),s(d,mt.entryType,"serverTiming"),d))}}catch(e){l.e(e)}finally{l.f()}}}}},{key:"capturePerformanceEvent",value:function(e){var t,n=e[mt.timestamp];null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"posthog/network@1",payload:e},timestamp:n})}}]),e}(),St=function(e){return"navigation"===e.entryType||"resource"===e.entryType},Ft=function(){function e(t){r(this,e),this.instance=t,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return o(e,[{key:"call",value:function(){var e=this,t=X(JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Ne),group_properties:this.instance.get_property(qe)}));this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=3"),{data:t,verbose:!0},{method:"POST"},(function(t){return e.parseDecideResponse(t)}))}},{key:"parseDecideResponse",value:function(e){var t,n,r,i=this;if(0!==(null==e?void 0:e.status)){if(this.instance.decideEndpointWasHit=!0,!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){i.parseDecideResponse(e)}),500);if(this.instance.toolbar.afterDecideResponse(e),null===(t=this.instance.sessionRecording)||void 0===t||t.afterDecideResponse(e),Ve.afterDecideResponse(e,this.instance),null===(n=this.instance.webPerformance)||void 0===n||n.afterDecideResponse(e),null===(r=this.instance.exceptionAutocapture)||void 0===r||r.afterDecideResponse(e),this.instance.featureFlags.receivedFeatureFlags(e),this.instance.compression={},e.supportedCompression&&!this.instance.get_config("disable_compression")){var o,s={},a=v(e.supportedCompression);try{for(a.s();!(o=a.n()).done;){s[o.value]=!0}}catch(e){a.e(e)}finally{a.f()}this.instance.compression=s}if(e.siteApps)if(this.instance.get_config("opt_in_site_apps")){var c,u=this.instance.get_config("api_host"),l=v(e.siteApps);try{var d=function(){var e=c.value,t=e.id,n=e.url,r=[u,"/"===u[u.length-1]&&"/"===n[0]?n.substring(1):n].join("");window["__$$ph_site_app_".concat(t)]=i.instance,ie(r,(function(e){e&&console.error("Error while initializing PostHog app with config id ".concat(t),e)}))};for(l.s();!(c=l.n()).done;)d()}catch(e){l.e(e)}finally{l.f()}}else e.siteApps.length>0&&console.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else console.error("Failed to fetch feature flags from PostHog.")}}]),e}(),Et=["https://app.posthog.com","https://eu.posthog.com"],xt=["source"],Ot=function(){function e(t){r(this,e),this.instance=t}return o(e,[{key:"afterDecideResponse",value:function(e){var n=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&n.toolbarVersion&&0===n.toolbarVersion.indexOf("toolbar")&&this.loadToolbar(t({},n))}},{key:"maybeLoadToolbar",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!t){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(e){return!1}t=window.localStorage}var r,i=ne(e.hash,"__posthog")||ne(e.hash,"state"),o=i?JSON.parse(decodeURIComponent(i)):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState("",document.title,e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.get_config("token")!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}},{key:"loadToolbar",value:function(e){var n=this;if(window._postHogToolbarLoaded)return!1;window._postHogToolbarLoaded=!0;var r=this.instance.get_config("api_host"),i=3e4*Math.floor(Date.now()/3e4),o="".concat(r).concat(r.endsWith("/")?"":"/","static/toolbar.js?_ts=").concat(i),s=!Et.includes(this.instance.get_config("api_host"))&&this.instance.get_config("advanced_disable_toolbar_metrics"),a=t(t({token:this.instance.get_config("token")},e),{},{apiURL:r},s?{instrument:!1}:{});a.source;var c=l(a,xt);return window.localStorage.setItem("_postHogToolbarParams",JSON.stringify(c)),ie(o,(function(e){e?R.error("Failed to load toolbar",e):(window.ph_load_toolbar||window.ph_load_editor)(a,n.instance)})),re(window,"turbolinks:load",(function(){window._postHogToolbarLoaded=!1,n.loadToolbar(a)})),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;return this.maybeLoadToolbar(e,t,n)}}]),e}(),Pt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;r(this,e),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=t}return o(e,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return(new Date).getTime()}}]),e}(),It=function(e){a(i,Pt);var n=p(i);function i(e,t){var o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;return r(this,i),(o=n.call(this,s)).handlePollRequest=t,o.captureMetrics=e,o}return o(i,[{key:"enqueue",value:function(e,t,n){this.captureMetrics.incr("batch-enqueue"),this._event_queue.push({url:e,data:t,options:n}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var e=this;clearTimeout(this._poller),this._poller=setTimeout((function(){if(e._event_queue.length>0){var t=e.formatQueue(),n=function(n){var r=t[n],i=r.url,o=r.data,s=r.options;M(o,(function(t,n){o[n].offset=Math.abs(o[n].timestamp-e.getTime()),delete o[n].timestamp})),e.handlePollRequest(i,o,s),e.captureMetrics.incr("batch-requests"),e.captureMetrics.incr("batch-requests-".concat(i.slice(i.length-2))),e.captureMetrics.incr("batch-handle",o.length),e.captureMetrics.incr("batch-handle-".concat(i.slice(i.length-2)),o.length)};for(var r in t)n(r);e._event_queue.length=0,e._empty_queue_count=0}else e._empty_queue_count++;e._empty_queue_count>4&&(e.isPolling=!1,e._empty_queue_count=0),e.isPolling&&e.poll()}),this._pollInterval)}},{key:"updateUnloadMetrics",value:function(){var e=this.formatQueue();for(var t in e){var n=e[t],r=n.url,i=n.data;this.captureMetrics.incr("batch-unload-requests"),this.captureMetrics.incr("batch-unload-requests-".concat(r.slice(r.length-2))),this.captureMetrics.incr("batch-unload",i.length),this.captureMetrics.incr("batch-unload-".concat(r.slice(r.length-2)),i.length)}}},{key:"unload",value:function(){var e=this;clearTimeout(this._poller);var n=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var r=Object.values(n);[].concat(h(r.filter((function(e){return 0===e.url.indexOf("/e")}))),h(r.filter((function(e){return 0!==e.url.indexOf("/e")})))).map((function(n){var r=n.url,i=n.data,o=n.options;e.handlePollRequest(r,i,t(t({},o),{},{transport:"sendBeacon"}))}))}},{key:"formatQueue",value:function(){var e={};return M(this._event_queue,(function(t){var n=t.url,r=t.data,i=t.options,o=(i?i._batchKey:null)||n;void 0===e[o]&&(e[o]={data:[],url:n,options:i}),i&&e[o].options&&e[o].options._metrics&&!e[o].options._metrics.rrweb_full_snapshot&&(e[o].options._metrics.rrweb_full_snapshot=i._metrics.rrweb_full_snapshot),e[o].data.push(r)})),e}}]),i}(),$t=function(){function e(t){r(this,e),this.enabled=t,this.metrics={}}return o(e,[{key:"incr",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)+t)}},{key:"decr",value:function(e){this.enabled&&(e="phjs-".concat(e),this.metrics[e]=(this.metrics[e]||0)-1)}}]),e}(),Tt=Uint8Array,Rt=Uint16Array,At=Uint32Array,Ct=new Tt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mt=new Tt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jt=new Tt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dt=function(e,t){for(var n=new Rt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new At(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Nt=Dt(Ct,2),qt=Nt[0],Ht=Nt[1];qt[28]=258,Ht[258]=28;for(var Lt=Dt(Mt,0)[1],Bt=new Rt(32768),Ut=0;Ut<32768;++Ut){var Vt=(43690&Ut)>>>1|(21845&Ut)<<1;Vt=(61680&(Vt=(52428&Vt)>>>2|(13107&Vt)<<2))>>>4|(3855&Vt)<<4,Bt[Ut]=((65280&Vt)>>>8|(255&Vt)<<8)>>>1}var Gt=function(e,t,n){for(var r=e.length,i=0,o=new Rt(t);i<r;++i)++o[e[i]-1];var s,a=new Rt(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new Rt(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,p=d|(1<<l)-1;d<=p;++d)s[Bt[d]>>>c]=u}else for(s=new Rt(r),i=0;i<r;++i)s[i]=Bt[a[e[i]-1]++]>>>15-e[i];return s},Wt=new Tt(288);for(Ut=0;Ut<144;++Ut)Wt[Ut]=8;for(Ut=144;Ut<256;++Ut)Wt[Ut]=9;for(Ut=256;Ut<280;++Ut)Wt[Ut]=7;for(Ut=280;Ut<288;++Ut)Wt[Ut]=8;var zt=new Tt(32);for(Ut=0;Ut<32;++Ut)zt[Ut]=5;var Qt,Jt=Gt(Wt,9,0),Xt=Gt(zt,5,0),Zt=function(e){return(e/8>>0)+(7&e&&1)},Yt=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Rt?Rt:e instanceof At?At:Tt)(n-t);return r.set(e.subarray(t,n)),r},Kt=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},en=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},tn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new Tt(0),0];if(1==i){var s=new Tt(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:a.f+c.f,l:a,r:c};var p=o[0].s;for(r=1;r<i;++r)o[r].s>p&&(p=o[r].s);var f=new Rt(p+1),h=nn(n[l-1],f,0);if(h>t){r=0;var _=0,g=h-t,v=1<<g;for(o.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<i;++r){var y=o[r].s;if(!(f[y]>t))break;_+=v-(1<<h-f[y]),f[y]=t}for(_>>>=g;_>0;){var m=o[r].s;f[m]<t?_-=1<<t-f[m]++-1:++r}for(;r>=0&&_;--r){var b=o[r].s;f[b]==t&&(--f[b],++_)}h=t}return[new Tt(f),h]},nn=function e(t,n,r){return-1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},rn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Rt(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},on=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},sn=function(e,t,n){var r=n.length,i=Zt(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},an=function(e,t,n,r,i,o,s,a,c,u,l){Kt(t,l++,n),++i[256];for(var d=tn(i,15),p=d[0],f=d[1],h=tn(o,15),_=h[0],g=h[1],v=rn(p),y=v[0],m=v[1],b=rn(_),w=b[0],k=b[1],S=new Rt(19),F=0;F<y.length;++F)S[31&y[F]]++;for(F=0;F<w.length;++F)S[31&w[F]]++;for(var E=tn(S,7),x=E[0],O=E[1],P=19;P>4&&!x[jt[P-1]];--P);var I,$,T,R,A=u+5<<3,C=on(i,Wt)+on(o,zt)+s,M=on(i,p)+on(o,_)+s+14+3*P+on(S,x)+(2*S[16]+3*S[17]+7*S[18]);if(A<=C&&A<=M)return sn(t,l,e.subarray(c,c+u));if(Kt(t,l,1+(M<C)),l+=2,M<C){I=Gt(p,f,0),$=p,T=Gt(_,g,0),R=_;var j=Gt(x,O,0);Kt(t,l,m-257),Kt(t,l+5,k-1),Kt(t,l+10,P-4),l+=14;for(F=0;F<P;++F)Kt(t,l+3*F,x[jt[F]]);l+=3*P;for(var D=[y,w],N=0;N<2;++N){var q=D[N];for(F=0;F<q.length;++F){var H=31&q[F];Kt(t,l,j[H]),l+=x[H],H>15&&(Kt(t,l,q[F]>>>5&127),l+=q[F]>>>12)}}}else I=Jt,$=Wt,T=Xt,R=zt;for(F=0;F<a;++F)if(r[F]>255){H=r[F]>>>18&31;en(t,l,I[H+257]),l+=$[H+257],H>7&&(Kt(t,l,r[F]>>>23&31),l+=Ct[H]);var L=31&r[F];en(t,l,T[L]),l+=R[L],L>3&&(en(t,l,r[F]>>>5&8191),l+=Mt[L])}else en(t,l,I[r[F]]),l+=$[r[F]];return en(t,l,I[256]),l+$[256]},cn=new At([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),un=new Tt(0),ln=function(){for(var e=new At(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),dn=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ln[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},pn=function(e,t,n,r,i){return function(e,t,n,r,i,o){var s=e.length,a=new Tt(r+s+5*(1+Math.floor(s/7e3))+i),c=a.subarray(r,a.length-i),u=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d<s?u=sn(c,u,e.subarray(l,d)):(c[l]=o,u=sn(c,u,e.subarray(l,s)))}else{for(var p=cn[t-1],f=p>>>13,h=8191&p,_=(1<<n)-1,g=new Rt(32768),v=new Rt(_+1),y=Math.ceil(n/3),m=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<m)&_},w=new At(25e3),k=new Rt(288),S=new Rt(32),F=0,E=0,x=(l=0,0),O=0,P=0;l<s;++l){var I=b(l),$=32767&l,T=v[I];if(g[$]=T,v[I]=$,O<=l){var R=s-l;if((F>7e3||x>24576)&&R>423){u=an(e,c,0,w,k,S,E,x,P,l-P,u),x=F=E=0,P=l;for(var A=0;A<286;++A)k[A]=0;for(A=0;A<30;++A)S[A]=0}var C=2,M=0,j=h,D=$-T&32767;if(R>2&&I==b(l-D))for(var N=Math.min(f,R)-1,q=Math.min(32767,l),H=Math.min(258,R);D<=q&&--j&&$!=T;){if(e[l+C]==e[l+C-D]){for(var L=0;L<H&&e[l+L]==e[l+L-D];++L);if(L>C){if(C=L,M=D,L>N)break;var B=Math.min(D,L-2),U=0;for(A=0;A<B;++A){var V=l-D+A+32768&32767,G=V-g[V]+32768&32767;G>U&&(U=G,T=V)}}}D+=($=T)-(T=g[$])+32768&32767}if(M){w[x++]=268435456|Ht[C]<<18|Lt[M];var W=31&Ht[C],z=31&Lt[M];E+=Ct[W]+Mt[z],++k[257+W],++S[z],O=l+C,++F}else w[x++]=e[l],++k[e[l]]}}u=an(e,c,o,w,k,S,E,x,P,l-P,u),o||(u=sn(c,u,un))}return Yt(a,0,r+Zt(u)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},fn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},hn=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&fn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},_n=function(e){return 10+(e.filename&&e.filename.length+1||0)};function gn(e,t){void 0===t&&(t={});var n=dn(),r=e.length;n.p(e);var i=pn(e,t,_n(t),8),o=i.length;return hn(i,t),fn(i,o-8,n.d()),fn(i,o-4,r),i}function vn(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Tt(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;s<n;++s){if(i+5>r.length){var a=new Tt(i+8+(n-s<<1));a.set(r),r=a}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return Yt(r,0,i)}exports.Compression=void 0,(Qt=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",Qt.Base64="base64";var yn=function(e,t,n){var r=t||{};r.ip=n.ip?1:0,r._=(new Date).getTime().toString(),r.ver=y.LIB_VERSION;var i=e.split("?");if(i.length>1){var o,s=v(i[1].split("&"));try{for(s.s();!(o=s.n()).done;){var a=o.value.split("=")[0];r[a]&&delete r[a]}}catch(e){s.e(e)}finally{s.f()}}var c=e.indexOf("?")>-1?"&":"?";return e+c+function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",i=[];return M(e,(function(e,r){t=encodeURIComponent(e.toString()),n=encodeURIComponent(r),i[i.length]=n+"="+t})),i.join(r)}(r)},mn=function e(t,n){if(n.blob&&t.buffer)return new Blob([t.buffer],{type:"text/plain"});if(n.sendBeacon||n.blob){var r=e(t,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}if("POST"!==n.method)return null;var i,o;return i=Array.isArray(t)||(o=t,"[object Uint8Array]"===Object.prototype.toString.call(o))?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),"compression"in t&&t.compression&&(i+="&compression="+t.compression),i},bn=function(e){var t=e.url,n=e.data,r=e.headers,i=e.options,o=e.captureMetrics,s=e.callback,a=e.retriesPerformedSoFar,c=e.retryQueue,u=e.onXHRError,l=e.timeout,d=void 0===l?1e4:l,p=new XMLHttpRequest;p.open(i.method||"GET",t,!0);var f=mn(n,i);o.incr("_send_request"),o.incr("_send_request_inflight"),M(r,(function(e,t){p.setRequestHeader(t,e)})),"POST"!==i.method||i.blob||p.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p.timeout=d,p.withCredentials=!0,p.onreadystatechange=function(){if(4===p.readyState)if(o.incr("xhr-response"),o.incr("xhr-response-".concat(p.status)),o.decr("_send_request_inflight"),200===p.status){if(s){var e;try{e=JSON.parse(p.responseText)}catch(e){return void R.error(e)}s(e)}}else"function"==typeof u&&u(p),[401,403,404,500].indexOf(p.status)<0&&c.enqueue({url:t,data:n,options:i,headers:r,retriesPerformedSoFar:(a||0)+1,callback:s}),s&&s({status:0})},p.send(f)},wn=function(e){a(i,Pt);var n=p(i);function i(e,t){var o;return r(this,i),(o=n.call(this)).captureMetrics=e,o.isPolling=!1,o.queue=[],o.areWeOnline=!0,o.onXHRError=t,"undefined"!=typeof window&&"onLine"in window.navigator&&(o.areWeOnline=window.navigator.onLine,window.addEventListener("online",(function(){o._handleWeAreNowOnline()})),window.addEventListener("offline",(function(){o.areWeOnline=!1}))),o}return o(i,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var n=3e3*Math.pow(2,t),r=new Date(Date.now()+n);console.warn("Enqueued failed request for retry in ".concat(n)),this.queue.push({retryAt:r,requestData:e}),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout((function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()}),this._pollInterval)}},{key:"flush",value:function(){var e=new Date(Date.now()),t=this.queue.filter((function(t){return t.retryAt<e}));if(t.length>0){this.queue=this.queue.filter((function(t){return t.retryAt>=e}));var n,r=v(t);try{for(r.s();!(n=r.n()).done;){var i=n.value.requestData;this._executeXhrRequest(i)}}catch(e){r.e(e)}finally{r.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var e,n=v(this.queue);try{for(n.s();!(e=n.n()).done;){var r=e.value.requestData,i=r.url,o=r.data,s=r.options;try{window.navigator.sendBeacon(i,mn(o,t(t({},s),{},{sendBeacon:!0})))}catch(e){y.DEBUG&&console.error(e)}}}catch(e){n.e(e)}finally{n.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var t=e.url,n=e.data,r=e.options,i=e.headers,o=e.callback,s=e.retriesPerformedSoFar;bn({url:t,data:n||{},options:r||{},headers:i||{},retriesPerformedSoFar:s||0,callback:o,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}(),kn=18e5,Sn=864e5,Fn=function(){function e(t,n){r(this,e),this.config=t,this.persistence=n,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null;var i=t.persistence_name||t.token;if(this.window_id_storage_key="ph_"+i+"_window_id",this.primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var o=Oe.parse(this.window_id_storage_key),s=Oe.parse(this.primary_window_exists_storage_key);o&&!s?this._windowId=o:Oe.remove(this.window_id_storage_key),Oe.set(this.primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return o(e,[{key:"_canUseSessionStorage",value:function(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&Oe.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Oe.set(this.window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?Oe.parse(this.window_id_storage_key):null}},{key:"_setSessionId",value:function(e,t,n){e===this._sessionId&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register(s({},Me,[t,e,n])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[Me];return Array.isArray(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;window.addEventListener("beforeunload",(function(){e._canUseSessionStorage()&&Oe.remove(e.primary_window_exists_storage_key)}))}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),n=f(this._getSessionId(),3),r=n[0],i=n[1],o=n[2],s=this._getWindowId(),a=o&&o>0&&Math.abs(t-o)>Sn;!i||!e&&Math.abs(t-r)>kn||a?(i=K(),s=K(),o=t):s||(s=K());var c=0===r||!e||a?t:r,u=0===o?(new Date).getTime():o;return this._setWindowId(s),this._setSessionId(i,c,u),{sessionId:i,windowId:s}}}]),e}(),En=o((function e(t,n,i,o){r(this,e),this.name="posthog-js",this.setupOnce=function(e){e((function(e){var r,s,a,c,u;if("error"!==e.level||!t.__loaded)return e;e.tags||(e.tags={});var l=t.config.ui_host||t.config.api_host;e.tags["PostHog Person URL"]=l+"/person/"+t.get_distinct_id(),t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var d=(null===(r=e.exception)||void 0===r?void 0:r.values)||[],p={$exception_message:null===(s=d[0])||void 0===s?void 0:s.value,$exception_type:null===(a=d[0])||void 0===a?void 0:a.type,$exception_personURL:l+"/person/"+t.get_distinct_id(),$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:null===(c=d[0])||void 0===c?void 0:c.value,$sentry_exception_type:null===(u=d[0])||void 0===u?void 0:u.type,$sentry_tags:e.tags};return n&&i&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+e.event_id),t.capture("$exception",p),e}))}})),xn=function(e){var t=function(t,n){t.event.userId||t.event.anonymousId===e.get_distinct_id()||e.reset(),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(e.register({distinct_id:t.event.userId}),e.reloadFeatureFlags());var r=e._calculate_event_properties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return t(e,e.event.event)},page:function(e){return t(e,"$pageview")},identify:function(e){return t(e,"$identify")},screen:function(e){return t(e,"$screen")}}},On=function(){function e(){r(this,e),s(this,"_seenFirstPageView",!1)}return o(e,[{key:"onPageview",value:function(){this._seenFirstPageView&&(this._pageViewId=K()),this._seenFirstPageView=!0}},{key:"getPageViewId",value:function(){return this._pageViewId||(this._pageViewId=K()),this._pageViewId}}]),e}();function Pn(e){return"undefined"!=typeof Event&&In(e,Event)}function In(e,t){try{return e instanceof t}catch(e){return!1}}function $n(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Tn(e){return $n(e,"DOMError")}var Rn=/\(error: (.*)\)/,An=50,Cn="?";function Mn(e,t,n,r){var i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}var jn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Dn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Nn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Hn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Ln=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.sort((function(e,t){return e[0]-t[0]})).map((function(e){return e[1]}));return function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],o=e.split("\n"),s=n;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var c=Rn.test(a)?a.replace(Rn,"$1"):a;if(!c.match(/\S*Error: /)){var u,l=v(i);try{for(l.s();!(u=l.n()).done;){var d=(0,u.value)(c);if(d){r.push(d);break}}}catch(e){l.e(e)}finally{l.f()}if(r.length>=An)break}}}return function(e){if(!e.length)return[];var n=e.slice(0,An);return n.reverse(),n.map((function(e){return t(t({},e),{},{filename:e.filename||n[n.length-1].filename,function:e.function||"?"})}))}(r)}}.apply(void 0,[[30,function(e){var t=jn.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){var n=Dn.exec(t[2]);n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3])}var r=f(Bn(t[1]||Cn,t[2]),2),i=r[0];return Mn(r[1],i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,function(e){var t=Nn.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=qn.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||Cn,o=f(Bn(i,r),2);return i=o[0],Mn(r=o[1],i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,function(e){var t=Hn.exec(e);return t?Mn(t[2],t[1]||Cn,+t[3],t[4]?+t[4]:void 0):void 0}]]),Bn=function(e,t){var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Cn,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Un=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Vn=/Minified React error #\d+;/i;function Gn(e){var t=e.stacktrace||e.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Vn.test(e.message))return 1}return 0}(e);try{return Ln(t,n)}catch(e){}return[]}function Wn(e){var t=Gn(e);return{$exception_type:e.name,$exception_message:e.message,$exception_stack_trace_raw:JSON.stringify(t)}}function zn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:"".concat(i.slice(0,t),"...")}return""}function Qn(e){var n=f(e,5),r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],c={};if(void 0===a&&"string"==typeof r){var u="Error",l=r,d=r.match(Un);d&&(u=d[1],l=d[2]),c={$exception_type:u,$exception_message:l}}var p=a||r;if(function(e){return $n(e,"ErrorEvent")}(p)&&p.error)c=Wn(p.error);else if(Tn(p)||function(e){return $n(e,"DOMException")}(p)){var h=p;if(function(e){return"stack"in e}(p))c=Wn(p);else{var _=h.name||(Tn(h)?"DOMError":"DOMException"),g=h.message?"".concat(_,": ").concat(h.message):_;c=function(e){return{$exception_type:"Error",$exception_message:e}}(g),c.$exception_type=c.$exception_type||"Error",c.$exception_message=c.$exception_message||g}"code"in h&&(c.$exception_DOMException_code="".concat(h.code))}else if(function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return In(e,Error)}}(p))c=Wn(p);else if(function(e){return $n(e,"Object")}(p)||Pn(p)){c=function(e){return{$exception_type:Pn(e)?e.constructor.name:"Error",$exception_message:"Non-Error ".concat("exception"," captured with keys: ",zn(e))}}(p),c.$exception_is_synthetic=!0}else c.$exception_type=c.$exception_type||"Error",c.$exception_message=c.$exception_message||p,c.$exception_is_synthetic=!0;return t(t(t(t({},c),{},{$exception_type:c.$exception_type||"UnknownErrorType",$exception_message:c.$exception_message||""},i?{$exception_source:i}:{}),o?{$exception_lineno:o}:{}),s?{$exception_colno:s}:{})}function Jn(e){var r=f(e,1)[0],i=r;try{"reason"in r?i=r.reason:"detail"in r&&"reason"in r.detail&&(i=r.detail.reason)}catch(e){}var o,s={};return(s=null===(o=i)||"object"!==n(o)&&"function"!=typeof o?{$exception_message:"Non-Error promise rejection captured with value: ".concat(String(i))}:Qn([i])).$exception_handled=!1,t(t({},s),{},{$exception_type:s.$exception_type="UnhandledRejection",$exception_message:s.$exception_message=s.$exception_message||r.reason||String(i)})}var Xn,Zn,Yn,Kn=function(){function e(t){r(this,e),s(this,"originalOnErrorHandler",void 0),s(this,"originalOnUnhandledRejectionHandler",void 0),this.instance=t}return o(e,[{key:"startCapturing",value:function(){var e;if(this.isEnabled()&&(null===(e=S.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__))try{this.originalOnErrorHandler=S.onerror,S.onerror=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.captureException(t),!!this.originalOnErrorHandler&&this.originalOnErrorHandler.apply(this,t)}.bind(this),S.onerror.__POSTHOG_INSTRUMENTED__=!0,this.originalOnUnhandledRejectionHandler=S.onunhandledrejection,S.onunhandledrejection=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Jn(t);return this.sendExceptionEvent(r),!this.originalOnUnhandledRejectionHandler||this.originalOnUnhandledRejectionHandler.apply(S,t)}.bind(this),S.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0}catch(e){console.error("PostHog failed to start exception autocapture",e),this.stopCapturing()}}},{key:"stopCapturing",value:function(){var e,t;void 0!==this.originalOnErrorHandler&&(S.onerror=this.originalOnErrorHandler,this.originalOnErrorHandler=null),null===(e=S.onerror)||void 0===e||delete e.__POSTHOG_INSTRUMENTED__,void 0!==this.originalOnUnhandledRejectionHandler&&(S.onunhandledrejection=this.originalOnUnhandledRejectionHandler,this.originalOnUnhandledRejectionHandler=null),null===(t=S.onunhandledrejection)||void 0===t||delete t.__POSTHOG_INSTRUMENTED__}},{key:"isCapturing",value:function(){var e;return!(null===(e=S.onerror)||void 0===e||!e.__POSTHOG_INSTRUMENTED__)}},{key:"isEnabled",value:function(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}},{key:"afterDecideResponse",value:function(e){this.remoteEnabled=e.autocaptureExceptions||!1,this.isEnabled()&&this.startCapturing()}},{key:"captureException",value:function(e,n){var r=Qn(e),i=t(t({},n),r),o=this.instance.config.ui_host||this.instance.config.api_host;r.$exception_personURL=o+"/person/"+this.instance.get_distinct_id(),this.sendExceptionEvent(i)}},{key:"sendExceptionEvent",value:function(e){this.instance.capture("$exception",e,{transport:"XHR",method:"POST",endpoint:"/e/",_noTruncate:!0,_batchKey:"exceptionEvent"})}}]),e}();!function(e){e[e.INIT_MODULE=0]="INIT_MODULE",e[e.INIT_SNIPPET=1]="INIT_SNIPPET"}(Xn||(Xn={}));var er=function(){},tr={},nr="posthog",rr=S.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,ir=!rr&&-1===x.indexOf("MSIE")&&-1===x.indexOf("Mozilla"),or=function(){var e,t,n;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:-1===(null==E||null===(e=E.location)||void 0===e||null===(t=e.hostname)||void 0===t?void 0:t.indexOf("herokuapp.com")),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:er,store_google:!0,custom_campaign_params:[],save_referrer:!0,test:!1,verbose:!1,capture_pageview:!0,capture_pageleave:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==S||null===(n=S.location)||void 0===n?void 0:n.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!0,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_toolbar_metrics:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;console.error(t)},get_device_id:function(e){return e},_onCapture:er,_capture_metrics:!1,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1}},sr=function(e,t,n,r){var i,o=n!==nr&&Yn?n?Yn[n]:void 0:Yn,s={initComplete:!1,syncCode:!1},a=function(e){return function(t){s[e]||(s[e]=!0,s.initComplete&&s.syncCode&&(null==r||r(t)))}};if(o&&Zn===Xn.INIT_MODULE)i=o;else{if(o&&!D(o))return void console.error("You have already initialized "+n);i=new ar}if(i._init(e,t,n,a("initComplete")),i.toolbar.maybeLoadToolbar(),i.sessionRecording=new yt(i),i.sessionRecording.startRecordingIfEnabled(),i.webPerformance=new kt(i),i.webPerformance.startObservingIfEnabled(),i.exceptionAutocapture=new Kn(i),i.__autocapture=i.get_config("autocapture"),Ve._setIsAutocaptureEnabled(i),Ve._isAutocaptureEnabled){i.__autocapture=i.get_config("autocapture");Ve.enabledForProject(i.get_config("token"),100,100)?Ve.isBrowserSupported()?Ve.init(i):(i.__autocapture=!1,R.log("Disabling Automatic Event Collection because this browser is not supported")):(i.__autocapture=!1,R.log("Not in active bucket: disabling Automatic Event Collection."))}return y.DEBUG=y.DEBUG||i.get_config("debug"),void 0!==o&&D(o)&&(i._execute_array.call(i.people,o.people),i._execute_array(o)),a("syncCode")(i),i},ar=function(){function e(){var t=this;r(this,e),this.config=or(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=En,this.segmentIntegration=function(){return xn(t)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.people=new it(this),this.featureFlags=new ut(this),this.feature_flags=this.featureFlags,this.toolbar=new Ot(this),this.pageViewIdManager=new On,this._captureMetrics=void 0,this._requestQueue=void 0,this._retryQueue=void 0,this.persistence=void 0,this.sessionPersistence=void 0,this.sessionManager=void 0}return o(e,[{key:"init",value:function(e,t,n){if(L(n))console.error("You must name your new library: init(token, config, name)");else{if(n!==nr){var r=sr(e,t,n,(function(e){Yn[n]=e,e._loaded()}));return Yn[n]=r,r}console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var n,r,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var c,u={segmentRegister:!1,syncCode:!1},l=function(e){return function(){u[e]||(u[e]=!0,u.segmentRegister&&u.syncCode&&(null==a||a(i)))}};(this.set_config(j({},or(),o,{name:s,token:e,callback_fn:(s===nr?s:nr+"."+s)+"._jsc"})),this._jsc=function(){},null!=S&&null!==(n=S.rrweb)&&void 0!==n&&n.record||null!=S&&S.rrwebRecord)&&(this.__loaded_recorder_version=null==S||null===(c=S.rrweb)||void 0===c?void 0:c.version);if(this._captureMetrics=new $t(this.get_config("_capture_metrics")),this._requestQueue=new It(this._captureMetrics,this._handle_queued_event.bind(this)),this._retryQueue=new wn(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new Ue(this.config),this.sessionManager=new Fn(this.config,this.persistence),this.sessionPersistence="sessionStorage"===this.config.persistence?this.persistence:new Ue(t(t({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),o.segment?(this.config.get_device_id=function(){return o.segment.user().anonymousId()},o.segment.user().id()&&(this.register({distinct_id:o.segment.user().id()}),this.persistence.set_user_state("identified")),o.segment.register(this.segmentIntegration()).then(l("segmentRegister"))):l("segmentRegister")(),void 0!==(null===(r=o.bootstrap)||void 0===r?void 0:r.distinctID)){var d,p,f=this.get_config("get_device_id")(K()),h=null!==(d=o.bootstrap)&&void 0!==d&&d.isIdentifiedID?f:o.bootstrap.distinctID;this.persistence.set_user_state(null!==(p=o.bootstrap)&&void 0!==p&&p.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var _,g,v=Object.keys((null===(_=o.bootstrap)||void 0===_?void 0:_.featureFlags)||{}).filter((function(e){var t,n;return!(null===(t=o.bootstrap)||void 0===t||null===(n=t.featureFlags)||void 0===n||!n[e])})).reduce((function(e,t){var n,r;return e[t]=(null===(n=o.bootstrap)||void 0===n||null===(r=n.featureFlags)||void 0===r?void 0:r[t])||!1,e}),{}),y=Object.keys((null===(g=o.bootstrap)||void 0===g?void 0:g.featureFlagPayloads)||{}).filter((function(e){return v[e]})).reduce((function(e,t){var n,r,i,s;null!==(n=o.bootstrap)&&void 0!==n&&null!==(r=n.featureFlagPayloads)&&void 0!==r&&r[t]&&(e[t]=null===(i=o.bootstrap)||void 0===i||null===(s=i.featureFlagPayloads)||void 0===s?void 0:s[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:y})}if(!this.get_distinct_id()){var m=this.get_config("get_device_id")(K());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_user_state("anonymous")}S.addEventListener&&S.addEventListener("onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_loaded",value:function(){this.featureFlags.setReloadingPaused(!0);try{this.get_config("loaded")(this)}catch(e){console.error("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0}),this.get_config("advanced_disable_decide")||new Ft(this).call(),this.featureFlags.resetRequestQueue(),this.featureFlags.setReloadingPaused(!1)}},{key:"_start_queue_if_opted_in",value:function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||C(this.__request_queue,(function(t){e._send_request.apply(e,h(t))})),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,t){if(L(e))return null;if(rr)return function(n){e(n,t)};var n=this._jsc,r=""+Math.floor(1e8*Math.random()),i=this.get_config("callback_fn")+"["+r+"]";return n[r]=function(i){delete n[r],e(i,t)},i}},{key:"_handle_unload",value:function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics)),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.get_config("capture_pageleave")&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,t,n){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,n||tr,er)}},{key:"__compress_and_send_json_request",value:function(e,n,r,i){var o=function(e,n,r){return e===exports.Compression.GZipJS?[gn(vn(n),{mtime:0}),t(t({},r),{},{blob:!0,urlQueryArgs:{compression:exports.Compression.GZipJS}})]:[{data:X(n)},r]}(this.compression[exports.Compression.GZipJS]?exports.Compression.GZipJS:exports.Compression.Base64,n,r),s=f(o,2),a=s[0],c=s[1];this._send_request(e,a,c,i)}},{key:"_send_request",value:function(e,n,r,i){if(ir)this.__request_queue.push([e,n,r,i]);else{var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};r=j(o,r||{}),rr||(r.method="GET");var s="sendBeacon"in S.navigator&&"sendBeacon"===r.transport;if(e=yn(e,r.urlQueryArgs||{},{ip:this.get_config("ip")}),s)try{S.navigator.sendBeacon(e,mn(n,t(t({},r),{},{sendBeacon:!0})))}catch(e){this.get_config("debug")&&console.error(e)}else if(rr)try{bn({url:e,data:n,headers:this.get_config("xhr_headers"),options:r,captureMetrics:this._captureMetrics,callback:i,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(e){console.error(e)}else{var a,c=E.createElement("script");c.type="text/javascript",c.async=!0,c.defer=!0,c.src=e;var u=E.getElementsByTagName("script")[0];null===(a=u.parentNode)||void 0===a||a.insertBefore(c,u)}}}},{key:"_execute_array",value:function(e){var t,n=this,r=[],i=[],o=[];C(e,(function(e){e&&(t=e[0],D(t)?o.push(e):"function"==typeof e?e.call(n):D(e)&&"alias"===t?r.push(e):D(e)&&-1!==t.indexOf("capture")&&"function"==typeof n[t]?o.push(e):i.push(e))}));var s=function(e,t){C(e,(function(e){if(D(e[0])){var n=t;M(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};s(r,this),s(i,this),s(o,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"captureException",value:function(e,t){var n;null===(n=this.exceptionAutocapture)||void 0===n||n.captureException([e.name,void 0,void 0,void 0,e],t)}},{key:"capture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tr;if(this.__loaded&&!tt(this,!1)){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(n=n||tr).transport;if(r&&(n.transport=r),L(e)||"string"!=typeof e)console.error("No event name provided to posthog.capture");else if(!ee(x)){this.sessionPersistence.update_search_keyword(),this.get_config("store_google")&&this.sessionPersistence.update_campaign_params(),this.get_config("save_referrer")&&this.sessionPersistence.update_referrer_info();var i={event:e,properties:this._calculate_event_properties(e,t||{})};"$identify"===e&&(i.$set=n.$set,i.$set_once=n.$set_once),(i=J(i,n._noTruncate?null:this.get_config("properties_string_max_length"))).timestamp=n.timestamp||new Date,this.get_config("debug")&&R.log("PostHog.js send",i);var o=JSON.stringify(i),s=this.get_config("api_host")+(n.endpoint||"/e/"),a=n!==tr;return!this.get_config("request_batching")||a&&!n._batchKey||n.send_instantly?this.__compress_and_send_json_request(s,o,n):this._requestQueue.enqueue(s,i,n),this._invokeCaptureHooks(e,i),i}}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,t){this.config._onCapture(e,t),M(this.__captureHooks,(function(t){return t(e)}))}},{key:"_calculate_event_properties",value:function(e,n){var r,i=this.persistence.remove_event_timer(e),o=t({},n);if(o.token=this.get_config("token"),"$snapshot"===e){var s=t(t({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,o}var a=oe.properties();if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(),u=c.sessionId,l=c.windowId;o.$session_id=u,o.$window_id=l}if(null!==(r=this.webPerformance)&&void 0!==r&&r.isEnabled&&("$pageview"===e&&this.pageViewIdManager.onPageview(),o=j(o,{$pageview_id:this.pageViewIdManager.getPageViewId()})),"$performance_event"===e){var d=this.persistence.properties();return o.distinct_id=d.distinct_id,o.$current_url=a.$current_url,o}if(void 0!==i){var p=(new Date).getTime()-i;o.$duration=parseFloat((p/1e3).toFixed(3))}o=j({},oe.properties(),this.persistence.properties(),this.sessionPersistence.properties(),o);var f=this.get_config("property_blacklist");D(f)?M(f,(function(e){delete o[e]})):console.error("Invalid value for property_blacklist config: "+f);var h=this.get_config("sanitize_properties");return h&&(o=h(o,e)),o}},{key:"register",value:function(e,t){this.persistence.register(e,t)}},{key:"register_once",value:function(e,t,n){this.persistence.register_once(e,t,n)}},{key:"register_for_session",value:function(e){this.sessionPersistence.register(e)}},{key:"unregister",value:function(e){this.persistence.unregister(e)}},{key:"unregister_for_session",value:function(e){this.sessionPersistence.unregister(e)}},{key:"_register_single",value:function(e,t){this.register(s({},e,t))}},{key:"getFeatureFlag",value:function(e,t){return this.featureFlags.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}},{key:"isFeatureEnabled",value:function(e,t){return this.featureFlags.isFeatureEnabled(e,t)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}},{key:"getEarlyAccessFeatures",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"identify",value:function(e,t,n){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(Ie)&&(this.unregister(Ie),this.register({distinct_id:e}));var o="anonymous"===this.persistence.get_user_state();e!==r&&o?(this.persistence.set_user_state("identified"),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.featureFlags.setAnonymousDistinctId(r)):(t&&this.people.set(t),n&&this.people.set_once(n)),e!==r&&this.reloadFeatureFlags()}else console.error("Unique user id has not been set in posthog.identify")}},{key:"group",value:function(e,n,r){if(e&&n){this._captureMetrics.incr("group");var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t(t({},i),{},s({},e,n))}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags(s({},e,r))),i[e]===n||r||this.reloadFeatureFlags()}else console.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,t)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t=this.get_property("$device_id");this.persistence.clear(),this.sessionPersistence.clear(),this.persistence.set_user_state("anonymous"),this.sessionManager.resetSessionId();var n=this.get_config("get_device_id")(K());this.register_once({distinct_id:n,$device_id:e?n:t},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){return this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionId}},{key:"get_session_replay_url",value:function(e){var t=(this.config.ui_host||this.config.api_host)+"/replay/"+this.get_session_id();if(null!=e&&e.withTimestamp&&this.sessionManager._sessionStartTimestamp){var n,r=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!this.sessionManager._sessionStartTimestamp)return t;var i=Math.max(Math.floor(((new Date).getTime()-(this.sessionManager._sessionStartTimestamp||0))/1e3)-r,0);t+="?t=".concat(i)}return t}},{key:"alias",value:function(e,t){return e===this.get_property(Pe)?(R.critical("Attempting to create alias for existing People user - aborting."),-2):(L(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Ie,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var n=t({},this.config);H(e)&&(j(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),this.sessionPersistence&&this.sessionPersistence.update_config(this.config),ke.is_supported()&&"true"===ke.get("ph_debug")&&(this.config.debug=!0),this.get_config("debug")&&(y.DEBUG=!0),this.sessionRecording&&void 0!==e.disable_session_recording&&n.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!(null===(e=this.sessionRecording)||void 0===e||!e.started())}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_config",value:function(e){var t;return null===(t=this.config)||void 0===t?void 0:t[e]}},{key:"get_property",value:function(e){return this.persistence.props[e]}},{key:"getSessionProperty",value:function(e){return this.sessionPersistence.props[e]}},{key:"toString",value:function(){var e,t=null!==(e=this.get_config("name"))&&void 0!==e?e:nr;return t!==nr&&(t=nr+"."+t),t}},{key:"_gdpr_init",value:function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&ke.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!be.get("ph_optout")||(be.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))}},{key:"_gdpr_update_persistence",value:function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),this.get_config("disable_persistence")||this.sessionPersistence.disabled===t||this.sessionPersistence.set_disabled(t)}},{key:"_gdpr_call_func",value:function(e,t){return t=j({capture:this.capture.bind(this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t||{}),ke.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=j({enable_persistence:!0},e||{}),this._gdpr_call_func(We,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var t=j({clear_persistence:!0},e||{});this._gdpr_call_func(ze,t),this._gdpr_update_persistence(t)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(Qe,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Je,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var t=j({enable_persistence:!0},null!=e?e:{});this._gdpr_call_func(Xe,t),this._gdpr_update_persistence(t)}},{key:"debug",value:function(e){!1===e?(S.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(S.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),e}();!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=W(e.prototype[t[n]])}(ar,["identify"]);var cr={},ur=function(){Yn.init=function(e,t,n){if(n)return Yn[n]||(Yn[n]=cr[n]=sr(e||"",t||{},n,(function(e){Yn[n]=cr[n]=e,e._loaded()}))),Yn[n];var r=Yn;return cr[nr]?r=cr[nr]:e&&(r=sr(e,t||{},nr,(function(e){cr[nr]=e,e._loaded()})),cr[nr]=r),Yn=r,Zn===Xn.INIT_SNIPPET&&(S[nr]=Yn),M(cr,(function(e,t){t!==nr&&(Yn[t]=e)})),r}},lr=function(){function e(){e.done||(e.done=!0,ir=!1,M(cr,(function(e){e._dom_loaded()})))}E.addEventListener&&("complete"===E.readyState?e():E.addEventListener("DOMContentLoaded",e,!1)),re(S,"load",e,!0)};var dr=(Zn=Xn.INIT_MODULE,Yn=new ar,ur(),Yn.init(),lr(),Yn);exports.PostHog=ar,exports.default=dr,exports.posthog=dr;
|
|
2
2
|
//# sourceMappingURL=module.js.map
|